Skip to main content

rskit_mcp/
lib.rs

1//! Bridge between rskit tool registry and Model Context Protocol (MCP).
2//!
3//! This crate connects rskit's tool system to the MCP protocol using the official Rust MCP SDK (`rmcp`).
4//! It provides:
5//!
6//! - **Server**: expose an rskit [`Registry`](rskit_tool::Registry) as an MCP server
7//! - **Client**: connect to an MCP server
8//!   and wrap remote tools as rskit [`Callable`](rskit_tool::Callable)
9//! - **Convert**: bidirectional type conversions between rskit and MCP types
10//! - **Skill integration**: consumes top-level `rskit-skill`; remote MCP servers are tool sources
11//! - **Transport helpers**: validate canonical transport names
12//!   and build localhost-only Streamable HTTP configuration defaults
13
14#[cfg(feature = "protocol")]
15pub mod convert;
16#[cfg(feature = "server")]
17pub mod transport;
18
19#[cfg(feature = "server")]
20pub mod audit;
21#[cfg(feature = "server")]
22pub mod authorizer;
23#[cfg(feature = "server")]
24pub mod authz;
25#[cfg(feature = "server")]
26pub mod config;
27#[cfg(feature = "server")]
28pub mod limits;
29#[cfg(feature = "server")]
30pub mod prompts;
31#[cfg(feature = "server")]
32pub mod resources;
33#[cfg(feature = "server")]
34pub mod server;
35#[cfg(feature = "server")]
36pub mod tool_call;
37
38#[cfg(feature = "client")]
39pub mod client;
40
41#[cfg(feature = "protocol")]
42pub use convert::{
43    app_error_to_mcp_error, call_result_to_tool_result, definition_to_tool,
44    definitions_to_list_result, tool_result_to_call_result, tool_to_definition,
45};
46
47#[cfg(feature = "server")]
48pub use audit::{ToolAuditEvent, ToolAuditSink};
49#[cfg(feature = "server")]
50pub use authorizer::DeciderToolAuthorizer;
51#[cfg(feature = "server")]
52pub use authz::{ToolAuthorizationDecision, ToolAuthorizationRequest, ToolAuthorizer};
53#[cfg(feature = "server")]
54pub use config::ServerConfig;
55#[cfg(feature = "server")]
56pub use prompts::PromptEntry;
57#[cfg(feature = "server")]
58pub use resources::{ResourceEntry, ResourceTemplateEntry};
59#[cfg(feature = "server")]
60pub use server::{RegistryHandler, create_server};
61#[cfg(feature = "server")]
62pub use transport::{
63    TRANSPORT_STDIO, TRANSPORT_STREAMABLE_HTTP, TransportKind, streamable_http_server_config,
64};
65
66#[cfg(feature = "client")]
67pub use client::{ClientConfig, discover_tools, wrap_tools};