-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Some HTTP adapters (e.g., @hono/node-server) buffer small SSE responses and automatically add a Content-Length header. When the SSE stream closes, this causes an HTTP/2 PROTOCOL_ERROR because HTTP/2 doesn't allow Content-Length with streaming responses.
Reproduction
- Use
WebStandardStreamableHTTPServerTransportwith@hono/node-serverover HTTP/2 - Perform an MCP operation that returns a small SSE response
- Observe
PROTOCOL_ERRORon stream close
Expected Behavior
SSE streams should work correctly over HTTP/2 without protocol errors.
Proposed Fix
Add Transfer-Encoding: chunked header to all SSE responses in WebStandardStreamableHTTPServerTransport. This prevents HTTP adapters from buffering and adding Content-Length.
Affected locations in packages/server/src/server/streamableHttp.ts:
handleGetRequestmethod (~line 450)replayEventsmethod (~line 507)handlePostRequestmethod (~line 757)
Additional Context
Reference: https://github.com/honojs/node-server/blob/main/src/listener.ts#L463-L491 (Hono's buffering logic)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working