[Bug] MCP HTTP Transport: JSON-RPC validation paradox - rejects valid jsonrpc: 2.0

Resolved 💬 2 comments Opened Jan 20, 2026 by christophmaier Closed Jan 20, 2026

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

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": true in 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

  1. Configure any HTTP MCP with Z.ai services
  2. Use environment variable in Authorization header (e.g., "Authorization": "Bearer ZAI_GLM_CODING_PLAN_API_KEY")
  3. Restart Claude Code
  4. 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.

View original on GitHub ↗

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