Skip to content

Commit eb801cc

Browse files
atesgoralclaude
andcommitted
Address PR review feedback from Koichi
- Move event_stream_parser from Gemfile to gemspec as runtime dependency - Add brief descriptions to TODO comments in client/http.rb and streamable_http_transport.rb - Add description to spec URL comment in client.rb - Use SESSION_ID_HEADER constant for session ID header lookup in connect Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3f4576d commit eb801cc

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ gem "rubocop-minitest", require: false
1010
gem "rubocop-rake", require: false
1111
gem "rubocop-shopify", ">= 2.18", require: false if RUBY_VERSION >= "3.1"
1212

13-
gem "event_stream_parser", ">= 1.0"
1413
gem "puma", ">= 5.0.0"
1514
gem "rack-cors"
1615
gem "rackup", ">= 2.1.0"

lib/mcp/client.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
module MCP
88
class Client
9-
# https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#streamable-http
9+
# Protocol version and header constants for Streamable HTTP transport.
10+
# See: https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#streamable-http
1011
LATEST_PROTOCOL_VERSION = "2025-11-25"
1112
SESSION_ID_HEADER = "Mcp-Session-Id"
1213
PROTOCOL_VERSION_HEADER = "MCP-Protocol-Version"
@@ -86,8 +87,8 @@ def connect(client_info:, protocol_version: LATEST_PROTOCOL_VERSION, capabilitie
8687

8788
response = transport.post(body: request_body)
8889

89-
# Faraday normalizes headers to lowercase
90-
@session_id = response.headers["mcp-session-id"]
90+
# Faraday normalizes header names to lowercase
91+
@session_id = response.headers[SESSION_ID_HEADER.downcase]
9192
@protocol_version = response.body.dig("result", "protocolVersion") || protocol_version
9293

9394
response.body

lib/mcp/client/http.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
module MCP
44
class Client
5-
# TODO: https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#listening-for-messages-from-the-server
6-
# TODO: https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#resumability-and-redelivery
5+
# TODO: HTTP GET for SSE streaming is not yet implemented.
6+
# See: https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#listening-for-messages-from-the-server
7+
# TODO: Resumability and redelivery with Last-Event-ID is not yet implemented.
8+
# See: https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#resumability-and-redelivery
79

810
class HTTP
911
ACCEPT_HEADER = "application/json, text/event-stream"

lib/mcp/server/transports/streamable_http_transport.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
module MCP
77
class Server
88
module Transports
9-
# TODO: https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#resumability-and-redelivery
9+
# TODO: Resumability and redelivery with Last-Event-ID is not yet implemented.
10+
# See: https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#resumability-and-redelivery
1011

1112
class StreamableHTTPTransport < Transport
1213
def initialize(server, stateless: false, session_idle_timeout: nil)

mcp.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ Gem::Specification.new do |spec|
3131
spec.require_paths = ["lib"]
3232

3333
spec.add_dependency("json-schema", ">= 4.1")
34+
spec.add_dependency("event_stream_parser", ">= 1.0")
3435
end

0 commit comments

Comments
 (0)