[BUG] MCP Server Connection Failures on Windows

Resolved 💬 6 comments Opened Jul 29, 2025 by lcipciriuc Closed Aug 15, 2025

Title: MCP Server Connection Failures on Windows - All stdio MCP servers fail to connect

Environment:

  • OS: Windows 11
  • Claude Code CLI Version: 1.0.62
  • Installation: npm-global
  • Node.js: [your version]

Issue Description:
All MCP servers fail to connect with "Connection closed" errors, regardless of configuration. Even simple test commands fail.

Evidence:

  1. Manual MCP protocol test WORKS:

echo {"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0"}}} | context7-mcp
Returns proper JSON response.

  1. ALL Claude Code CLI configurations FAIL:
  • context7-mcp
  • powershell -Command context7-mcp
  • cmd /c "C:\Users\LILIAN C\AppData\Roaming\npm\context7-mcp.cmd"
  • cmd /c C:\Users\LILIAN~1\AppData\Roaming\npm\context7-mcp.cmd
  • cmd /c echo MCP_TEST (simple test)

Debug Output Shows:

  • Error: /usr/bin/bash: Files\Git\bin\bash.exe: No such file or directory
  • Claude CLI tries to use bash even when cmd/powershell specified
  • Path with spaces gets mangled: Files\Git\bin\bash.exe

Root Cause:
Claude Code CLI's MCP stdio transport appears to force bash execution on Windows, with broken path handling for spaces.

Expected Behavior:
MCP servers should connect when properly configured, especially when manual protocol test succeeds.

Reproduction:

  1. Install any MCP server on Windows
  2. Add with claude mcp add test "echo hello"
  3. Run claude mcp list
  4. Observe "Failed to connect" for all servers

View original on GitHub ↗

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