Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

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

Offen
#603 0 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@koic arbeitet bereits daran.

Seit 14.10.2026.

  • #608 von @dominikklein — ohne Merge geschlossen
  • #613 von @koic — offen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

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.

Vorherrschende Sprache
Ruby
Sterne
924
Forks
136
Ø Merge
1 T. 9 Std.
Gemergte PRs (30 T.)
38

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus modelcontextprotocol/ruby-sdk

Alle Issues in modelcontextprotocol/ruby-sdk

Ähnliche Issues

Weitere Issues zu Ruby

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.