Skip to content

fix(streamable): emit explicit SSE event name for JSON-RPC responses#5657

Open
syf2211 wants to merge 2 commits into
stacklok:mainfrom
syf2211:fix/5655-streamable-sse-event-name
Open

fix(streamable): emit explicit SSE event name for JSON-RPC responses#5657
syf2211 wants to merge 2 commits into
stacklok:mainfrom
syf2211:fix/5655-streamable-sse-event-name

Conversation

@syf2211

@syf2211 syf2211 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

The streamable-http proxy now writes event: message before each JSON-RPC SSE data: line, matching reference MCP server transports and ToolHive's own SSE transport.

Motivation

Clients such as @ai-sdk/mcp only dispatch SSE frames where event === "message" and silently drop event-less frames. When stdio MCP servers are fronted by the streamable proxy, initialize hangs forever because the proxy emitted data:-only frames.

Fixes #5655

Changes

  • Add sseMessageEvent constant ("message") in streamable_proxy.go
  • Update both success and error SSE write paths in handleSingleRequestSSE to emit event: message\ndata: ...\n\n
  • Add TestSSEResponseIncludesEventName regression test covering POST initialize with Accept: text/event-stream

Tests

go test ./pkg/transport/proxy/streamable/... -count=1

All tests pass (including the new SSE event name test).

Notes

The streamable-http proxy wrote data:-only SSE frames, which breaks
clients like @ai-sdk/mcp that only dispatch event: message frames.
Match reference MCP server transports by including event: message on
both success and error SSE write paths.

Fixes stacklok#5655
@github-actions github-actions Bot added the size/XS Extra small PR: < 100 lines changed label Jun 26, 2026
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.35%. Comparing base (7c574e2) to head (383de73).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/transport/proxy/streamable/streamable_proxy.go 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5657      +/-   ##
==========================================
- Coverage   70.37%   70.35%   -0.02%     
==========================================
  Files         649      649              
  Lines       66170    66185      +15     
==========================================
- Hits        46568    46566       -2     
- Misses      16231    16265      +34     
+ Partials     3371     3354      -17     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot added size/XS Extra small PR: < 100 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

streamable-http proxy omits the SSE event name, breaking spec-lenient MCP clients

2 participants