[MCP servers “Failed to connect” on Windows 11 (Node 22, npm 11.5.1, Claude CLI 1.0.62)]

Status Fixed / completed
Maintainer reply None cached
Activity 7 comments · opened Jul 30, 2025 · closed Aug 4, 2025

Environment

  • Platform: [x] Other (local Windows 11 PowerShell/CMD)
  • Claude CLI version: 1.0.62 (Claude Code)
  • Operating System: Windows 11 Pro, build 22631
  • Terminal: PowerShell, CMD, VSCode integrated terminal
  • Node.js: v22.17.1
  • npm: v11.5.1 (upgraded per npm doctor)
  • Global npm bin: Confirmed in PATH (C:\Users\gatto\AppData\Roaming\npm)
  • VSCode: 1.99.3

Bug Description

All MCP servers (context7-mcp, playwright-mcp, firecrawl-mcp) are globally installed and present in the user PATH. Each one runs perfectly from the command line (context7-mcp --help works, context7-mcp reports “MCP server running on stdio”). However, Claude CLI fails to connect to any MCP via claude mcp list, even if the MCP process is already running in a separate terminal.

Steps to Reproduce

  1. Upgrade to npm 11.5.1, confirm global bin is in PATH.
  2. Install MCP binaries: npm install -g @upstash/context7-mcp @playwright/mcp firecrawl-mcp
  3. Confirm binaries run directly: context7-mcp --help and context7-mcp both work.
  4. Register MCPs with Claude CLI using:

claude mcp add context7 -- "context7-mcp"
claude mcp add playwright -- "playwright-mcp"
claude mcp add firecrawl -- "firecrawl-mcp"

  1. Run claude mcp list — all report “Failed to connect”.
  2. Tried running MCPs manually in a terminal, and then claude mcp list in another — still fails.
  3. Tried in PowerShell, CMD, and VSCode terminals, including Run as Administrator.
  4. Verified all env vars and checked for duplicate Node/npm versions.
  5. Ran npm doctor (all OK, npm upgraded as suggested).

Expected Behavior

Claude CLI should connect and handshake with MCPs started via CLI, reporting them as “active” or “ready” in claude mcp list.

Actual Behavior

No connection—always “Failed to connect.” No errors in shell, logs, or MCP startup output.

Additional Context

  • Other users report this as a rare but recurring Windows/Node/stdio issue.
  • Works for many on WSL/Linux.
  • Attaching screenshots and transcript for full reference.
  • If you need more debug logs or want me to try a debug/verbose flag, I’m happy to help.

Thank you!
— Carlos Gattorno (gattorno.carlos@gmail.com)

View original on GitHub ↗

7 Comments

vmadman · 1 year ago

Try running the MCP servers using absolute paths through Node.js directly.

As an example:

claude mcp add mcp-gitlab \
  -e GITLAB_PERSONAL_ACCESS_TOKEN="xxxxx" \
  -e GITLAB_PROJECT_ID="123456" \
  -- \
  node /home/me/.nvm/versions/node/v22.17.0/lib/node_modules/@zereight/mcp-gitlab/build/index.js

It's not a fix, but it's the workaround that is currently working for me.

Hope it helps.

YuenSzeHong · 1 year ago
Try running the MCP servers using absolute paths through Node.js directly. As an example: `` claude mcp add mcp-gitlab \ -e GITLAB_PERSONAL_ACCESS_TOKEN="xxxxx" \ -e GITLAB_PROJECT_ID="123456" \ -- \ node /home/me/.nvm/versions/node/v22.17.0/lib/node_modules/@zereight/mcp-gitlab/build/index.js `` It's not a fix, but it's the workaround that is currently working for me. Hope it helps.

Thanks for the workaround, though I notice the path you provided is Unix-style while the issue is specifically about Windows 😅 More importantly, hardcoding absolute paths defeats the purpose of having a proper CLI tool.
Hopefully anthropic will sooner fix this issue

pouliens · 1 year ago

I had a similar issue. Running claude doctor gave me this warning: Windows requires 'cmd /c' wrapper to execute npx

I've updated my .mcp.json to this and it works now:

{
  "mcpServers": {
    "playwright": {
      "command": "cmd",
      "args": ["/c", "npx", "@playwright/mcp@latest"],
      "type": "stdio"
    }
  }
}
YuenSzeHong · 1 year ago

wonder if bunx would work with this

{
 "mcpServers": {
        "mcp_server_mysql": {
          "command": "cmd",
          "args": [
            "/c",
            "bunx",
            "@benborla29/mcp-server-mysql"
          ],
          "env": {
            "MYSQL_HOST": "127.0.0.1",
            "MYSQL_PORT": "3306",
            "MYSQL_USER": "lms",
            "MYSQL_PASS": "lmsroot",
            "MYSQL_DB": "lms",
            "ALLOW_INSERT_OPERATION": "false",
            "ALLOW_UPDATE_OPERATION": "false",
            "ALLOW_DELETE_OPERATION": "false"
          }
        }
      }
}
mcp_server_mysql: cmd /c bunx @benborla29/mcp-server-mysql - ✗ Failed to connect
claude doctor

Claude CLI Diagnostic
Currently running: npm-global (1.0.67)
Path: C:\Program Files\nodejs\node.exe
Invoked: C:\Users\YuenSzeHong\AppData\Roaming\npm\node_modules\@anthropic-ai\claude-code\cli.js
Config install method: unknown
Auto-updates enabled: true
Update permissions: Yes
Press Enter to continue…
I had a similar issue. Running claude doctor gave me this warning: Windows requires 'cmd /c' wrapper to execute npx I've updated my .mcp.json to this and it works now: `` { "mcpServers": { "playwright": { "command": "cmd", "args": ["/c", "npx", "@playwright/mcp@latest"], "type": "stdio" } } } ``
CFA-Fintech · 1 year ago

✅ ISSUE RESOLVED - Windows 11 MCP Connection Problem SOLVED!

I'm happy to report that this Windows 11 MCP connection issue has been completely resolved! All three MCP servers (context7, playwright, firecrawl) are now successfully connecting and fully operational.

🎯 Root Cause & Solution

Root Cause: Windows requires a cmd /c wrapper for npm subprocess execution, which the Claude CLI wasn't handling automatically.

Working Solution: Use the cmd /c wrapper format when adding MCP servers:

claude mcp add server-name -- cmd /c npx package-name

Example working commands:

claude mcp add context7 -- cmd /c npx @upstash/context7-mcp
claude mcp add playwright -- cmd /c npx @playwright/mcp
claude mcp add firecrawl -- cmd /c npx firecrawl-mcp

🏆 Acknowledgments & Special Thanks

🌟 Special recognition to @pouliens (Paulius Tvaranavicius) - You found the actual solution! Your discovery that claude doctor shows the warning "Windows requires 'cmd /c' wrapper to execute npx" was the key breakthrough. Your .mcp.json configuration example with the cmd /c wrapper format solved the core issue. Thank you for your persistence and technical insight! 🙏

Thanks to all contributors who helped troubleshoot:

  • @vmadman (Luke Chavers): Thank you for the initial workaround attempt using absolute paths with node directly. While it wasn't the final solution, it helped confirm the npm binaries were functional and pointed us toward a subprocess execution issue. Your willingness to share a working approach helped move the troubleshooting forward.
  • @YuenSzeHong (Yuen Sze Hong): Thanks for your valuable feedback pointing out that the Unix-style paths wouldn't work on Windows and that hardcoding absolute paths defeats the purpose of having a proper CLI tool. You also tested alternative approaches like bunx and helped validate that this was a Windows-specific execution problem. Your critical analysis kept us focused on finding a proper solution.

📋 Final Status - All MCP Servers Connected

claude mcp list
Checking MCP server health...
context7: cmd /c npx @upstash/context7-mcp - ✓ Connected
playwright: cmd /c npx @playwright/mcp - ✓ Connected  
firecrawl: cmd /c npx firecrawl-mcp - ✓ Connected

🔧 For Future Windows 11 Users

If you encounter "Failed to connect" with MCP servers on Windows 11:

  1. Run claude doctor to check for the Windows 'cmd /c' wrapper warning
  2. Remove existing broken servers: claude mcp remove server-name
  3. Re-add using the Windows format: claude mcp add server-name -- cmd /c npx package-name
  4. Verify with claude mcp list - should show "✓ Connected"

This solution should work for any npm-installed MCP server on Windows 11.

---

Closing this issue as RESOLVED. Thanks again to everyone who contributed to solving this Windows-specific MCP connection problem! 🎉

— Carlos Gattorno (@CFA-Fintech)

YuenSzeHong · 1 year ago
## ✅ ISSUE RESOLVED - Windows 11 MCP Connection Problem SOLVED! I'm happy to report that this Windows 11 MCP connection issue has been completely resolved! All three MCP servers (context7, playwright, firecrawl) are now successfully connecting and fully operational. ### 🎯 Root Cause & Solution Root Cause: Windows requires a cmd /c wrapper for npm subprocess execution, which the Claude CLI wasn't handling automatically. Working Solution: Use the cmd /c wrapper format when adding MCP servers: ``bash claude mcp add server-name -- cmd /c npx package-name ` **Example working commands**: `bash claude mcp add context7 -- cmd /c npx @upstash/context7-mcp claude mcp add playwright -- cmd /c npx @playwright/mcp claude mcp add firecrawl -- cmd /c npx firecrawl-mcp ` ### 🏆 **Acknowledgments & Special Thanks** **🌟 Special recognition to @pouliens (Paulius Tvaranavicius)** - You found the actual solution! Your discovery that claude doctor shows the warning "Windows requires 'cmd /c' wrapper to execute npx" was the key breakthrough. Your .mcp.json configuration example with the cmd /c wrapper format solved the core issue. Thank you for your persistence and technical insight! 🙏 **Thanks to all contributors who helped troubleshoot:** - **@vmadman (Luke Chavers)**: Thank you for the initial workaround attempt using absolute paths with node directly. While it wasn't the final solution, it helped confirm the npm binaries were functional and pointed us toward a subprocess execution issue. Your willingness to share a working approach helped move the troubleshooting forward. - **@YuenSzeHong (Yuen Sze Hong)**: Thanks for your valuable feedback pointing out that the Unix-style paths wouldn't work on Windows and that hardcoding absolute paths defeats the purpose of having a proper CLI tool. You also tested alternative approaches like bunx and helped validate that this was a Windows-specific execution problem. Your critical analysis kept us focused on finding a proper solution. ### 📋 **Final Status - All MCP Servers Connected** ` claude mcp list Checking MCP server health... context7: cmd /c npx @upstash/context7-mcp - ✓ Connected playwright: cmd /c npx @playwright/mcp - ✓ Connected firecrawl: cmd /c npx firecrawl-mcp - ✓ Connected ` ### 🔧 **For Future Windows 11 Users** If you encounter "Failed to connect" with MCP servers on Windows 11: 1. Run claude doctor to check for the Windows 'cmd /c' wrapper warning 2. Remove existing broken servers: claude mcp remove server-name 3. Re-add using the Windows format: claude mcp add server-name -- cmd /c npx package-name 4. Verify with claude mcp list` - should show "✓ Connected" This solution should work for any npm-installed MCP server on Windows 11. --- Closing this issue as RESOLVED. Thanks again to everyone who contributed to solving this Windows-specific MCP connection problem! 🎉 — Carlos Gattorno (@CFA-Fintech)

well, npx did work, but bunx don't work with the fix

github-actions[bot] · 1 year ago

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.