Windows: claude mcp add mangles /c flag, breaks npx-based MCP servers

Resolved 💬 4 comments Opened Jan 22, 2026 by PaulNonatomic Closed Feb 28, 2026

Description

This issue documents two specific problems not fully covered by related issues:

  1. CLI Bug: claude mcp add mangles /c into C:/ when users try to add the Windows wrapper manually
  2. Regression: This broke after reinstalling Claude Code with the new native installer - previously MCP servers worked without manual cmd /c configuration

Related Issues

  • #19571 - Broader Windows/Git Bash shell handling (open)
  • #15562 - Feature request for cross-platform MCP config with shell: true option (open)
  • #9594 - Original report about npx needing cmd /c (closed as "not planned" - incorrectly IMO)

This issue focuses on the CLI-specific bug that makes the workaround impossible via command line.

Steps to Reproduce

Problem 1: Missing wrapper

claude mcp add myserver npx @some/mcp-server@latest --env API_KEY=xxx

Result: Warning "Windows requires 'cmd /c' wrapper to execute npx"

Problem 2: CLI mangles /c flag

claude mcp add myserver cmd /c npx @some/mcp-server@latest --env API_KEY=xxx

Result in config:

{
  "command": "cmd",
  "args": ["C:/", "npx", "@some/mcp-server@latest"]  // /c became C:/
}

Regression Evidence

This worked before reinstalling Claude Code with the new native installer. The previous version either:

  • Auto-wrapped npx commands with cmd /c on Windows
  • Handled the shell spawning differently
  • Or preserved existing configs that already had the fix

After reinstall, all npx-based MCP servers broke and required manual config editing.

Workaround

Manually edit your Claude config file to fix the args:

{
  "mcpServers": {
    "myserver": {
      "type": "stdio",
      "command": "cmd",
      "args": ["/c", "npx", "@some/mcp-server@latest"],
      "env": {
        "API_KEY": "xxx"
      }
    }
  }
}

Suggested Fixes

  1. Fix the CLI parser - Don't interpret /c as a path
  2. Auto-detect Windows - When command is npx on Windows, auto-wrap with cmd /c
  3. Add shell: true option - As proposed in #15562

Environment

  • OS: Windows 10/11
  • Claude Code: Latest (post native installer update)
  • Shell: Affects all shells (cmd, PowerShell, Windows Terminal, Git Bash)

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗