[BUG] C# MCP Server stdio transport fails to connect - health check timeout issue
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?
C# MCP servers using stdio transport fail to connect with Claude Code, even though they work correctly when tested manually.
What Should Happen?
C# MCP Server stdio transport connects successfully
Error Messages/Logs
Steps to Reproduce
Environment:
- Claude Code on WSL2 Ubuntu
- MCP Server: Microsoft's C# SDK (ModelContextProtocol v0.1.0-preview.10)
- Transport: stdio
Issue:
claude mcp list shows "✗ Failed to connect" and /mcp fails with "Failed to reconnect"
Root Cause:
When the MCP server starts with closed/empty stdin, it hangs waiting for input:
timeout 5 /path/to/MssqlMcp < /dev/null
# Hangs until timeout
Manual test shows server works:
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{...}}' | /path/to/MssqlMcp
# Returns valid JSON-RPC response immediately
Conclusion:
Claude Code's health check doesn't send an initialize request or doesn't properly establish stdio connection. The C# SDK stdio transport expects stdin to be open with data available.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.17
Platform
Anthropic API
Operating System
Ubuntu
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗