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,44 @@
|
||||
# 2025-era server (protocol STREAMABLE): the session lives in the server's memory
|
||||
# Error bodies are shown without the Java stack trace the SDK serialises into them.
|
||||
|
||||
## 1. tools/call with no session yet
|
||||
> POST /mcp
|
||||
> {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"order_status","arguments":{"orderId":"A-101"}}}
|
||||
< 400
|
||||
< Content-Type: application/json
|
||||
< {"jsonRpcError":{"code":-32601,"message":"Session ID missing"}}
|
||||
|
||||
## 2. initialize
|
||||
> POST /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
|
||||
< {"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."}}
|
||||
|
||||
## 3. notifications/initialized
|
||||
> POST /mcp
|
||||
> MCP-Protocol-Version: 2025-11-25
|
||||
> Mcp-Session-Id: <session-id>
|
||||
> {"jsonrpc":"2.0","method":"notifications/initialized"}
|
||||
< 202
|
||||
|
||||
## 4. tools/call with the session
|
||||
> POST /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
|
||||
< 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}}
|
||||
|
||||
## 5. tools/call with a session id this server never issued
|
||||
> POST /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"}}}
|
||||
< 404
|
||||
< Content-Type: application/json
|
||||
< {"jsonRpcError":{"code":-32603,"message":"Session not found: <session-id>"}}
|
||||
Reference in New Issue
Block a user