Skip to main content

Module mcp

Module mcp 

Source
Expand description

The parts of MCP that exist as wire headers rather than as IR.

§Why this module exists at all

Everything the application layer exchanges is a version-agnostic IR message, and the JSON-RPC envelope around it. A Streamable HTTP request is neither: an HTTP request is addressed by a set of headers, and three of them carry MCP meaning that the IR cannot express — Mcp-Session-Id names the session the request belongs to, and Mcp-Method/Mcp-Name name the operation and the target before a body is even parsed. Those facts are MCP’s, not the IR’s and not the HTTP library’s, so they are value objects here with the rules about what a legal value looks like attached to the type.

This is the first domain/mcp module. It exists because the project rule is that MCP-specific code lives under an mcp submodule in each layer while the protocol-neutral core stays free of MCP types, and putting a header value in domain/ir would have made the IR depend on a transport.

§What is deliberately not here

Nothing that reads or writes a header. These types know the grammar of a value and nothing about HTTP: no http::HeaderValue, no request, no status code. The axum adapter in the next stage owns that, and it converts these values at the boundary. A value object that borrowed the HTTP crate’s types would be untestable without an HTTP runtime, and this stage has no HTTP dependency at all by design.

Re-exports§

pub use authorization::AuthorizationModel;
pub use authorization::ClientRegistration;
pub use authorization::authorization_model;
pub use resource_metadata::BearerMethod;
pub use resource_metadata::ResourceMetadata;
pub use resource_metadata::ResourceUri;
pub use resource_metadata::ResourceUriError;
pub use resource_metadata::WELL_KNOWN;

Modules§

authorization
What each revision’s authorization spec asks of the two sides.
resource_metadata
The canonical resource identifier and the document that publishes it.

Structs§

McpSessionId
The Mcp-Session-Id header value naming one session.
RoutingHeaders
A validated Mcp-Method/Mcp-Name pair, proven admissible for one session.
RoutingName
The name of a tool, resource or prompt.
RoutingTarget
The operation a request addresses, and the thing it addresses it against.

Enums§

McpSessionIdError
Why a Mcp-Session-Id header is not an McpSessionId.
RoutingHeaderError
Why a request is not routable by header.

Constants§

MCP_METHOD_HEADER
The method header’s name, exactly as the specification spells it.
MCP_NAME_HEADER
The target-name header’s name, exactly as the specification spells it.
VISIBLE_ASCII_RANGE
The byte range an Mcp-Session-Id value is drawn from, inclusive.

Functions§

client_method_defined_in
Whether method is a client-to-server request version defines.