Skip to main content

rs_fast_mcp/
lib.rs

1//! # Rs Fast MCP
2//!
3//! High-performance, async-first Rust implementation of the
4//! [Model Context Protocol (MCP)](https://modelcontextprotocol.io/).
5//!
6//! Rs Fast MCP provides a complete framework for building MCP **servers** and **clients**
7//! using modern Rust practices. Built on [`tokio`] and `actix-web`, it offers non-blocking
8//! I/O, type-safe interfaces, and a rich middleware pipeline out of the box.
9//!
10//! ## Key Features
11//!
12//! - **Flexible transports** — Stdio (pipe) and HTTP/SSE with session management.
13//! - **Authentication** — Pluggable [`server::auth::AuthProvider`] trait with built-in
14//!   providers for Google, GitHub, Azure, AWS Cognito, Auth0, and more.
15//! - **Middleware** — Composable request pipeline with rate-limiting, caching, and logging.
16//! - **Component managers** — First-class registration, validation, and execution for
17//!   [`tools`], [`resources`], and [`prompts`].
18//! - **Client SDK** — Async client with transport auto-detection, sampling, and roots support.
19//!
20//! ## Quick Start
21//!
22//! ```rust,no_run
23//! use rs_fast_mcp::server::app::Server;
24//! use rs_fast_mcp::tools::tool::{Tool, ToolResult};
25//! use rs_fast_mcp::mcp::types::ContentBlock;
26//!
27//! #[tokio::main]
28//! async fn main() {
29//!     // Build the server (creates an internal FastMCPServer engine)
30//!     let server = Server::builder("my-server", "0.1.0")
31//!         .stdio()
32//!         .build();
33//!
34//!     // Register a tool on the running engine
35//!     let tool = Tool::new("greet", "Say hello to a name")
36//!         .add_parameter("name", "string", "The name to greet");
37//!     server.core.add_tool(tool).unwrap();
38//!
39//!     // Run until EOF or SIGINT
40//!     server.run().await.unwrap();
41//! }
42//! ```
43//!
44//! ## Module Overview
45//!
46//! | Module | Purpose |
47//! |--------|---------|
48//! | [`mcp`] | Protocol types, JSON-RPC messages, and configuration |
49//! | [`server`] | Server core, transports, auth, and middleware |
50//! | [`client`] | Async MCP client SDK |
51//! | [`tools`] | Tool registration, validation, and execution |
52//! | [`resources`] | Resource management and URI templates |
53//! | [`prompts`] | Prompt templates and execution |
54//! | [`cli`] | Command-line interface (`serve`, `client`, `inspect`) |
55//! | [`settings`] | Environment-driven configuration |
56//! | [`error`] | Error types used across the crate |
57//! | [`util`] | JSON Schema helpers and shared utilities |
58
59pub mod cli;
60pub mod client;
61pub mod error;
62pub mod mcp;
63
64pub mod prompts;
65pub mod resources;
66pub mod server;
67pub mod settings;
68pub mod shared;
69pub mod tools;
70pub mod util;