docs: explain why GET /api/mcp deliberately answers 405 in stateless mode

This commit is contained in:
2026-09-08 14:07:54 +00:00
parent aedc388535
commit a0b5565a63
4 changed files with 30 additions and 5 deletions
@@ -181,10 +181,14 @@ endpoint, so enabling the feature grants nothing by itself.
## Transport and protocol
Streamable HTTP, stateless. `POST /api/mcp` carries the JSON-RPC request and
returns either a JSON response or an SSE stream; `GET /api/mcp` opens the
server-to-client stream where a client asks for one. No session resumption in
v1 — each request stands alone, which is what lets the endpoint sit behind
ordinary request middleware with no special-casing.
returns either a JSON response or an SSE stream. The transport is stateless
rather than session-resuming precisely so each request can stand alone and
sit behind ordinary request middleware with no special-casing, and that
stateless mode leaves no session for a server-to-client stream to resume
against — so `GET /api/mcp` is registered but answers the protocol's 405
rather than opening a stream. A client probing the endpoint therefore learns
"POST-only here" rather than seeing a bare 404, which is what the MCP spec
expects from a server that does not offer the GET/SSE leg.
Protocol framing comes from `github.com/modelcontextprotocol/go-sdk`. Everything
below the framing is the existing service layer, called directly in-process.