[Bug] MCP HTTP Transport: JSON-RPC validation paradox - rejects valid jsonrpc: 2.0
Bug Report: Claude Code MCP HTTP Transport - JSON-RPC Validation Error
Summary
Z.ai MCP servers (HTTP type) fail to connect during startup due to a JSON-RPC schema validation bug in Claude Code's MCP client. The server sends valid {"jsonrpc": "2.0"} but the client's schema validator rejects it.
Environment
- Claude Code: 2.1.12 (native)
- Node: v24.3.0
- Platform: Linux (Fedora)
Affected MCPs
web-search-prime(https://api.z.ai/api/mcp/web_search_prime/mcp)zread(https://api.z.ai/api/mcp/zread/mcp)web-reader(https://api.z.ai/api/mcp/web_reader/mcp)
Error from Debug Log
\\\\
[DEBUG] MCP server "web-search-prime": HTTP Connection failed after 1176ms: [
{
"code": "invalid_union",
"errors": [
{
"code": "invalid_value",
"values": ["2.0"],
"path": ["jsonrpc"],
"message": "Invalid input: expected \"2.0\""
}
]
}
]
\\
Root Cause
The MCP server sends valid {"jsonrpc": "2.0"} but Claude Code's schema validator rejects it, creating a paradox where the expected value ("2.0") is received but marked as invalid.
Evidence That Auth/Env Vars Work
"hasAuthProvider": truein debug logs"Authorization":"[REDACTED]"(key was resolved from env var)- Tools worked during active session (webReader successfully fetched pages)
- Only fails during startup MCP handshake
Steps to Reproduce
- Configure any HTTP MCP with Z.ai services
- Use environment variable in Authorization header (e.g.,
"Authorization": "Bearer ZAI_GLM_CODING_PLAN_API_KEY") - Restart Claude Code
- Check MCP status with \
claude mcp list\
Expected Behavior
MCP servers should connect successfully.
Actual Behavior
Connection fails with JSON-RPC validation error during startup.
Additional Context
The same MCP tools work when called during an active session, suggesting the validation bug only affects the startup handshake process.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗