A single runnable mocapi app over the stateless streamable-HTTP transport
(MCP protocol 2026-07-28). No external infrastructure required — just Java
and Maven.
- JDK 25
- Maven 3.6+
cd examples/http
mvn spring-boot:runThe server starts on http://localhost:8080 with the MCP endpoint at /mcp.
The 2026-07-28 transport is stateless and POST-only: there is no
initialize handshake and no Mcp-Session-Id header. Each request is a
self-contained JSON-RPC POST to /mcp; per-call context (protocol version,
client info, etc.) travels in the request's _meta envelope.
For the exact request envelope shape, see the streamable-HTTP transport guide
under docs/guides rather than copying a payload from
here — the envelope is versioned and the guides are kept current.
A tools/call request looks roughly like:
curl -X POST http://localhost:8080/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": { "name": "hello", "arguments": { "name": "World" } }
}'Tools:
- hello — returns a greeting for the given name
- hello-elicitation — greets after eliciting first/last name from the client
- rot13 — applies ROT13 encoding to a string
- countdown — streams a countdown with progress notifications
- greet — Jakarta Bean Validation on a tool parameter (
namemust be 2–60 non-blank chars; violations come back as a tool error result)
Resources:
- docs resources — static example resources
- config://{env}/app resource template — Jakarta Bean Validation on a URI
template variable (
envmust be lowercase letters; violations come back as JSON-RPC-32602)
Prompts:
- summarize — a template-backed prompt
Not for production use.