Handle 202 Accepted response in HTTP client
Per the Streamable HTTP spec, a server returns 202 Accepted with no body as the ACK for a JSON-RPC notification or response. The client previously errored on 202 because it fell through Content-Type dispatch. Short-circuit to return nil before Content-Type handling so fire-and-forget messages (e.g. notifications/initialized) no longer raise. https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#sending-messages-to-the-server Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
5c0fee309f
commit
cfc42dbfe7
1 changed files with 20 additions and 1 deletions
|
|
@ -171,7 +171,7 @@ puts <<~MESSAGE
|
|||
curl -i http://localhost:9393 -H "Mcp-Session-Id: YOUR_SESSION_ID" \\
|
||||
--json '{"jsonrpc":"2.0","method":"tools/call","id":3,"params":{"name":"notification_tool","arguments":{"message":"Hello SSE!", "delay": 2}}}'
|
||||
|
||||
Note: When an SSE stream is active, tool responses will appear in the SSE stream and the POST request will return {"accepted": true}
|
||||
Note: When an SSE stream is active, tool responses will appear in the SSE stream and the POST request will return 202 Accepted with no body.
|
||||
|
||||
Press Ctrl+C to stop the server
|
||||
MESSAGE
|
||||
|
|
|
|||
Loading…
Reference in a new issue