Repository navigation
Conversation
… upgrade
mcpStreamableHttp serves GET through Ktor's sse {}, which sends 200 and
the event-stream headers before its handler runs. The Accept and
MCP-Protocol-Version checks in StreamableHttpServerTransport's GET
handling ran inside that handler, so a GET without text/event-stream in
Accept, or with an unsupported protocol version, got 200 and an empty
stream instead of 406 or 400.
The route's GET guard, which already rejects a missing or unknown
session before sse {}, now runs both checks too, in the transport's
order: Accept, then session, then protocol version. It reuses the
transport's own checks rather than copying them; the transport keeps
them for callers that route GETs to handleRequest themselves.
Verified with two new StreamableHttpResponseDeliveryTest cases that fail
on main with 200 and pass with the fix, and fail again when the guard
change alone is reverted. kotlin-sdk-server jvmTest (202 tests),
ktlintCheck, detekt and checkKotlinAbi pass.
With modelcontextprotocol#1032 covering the missing and unknown session rows, this handles
all four cases in the issue.
Closes modelcontextprotocol#1036
This branch has not been deployed
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.
GETgoes throughsse {}, which sends200before its handler runs, so theAccept(406) andMCP-Protocol-Version(400) checks came too late. TheGETguard from #1032 now runs both before the upgrade, reusing the transport's checks. With #1032 this covers all four cases in the issue.closes #1036
How Has This Been Tested?
Two new
StreamableHttpResponseDeliveryTestcases fail onmainwith200and pass with the fix. ServerjvmTest, ktlint, detekt andcheckKotlinAbipass, and so do Build and Conformance on my fork.Breaking Changes
None.
Types of changes
Checklist
I used Claude Code to write and test this.