Repository navigation
test(e2e): MCP is sessionless; don't expect Mcp-Session-Id - #900
Merged
Merged
Conversation
go-sdk v1.8.0 (shipped in 2.4.5) stopped issuing Mcp-Session-Id from a stateless server, per SEP-2567. Authorizer runs /mcp stateless on purpose (internal/mcp/server.go), and session IDs are optional for servers, so this is not a client-facing regression: mcp.spec.ts already calls tools/list with no session ID. dcr.spec.ts asserted the old SDK detail and has failed since 2.4.5; e2e-playground does not run in CI, so nothing caught it. The test now asserts the sessionless contract instead: initialize returns no session ID, tools/list works without one, and a stale ID from an older server is ignored rather than rejected.
Adds two subtests to TestHandlerIsStateless: initialize issues no Mcp-Session-Id, and DELETE is refused with 405 + Allow. Both fail on go-sdk v1.6.1 and pass on v1.8.0, so the behaviour change behind the stale e2e assertion is now caught by the Go suite, which runs in CI.
Merged
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.
What failed
e2e-playground/tests/dcr.spec.ts› "a self-registered client is consented to, then reaches the MCP surface" has failed since 2.4.5:mcp-session-idis undefined afterinitialize. It fails identically on unmodifiedmain(c6b0ca31, the 2.4.5 release).e2e-playgrounddoesn't run in CI, so nothing caught it.Cause: an intended SDK change, not a server bug
2.4.5 moved
github.com/modelcontextprotocol/go-sdkfrom v1.6.1 to v1.8.0. Authorizer serves/mcpwithStreamableHTTPOptions{Stateless: true, JSONResponse: true}on purpose (internal/mcp/server.go): no sticky sessions, so replicas scale horizontally. v1.8.0 changed what stateless mode does:Session IDs are optional for MCP servers, so spec-conformant clients send none when none is issued.
mcp.spec.tsalready callstools/listwithout one and passes. So no client is affected; only this test, which asserted the old SDK behaviour, broke.Not done: restoring the old behaviour with
MCPGODEBUG=allowsessionsinstateless=1. The SDK removes that option in 1.9.0, and a session ID from a stateless server means nothing anyway.Change
dcr.spec.tsnow asserts the sessionless contract instead of the SDK detail:initializereturns noMcp-Session-Id. This pins the stateless design: if one ever appears, sessions were enabled and replicas would need affinity.tools/listworks without a session ID.The Go side already covers the stale-ID case (
internal/mcp/transport_test.gosends an ID "issued-by-some-other-replica").Release note for 2.4.6
Verification
e2e-playground, built from this branch:npx playwright test tests/dcr.spec.ts tests/mcp.spec.ts→ 10 passed. Previously the DCR test above failed onmain.