fix(transport): fall back after JSON discover rejections - #1288
Open
alexhancock wants to merge 1 commit into
Open
alexhancock wants to merge 1 commit into
alexhancock wants to merge 1 commit into
Conversation
jamadeo
reviewed
Sep 21, 2026
| .text() | ||
| .await | ||
| .unwrap_or_else(|_| "<failed to read response body>".to_owned()); | ||
| // A 4xx rejection of `server/discover` is a legacy-server signal even when |
Contributor
There was a problem hiding this comment.
I don't think this is quite in agreement with https://modelcontextprotocol.io/specification/2026-07-28/basic/versioning#backward-compatibility-with-initialization-based-versions :
a recognized modern JSON-RPC error (such as UnsupportedProtocolVersionError) identifies a modern server: the client retries with a supported version rather than falling back. Anything else identifies a legacy server.
so I think this fixes the generic uncorrelated error case, but may treat recognized modern errors as legacy servers. We need to check the body here too to see if it parses
Check the discover fallback before the JSON-RPC error branch, or middleware rejections with an uncorrelated id abort the handshake instead of falling back to legacy `initialize`.
alexhancock
force-pushed
the
alexhancock/fix-discover-4xx-json-fallback
branch
from
September 21, 2026 20:38
83ea96b to
04b4738
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Check the discover fallback before the JSON-RPC error branch, or middleware rejections with an uncorrelated id abort the handshake instead of falling back to legacy
initialize.How Has This Been Tested?
Unit tests, and tested in a client app (goose)
Breaking Changes
N/A
Types of changes
Checklist
Additional context
Related goose issue aaif-goose/goose#12257