Requests with "id": null are run like notifications
Mantenedores costumam responder em até 1 dia
Avaliação
Esta issue ainda não foi avaliada.
Descrição
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.
- Linguagem predominante
- Ruby
- Estrelas
- 924
- Forks
- 136
- Merge médio
- 1d 5h
- PRs com merge (30d)
- 37
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de modelcontextprotocol/ruby-sdk
-
Empty members in the Accept header cause a 500Talvez já em andamento @koic assumiu hoje. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
modelcontextprotocol/ruby-sdk#609 ·
Mantenedores costumam responder em até 1 dia
-
Error responses carry "id": null, which the MCP schema does not allowTalvez já em andamento @koic assumiu hoje. Abertabug
Dificuldade 3/5 Meio dia Facilidade para iniciantes 45/100
modelcontextprotocol/ruby-sdk#606 ·
Mantenedores costumam responder em até 1 dia
-
String request ids are limited to letters, digits, "_" and "-"Talvez já em andamento @koic assumiu há 1 dia. Abertabug
modelcontextprotocol/ruby-sdk#603 · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
Methods of undeclared capabilities return -32603 instead of -32601Talvez já em andamento @koic assumiu há 1 dia. Abertabug
modelcontextprotocol/ruby-sdk#602 · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
Support modelcontextprotocol/experimental-ext-triggers-eventsTalvez já em andamento @koic assumiu há 4 dias. Abertaenhancement
modelcontextprotocol/ruby-sdk#594 · 1 responsável ·
Mantenedores costumam responder em até 1 dia
Todas as issues de modelcontextprotocol/ruby-sdk
Issues semelhantes
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
TheOdinProject/curriculum#31465 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
-
agent:triaged bug bughunt pm:bundler priority:p1
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
SocketDev/socket-patch#1573 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Generated server webpack config keeps Rspack's manifest and CSS extraction pluginsTalvez já em andamento @justin808 assumiu hoje. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
shakacode/react_on_rails#5184 ·
Mantenedores costumam responder em até 1 dia
-
bug chat verified
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 6 dias