Skip to main content

Crate rs_fast_mcp

Crate rs_fast_mcp 

Source
Expand description

§Rs Fast MCP

High-performance, async-first Rust implementation of the Model Context Protocol (MCP).

Rs Fast MCP provides a complete framework for building MCP servers and clients using modern Rust practices. Built on tokio and actix-web, it offers non-blocking I/O, type-safe interfaces, and a rich middleware pipeline out of the box.

§Key Features

  • Flexible transports — Stdio (pipe) and HTTP/SSE with session management.
  • Authentication — Pluggable server::auth::AuthProvider trait with built-in providers for Google, GitHub, Azure, AWS Cognito, Auth0, and more.
  • Middleware — Composable request pipeline with rate-limiting, caching, and logging.
  • Component managers — First-class registration, validation, and execution for tools, resources, and prompts.
  • Client SDK — Async client with transport auto-detection, sampling, and roots support.

§Quick Start

use rs_fast_mcp::server::app::Server;
use rs_fast_mcp::tools::tool::{Tool, ToolResult};
use rs_fast_mcp::mcp::types::ContentBlock;

#[tokio::main]
async fn main() {
    // Build the server (creates an internal FastMCPServer engine)
    let server = Server::builder("my-server", "0.1.0")
        .stdio()
        .build();

    // Register a tool on the running engine
    let tool = Tool::new("greet", "Say hello to a name")
        .add_parameter("name", "string", "The name to greet");
    server.core.add_tool(tool).unwrap();

    // Run until EOF or SIGINT
    server.run().await.unwrap();
}

§Module Overview

ModulePurpose
mcpProtocol types, JSON-RPC messages, and configuration
serverServer core, transports, auth, and middleware
clientAsync MCP client SDK
toolsTool registration, validation, and execution
resourcesResource management and URI templates
promptsPrompt templates and execution
cliCommand-line interface (serve, client, inspect)
settingsEnvironment-driven configuration
errorError types used across the crate
utilJSON Schema helpers and shared utilities

Modules§

cli
Command-line interface for rs-fast-mcp.
client
error
Crate-wide error types.
mcp
Model Context Protocol (MCP) type definitions and wire-format utilities.
prompts
Prompt template registration and execution.
resources
Resource management, URI templates, and subscriptions.
server
MCP server implementation.
settings
Environment-driven application settings.
shared
tools
Tool registration, validation, and execution.
util
Shared utility modules.