HTTP client fails connect when the server acknowledges notifications/initialized with an empty 200
Les mainteneurs répondent en général sous 1 jour
@koic y travaille déjà.
Depuis le 13/10/2026.
Évaluation
- Difficulté
- 1/5
- Temps estimé
- Moins d'une heure
- Accessibilité débutants
- 20/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Stack technique
- ruby
- Domaine
- backend-api-design
Piste de recherche
Read MCP::Client::HTTP#send_request and resolve_response_body, which the issue identifies as the failing path. Check the existing tests for the notifications/initialized response and the linked pull requests #599 and #600 to see the work already underway. Done means a notification acknowledged with a bodyless 2xx no longer raises, while a request with the same response still raises unsupported_media_type.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Observed behavior
With mcp 1.7.0 (and 0.15.0), MCP::Client#connect with the legacy initialize handshake over Streamable HTTP fails against servers that acknowledge notifications/initialized with 200 OK, an empty body and no Content-Type, instead of 202 Accepted:
MCP::Client::RequestHandlerError: Unsupported Content-Type: nil. Expected application/json or text/event-stream.
error_type: :unsupported_media_type
The initialize request succeeds. The error comes from the following notifications/initialized POST: send_request passes the response to resolve_response_body, which returns early only for 202 and raises for any other response without a JSON or SSE content type.
For example, Freshservice's hosted MCP server (Freshworks, https://<account>.freshservice.com/mcp) responds this way:
POST /mcp {"jsonrpc":"2.0","method":"notifications/initialized"}
HTTP/1.1 200 OK
Content-Length: 0
I ran each SDK's client against the same Freshservice server, with the same OAuth token, on 2026-10-13:
| Client | notifications/initialized response |
Result |
|---|---|---|
TypeScript SDK 1.32.1 (StreamableHTTPClientTransport) |
200, no Content-Type |
Connects, listTools returns 40 tools |
Python SDK 2.3.0 (streamable_http_client) |
200, no Content-Type |
Connects, list_tools returns 40 tools |
Ruby SDK main (7735046) |
200, no Content-Type |
Unsupported Content-Type: nil |
Expected behavior
The spec says the server MUST return 202 Accepted with no body when it accepts a notification (Transports, Sending Messages to the Server), so the server is out of spec here. Still, a notification awaits no response, and both reference SDKs accept any 2xx for it:
- TypeScript SDK 1.32.1: after the
202check, the content type is checked only when the POST carried a request. For a notification, any other 2xx reaches the// No requests in message but got 200 OK - still need to release connectionbranch, which cancels the body and returns. - Python SDK 2.3.0: after the
202check, the content-type handling is gated onisinstance(message, JSONRPCRequest), with the comment "The server MUST NOT send a response to notifications." A notification answered with 2xx falls through without reading the body.
In both, a request answered the same way is still an error: TypeScript throws StreamableHTTPError and Python returns a JSON-RPC error, each with "Unexpected content type".
I'd expect connect to succeed when a notification is acknowledged with a 2xx and no body. Requests should keep raising unsupported_media_type for the same response.
Reproduction
require "mcp"
require "webmock"
include WebMock::API
WebMock.enable!
url = "https://example.com/mcp"
stub_request(:post, url)
.with { |req| JSON.parse(req.body)["method"] == "initialize" }
.to_return(
status: 200,
headers: { "Content-Type" => "application/json" },
body: { jsonrpc: "2.0", id: "1", result: { protocolVersion: "2025-11-25", capabilities: {}, serverInfo: { name: "s", version: "1" } } }.to_json,
)
stub_request(:post, url)
.with { |req| JSON.parse(req.body)["method"] == "notifications/initialized" }
.to_return(status: 200, body: "")
MCP::Client.new(transport: MCP::Client::HTTP.new(url: url)).connect(mode: :legacy)
# => MCP::Client::RequestHandlerError: Unsupported Content-Type: nil. ...
Fix: #599. It returns nil instead of raising in that branch when the message is a notification and the status is 2xx, matching the behaviour above.
- Langage dominant
- Ruby
- Étoiles
- 924
- Forks
- 136
- Merge moyen
- 1 j 6 h
- PR mergées (30 j)
- 38
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de modelcontextprotocol/ruby-sdk
-
Empty members in the Accept header cause a 500Peut-être pris @koic l’a pris il y a 1 jour. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
modelcontextprotocol/ruby-sdk#609 ·
Les mainteneurs répondent en général sous 1 jour
-
Error responses carry "id": null, which the MCP schema does not allowPeut-être pris @koic l’a pris il y a 1 jour. Ouvertebug
Difficulté 3/5 Une demi-journée Accessibilité débutants 45/100
modelcontextprotocol/ruby-sdk#606 ·
Les mainteneurs répondent en général sous 1 jour
-
String request ids are limited to letters, digits, "_" and "-"Peut-être pris @koic l’a pris il y a 2 jours. Ouvertebug
modelcontextprotocol/ruby-sdk#603 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Methods of undeclared capabilities return -32603 instead of -32601Peut-être pris @koic l’a pris il y a 2 jours. Ouvertebug
modelcontextprotocol/ruby-sdk#602 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Requests with "id": null are run like notificationsPeut-être pris @koic l’a pris il y a 2 jours. Ouvertebug
modelcontextprotocol/ruby-sdk#601 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de modelcontextprotocol/ruby-sdk
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
-
:bank: debt
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
cucumber/cucumber-ruby-core#346 · 1 commentaire ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 75/100
TheOdinProject/curriculum#31467 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
message-patterns
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
sisimai/rb-sisimai#468 ·