You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cff927f
Browse filesBrowse the repository at this point in the historyBrowse files
fix(client): skip the SSE fallback when the server/discover probe is rejected
A server predating SEP-2575 rejects the session-less server/discover POST at the
HTTP layer with 400 (cannot parse the request) or 404 (requires Mcp-Session-Id on
every non-initialize POST). AutoDetectingClientSessionTransport treated that like
any other non-JSON-RPC error and attempted the SSE fallback, but those two statuses
say nothing about which transport the peer speaks -- an SSE-only server rejects the
probe exactly the same way.
McpClientImpl.ConnectAsync already reads 400/404 from the probe as 'this server
requires the initialize handshake' and retries with initialize on the same transport,
and that retry still falls back to SSE. So the SSE GET spent during the probe is
always discarded: a Streamable-HTTP-only server that predates SEP-2575 pays a wasted
round trip on every connect and logs 'falling back to SSE transport' for settled
protocol negotiation, while an SSE-only server is reached one POST later either way.
Scoped to the discover probe and to the two statuses ConnectAsync acts on, so every
other failure keeps the existing fallback.
@@ -181,6 +208,9 @@ public async ValueTask DisposeAsync()
181
208
[LoggerMessage(Level=LogLevel.Information,Message="{EndpointName} streamable HTTP transport failed with status code {StatusCode}, falling back to SSE transport.")]
[LoggerMessage(Level=LogLevel.Debug,Message="{EndpointName} server/discover probe rejected with status code {StatusCode}; skipping the SSE fallback so the initialize handshake is attempted instead.")]
0 commit comments