Skip to main content

Module http

Module http 

Source
Expand description

The HTTP projection: the surfaces this repository exposes, resolved once and served.

surfaces narrows the resolved web topology to what this process can answer and binds a handler to each; router asks it who owns a path and dispatches, knowing the registry and nothing about sockets; server knows sockets and nothing about capabilities. The OpenAPI document is derived from the same registry at request time, and the Swagger UI shell loads it.

Re-exports§

pub use router::Body;
pub use router::Request;
pub use router::Response;
pub use router::Router;

Modules§

deadline
The read deadline: how long a connection may hold this server without a request read in full on it (I2156).
events
The live channel: one WebSocket over which this process reports what its executions are doing.
mcp
MCP over HTTP at /mcp: the Streamable HTTP transport’s request half. A client POSTs one JSON-RPC message (or a batch) and gets the response in the body; the server answers initialize with an Mcp-Session-Id header, requires it on every later request, and forgets the session on DELETE or after a silence longer than SESSION_IDLE_TIMEOUT. There is no server-initiated stream (GET is 405): this server sends no notifications, so a stream would carry nothing.
openapi
The OpenAPI projection: an OpenAPI 3.1 document built from the registry and nothing else. operationId is the canonical id; every operation carries the canonical id, kind, stability, policies and the other projections as x-majordomus-* extensions so that a reader can reconcile it against MCP and the CLI. The tags are the modules; the examples are the capabilities’ own benchmark cases, so an operation without an example is an operation without a case, and the executable will not compile in that state; the error responses are the statuses the router maps crate::capability::CapabilityError to, by kind. Deterministic: every map is sorted, nothing carries a timestamp.
router
Routing and binding, transport-neutral: a request in, a response out.
server
The socket: bind, read requests, hand them to the router, write responses. Loopback by default; the bound address is reported so that a caller who asked for port 0, or whose port was taken, learns the one in use. A bound socket is accepted by a few worker threads, and each request is answered on a thread of its own up to a bound, so a slow request queues nothing behind it — not even the probe a client sends before it would take the lease over — and the owner’s stdio session never waits on HTTP. Stopping is cooperative: every worker is unblocked and joined, and an in-flight response is finished first. A stopped server refuses the next connection: stop returns after the listening socket is closed. A connection that reads no request within the declared deadline is closed (super::deadline), and a request that finds every handler busy is refused rather than answered on a worker.
swagger
The Swagger UI shell: one HTML page that loads the pinned Swagger UI distribution and points it at /openapi.json. It embeds no specification of its own; what it shows is whatever the server generated from the registry at the moment of the request. The page is rendered once per process and served from memory.
ws
WebSocket, by hand: the handshake and the frames of RFC 6455, and nothing else.

Structs§

Served
The surfaces one router serves, with what answers each.