Skip to content

Preserve JSON-RPC error response ids#401

Closed
jstar0 wants to merge 1 commit into
modelcontextprotocol:mainfrom
jstar0:fix/json-rpc-error-request-id
Closed

Preserve JSON-RPC error response ids#401
jstar0 wants to merge 1 commit into
modelcontextprotocol:mainfrom
jstar0:fix/json-rpc-error-request-id

Conversation

@jstar0

@jstar0 jstar0 commented Jun 12, 2026

Copy link
Copy Markdown

Summary

Fixes #398.

Changes

  • Preserve recoverable JSON-RPC request ids when request-envelope validation returns an Invalid Request error.
  • Add regressions for an unsupported JSON-RPC version, a missing JSON-RPC version through handle_json, and a non-string method.
  • Keep invalid request ids returning id: null.

Verification

bundle exec ruby -I lib -I test test/json_rpc_handler_test.rb
bundle exec ruby -I lib -I test test/mcp/server_test.rb test/mcp/server/transports/stdio_transport_test.rb test/mcp/server/transports/streamable_http_transport_test.rb
bundle exec rake test
bundle exec rake rubocop
bundle exec yard --no-output

@koic

koic commented Jun 12, 2026

Copy link
Copy Markdown
Member

Since #400 has already been opened to address #398, I'm going to close this PR. Thank you.

@koic koic closed this Jun 12, 2026
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.

JSON-RPC envelope errors use id:null even when the request id is present

2 participants