fix(server): serve draft-version requests statelessly per SEP-2567#999
Merged
Conversation
DaleSeo
reviewed
Jul 17, 2026
alexhancock
force-pushed
the
alexhancock/sep-2567
branch
from
July 17, 2026 17:56
78e4e11 to
d27b509
Compare
DaleSeo
reviewed
Jul 17, 2026
| pub sse_retry: Option<Duration>, | ||
| /// If true, the server will create a session for each request and keep it alive. | ||
| /// When enabled, SSE priming events are sent to enable client reconnection. | ||
| pub stateful_mode: bool, |
Member
There was a problem hiding this comment.
Since this is a breaking change, the commit message should contains ! to pass CI like refactor!: rename stateful_mode to legacy_session_mode.
5 tasks
alexhancock
force-pushed
the
alexhancock/sep-2567
branch
from
July 20, 2026 17:33
80e9e93 to
754929b
Compare
9 tasks
alexhancock
force-pushed
the
alexhancock/sep-2567
branch
from
July 20, 2026 17:44
754929b to
d6eb140
Compare
DaleSeo
approved these changes
Jul 20, 2026
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
Per modelcontextprotocol/modelcontextprotocol#2567 protocol-level sessions (and the
Mcp-Session-Idheader) are removed from the Streamable HTTP transport as of the draft protocol version (2026-07-28); servers speaking that version MUST serve requests statelessly.The rust-sdk server assigned an
Mcp-Session-Idin its defaultstateful_modeeven when the negotiated protocol version was2026-07-28. This gates the session code path on the negotiated version: sessions are used only for pre-draft versions (< 2026-07-28), and draft-version requests are served statelessly even instateful_mode. Older versions retain full session behavior.How Has This Been Tested?
No dedicated SEP-2567 conformance scenario exists (the conformance PR that would add one was closed unmerged); per the maintainer, every existing draft (
2026-07-28) scenario already sends sessionless requests. Verified against the existing draft server suite:The default (stateful) server now produces results byte-for-byte identical to an explicit stateless server (48 passed / 31 failed; the 31 remaining failures are pre-existing SEP-2575
server/discovergaps, out of scope).rmcplib unit tests (232) and streamable-HTTP integration tests (session store, stale session, protocol version, JSON response — 19) pass locally.Breaking Changes
None. The session code path is unchanged for all pre-
2026-07-28versions; only the draft version changes behavior, bringing it into spec compliance.Types of changes
Checklist
Additional context
SEP-2575 (also in progress) removes the
initializehandshake for the draft version. Once that lands, the version detection here can be simplified to a lifecycle check (aninitializerequest implies the pre-draft/stateful lifecycle; draft requests never carryinitialize).