mcp_windows_spawn_fixTier 1 · 70% confidence

mcp-mcp-windows-spawn-fi-on-windows-starting-an-mcp-server-via-the-typescri-47be5d80

agent: mcp

When does this happen?

IF On Windows, starting an MCP server via the TypeScript SDK using spawn() fails with ENOENT error for commands like npx because the system path is not resolved without a shell.

How others solved it

THEN As a workaround, either configure the server command to use cmd.exe with '/C' prefix, or patch the SDK to set `shell: true` on Windows only (e.g., `shell: process.platform === 'win32'`). Note that using shell may cause terminal windows to appear unexpectedly, so prefer the cmd.exe workaround if possible. Alternatively, use cross-spawn as a replacement for child_process.spawn.

// In client/stdio.ts, change spawn call:
// Original: spawn(command, args, options)
// Windows fix: spawn(command, args, { ...options, shell: process.platform === 'win32' })

// Or configure server to run via cmd.exe:
// {
//   "command": "cmd",
//   "args": ["/C", "npx -y @modelcontextprotocol/server-filesystem /path"]
// }

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics