Add mcp-advanced module: resources, prompts, sampling and elicitation on Spring AI 2.0.2 and MCP Java SDK 2.1.0
An incident-desk MCP server with a fixed resource, two resource templates, a prompt, a tool that borrows the client's model (sampling) and a tool that asks the operator to approve a restart (elicitation). Driven by a plain SDK client in JUnit and by raw curl, so the JSON-RPC for both server-to-client requests is committed. Also captured: a client that declared neither capability (a gated tool degrades, an ungated one returns an isError result), a slow client hitting the server request timeout, and protocol=STATELESS silently dropping every tool that takes McpSyncRequestContext (one WARN line, an empty tools/list). Negotiated protocol version is 2025-11-25; the 2026-07-28 spec is not implemented by SDK 2.1.0. No docs/ folder. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b5jAFLJrmUXmbo5EuV
This commit is contained in:
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regenerates every file in output/. Needs JDK 25, Maven, curl, python3.
|
||||
# Session ids and request ids in the wire transcripts differ on every run; everything else is stable
|
||||
# except the one timing line in 07, which is indicative only.
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# 1-8: the JUnit tests write output/01..08 themselves (the assertions and the transcripts are the same code)
|
||||
mvn -B -q test 2>&1 | tee /tmp/mcp-advanced-test.log | grep -E 'Tests run:|BUILD|ERROR' || true
|
||||
|
||||
# 9: the one WARN the stateless server logs while it silently drops the tools
|
||||
{
|
||||
echo "# log line from the STATELESS test run (spring.ai.mcp.server.protocol=STATELESS)"
|
||||
grep 'Stateless servers' /tmp/mcp-advanced-test.log | sed -E 's/^.*(McpPredicates)/\1/'
|
||||
} > output/09-stateless-warning.txt
|
||||
|
||||
# 10-11: raw JSON-RPC with curl as the client
|
||||
mvn -B -q package -DskipTests
|
||||
bash scripts/wire-demo.sh
|
||||
Reference in New Issue
Block a user