Fix Windows MCP config mangling by bypassing cmd.exe shell for Claude spawn

On Windows, spawnProcess defaults to shell: true which routes through cmd.exe.
The SDK passes --mcp-config with inline JSON containing double quotes that
cmd.exe strips, producing an invalid string that Claude Code interprets as a
file path (e.g. D:\xFlow{mcpServers:{paseo:{type:http,url:http:\...}).
This commit is contained in:
Mohamed Boudra
2026-04-12 21:43:28 +07:00
parent 64b9b61223
commit 39b56af47b

View File

@@ -224,6 +224,10 @@ function applyRuntimeSettingsToClaudeOptions(
},
signal: spawnOptions.signal,
stdio: ["pipe", "pipe", "pipe"],
// Bypass cmd.exe on Windows: the SDK passes --mcp-config with inline JSON
// containing double quotes, which cmd.exe mangles (strips quotes, breaks parsing).
// The command is always a resolved binary path, so shell routing is unnecessary.
shell: false,
});
if (typeof options.stderr === "function") {
child.stderr?.on("data", (chunk: Buffer | string) => {