Repository navigation
fix(mcp): JSON-RPC 2.0 spec compliance — omit error field & skip notification acks - #576
Merged
Merged
Conversation
…fication acks Closes #573 Two violations fixed: 1. Success responses no longer include "error": null. Changed JsonRpcResponse from a flat struct with Option fields to a tagged enum (Success/Error) so serde omits the absent variant entirely, per JSON-RPC 2.0 §5.1 (result and error are mutually exclusive). 2. Notifications (requests with no "id") no longer receive a response. handle_jsonrpc now returns Option<String>: None for notifications, Some(response) for regular requests, per JSON-RPC 2.0 §4.1. Updated callers: - main.rs (stdio): skips writeln when handle_jsonrpc returns None - handlers.rs (HTTP): returns 204 No Content for notifications Also runs cargo fmt on pre-existing formatting issues in handlers.rs.
| }) | ||
| .unwrap_or_default(), | ||
| Ok(result) => { | ||
| if is_notification { |
🔍 Cora AI Code Review❌ Blocked — critical issues found. 🔴 Error (1)
Review powered by cora-cli · BYOK · MIT |
This was referenced Jul 6, 2026
Merged
ajianaz
added a commit
that referenced
this pull request
Aug 13, 2026
…ance fix(mcp): JSON-RPC 2.0 spec compliance — omit error field & skip notification acks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #573 —
uteke-mcpemits non-spec-compliant JSON-RPC, causing Claude Code to refuse connection.Changes
crates/uteke-mcp/src/lib.rsJsonRpcResponsefrom flat struct withOptionfields to tagged enum (Success/Error).handle_jsonrpcreturnsOption<String>—Nonefor notifications (per §4.1).crates/uteke-mcp/src/main.rsNone(notification).crates/uteke-server/src/handlers.rsWhat was broken
"error": null→ violates JSON-RPC 2.0 §5.1 (result/error mutually exclusive){"id":null,...}→ violates JSON-RPC 2.0 §4.1 (no response to notifications)What's fixed
Before (2.0K output, Claude Code rejects):
{"jsonrpc":"2.0","id":1,"result":{...},"error":null} {"jsonrpc":"2.0","id":null,"result":null,"error":null}After (spec-compliant, Claude Code accepts):
{"jsonrpc":"2.0","id":1,"result":{...}} (no second line — notification gets no response)Test plan
cargo fmt --all -- --checkpasses locallyprintf '...' | uteke-mcpno longer emits notification acks