Skip to main content

Module mcp

Module mcp 

Source
Expand description

The MCP capability: a projection of the index into resources and tools (surface), the JSON-RPC and MCP method handling over it (protocol), the one local transport (stdio), and the bridge that forwards a stdio session to the shared server of another process (bridge). Only protocol knows the wire shapes; only stdio knows about file descriptors; surface knows neither.

Re-exports§

pub use surface::Surface;

Modules§

bridge
The bridge: a majordomus mcp process that found the repository’s shared server already running forwards its client’s stdio frames to that server’s /mcp endpoint and writes the answers back, one HTTP request per message, and pings on the side so that the server keeps the session. It carries no index and no registry of its own, which is why it starts in milliseconds. The HTTP client below is the few lines a loopback request needs (the server always answers with Content-Length, never chunked); no HTTP library is pulled in for it.
stdio
The stdio transport: one JSON message per line in, one per line out. Nothing but protocol messages is ever written to the output; diagnostics go through tracing, which the executable points at stderr. EOF on input ends the session cleanly, and so does a closed output, because both mean the client has gone.
surface
The surface: the registry as resources and tools, independent of any protocol encoding. Every resource is a capability with an MCP resource exposure; every tool is a capability with an MCP tool exposure; every call goes through the registry to the one handler the capability has. Nothing is declared here.

Structs§

Server
The protocol state over a surface: whether the client has initialised, who it said it was, the version to announce, and the HTTP endpoint of the shared server this session belongs to, when there is one.

Constants§

METHODS
Every method a request may name. A request naming any other is answered method not found before it is looked at, so this list is what the server serves and not a description of it; mcp.projection renders it.
PROTOCOL_VERSIONS
Protocol versions this server accepts from a client, newest first. A client asking for another gets the first one.
SERVER_NAME
The serverInfo.name this server announces.
SERVER_TITLE
The serverInfo.title this server announces.