fix: connectStandaloneSSE checking Content-Type header#736
Merged
findleyr merged 3 commits intomodelcontextprotocol:mainfrom Jan 4, 2026
Merged
fix: connectStandaloneSSE checking Content-Type header#736findleyr merged 3 commits intomodelcontextprotocol:mainfrom
findleyr merged 3 commits intomodelcontextprotocol:mainfrom
Conversation
Contributor
|
Thanks for this CL. We're on break now, but I'll review next week. |
findleyr
reviewed
Dec 29, 2025
findleyr
reviewed
Dec 31, 2025
Contributor
findleyr
left a comment
There was a problem hiding this comment.
Thanks for adding the test! One more minor comment.
mcp/streamable.go
Outdated
| // | ||
| // [§2.2.3]: https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#listening-for-messages-from-the-server | ||
| if resp.StatusCode == http.StatusMethodNotAllowed { | ||
| if resp.StatusCode == http.StatusMethodNotAllowed || resp.Header.Get("Content-Type") != "text/event-stream" { |
Contributor
There was a problem hiding this comment.
Sorry for not catching this before: I think this is a non-conformant server implementation, so we should at the very least log.
Let's pull this out into a separate if block, and similar to the block on line 1558 below, we should log a warning.
findleyr
approved these changes
Dec 31, 2025
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.
Issue encountered: the MCP server request was unexpectedly redirected to an HTML page. Because the client didn’t validate the response Content-Type, it still entered handleSSE, which then kept treating the HTML as an SSE stream and repeatedly re-requesting the same page—creating an infinite request loop.