From 69345a42cdf8f952d61f2c8bfe03e73ef2f0806f Mon Sep 17 00:00:00 2001 From: ljf1227 Date: Tue, 13 Jan 2026 21:39:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Windows=20MCP=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=8D=9F=E5=9D=8F=E9=97=AE=E9=A2=98=E5=B9=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=8A=A8=E4=BF=AE=E5=A4=8D=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20(v1.7.24)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 applyPlatformCommand 幂等性检查,防止重复处理 - 新增 repairCorruptedMcpArgs 函数自动修复损坏的配置 - 修复 args 数组中重复的 'cmd' 和 'npx' 问题 --- package.json | 2 +- src/utils/mcp.ts | 52 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1e44c75..64045f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ccg-workflow", - "version": "1.7.23", + "version": "1.7.24", "description": "Claude-Codex-Gemini 多模型协作系统 - 智能路由多模型开发工作流", "type": "module", "packageManager": "pnpm@10.17.1", diff --git a/src/utils/mcp.ts b/src/utils/mcp.ts index 3dca02b..84e57ac 100644 --- a/src/utils/mcp.ts +++ b/src/utils/mcp.ts @@ -87,6 +87,11 @@ export async function writeClaudeCodeConfig(config: ClaudeCodeConfig): Promise= 3 && args[1] === args[2]) { + args.splice(2, 1) // 移除重复的命令 + repaired = true + } + + return repaired +} + /** * Fix Windows MCP configuration by applying platform wrappers * This function processes all MCP servers in the config and applies Windows-specific fixes @@ -161,7 +207,11 @@ export function fixWindowsMcpConfig(config: ClaudeCodeConfig): ClaudeCodeConfig // Fix each MCP server configuration for (const [serverName, serverConfig] of Object.entries(fixed.mcpServers || {})) { if (serverConfig && typeof serverConfig === 'object' && 'command' in serverConfig) { - applyPlatformCommand(serverConfig as McpServerConfig) + const mcpConfig = serverConfig as McpServerConfig + // 先尝试修复损坏的配置 + repairCorruptedMcpArgs(mcpConfig) + // 再应用平台命令包装(幂等,已处理过的会跳过) + applyPlatformCommand(mcpConfig) } }