From e85690adbc91111a46eae692775601ad0e67ecef Mon Sep 17 00:00:00 2001 From: Myfro9 Date: Thu, 8 Oct 2026 21:46:42 +0800 Subject: [PATCH] =?UTF-8?q?tools-sync:=20MCP=20=E5=AE=A1=E8=AE=A1=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=8E=92=E9=99=A4=20Codex=20=E6=8F=92=E4=BB=B6=20MCP?= =?UTF-8?q?=EF=BC=88=E6=8C=89=20cwd=20=E8=AF=86=E5=88=AB=EF=BC=89=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E4=BF=AE=20-ExcludeName=20=E9=80=97=E5=8F=B7=E4=BC=A0?= =?UTF-8?q?=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HJ_PC 上 code-review / codex_app 以 cmd.exe 启动、cwd 在 plugins\cache\openai-bundled, 旧逻辑只看 command 识别不出,-Apply 把它们复制进了 Claude; powershell -File 传 -ExcludeName a,b 时绑定成单个字符串 a,b,排除也失效。 Co-Authored-By: Claude Opus 5.5 --- tools-sync/scripts/sync_mcp_registrations.ps1 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools-sync/scripts/sync_mcp_registrations.ps1 b/tools-sync/scripts/sync_mcp_registrations.ps1 index 81e96b3..bfdd500 100644 --- a/tools-sync/scripts/sync_mcp_registrations.ps1 +++ b/tools-sync/scripts/sync_mcp_registrations.ps1 @@ -36,6 +36,8 @@ param( ) $ErrorActionPreference = "Stop" +# `powershell -File x.ps1 -ExcludeName a,b` binds the single string "a,b"; split it ourselves. +$ExcludeName = @($ExcludeName | ForEach-Object { $_ -split ',' } | ForEach-Object { $_.Trim() } | Where-Object { $_ }) $script:CodexBackupMade = $false $script:Failures = @() $script:Unsupported = @() @@ -156,12 +158,13 @@ function Get-CodexMcpsFromCli { $t = $s.transport $transport = if ($t.type) { [string]$t.type } elseif ($t.url) { "http" } else { "stdio" } if ($transport -eq "streamable_http") { $transport = "http" } - $result[[string]$s.name] = New-CanonicalMcp ([string]$s.name) $transport ([string]$t.command) ` + $mcp = New-CanonicalMcp ([string]$s.name) $transport ([string]$t.command) ` @($t.args) (ConvertTo-StringMap $t.env) ([string]$t.url) ` (ConvertTo-StringMap $t.http_headers) ([string]$t.bearer_token_env_var) "Codex" # Not part of the drift comparison; Test-CodexManaged needs it because bundled # plugin MCPs launch as plain `cmd.exe` and only their cwd names the plugin cache. - $result[[string]$s.name] | Add-Member -NotePropertyName cwd -NotePropertyValue ([string]$t.cwd) + $mcp | Add-Member -NotePropertyName cwd -NotePropertyValue ([string]$t.cwd) + $result[[string]$s.name] = $mcp } return $result } @@ -208,6 +211,8 @@ function Test-CodexManaged($Mcp) { # codex-cli 0.162: code-review / codex_app are `cmd.exe /c scripts\launch_*.cmd` with # cwd under .codex\plugins\cache\openai-bundled -- the command alone looks portable. if ([string]$Mcp.cwd -match '(?i)[\\/]\.codex[\\/](runtimes|plugins[\\/]cache)[\\/]') { return $true } + # The plugin cache may also live outside ~\.codex (e.g. orca's codex-runtime-home). 2026-10-08 HJ_PC. + if ([string]$Mcp.cwd -match '(?i)[\\/]plugins[\\/]cache[\\/]') { return $true } # The Codex desktop app also bundles MCPs from its own install dir (MSIX # WindowsApps, or AppData\Local\OpenAI\Codex). Host-owned, not portable. return ($command -match '(?i)[\\/](WindowsApps[\\/]OpenAI\.Codex|OpenAI[\\/]Codex[\\/])')