@@ -136,37 +136,38 @@ def call(message:, delay: 0)
136136end
137137
138138# Print usage instructions
139- puts "=== MCP Streaming HTTP Test Server ==="
140- puts ""
141- puts "Starting server on http://localhost:9393"
142- puts ""
143- puts "Available Tools:"
144- puts "1. NotificationTool - Returns messages that are sent via SSE when stream is active"
145- puts "2. echo - Simple echo tool"
146- puts ""
147- puts "Testing SSE:"
148- puts ""
149- puts "1. Initialize session:"
150- puts " curl -i http://localhost:9393 \\ "
151- puts ' --json \'{"jsonrpc":"2.0","method":"initialize","id":1,"params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"sse-test","version":"1.0"}}}\''
152- puts ""
153- puts "2. Connect SSE stream (use the session ID from step 1):"
154- puts ' curl -i -N -H "Mcp-Session-Id: YOUR_SESSION_ID" http://localhost:9393'
155- puts ""
156- puts "3. In another terminal, test tools (responses will be sent via SSE if stream is active):"
157- puts ""
158- puts " Echo tool:"
159- puts ' curl -i http://localhost:9393 -H "Mcp-Session-Id: YOUR_SESSION_ID" \\'
160- puts ' --json \'{"jsonrpc":"2.0","method":"tools/call","id":2,"params":{"name":"echo","arguments":{"message":"Hello SSE!"}}}\''
161- puts ""
162- puts " Notification tool (with 2 second delay):"
163- puts ' curl -i http://localhost:9393 -H "Mcp-Session-Id: YOUR_SESSION_ID" \\'
164- puts ' --json \'{"jsonrpc":"2.0","method":"tools/call","id":3,"params":{"name":"notification_tool","arguments":{"message":"Hello SSE!", "delay": 2}}}\''
165- puts ""
166- puts "Note: When an SSE stream is active, tool responses will appear in the SSE stream and the POST request will return {\" accepted\" : true}"
167- puts ""
168- puts "Press Ctrl+C to stop the server"
169- puts ""
139+ puts <<~MESSAGE
140+ === MCP Streaming HTTP Test Server ===
141+
142+ Starting server on http://localhost:9393
143+
144+ Available Tools:
145+ 1. NotificationTool - Returns messages that are sent via SSE when stream is active"
146+ 2. echo - Simple echo tool
147+
148+ Testing SSE:
149+
150+ 1. Initialize session:
151+ curl -i http://localhost:9393 \\
152+ --json '{"jsonrpc":"2.0","method":"initialize","id":1,"params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"sse-test","version":"1.0"}}}'
153+
154+ 2. Connect SSE stream (use the session ID from step 1):"
155+ curl -i -N -H "Mcp-Session-Id: YOUR_SESSION_ID" http://localhost:9393
156+
157+ 3. In another terminal, test tools (responses will be sent via SSE if stream is active):
158+
159+ Echo tool:
160+ curl -i http://localhost:9393 -H "Mcp-Session-Id: YOUR_SESSION_ID" \\
161+ --json '{"jsonrpc":"2.0","method":"tools/call","id":2,"params":{"name":"echo","arguments":{"message":"Hello SSE!"}}}'
162+
163+ Notification tool (with 2 second delay):
164+ curl -i http://localhost:9393 -H "Mcp-Session-Id: YOUR_SESSION_ID" \\
165+ --json '{"jsonrpc":"2.0","method":"tools/call","id":3,"params":{"name":"notification_tool","arguments":{"message":"Hello SSE!", "delay": 2}}}'
166+
167+ Note: When an SSE stream is active, tool responses will appear in the SSE stream and the POST request will return {"accepted": true}
168+
169+ Press Ctrl+C to stop the server
170+ MESSAGE
170171
171172# Start the server
172173Rackup ::Handler . get ( "puma" ) . run ( rack_app , Port : 9393 , Host : "localhost" )
0 commit comments