You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parse SSE responses in HTTP client via event_stream_parser
The Streamable HTTP spec allows servers to respond with either
`application/json` or `text/event-stream`. The client previously
rejected the latter. Add SSE parsing via the optional
`event_stream_parser` gem (users add it to their Gemfile when their
server uses SSE), dispatch on the response Content-Type, and scan the
event stream for the first JSON-RPC response message.
Document the new optional dependency in both the README's HTTP
Transport Layer section and docs/building-clients.md.
No other Streamable HTTP features (202 handling, session IDs,
`connect`, DELETE termination) are included here; those will land in
follow-up PRs.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1599,11 +1599,12 @@ The stdio transport automatically handles:
1599
1599
1600
1600
Use the `MCP::Client::HTTP` transport to interact with MCP servers using simple HTTP requests.
1601
1601
1602
-
You'll need to add `faraday` as a dependency in order to use the HTTP transport layer:
1602
+
You'll need to add `faraday` as a dependency in order to use the HTTP transport layer. Add `event_stream_parser` as well if the server uses SSE (`text/event-stream`) responses:
1603
1603
1604
1604
```ruby
1605
1605
gem 'mcp'
1606
1606
gem 'faraday', '>= 2.0'
1607
+
gem 'event_stream_parser', '>= 1.0'# optional, required only for SSE responses
Copy file name to clipboardExpand all lines: docs/building-clients.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,11 +51,12 @@ stdio_transport.close
51
51
52
52
## HTTP Transport
53
53
54
-
Use `MCP::Client::HTTP` to interact with MCP servers over HTTP. Requires the `faraday` gem:
54
+
Use `MCP::Client::HTTP` to interact with MCP servers over HTTP. Requires the `faraday` gem, plus `event_stream_parser` if the server uses SSE (`text/event-stream`) responses:
55
55
56
56
```ruby
57
57
gem 'mcp'
58
58
gem 'faraday', '>= 2.0'
59
+
gem 'event_stream_parser', '>= 1.0'# optional, required only for SSE responses
0 commit comments