[BUG] Windows: MCP server fails with /d: Is a directory -> MCP error -32000: Connection closed
Environment
- Platform: Anthropic API
- Claude CLI version: 1.0.67 (Claude Code)
- Operating System: Windows 11
- Terminal: Powershell - PSVersion 5.1.22621.5624
When Claude Code runs on Windows it always spawns Git Bash, even if the user launches claude from PowerShell or cmd.
Git Bash rewrites Windows drive letters (D:\…) to /d:.
Any MCP server (e.g. @playwright/mcp) that is started through spawn() then crashes immediately:
/d: /d: Is a directory
MCP error -32000: Connection closed
The CLI retries, but the child process exits in < 1 s every time, so Claude never connects to the MCP server.
Steps to Reproduce
- Windows 11, Node ≥ 18, Git for Windows installed
- claude mcp add playwright npx @playwright/mcp@latest
- Run Claude Code (claude --debug)
- [ERROR] MCP server "playwright" Server stderr: /d: /d: Is a directory
Expected
Playwright MCP server stays alive -> Claude can drive the browser.
Full debug log excerpt:
[DEBUG] MCP server "playwright": Starting connection attempt
[DEBUG] Creating shell snapshot for bash (D:\Tools\Git\Git\bin\bash.exe)
…
/d: /d: Is a directory
[DEBUG] MCP server "playwright": Connection failed: McpError: MCP error -32000: Connection closed
Root Cause:
Script/shell/getDefaultShell.ts
On Windows it always returns the first bash.exe found in PATH, ignoring settings.defaultShell and the user’s interactive shell.
Script/mcp/launch.ts
spawn(cmd, args, { env: process.env … }) passes the plain environment to Git Bash.
Without MSYS_NO_PATHCONV=1 Git rewrites D:\… -> /d: and the child process exits with the above error.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗