Skip to content

mcp: return json-rpc error on stateful server serving protocolVersion20260728 requests - #1143

Merged
guglielmo-san merged 2 commits into
mainfrom
guglielmoc/fix_error_on_stateful_server
Aug 5, 2026
Merged

guglielmo-san merged 2 commits into
mainfrom
guglielmoc/fix_error_on_stateful_server

Conversation

@guglielmo-san

Copy link
Copy Markdown
Contributor

Fixes #1130

…MCPGODEBUG flag to restore legacy plain-text rejection
@guglielmo-san
guglielmo-san merged commit 6b1518c into main Aug 5, 2026
10 checks passed
@guglielmo-san
guglielmo-san deleted the guglielmoc/fix_error_on_stateful_server branch August 5, 2026 10:16
blakebauman added a commit to fold-run/fold that referenced this pull request Aug 26, 2026
fold serves the handshake era. The 2026-07-28 era is unreachable through
it, because the SDK's streamable handler serves that revision only on
stateless HTTP servers and fold runs stateful for session-keyed
bridging. That was recorded for subscriptions/listen and pinned from the
client side by listen_test.go — that a default-options SDK client falls
back. A client is free not to be the SDK, so era_test.go pins the server
side too: a raw request declaring the era, by header or by per-request
_meta, must be refused rather than served.

It deliberately does not pin how it is refused. v1.7.0 answers an HTTP
400 and the SDK's main branch returns a JSON-RPC error instead
(modelcontextprotocol/go-sdk#1143), and a canary asserting the status
would have failed on that bump for a reason nobody cares about — which
is how a canary gets deleted rather than read. Being served is the
drift; the shape of the refusal is not.

Writing the canary corrected the premise it was built on. The claim it
started from was that the era was already reachable via per-request
_meta and that several gaps were therefore live. Testing it says
otherwise: the transport refuses before fold's router sees anything, so
those gaps are latent, and their ordering behind this canary is
deliberate rather than neglectful.

Roadmap item 13 plans to govern server-initiated requests, and this
revision removed that mechanism — a server "MUST send server-to-client
requests ... using the MRTR pattern. The previous pattern of
server-initiated requests is no longer supported." The governance
surface survives and its call site moves: an upstream now returns an
input-required result rather than asking, so what the item governs is an
inspection of inputRequests in a relayed result, not a handler on a
bridged session, and the per-request handler check its design record
argues for as the boundary has no meaning there. The bridged-session
apparatus is recorded as what it is — a legacy-era compatibility layer,
valuable for as long as handshake clients exist, and not the shape of
what replaces it.

README "Not implemented" gains what the era changes and fold has not:
no advertised extensions, tasks/list and tasks/result federated though
the redesigned extension removed them, resources/subscribe advertised
and logging/setLevel handled though the revision retired both, and
relayed results carrying no resultType of their own. Plus a separate
entry for upstream ttlMs and cacheScope going unhonoured, which is
structural — the SDK's paginating iterators consume the envelope those
hints ride on, and state.ListCache.GetOrFill takes its TTL before the
fill that would produce one.

And the roadmap gains a deprecation table it never had. Sampling, roots,
logging, and RFC 7591 dynamic client registration all carry an earliest
removal of the first revision on or after 2027-07-28. The last row cuts
against a plan rather than an implementation: Horizon 3 holds DCR as
demand-gated, and building it now would be adopting something new
implementations are told not to adopt.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ClientSession.Ping cannot succeed on a 2026-07-28 session (omits SEP-2575 _meta; stateless path fails session-not-found; failure poisons the connection)

2 participants