diff --git a/integrations/mcp/server.mjs b/integrations/mcp/server.mjs index 5aa696fa..50b4c9bb 100644 --- a/integrations/mcp/server.mjs +++ b/integrations/mcp/server.mjs @@ -112,6 +112,10 @@ function runMixEvalJson(jsonBody) { cwd: repoRoot, stdio: ["pipe", "pipe", "pipe"], env: { ...process.env }, + // Windows distributes Mix through a command shim, which CreateProcess + // cannot launch directly. The command and argument are fixed here. + shell: process.platform === "win32", + windowsHide: true, }); let out = ""; let err = ""; diff --git a/integrations/mcp/smoke.mjs b/integrations/mcp/smoke.mjs index cdce65ed..bd1ec8b0 100755 --- a/integrations/mcp/smoke.mjs +++ b/integrations/mcp/smoke.mjs @@ -46,6 +46,14 @@ echo '{"ok":true,"outcome":"ALLOW","status":"accepted","stop_reason":null}' const stubPath = path.join(dir, "mix"); writeFileSync(stubPath, stub); chmodSync(stubPath, 0o755); + + // Windows resolves command names through PATHEXT. Keep the smoke stub in + // that executable form as well, so the server's normal `spawn("mix", ...)` + // path is exercised on both platforms. + writeFileSync( + path.join(dir, "mix.cmd"), + "@echo off\r\nmore > nul\r\necho {\"ok\":true,\"outcome\":\"ALLOW\",\"status\":\"accepted\",\"stop_reason\":null}\r\n", + ); return dir; } @@ -100,7 +108,7 @@ function rpcDriver(child) { async function main() { const stubDir = setupStubMix(); const child = spawnServer({ - PATH: `${stubDir}:${process.env.PATH ?? ""}`, + PATH: `${stubDir}${path.delimiter}${process.env.PATH ?? ""}`, PYTHIA_REPO_ROOT: repoRoot, }); const { call } = rpcDriver(child);