How to Set Up an MCP Server in Claude Code on Windows
Add HTTP, SSE, and stdio MCP servers to Claude Code on Windows. The cmd /c npx wrapper, the three scopes, and the errors you hit if you skip the wrapper.
TL;DR: Use claude mcp add for remote HTTP servers without modification. Wrap any stdio server running through npx with cmd /c. Without the wrapper, npx fails to spawn and the server appears in claude mcp list but never connects.
Prerequisites
-
Claude Code installed. Run
claude --version. - Node.js 18 or newer on PATH if you plan to run stdio servers via npx.
- A working terminal. Windows PowerShell, Windows Terminal, or Git Bash. WSL is not required.
Pick a Scope Before You Add a Server
| Scope | Loads in | Shared with team | Stored in |
|---|---|---|---|
| local (default) | Current project only | No | ~/.claude.json |
| project | Current project only | Yes, via Git | .mcp.json in project root |
| user | All your projects | No | ~/.claude.json |
Option 1: Add a Remote HTTP Server (No Windows-Specific Quirks)
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
For servers that authenticate with a token:
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ --header "Authorization: Bearer YOUR_GITHUB_PAT"
Option 2: Add a Local Stdio Server (Where Windows Differs)
On Windows, npx resolves to npx.cmd, a batch script the Node child-process spawn inside Claude Code does not invoke directly. The fix is to wrap the call with cmd /c.
Method A: Through the CLI
claude mcp add --transport stdio filesystem -- cmd /c npx -y @modelcontextprotocol/server-filesystem C:/Users/you/projects
All flags come before the server name. The double-dash -- separates the name from the command.
Method B: Edit .mcp.json Directly
{
"mcpServers": {
"filesystem": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@modelcontextprotocol/server-filesystem", "C:/Users/you/projects"]
}
}
}
Use forward slashes in path arguments. Restart Claude Code after editing.
Verify the Server Is Connected
- Run
claude mcp list- the server should appear. - Inside Claude Code, type
/mcp- servers show as connected, pending, or failed. - Use a tool to confirm the connection works end-to-end.
Common Errors
-
spawn npx ENOENT - add the
cmd /cwrapper, or confirm Node is on PATH. -
Server failed to start after OAuth - set
MCP_TIMEOUT=10000before launching Claude Code. -
This project MCP servers must be approved - approve at the prompt, or run
claude mcp reset-project-choices. - Server shows in list but never appears under /mcp - flag ordering is wrong; re-run with all options before the name.
FAQ
Why does npx fail on Windows? On Windows it resolves to npx.cmd, a batch script the Node child-process spawn does not invoke as an executable. Wrapping with cmd /c hands the script to the shell.
Where is the MCP config file stored on Windows? Local and user-scoped servers live in %USERPROFILE%\.claude.json. Project-scoped servers live in .mcp.json at the project root.
Do I need WSL? No. The native Windows install of Claude Code runs MCP servers directly.
Originally published at automatelab.tech
Top comments (0)