Skip to content

Flush headers for idle Streamable HTTP GET requests - #1159

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

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

Conversation

@karthiksenv

@karthiksenv karthiksenv commented Oct 3, 2026 •

Copy link
Copy Markdown

An idle Streamable HTTP GET 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 times out without the flush and passes with it.

Fixes #1155.

Updated against upstream 54e8b612. The merge resolves an import collision by retaining both the regression's TimeUnit import and upstream's AtomicBoolean import. The production change remains one line and preserves upstream's listening-stream lifecycle registration.

Validation on Windows, Java 17.0.19, embedded Tomcat 11.0.27:

  • mvnw.cmd -pl mcp-test -am -Dtest=HttpServletStreamableIntegrationTests -Dsurefire.failIfNoSpecifiedTests=false test: 62 tests passed, no failures, errors, or skips. Maven also passed formatting validation and compiled the affected reactor modules.
  • Removing only the production flush against current upstream reproduces a TimeoutException in getStreamSendsHeadersBeforeFirstEvent (one test, one expected error).
  • Restoring the flush makes the same isolated regression pass again (one test, no failures/errors/skips).
  • git diff --check passed.

The full repository suite was not rerun for this merge. Earlier broader validation ran 823 mcp-test cases with 13 errors, including unavailable Docker/dependent initialization errors and a stdio timeout; it was not fully green. The reporter's exact JDK/Tomcat versions were not recreated.

This is an AI-assisted contribution. The existing repository-policy disclosure remains in disclosure.txt.

@karthiksenv

Copy link
Copy Markdown
Author

@Kehrlann, could you review the intended idle Streamable HTTP header-flush behavior or route it to the servlet transport reviewer? The PR documents its regression test and broader-suite limitations. It currently has conflicts that need resolution and a fresh test run before merge.

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