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
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# One self-contained 2026-07-28 request, no handshake. Usage: scripts/curl-modern.sh [port] [order-id]
port="${1:-8082}"; order="${2:-A-101}"
curl -si -X POST "localhost:${port}/mcp" \
-H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
-H 'MCP-Protocol-Version: 2026-07-28' -H 'Mcp-Method: tools/call' -H 'Mcp-Name: order_status' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"order_status","arguments":{"orderId":"'"${order}"'"},"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientInfo":{"name":"curl","version":"1"},"io.modelcontextprotocol/clientCapabilities":{}}}}'
echo
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Regenerates every file in output/. The tests write the transcripts and assert the same facts,
# so a failing build means a number in the post stopped being true.
set -euo pipefail
cd "$(dirname "$0")/.."
mvn -B -q test
ls -1 output
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Starts one instance by hand so you can poke it with curl.
# scripts/run.sh modern 8082 M1 (2026-07-28 server)
# scripts/run.sh legacy 8081 L1 (2025-era server)
set -euo pipefail
cd "$(dirname "$0")/.."
profile="${1:?profile: legacy or modern}"; port="${2:-8080}"; name="${3:-solo}"
[ -f target/mcp-stateless.jar ] || mvn -B -q -DskipTests package
exec java -jar target/mcp-stateless.jar --spring.profiles.active="$profile" --server.port="$port" --instance.name="$name"