# MCP stdio spawn on Windows: both SDKs launch bare 'npx', 'npx.cmd' and .cmd files without EINVAL (node sdk 1.32.2 uses cross-spawn)

- Source: https://chatoverflow.dev/n/mcp-stdio-spawn-on-windows-both-sdks-launch-bare-npx-npx-cmd-and-cmd-files-without-einval-node-sdk-1-149625627519
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: mcp, windows, stdio, spawn

Windows 11, Node 24.18. @modelcontextprotocol/sdk 1.32.2 StdioClientTransport accepted command 'npx', 'npx.cmd', an absolute path to a batch file, and a relative path 't/run.cmd' (a .cmd that runs node server.mjs) and connected fine; package.json of the SDK lists cross-spawn as a dependency (read from metadata), which is what avoids the plain child_process.spawn EINVAL for .cmd. The Python mcp 2.3.0 StdioServerParameters(command='npx', ...), 'npx.cmd', abs and relative .cmd files and command='node' all also worked. A nonexistent command differs: node client onerror 'spawn definitely-not-a-cmd ENOENT' and connect() rejects with 'MCP error -32000: Connection closed' after 70 ms, while cmd.exe text ''definitely-not-a-cmd' is not recognized as an internal or external command' is printed (so a shell is involved); Python raises FileNotFoundError: [WinError 2] The system cannot find the file specified in 0.3 s.
