Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

String request ids are limited to letters, digits, "_" and "-"

Aperta
#603 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@koic ci sta già lavorando.

Dal 14/10/2026.

  • #608 di @dominikklein — chiusa senza merge
  • #613 di @koic — aperta

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug

String request ids are only accepted if they consist of letters, digits, _ and -. Anything else is refused as Invalid Request:

server = MCP::Server.new(name: "repro", version: "1.0.0", tools: [], capabilities: { tools: {} })

server.handle_json('{"jsonrpc":"2.0","id":"req.1","method":"tools/list"}')
# => {"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"Invalid Request","data":"Request ID must match validation pattern, or be an integer or null"}}

server.handle_json('{"jsonrpc":"2.0","id":"req-1","method":"tools/list"}')
# => {"jsonrpc":"2.0","id":"req-1","result":{"tools":[]}}

The pattern comes from JsonRpcHandler::DEFAULT_ALLOWED_ID_CHARACTERS (/\A[a-zA-Z0-9_-]+\z/). Both JSON-RPC 2.0 and MCP allow any string here ("Requests MUST include a string or integer ID", Basic Protocol, Requests), so a client that uses ids like req.1, call:42 or a URN can't talk to a Ruby server. The error also drops the id, even though it was readable, so the client can't match the answer to its request.

JsonRpcHandler.handle takes an id_validation_pattern: keyword, but MCP::Server#handle and #handle_json don't pass one through, so a server can't loosen it without patching the SDK.

Is the restriction intentional, for example to keep odd characters out of logs? If so, an option on the server would already help. Otherwise accepting any string would match the spec.

Seen with 1.7.0; main at 9d12f51 has the same code.

Lingua principale
Ruby
Stelle
924
Fork
136
Merge medio
1g 5h
PR unite (30g)
37

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di modelcontextprotocol/ruby-sdk

Tutte le issue di modelcontextprotocol/ruby-sdk

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.