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 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§
- McpSession
Id - The
Mcp-Session-Idheader value naming one session. - Routing
Headers - A validated
Mcp-Method/Mcp-Namepair, proven admissible for one session. - Routing
Name - The name of a tool, resource or prompt.
- Routing
Target - The operation a request addresses, and the thing it addresses it against.
Enums§
- McpSession
IdError - Why a
Mcp-Session-Idheader is not anMcpSessionId. - Routing
Header Error - 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-Idvalue is drawn from, inclusive.
Functions§
- client_
method_ defined_ in - Whether
methodis a client-to-server requestversiondefines.