[BUG] MCP Fails on native Windows
Status Fixed / completed
Maintainer reply ✓ Yes — ollie-anthropic
Activity 9 comments · opened Jul 12, 2025 · closed Jul 18, 2025
💡 Likely answer: A maintainer (ollie-anthropic, collaborator)
responded on this thread — see the highlighted reply below.
Environment
- Platform (select one): Claude Max Sub
- Claude CLI version: 1.0.51
- Operating System: Windows 11
- Terminal: Powershell
Bug Description
The MCP functionality is not working on Windows (native installation). When attempting to add a stdio MCP.
Steps to Reproduce
- Open a terminal (e.g., PowerShell, Cmd).
- Attempt to add a context using the
claude mcp addcommand, for example:
claude mcp add context7 -- "npx -y @upstash/context7-mcp"
Expected Behavior
The MCP should be successfully added - It's working on WSL2 on the same machine.
Actual Behavior
The MCP command fails with the following error log, indicating a "Connection closed" issue:
{
"debug": "Error stack: McpError: MCP error -32000: Connection closed\n at ka1._onclose (file:///C:/Users/FooBar/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:1336:15216)\n at _transport.onclose (file:///C:/Users/FooBar/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:1336:14535)\n at ChildProcess.<anonymous> (file:///C:/Users/FooBar/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:1338:1459)\n at ChildProcess.emit (node:events:518:28)\n at ChildProcess.emit (node:domain:489:12)\n at LbQ.A.emit (file:///C:/Users/FooBar/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:320:155823)\n at maybeClose (node:internal/child_process:1104:16)\n at Socket.<anonymous> (node:internal/child_process:456:11)\n at Socket.emit (node:events:518:28)\n at Socket.emit (node:domain:489:12)",
"timestamp": "2025-07-11T23:43:11.730Z",
"sessionId": "8c2cb375-4da4-48e2-9d0f-f37c8f0ccae7",
"cwd": "D:\\FooBar\\bpress"
}
9 Comments
@vuhoanglam Try this,Using cmd /c wrapper The most reliable solution is to use cmd /c to ensure npx is executed in the correct shell environment
:
json
{
"mcpServers": {
"context7": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"]
}
}
}
same
Same issue. Where does claude code store mcp config json?
i can confirm that this works pretty well
Nice. U guys can try @Vanyangyang method, use mcp add-json instead of add:
claude mcp add-json context7 -s user '{"type":"stdio","command":"cmd","args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"]}'document link: https://docs.anthropic.com/en/docs/claude-code/mcp#add-mcp-servers-from-json-configuration
but i think the offiial document needs to be updated for windows users before marking this issue as resolved
Thanks for all the Input, to summary
Where does claude store the mcp config.json? (as per @ismailhozza)
It is stored in
C:\Users\[username]\.claude.jsonThere should be multiple
mcpServersentries.You should be able to recognize which ones are on a Project scope and which one are on a User Scope (Higher)
I just put this in and it started working
Now if you want to use a command line from terminal you can do like this:
Command Prompt:
Powershell
Hope this helps
Kudos to @Vanyangyang and @vuhoanglam
it's good
Hey all, thanks a lot for the feedback on this. The solutions here involving using the cmd command seem to fix this. I've added some documentation on our website addressing this https://docs.anthropic.com/en/docs/claude-code/mcp. In the coming release, we'll also have a custom warning for Windows users, prompting them about a potentially misconfigured setup in this case.
I'll close the issue given a solution has been found. However, we do hope to make all this much more ergonomic!
<img width="767" height="304" alt="Image" src="https://github.com/user-attachments/assets/660f01ee-00a3-4938-95fa-22b3ca6cf9c6" />
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.