Skip to content

Commit cccb749

Browse files
committed
Log headers in curl initialize requests
The user needs the `mcp-session-id` header, so we should log headers.
1 parent 7a2043b commit cccb749

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

examples/http_server.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def template(args, server_context:)
156156
puts "Starting MCP HTTP server on http://localhost:9292"
157157
puts "Use POST requests to initialize and send JSON-RPC commands"
158158
puts "Example initialization:"
159-
puts ' curl -X POST http://localhost:9292 -H "Content-Type: application/json" -d \'{"jsonrpc":"2.0","method":"initialize","id":1,"params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}\''
159+
puts ' curl -i -X POST http://localhost:9292 -H "Content-Type: application/json" -d \'{"jsonrpc":"2.0","method":"initialize","id":1,"params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}\''
160160
puts ""
161161
puts "The server will return a session ID in the Mcp-Session-Id header."
162162
puts "Use this session ID for subsequent requests."

examples/streamable_http_server.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def call(message:, delay: 0)
147147
puts "Testing SSE:"
148148
puts ""
149149
puts "1. Initialize session:"
150-
puts ' curl -X POST http://localhost:9393 -H "Content-Type: application/json" \\'
150+
puts ' curl -i -X POST http://localhost:9393 -H "Content-Type: application/json" \\'
151151
puts ' -d \'{"jsonrpc":"2.0","method":"initialize","id":1,"params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"sse-test","version":"1.0"}}}\''
152152
puts ""
153153
puts "2. Connect SSE stream (use the session ID from step 1):"

0 commit comments

Comments
 (0)