Skip to content

Flush headers for idle Streamable HTTP GET requests - #1159

Open
karthiksenv wants to merge 2 commits into
modelcontextprotocol:mainfrom
karthiksenv:codex/fix-streamable-get-headers
Open

karthiksenv wants to merge 2 commits into
modelcontextprotocol:mainfrom
karthiksenv:codex/fix-streamable-get-headers

Conversation

@karthiksenv

Copy link
Copy Markdown

An idle Streamable HTTP GET currently sends neither status nor headers until the first SSE event, causing clients to time out when keep-alive is disabled. Flush the servlet response after registering the listening stream so clients receive HTTP 200 and Content-Type: text/event-stream immediately.

Adds an embedded-Tomcat regression test with keep-alive disabled. The test timed out before the fix and passes with it.

Fixes #1155.

Validation:

  • Regression test: passed after reproducing the failure before the fix.
  • HttpServletStreamableIntegrationTests: all 54 tests passed.
  • mvnw.cmd -pl mcp-core,mcp-test -am test: core and Jackson modules passed; mcp-test ran 823 tests with 13 errors, including unavailable Docker/dependent initialization errors and a stdio timeout. The broader suite is not fully green in this environment.
  • Tested with Java 17 and embedded Tomcat 11.0.2; the reporter's exact JDK/Tomcat versions were not reproduced.
  • Formatting validation and git diff --check passed.

This is an AI-assisted contribution. The required repository-policy disclosure is included in disclosure.txt.

This branch has not been deployed

No deployments
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.

HttpServletStreamableServerTransportProvider: GET stream sends no status or headers until the first event

1 participant