TurboMCP
Production-ready Rust SDK for the Model Context Protocol with RFC 9449 DPoP security, type-state capability builders, SIMD acceleration, and zero-cost abstractions. Enterprise-grade features for mission-critical AI infrastructure.
Key Features
Built with performance, reliability, and developer experience in mind.
RFC 9449 DPoP Security Suite
Complete Demonstration of Proof-of-Possession implementation with enterprise-grade OAuth 2.0 enhancements.
Type-State Capability Builders
Revolutionary const-generic builders with compile-time validation and impossible state prevention.
SIMD Acceleration
Fast JSON processing with sonic-rs and simd-json for 2-3x performance improvements over standard libraries.
Advanced Transport Layer
Enterprise-ready transport with Axum integration, circuit breakers, and modern WebSocket support.
Revolutionary Macro System
Zero-boilerplate MCP tools with compile-time validation, automatic schema generation, and ergonomic async support.
Complete MCP 2025-06-18
Full protocol support with enhanced features and comprehensive security hardening.
Modular Architecture
Clean, layered architecture with 8 specialized crates for maximum flexibility and maintainability.
Main SDK with ergonomic APIs
Foundation with SIMD acceleration
MCP specification implementation
Multi-protocol transport layer
Server framework and middleware
MCP client implementation
Procedural macro definitions
Command-line development tools
Revolutionary Type-Safe APIs
Build enterprise-grade MCP servers with DPoP security, type-state builders, and zero-cost abstractions.
use turbomcp::prelude::*;
#[derive(Clone)]
struct Calculator;
#[server(
name = "calculator-server",
version = "1.0.0",
description = "A simple calculator"
)]
impl Calculator {
#[tool("Add two numbers")]
async fn add(&self, a: i32, b: i32) -> McpResult<i32> {
Ok(a + b)
}
#[tool("Subtract two numbers")]
async fn subtract(&self, a: i32, b: i32) -> McpResult<i32> {
Ok(a - b)
}
#[tool("Get server status")]
async fn status(&self, ctx: Context) -> McpResult<String> {
ctx.info("Status requested").await?;
Ok("Server running".to_string())
}
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
Calculator.run_stdio().await?;
Ok(())
}
Get started with TurboMCP in your Cargo.toml
Powerful Macro System
Revolutionary type-state builders and zero-overhead macros with compile-time safety guarantees.
Attribute Macros #[...]
Procedural attribute macros for server definitions and method handlers.
Server Definition
Define MCP servers with automatic trait implementations
Tool Handlers
Create tool endpoints with parameter validation
Resource Providers
Handle resource requests with URI templating
Prompt Generators
Generate dynamic prompts for AI interactions
DPoP Security (NEW)
RFC 9449 token binding with cryptographic proof
Type-State Builder (NEW)
Compile-time safe capability configuration
User Input
Request structured input from clients
Autocomplete
Provide intelligent completion suggestions
Macro Invocations name!()
Helper macros for creating formatted content, errors, and responses.
DPoP Tokens (NEW)
Generate RFC 9449 cryptographically bound tokens
Text Content Blocks
Create ContentBlock structures (often used with tool_result!)
Tool Results (Advanced)
Create CallToolResult manually (usually auto-handled by #[tool])
Error Creation
Create MCP errors (use with Err(mcp_error!(...)))
Ready-to-Use Examples
Get started quickly with our comprehensive examples covering everything from basic servers to advanced use cases.
use turbomcp::prelude::*;
#[derive(Clone)]
struct Calculator {
operations: std::sync::Arc<std::sync::atomic::AtomicU64>,
}
#[server]
impl Calculator {
#[tool("Add two numbers")]
async fn add(&self, a: i32, b: i32) -> McpResult<i32> {
self.operations.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
Ok(a + b)
}
#[tool("Get server statistics")]
async fn stats(&self) -> McpResult<String> {
let ops = self.operations.load(std::sync::atomic::Ordering::Relaxed);
Ok(format!("Operations performed: {}", ops))
}
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let server = Calculator {
operations: std::sync::Arc::new(std::sync::atomic::AtomicU64::new(0)),
};
server.run_stdio().await?;
Ok(())
}
Run any example with cargo:
Performance Benchmarks
Optimized for fast processing with measurable performance improvements. Benchmarks conducted on consumer hardware (MacBook Pro M3, 32GB RAM).
2-3x Faster
JSON processing performance vs serde_json
Zero Copy
Memory-efficient message handling
SIMD
Hardware-accelerated processing
Low Latency
Optimized for real-time applications
Ready to Build with TurboMCP?
Start building fast MCP servers today with our comprehensive Rust SDK.
Learn by Example
Explore 40+ comprehensive examples covering everything from basic usage to advanced enterprise features.
View All Examples on GitHub