Skip to content

fix(mcp): JSON-RPC 2.0 and MCP spec compliance - #350

Merged
ajianaz merged 2 commits into
developfrom
fix/336-mcp-compliance
Oct 13, 2026
Merged

ajianaz merged 2 commits into
developfrom
fix/336-mcp-compliance

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #336

What

  • Notifications (no id) get no response; batch arrays supported (empty batch -> -32600, all-notification batch -> no output)
  • Validates jsonrpc == "2.0", id type, method, params; error codes -32700/-32600/-32601/-32602
  • initialize negotiates protocolVersion (2025-06-18, 2025-03-26, 2024-11-05)
  • tools/call failures return isError: true content; unknown tool is -32602
  • Async stdin/stdout (tokio), removed unwrap(), char-boundary-safe key abbreviation (no panic on short/multibyte keys)
  • handle_message now returns Option<String>

Why

Strict MCP clients broke on non-compliant JSON-RPC behavior (responses to notifications, wrong error codes, no batch support, no version negotiation). Fixes all gaps listed in #336. Deferred: none.

Testing

Failing tests added first (mcp_test.rs plus unit tests). cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings and cargo test --workspace all pass (mcp: 2 unit + 16 integration).

🤖 Generated with Claude Code

ajianaz and others added 2 commits October 13, 2026 08:35
- notifications (no id) get no response; batches supported
- validate jsonrpc/id/method/params; codes -32600/-32601/-32602
- negotiate protocolVersion on initialize
- tool failures returned as isError results; unknown tool is -32602
- async stdin/stdout, remove unwrap, char-safe key abbreviation

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ajianaz
ajianaz merged commit e5c7be7 into develop Oct 13, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(mcp): JSON-RPC 2.0 / MCP compliance gaps

1 participant