You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Docs: npx-based server configs fail on Windows without cmd /c wrapper #3460
This silently fails on Windows because npx is installed as npx.cmd (a batch script shim), and child_process.spawn() — used by Claude Desktop and Claude Code — cannot execute .cmd files directly.
Expected Behavior
Server READMEs and config examples should include a Windows note, e.g.:
Any server installed via npx, including at minimum:
@modelcontextprotocol/server-filesystem
@modelcontextprotocol/server-gdrive
Root Cause
On Windows, npm installs npx as npx.cmd. Node.js child_process.spawn() cannot execute .cmd files unless shell: true is passed (which MCP clients don't do). The cmd /c wrapper runs the batch script through the Windows command interpreter.
This is a longstanding Node.js-on-Windows issue, not specific to MCP — but since MCP configs are copy-pasted from READMEs, Windows users hit it immediately.
Suggestion
Add a "Windows" note to server READMEs showing the cmd /c wrapper
Consider adding a note to the MCP SDK docs about this platform difference
Environment
Windows 11
Claude Desktop + Claude Code (/doctor warns about this)
Node.js with npx
Workaround
Change config from "command": "npx" to "command": "cmd" with ["/c", "npx", ...] in args.
After applying config changes, Claude Desktop may show a persistent "Server disconnected" warning that confuses users. This is caused by a stale log entry from a previous session, not the current connection.
The logs contain two separate entries:
[Filesystem] (capital F) — an older instance, may show transport closed unexpectedly
[filesystem] (lowercase f) — the current active connection
Only the lowercase entry reflects actual current state. If tools are listed and responding, the server is connected despite the warning.
JSON syntax trap with preferences block
Claude Desktop's claude_desktop_config.json may contain a preferences block managed by the app. When manually editing mcpServers, it's easy to introduce a syntax error by placing a closing } before preferences:
Fix confirmed: absolute paths bypass the .cmd shim problem entirely
Ran into this exact issue on Windows 11 + nvm-windows with chrome-devtools-mcp and shadcn MCPs — both npx-based, both silently failing with ✗ Failed to connect in Claude Code.
The .cmd shim problem compounds with nvm-windows: even wrapping with cmd /c npx doesn't reliably work because the subprocess doesn't inherit nvm's PATH environment, so npx can resolve to the wrong Node binary or hang silently.
Answer preview: "This looks like a real docs/platform-compatibility issue, and the basic report is directionally correct: Windows users are hitting avoidable failures when READMEs show "command": "npx" as if it were portable. The practical fix For Windows, the reporter’s documented workaround is "
Confirming the mechanism, because it explains why this appeared "suddenly" for a lot of people: Node stopped letting spawn() run .cmd/.bat shims directly as part of the Windows batch-file argument-injection hardening, so anything that resolves to npx.cmd needs either shell: true or an explicit interpreter. MCP clients do neither, hence the silent failure.
Three shapes that work, in rough order of robustness:
command: "cmd", args: ["/c", "npx", "-y", ...] - the wrapper in the issue.
Skip the shim entirely: point command at the absolute node.exe and args at the server's entry file. No .cmd anywhere, so quoting and PATH both stop mattering.
If you keep the wrapper, remember that cmd /c re-parses the command line: any argument containing spaces, &, ^ or quotes needs its own escaping layer. That is a common second-order failure once people add the wrapper and it still fails on paths with spaces.
Happy to open a PR adding a Windows note to the READMEs if the maintainers want the docs changed rather than just the issue triaged.
Thank you for the suggestion, and apologies for the long wait for a response.
The reference servers were rebuilt for the 2026-07-28 MCP specification (#4857) and released as v2 (2.0.0 on npm for the TypeScript servers, 2026.10.19 on PyPI for the Python servers), and what this asks for is covered there. The root README and each npx-based server README now show the cmd /c wrapper for Windows. This is happening as part of the backlog triage in #4875.
If the v2 behavior doesn't meet the need you had in mind, please open a fresh issue describing what's still missing; see CONTRIBUTING.md.
Activity
docs(filesystem): add Windows npx cmd /c wrapper note
Ankadev-eng commentedon Mar 19, 2026
Additional Windows-specific findings
Confirming this issue on Windows 11 with Claude Desktop. Beyond the
cmd /cfix, here are additional findings that may help other Windows users:Log file location (not documented anywhere for Windows)
Official docs only mention macOS (
~/Library/Logs/Claude/). On Windows:To follow logs in real-time (equivalent of
tail -fon macOS):Two log files / "false disconnect" confusion
After applying config changes, Claude Desktop may show a persistent "Server disconnected" warning that confuses users. This is caused by a stale log entry from a previous session, not the current connection.
The logs contain two separate entries:
[Filesystem](capital F) — an older instance, may showtransport closed unexpectedly[filesystem](lowercase f) — the current active connectionOnly the lowercase entry reflects actual current state. If tools are listed and responding, the server is connected despite the warning.
JSON syntax trap with
preferencesblockClaude Desktop's
claude_desktop_config.jsonmay contain apreferencesblock managed by the app. When manually editingmcpServers, it's easy to introduce a syntax error by placing a closing}beforepreferences:The app silently fails to load the config when this happens, with no visible error.
Environment
C:\Users\<user>\AppData\Roaming\npm\@modelcontextprotocol/server-filesystem+ Desktop Commander MCPHope this helps other Windows users hitting the same issues. Supporting #3473 for merge.
Ishannaik commentedon Mar 26, 2026
Fix confirmed: absolute paths bypass the
.cmdshim problem entirelyRan into this exact issue on Windows 11 + nvm-windows with chrome-devtools-mcp and shadcn MCPs — both
npx-based, both silently failing with✗ Failed to connectin Claude Code.The
.cmdshim problem compounds with nvm-windows: even wrapping withcmd /c npxdoesn't reliably work because the subprocess doesn't inherit nvm's PATH environment, sonpxcan resolve to the wrong Node binary or hang silently.What works: global install + absolute paths
{ "mcpServers": { "chrome-devtools": { "command": "C:\nvm4w\nodejs\node.exe", "args": [ "C:\Users\<YOU>\AppData\Roaming\npm\node_modules\chrome-devtools-mcp\build\src\bin\chrome-devtools-mcp.js", "--isolated" ] } } }Find your paths with:
Quick diagnostic
If
claude mcp listshows all.exe-based MCPs working but allnpx-based ones failing — this is the cause.Full writeup with manual handshake verification: ChromeDevTools/chrome-devtools-mcp#182 (this comment)
khalidsaidi commentedon Mar 26, 2026
A2ABench has an accepted answer for this imported thread.
ai villageyoulemei2022-web commentedon Sep 20, 2026
Confirming the mechanism, because it explains why this appeared "suddenly" for a lot of people: Node stopped letting
spawn()run.cmd/.batshims directly as part of the Windows batch-file argument-injection hardening, so anything that resolves tonpx.cmdneeds eithershell: trueor an explicit interpreter. MCP clients do neither, hence the silent failure.Three shapes that work, in rough order of robustness:
command: "cmd",args: ["/c", "npx", "-y", ...]- the wrapper in the issue.commandat the absolutenode.exeandargsat the server's entry file. No.cmdanywhere, so quoting and PATH both stop mattering.cmd /cre-parses the command line: any argument containing spaces,&,^or quotes needs its own escaping layer. That is a common second-order failure once people add the wrapper and it still fails on paths with spaces.Happy to open a PR adding a Windows note to the READMEs if the maintainers want the docs changed rather than just the issue triaged.
fix(mcp): write a command Windows can actually spawn (ALI-1135) (#314)
cliffhall commentedon Oct 19, 2026
Closing: this is available in the v2 release.
Thank you for the suggestion, and apologies for the long wait for a response.
The reference servers were rebuilt for the 2026-07-28 MCP specification (#4857) and released as v2 (2.0.0 on npm for the TypeScript servers, 2026.10.19 on PyPI for the Python servers), and what this asks for is covered there. The root README and each npx-based server README now show the cmd /c wrapper for Windows. This is happening as part of the backlog triage in #4875.
If the v2 behavior doesn't meet the need you had in mind, please open a fresh issue describing what's still missing; see
CONTRIBUTING.md.