Requests with "id": null are run like notifications
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
I'm wiring the SDK into a Rails app (stateless Streamable HTTP, JSON responses) and noticed that a request with "id": null isn't rejected. The server treats it like a notification: the method runs, but no response is produced, so over HTTP the client gets a 202 Accepted with an empty body.
For a tool that changes data, that's a write the client never hears about. The spec rules null ids out for requests:
- Requests MUST include a string or integer ID.
- Unlike base JSON-RPC, the ID MUST NOT be
null.
(Basic Protocol, Requests, same wording in 2026-07-28)
Repro with 1.7.0 (main at 9d12f51 behaves the same):
require "mcp"
calls = 0
echo = MCP::Tool.define(
name: "echo",
description: "Echoes the text back",
input_schema: { properties: { text: { type: "string" } }, required: ["text"] },
) do |text:, server_context: nil|
calls += 1
MCP::Tool::Response.new([{ type: "text", text: text }])
end
server = MCP::Server.new(name: "repro", version: "1.0.0", tools: [echo], capabilities: { tools: {} })
server.handle_json('{"jsonrpc":"2.0","id":null,"method":"tools/call","params":{"name":"echo","arguments":{"text":"hi"}}}')
# => nil
server.handle_json('{"jsonrpc":"2.0","method":"tools/call","params":{"name":"echo","arguments":{"text":"hi"}}}')
# => nil
calls # => 2
JsonRpcHandler.valid_id? accepts nil on purpose (the error message says "or be an integer or null"), which fits plain JSON-RPC but not MCP.
The second call, without any id, is a notification by JSON-RPC rules, so it's a slightly different case. But tools/call isn't a notification in MCP, and the Streamable HTTP transport allows a server to answer a notification it can't accept with an HTTP error (e.g. 400). Running it silently seems like the riskiest option.
What I'd expect:
"id": nullis answered with Invalid Request (-32600) and the method doesn't run.- A request method sent without an id is refused, or at least not executed.
- Vorherrschende Sprache
- Ruby
- Sterne
- 924
- Forks
- 136
- Ø Merge
- 1 T. 5 Std.
- Gemergte PRs (30 T.)
- 37
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus modelcontextprotocol/ruby-sdk
-
Empty members in the Accept header cause a 500Evtl. vergeben @koic hat das heute übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
modelcontextprotocol/ruby-sdk#609 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Error responses carry "id": null, which the MCP schema does not allowEvtl. vergeben @koic hat das heute übernommen. Offenbug
Schwierigkeit 3/5 Ein halber Tag Anfängerfreundlichkeit 45/100
modelcontextprotocol/ruby-sdk#606 ·
Maintainer antworten meist innerhalb von 1 Tag
-
String request ids are limited to letters, digits, "_" and "-"Evtl. vergeben @koic hat das vor 1 Tag übernommen. Offenbug
modelcontextprotocol/ruby-sdk#603 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Methods of undeclared capabilities return -32603 instead of -32601Evtl. vergeben @koic hat das vor 1 Tag übernommen. Offenbug
modelcontextprotocol/ruby-sdk#602 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Support modelcontextprotocol/experimental-ext-triggers-eventsEvtl. vergeben @koic hat das vor 4 Tagen übernommen. Offenenhancement
modelcontextprotocol/ruby-sdk#594 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in modelcontextprotocol/ruby-sdk
Ähnliche Issues
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
TheOdinProject/curriculum#31465 ·
Maintainer antworten meist innerhalb von 1 Tag
-
agent:triaged bug bughunt pm:bundler priority:p1
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
SocketDev/socket-patch#1573 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Generated server webpack config keeps Rspack's manifest and CSS extraction pluginsEvtl. vergeben @justin808 hat das heute übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
shakacode/react_on_rails#5184 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug chat verified
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 6 Tagen
-
🐞 bug pending triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
CircuitVerse/CircuitVerse#8031 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag