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:
Ankur
2026-11-22 02:18:48 +05:30
co-authored by Claude Sonnet 5.5
parent 3aa20a1dce
commit 26e0a3875a
34 changed files with 1922 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
# One URL, two server generations, split on the MCP-Protocol-Version header
# Rule: MCP-Protocol-Version >= 2026-07-28 goes to the modern pool (M1, M2). Everything else goes to the legacy pool (L1).
# A 2025-era client: initialize, initialized, tools/call.
## 1. initialize carries no MCP-Protocol-Version header
> POST router/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."}}
## 2. tools/call with the session and MCP-Protocol-Version: 2025-11-25
> POST router/mcp
> MCP-Protocol-Version: 2025-11-25
> Mcp-Session-Id: <session-id>
> {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"order_status","arguments":{"orderId":"A-101"}}}
< 200
< Content-Type: text/event-stream
< X-Served-By: L1
< id:<session-id>
< event:message
< data: {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"order A-101 is SHIPPED (answered by instance L1)"}],"isError":false}}
# A 2026-07-28 client through the same URL: four tools/call, nothing else.
modern call 1 -> M1: 200 order A-101 is SHIPPED (answered by instance M1)
modern call 2 -> M2: 200 order A-101 is SHIPPED (answered by instance M2)
modern call 3 -> M1: 200 order A-101 is SHIPPED (answered by instance M1)
modern call 4 -> M2: 200 order A-101 is SHIPPED (answered by instance M2)