Skip to content

mcp: ignore Mcp-Session-Id on 2026-07-28 sessions - #1222

Open
arpankernel wants to merge 2 commits into
modelcontextprotocol:mainfrom
arpankernel:fix/no-session-id-modern
Open

mcp: ignore Mcp-Session-Id on 2026-07-28 sessions#1222
arpankernel wants to merge 2 commits into
modelcontextprotocol:mainfrom
arpankernel:fix/no-session-id-modern

Conversation

@arpankernel

Copy link
Copy Markdown

2026-07-28 removed protocol-level sessions (SEP-2567), so the client must not echo an Mcp-Session-Id even if a non-compliant server sends one. Drop the session ID once the negotiated version is known to be modern, so it is not sent on later requests or used for a DELETE on close.

Added a regression test covering a modern session where the server sends a session ID; the client must not echo it on later requests.

Closes #1028

2026-07-28 removed protocol-level sessions (SEP-2567), so a client must
not echo an Mcp-Session-Id even if a non-compliant server sends one. Drop
the session ID once the negotiated version is known to be modern, so it
is not sent on later requests or used to terminate the session on close.
Comment thread mcp/streamable.go Outdated
Comment on lines +2153 to +2159
// Protocol-level sessions were removed in 2026-07-28 (SEP-2567): a client
// must not echo an Mcp-Session-Id, so drop one that the initial response
// adopted before the negotiated version was known.
if state.InitializeResult != nil &&
state.InitializeResult.ProtocolVersion >= protocolVersion20260728 {
c.sessionID = ""
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a duplicate of the lines below

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good catch. Consolidated it so the version check is computed once and reused for both the session-id reset and the standalone-SSE branch.

@arpankernel
arpankernel force-pushed the fix/no-session-id-modern branch from 4be6401 to e2fdc54 Compare September 1, 2026 17:06
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.

(possible) 2026-07-28 spec violation: mcp-session-id used in client requests with 2026-07-28

2 participants