protocol_droid/domain/mcp/mod.rs
1//! The parts of MCP that exist as wire headers rather than as IR.
2//!
3//! # Why this module exists at all
4//!
5//! Everything the application layer exchanges is a version-agnostic IR message,
6//! and the JSON-RPC envelope around it. A Streamable HTTP request is neither: an
7//! HTTP request is addressed by a set of headers, and three of them carry MCP
8//! meaning that the IR cannot express — `Mcp-Session-Id` names the session the
9//! request belongs to, and `Mcp-Method`/`Mcp-Name` name the operation and the
10//! target before a body is even parsed. Those facts are MCP's, not the IR's and
11//! not the HTTP library's, so they are value objects here with the rules about
12//! what a legal value looks like attached to the type.
13//!
14//! This is the first `domain/mcp` module. It exists because the project rule is
15//! that MCP-specific code lives under an `mcp` submodule in each layer while the
16//! protocol-neutral core stays free of MCP types, and putting a header value in
17//! `domain/ir` would have made the IR depend on a transport.
18//!
19//! # What is deliberately not here
20//!
21//! Nothing that reads or writes a header. These types know the *grammar* of a
22//! value and nothing about HTTP: no `http::HeaderValue`, no request, no status
23//! code. The axum adapter in the next stage owns that, and it converts these
24//! values at the boundary. A value object that borrowed the HTTP crate's types
25//! would be untestable without an HTTP runtime, and this stage has no HTTP
26//! dependency at all by design.
27
28mod client_methods;
29mod routing_headers;
30mod session_id;
31
32pub mod authorization;
33pub mod resource_metadata;
34
35pub use authorization::{AuthorizationModel, ClientRegistration, authorization_model};
36pub use client_methods::client_method_defined_in;
37pub use resource_metadata::{
38 BearerMethod, ResourceMetadata, ResourceUri, ResourceUriError, WELL_KNOWN,
39};
40pub use routing_headers::{
41 MCP_METHOD_HEADER, MCP_NAME_HEADER, RoutingHeaderError, RoutingHeaders, RoutingName,
42 RoutingTarget,
43};
44pub use session_id::{McpSessionId, McpSessionIdError, VISIBLE_ASCII_RANGE};