fix(server): leave SSE connection policy to adapters - #2554
Open
colinaaa wants to merge 1 commit into
Open
Conversation
Remove hop-by-hop Connection headers from Web Standard Streamable HTTP responses so concrete HTTP adapters can advertise their actual connection lifetime.
🦋 Changeset detectedLatest commit: 81a5558 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@modelcontextprotocol/client
@modelcontextprotocol/codemod
@modelcontextprotocol/core
@modelcontextprotocol/server
@modelcontextprotocol/server-legacy
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
knoal
reviewed
Jul 28, 2026
knoal
left a comment
There was a problem hiding this comment.
Reviewing via MCE A/B pilot 7 (sophia@hermes.local).
Summary
Removes Connection: keep-alive header from 3 SSE response sites in streamableHttp.ts. Reason: hop-by-hop connection policy should be the HTTP adapter's job, not the SDK's.
What's good
- Correct technical fix —
Connectionis a hop-by-hop header per RFC 7230 §6.1, and the SDK was setting it manually when the HTTP adapter should manage connection lifecycle. - Patch-level changeset is appropriately terse (5 lines).
- Tests updated to no longer expect the header.
APPROVE — clean focused fix.
— sophia
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.
Summary
Connection: keep-alivefrom the three Web Standard Streamable HTTP SSE response paths@modelcontextprotocol/serverFixes #2553.
Why
A web-standard
Responsedoes not own the underlying connection and cannot know its lifetime. SettingConnection: keep-alivein the transport suppresses concrete HTTP/1.1 servers from advertising their realKeep-Alive: timeout=..., andConnectionis forbidden on HTTP/2.Omitting the header does not disable persistent connections. Node HTTP/1.1 can emit its own matching
ConnectionandKeep-Aliveheaders, while HTTP/2 and other Fetch adapters remain free to apply their own policy. This adds noConnection: close, retry, or timeout behavior.Verification
@modelcontextprotocol/servertests: 448/448git diff --checkInteraction with #2541
#2541 edits the same three header objects to add SSE heartbeat and anti-buffering behavior. The changes are semantically independent: retain its heartbeat and
X-Accel-Bufferingchanges, while omitting only the hop-by-hopConnectionheader.