The Streamable HTTP transport, on the JDK's own HTTP server.
The MCP endpoint is /mcp, POST only. Quick protocol methods are answered
with plain JSON; a tools/call gets an SSE stream — opened immediately,
heartbeated with progress while the work runs, closed after its one
response message (§4). Nothing here initiates messages, so there is no GET
stream to offer and GET is 405 — news reaches the model by riding
responses instead (§5). Beside it, /probe is a sessionless GET answering
the server's identity for discovery and health checks (§11), and
/upload/<session-id>/<name> takes a file by PUT into that session's
upload directory.
The Streamable HTTP transport, on the JDK's own HTTP server. The MCP endpoint is `/mcp`, POST only. Quick protocol methods are answered with plain JSON; a `tools/call` gets an SSE stream — opened immediately, heartbeated with progress while the work runs, closed after its one response message (§4). Nothing here initiates messages, so there is no GET stream to offer and GET is 405 — news reaches the model by riding responses instead (§5). Beside it, `/probe` is a sessionless GET answering the server's identity for discovery and health checks (§11), and `/upload/<session-id>/<name>` takes a file by PUT into that session's upload directory.
(address server)The address server is bound to.
The address `server` is bound to.
Set on a tunnelled exchange whose requests were registered for
cancellation before it was handed to a handler: the context
mcp/admit returned, whose records stay with whoever made them.
Set on a tunnelled exchange whose requests were registered for cancellation before it was handed to a handler: the context `mcp/admit` returned, whose records stay with whoever made them.
Set on a tunnelled exchange ahead of the write that answers its request on an event stream: the one message that carries every response the request is owed. A node says so with that write, and its gateway counts the request answered by what it is told (§15).
Set on a tunnelled exchange ahead of the write that answers its request on an event stream: the one message that carries every response the request is owed. A node says so with that write, and its gateway counts the request answered by what it is told (§15).
(encode x)data.json escapes both / and every non-ASCII character by default. Both are
valid JSON and neither is necessary over a UTF-8 body — and a project whose
premise is that escaping layers eat backslashes should not add a layer of its
own for decoration (§1).
data.json escapes both `/` and every non-ASCII character by default. Both are valid JSON and neither is necessary over a UTF-8 body — and a project whose premise is that escaping layers eat backslashes should not add a layer of its own for decoration (§1).
(origin-allowed? exchange allowed)Non-browser clients send no Origin at all; browsers always do. So absence is the normal case and presence is the one to check. Nothing is allowed by default, and no CORS headers are ever emitted — §4's failure mode is an Access-Control-Allow-Origin added later to make some browser test pass.
Non-browser clients send no Origin at all; browsers always do. So absence is the normal case and presence is the one to check. Nothing is allowed by default, and no CORS headers are ever emitted — §4's failure mode is an Access-Control-Allow-Origin added later to make some browser test pass.
(serve-tunnelled! exchange door)Serve an exchange that arrived through a gateway rather than on this
server's socket (§15), by the handler its path names — the same
handlers, at a door of the same origin policy, as a request made
directly. The door's :fleet is what the instance that took the
request off its gateway is to the fleet, for the sessions it opens and
the name they are said to be on.
Serve an exchange that arrived through a gateway rather than on this server's socket (§15), by the handler its path names — the same handlers, at a `door` of the same origin policy, as a request made directly. The door's `:fleet` is what the instance that took the request off its gateway is to the fleet, for the sessions it opens and the name they are said to be on.
(start! opts)(start! {:keys [port bind allowed-origins]} {:keys [route contexts fleet]})Bind and start. Returns the HttpServer.
wiring is what this instance's role adds to the transport (§15), and
never a host's options. :route is a gateway's say over each request
before it is served here: called as (route exchange request) for each
/mcp POST — request being {:kind :mcp, :payload parsed, :body text, :modern? bool, :peer host} — and each upload, {:kind :upload, :session sid, :peer host}, it answers truthy when it has answered the
exchange itself, and the request is served here otherwise. :contexts
are further doors, path → (fn [exchange door]). :fleet is what the
instance is to a fleet (session/fleet-hooks!), made before the port
opens and given to every request the server accepts: no request finds
the endpoint without it, and none is served as an instance the JVM
became later.
Bind and start. Returns the HttpServer.
`wiring` is what this instance's role adds to the transport (§15), and
never a host's options. `:route` is a gateway's say over each request
before it is served here: called as `(route exchange request)` for each
`/mcp` POST — `request` being `{:kind :mcp, :payload parsed, :body
text, :modern? bool, :peer host}` — and each upload, `{:kind :upload,
:session sid, :peer host}`, it answers truthy when it has answered the
exchange itself, and the request is served here otherwise. `:contexts`
are further doors, path → `(fn [exchange door])`. `:fleet` is what the
instance is to a fleet (`session/fleet-hooks!`), made before the port
opens and given to every request the server accepts: no request finds
the endpoint without it, and none is served as an instance the JVM
became later.Set on an exchange that did not arrive on this server's own socket: a node serving what its gateway sent it (§15).
Set on an exchange that did not arrive on this server's own socket: a node serving what its gateway sent it (§15).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |