Skip to main content

rig_mcp/
lib.rs

1//! # rig-mcp
2//!
3//! Model Context Protocol bridge for [`rig-compose`](https://crates.io/crates/rig-compose)
4//! tool registries, backed by the official [`rmcp`] SDK.
5//!
6//! Skills cannot tell an [`McpTool`] apart from a `rig_compose::LocalTool`
7//! — both implement the same [`Tool`](rig_compose::tool::Tool) trait.
8//! The same registry can be exposed as an MCP server via [`serve_stdio`]
9//! and consumed by another process via [`StdioTransport::spawn`], with
10//! all spec-level concerns (JSON-RPC framing, capability handshakes,
11//! protocol-version negotiation) delegated to `rmcp`.
12
13#![cfg_attr(
14    test,
15    allow(
16        clippy::unwrap_used,
17        clippy::expect_used,
18        clippy::indexing_slicing,
19        clippy::panic,
20        clippy::panic_in_result_fn,
21    )
22)]
23
24pub mod cache_tools;
25pub mod replay;
26pub mod result_cache;
27#[cfg(feature = "stdio")]
28pub mod stdio;
29pub mod transport;
30
31pub use cache_tools::{
32    CACHE_PAGE_TOOL, CACHE_RELEASE_TOOL, CachedResultsConfig, CachedResultsTransport,
33    cache_page_tool, cache_release_tool, cache_tools, register_cache_tools,
34};
35pub use replay::{RegistrationReplayPolicy, RegistrationSnapshot};
36pub use result_cache::{
37    CachedResultEnvelope, CachedResultHandle, MemoryResultCache, ResultCache, cache_if_large,
38};
39#[cfg(feature = "stdio")]
40pub use stdio::{StdioTransport, serve_stdio};
41pub use transport::{LoopbackTransport, McpTool, McpTransport};