Skip to main content

mcp/
lib.rs

1// SPDX-License-Identifier: AGPL-3.0-only
2//! **mcp** — the Model Context Protocol base library.
3//!
4//! A reusable, agentd-independent core for speaking MCP across every protocol
5//! revision. Two protocol **eras** coexist (see [`version`]):
6//!
7//! * **Legacy** (`2025-11-25` and earlier): an `initialize` handshake establishes
8//!   a session; the negotiated version + capabilities are learned once, and
9//!   server→client messages ride a session-scoped SSE stream.
10//! * **Modern** (`2026-07-28`+, "stateless"): no handshake and no session — every
11//!   request carries its protocol version, client identity, and capabilities in
12//!   `_meta` (mirrored to `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name`
13//!   headers on Streamable HTTP), any request can hit any server instance, and
14//!   long-lived notifications ride a `subscriptions/listen` response stream.
15//!
16//! This crate keeps that era logic in one place so a client or server built on it
17//! can be **dual-era** without branching everywhere. [`wire`] holds the message
18//! types and [`version`] the era model; the [`client`], [`http`] transport, and
19//! [`server`] base build on them.
20//!
21//! Dependency budget: `serde` + `serde_json` only (the agentd minimalism moat).
22
23pub mod client;
24pub mod http;
25pub mod http_server;
26pub mod inbound;
27pub mod modern;
28pub mod rmcp_client;
29/// agentd's credentialed socket under the SDK's transport trait.
30pub mod rmcp_transport;
31pub mod rpc;
32pub mod server;
33pub mod version;
34pub mod wire;