HTTP endpoint of an MCP server: the Streamable HTTP transport.
A host mounts this plug on a single path and serves it with an HTTP
server of its choice. The endpoint supports POST (client requests
and notifications), GET (the server-to-client event stream),
DELETE (session termination) and OPTIONS (CORS preflight). A
request with another method gets 405 with an Allow header, a
request for another path gets 404 and an instance that does not
run gets 503. The order of the checks is: the host, the CORS
origin, authentication, then the route — so an unsupported method on
a protected server gets 401 before any token and 405 with a
valid one.
The rules of the transport — the origins, the host check, the
headers, the status codes, the GET stream and its resume — live in
the guide HTTP transport. The
status rules of the POST answers are in OzMcp.Transport.Http.Post,
the rules of the GET stream in OzMcp.Transport.Http.GetStream
and the DELETE route in OzMcp.Transport.Http.Delete.
The end of a session process
A GET stream monitors the session process that owns it. When that
process stops, the stream writes a retry: hint and ends. A resumer of
a POST stream does the same. The client connects again with its
Last-Event-ID:
- When the session is lost (its process crashed and no snapshot keeps
it) the client gets
404and sendsinitializeagain. - With a snapshot module (
OzMcp.Session.Snapshot) that keeps the session, the session starts again at the next request of the client.
One warning is written for each stream that closes this way. The warning holds no session id and no event id (these are client data).
Disconnect
The framework does not cancel a request when the client disconnects: the callback goes on and its later messages and its response are written to the event log of the session (see OzMcp.PostStream). The guide gives the contract of the host server and the table of the two supported servers.