[BUG] MCP server spawning fails for some .bat/.cmd files on Windows
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Suggested by Claude Code v2.1.39: ".mcp.json with "command": "sireum-mcp.bat" fails on Windows because child_process.spawn() cannot directly execute .bat files without shell: true. The same .bat file works fine when run directly from cmd.
What Should Happen?
Claude Code should automatically handle .bat/.cmd extensions on Windows by either using shell: true or spawning via cmd.exe /c, similar to how the https://www.npmjs.com/package/cross-spawn package handles this.
In the meantime, the only cross-platform workaround without requiring bash would be to use cmd on Windows and bash on macOS/Linux — which unfortunately means platform-specific .mcp.json files, or you'd need to .gitignore the .mcp.json and generate it per-platform."
Related to: https://github.com/anthropics/claude-code/issues/15562
Error Messages/Logs
[ERROR] MCP server "sireum" Server stderr: 'bash' is not recognized as an internal or external command,
operable program or batch file.
[DEBUG] MCP server "sireum": Connection failed after 777ms: MCP error -32000: Connection closed
[ERROR] MCP server "sireum" Connection failed: MCP error -32000: Connection closed
2
Steps to Reproduce
md bin
curl -JLo bin\sireum-mcp.bat https://github.com/sireum/kekinian/raw/b1e27d4483a8a289d3e5762ec2bafc6a321c72f0/bin/sireum-mcp.bat
curl -JLO https://github.com/sireum/kekinian/raw/b1e27d4483a8a289d3e5762ec2bafc6a321c72f0/.mcp.json
claude --debug
Claude Model
None
Is this a regression?
No
Last Working Version
_No response_
Claude Code Version
2.1.39
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗