claude mcp add on Windows expands /c flag to C:/ path
Description
When using claude mcp add on Windows with cmd /c as the command (required for running npx via stdio MCP servers on Windows), the /c argument is incorrectly expanded to C:/ by the CLI.
Steps to Reproduce
Run any of these commands on Windows:
claude mcp add --scope local my-server -- cmd /c npx -y some-mcp-server
claude mcp add --scope user my-server -- cmd /c npx -y some-mcp-server
claude mcp add my-server -- cmd "/c" npx -y some-mcp-server
Expected Behavior
The resulting config in ~/.claude.json should be:
{
"command": "cmd",
"args": ["/c", "npx", "-y", "some-mcp-server"]
}
Actual Behavior
The /c is expanded to a Windows path:
{
"command": "cmd",
"args": ["C:/", "npx", "-y", "some-mcp-server"]
}
The CLI even reports the mangled result:
Added stdio MCP server my-server with command: cmd C:/ npx -y some-mcp-server
Quoting /c does not help — the expansion happens regardless.
Impact
This is particularly problematic because Claude Code itself warns that Windows requires cmd /c wrapper to execute npx for MCP servers. But the CLI tool to add MCP servers cannot produce a correct cmd /c configuration. Users must manually edit ~/.claude.json to fix C:/ back to /c after every claude mcp add.
Environment
- Claude Code version: 2.1.x (installed via native method)
- OS: Windows 11 Pro 10.0.26200
- Bun: Canary v1.3.9-canary.51
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗