Add mcp-stateless module: migrate an MCP server from the 2025 stateful protocol to 2026-07-28 on Spring AI 2.1.0
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4tJPXfq5UyiLSFr49
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
3aa20a1dce
commit
26e0a3875a
@@ -0,0 +1,55 @@
|
||||
# Two 2025-era instances behind a balancer: round-robin, then session affinity, then an instance dies
|
||||
# PART A: plain round-robin. Request n goes to L1 when n is even and to L2 when n is odd.
|
||||
|
||||
## A1. initialize
|
||||
> POST balancer/mcp
|
||||
> {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"wire-test","version":"1"}}}
|
||||
< 200
|
||||
< Mcp-Session-Id: <session-id>
|
||||
< Content-Type: application/json
|
||||
< X-Served-By: L1
|
||||
< {"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","capabilities":{"completions":{},"logging":{},"prompts":{"listChanged":true},"resources":{"subscribe":false,"listChanged":true},"tools":{"listChanged":true}},"serverInfo":{"name":"orders","version":"1.0.0"},"instructions":"Order lookup server used to compare the 2025 and 2026-07-28 MCP protocol generations."}}
|
||||
|
||||
## A2. notifications/initialized
|
||||
> POST balancer/mcp
|
||||
> MCP-Protocol-Version: 2025-11-25
|
||||
> Mcp-Session-Id: <session-id>
|
||||
> {"jsonrpc":"2.0","method":"notifications/initialized"}
|
||||
< 404
|
||||
< Content-Type: application/json
|
||||
< X-Served-By: L2
|
||||
< {"jsonRpcError":{"code":-32603,"message":"Session not found: <session-id>"}}
|
||||
|
||||
# Six tools/call with the same session id, through the same balancer:
|
||||
call 1 -> L1: 200 OK
|
||||
call 2 -> L2: 404 Session not found: <session-id>
|
||||
call 3 -> L1: 200 OK
|
||||
call 4 -> L2: 404 Session not found: <session-id>
|
||||
call 5 -> L1: 200 OK
|
||||
call 6 -> L2: 404 Session not found: <session-id>
|
||||
succeeded: 3 of 6
|
||||
|
||||
# PART B: the balancer learns Mcp-Session-Id from the initialize response and pins the session.
|
||||
initialize served by L1, then 6 calls pinned to the same instance
|
||||
succeeded: 6 of 6
|
||||
|
||||
# PART C: the pinned instance L1 is stopped, as in a rolling deploy.
|
||||
|
||||
## C1. the same session after L1 is gone
|
||||
> POST balancer/mcp
|
||||
> MCP-Protocol-Version: 2025-11-25
|
||||
> Mcp-Session-Id: <session-id>
|
||||
> {"jsonrpc":"2.0","id":30,"method":"tools/call","params":{"name":"order_status","arguments":{"orderId":"A-101"}}}
|
||||
< 404
|
||||
< Content-Type: application/json
|
||||
< X-Served-By: L2
|
||||
< {"jsonRpcError":{"code":-32603,"message":"Session not found: <session-id>"}}
|
||||
|
||||
## C2. the client has to start over with initialize
|
||||
> POST balancer/mcp
|
||||
> {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"wire-test","version":"1"}}}
|
||||
< 200
|
||||
< Mcp-Session-Id: <session-id>
|
||||
< Content-Type: application/json
|
||||
< X-Served-By: L2
|
||||
< {"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","capabilities":{"completions":{},"logging":{},"prompts":{"listChanged":true},"resources":{"subscribe":false,"listChanged":true},"tools":{"listChanged":true}},"serverInfo":{"name":"orders","version":"1.0.0"},"instructions":"Order lookup server used to compare the 2025 and 2026-07-28 MCP protocol generations."}}
|
||||
Reference in New Issue
Block a user