| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
The streamable HTTP GET stream only committed the response with the first event written to it, so clients waiting for the status line and SSE headers timed out (e.g. undici's default 300s headersTimeout) when the server had nothing to send yet. Commit the response buffer right after the async stream opens, so a 200 with text/event-stream headers is sent immediately. Fixes modelcontextprotocol#1155
| Back | FazBrowse Home | New Git URL |
Fixes #1155
What
HttpServletStreamableServerTransportProvider.doGet now commits the response buffer (response.flushBuffer()) right after opening the async stream, before any event is written. Previously the status line and the SSE headers were only sent together with the first event on the stream.
Why
Clients that open the GET stream and wait for the response headers hang until the server has something to send. With nothing arriving, undici (Node's fetch) aborts after its default 300s headersTimeout (UND_ERR_HEADERS_TIMEOUT), mcp-remote gives up reconnecting, and any server-initiated request then fails with Stream unavailable for session. Flushing right after the stream opens sends 200 + Content-Type: text/event-stream immediately, as expected in the issue.
How I checked