Skip to content
← Blog

AI & Development

Introducing TurboMCP: Fast Rust SDK for Model Context Protocol

How we built a production-grade MCP implementation that achieves 2-3x performance improvements and decided to open-source it.

AI Infrastructure Team · · 12 min read

The Model Context Protocol (MCP) is rapidly becoming the standard for connecting AI assistants to external tools and data sources. As AI applications move from proof-of-concept to production, the infrastructure supporting them must evolve to meet enterprise-grade requirements for performance, reliability, and developer experience.

At Epistates, we found ourselves in need of an MCP implementation that could handle our workloads: thousands of requests per second, zero-downtime deployments, and integration with complex systems. After evaluating existing options and finding them insufficient for our needs, we built TurboMCP, a fast Rust SDK that we’ve now decided to open-source for the community.

The Challenge: Robust MCP Infrastructure

The Model Context Protocol enables AI assistants like Claude to interact with external tools through a standardized JSON-RPC interface. While the protocol specification is elegant, implementing it efficiently at scale presents several challenges.

Performance Requirements

Modern AI applications demand sub-millisecond response times for tool calls. When an AI assistant needs to process hundreds of context requests per second, every microsecond counts.

Developer Experience

Building MCP servers shouldn’t require deep protocol knowledge or extensive boilerplate code. Developers should focus on business logic, not JSON-RPC message handling.

OAuth 2.0 Authentication

World-class authentication with Google, GitHub, Microsoft providers and always-on PKCE security for enterprise applications.

Deployment Flexibility

Different scenarios require different transport protocols. A local tool might use STDIO, while a cloud service needs HTTP with Server-Sent Events.

Our Solution: TurboMCP

TurboMCP addresses these challenges through a carefully architected Rust SDK that prioritizes performance, developer experience, and reliability.

SIMD-Accelerated Performance

The foundation of TurboMCP’s performance advantage lies in its use of SIMD (Single Instruction, Multiple Data) acceleration for JSON processing. By leveraging the sonic-rs and simd-json crates, we achieve 2-3x performance improvements over standard serde_json in real-world workloads.

// TurboMCP automatically uses SIMD acceleration under the hood
use turbomcp::prelude::*;

#[derive(Clone)]
struct HighThroughputServer;

#[server]
impl HighThroughputServer {
    #[tool("Process data with SIMD acceleration")]
    async fn process_data(&self, data: Vec<f64>) -> McpResult<f64> {
        // Your business logic here - JSON processing is automatically optimized
        Ok(data.iter().sum::<f64>() / data.len() as f64)
    }
}

Performance impact:

  • 2-3x faster JSON parsing compared to serde_json
  • Reduced memory allocations through zero-copy processing
  • Better CPU cache utilization with vectorized operations
  • Higher throughput under concurrent load

Zero-Overhead Procedural Macros

TurboMCP’s procedural macros eliminate boilerplate while generating optimal code at compile time. The #[server], #[tool], #[resource], and #[prompt] attributes handle all the MCP protocol details automatically.

use turbomcp::prelude::*;

#[derive(Clone)]
struct Calculator;

#[server]
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)
    }

    #[resource("calc://history")]
    async fn history_resource(&self, _uri: String) -> McpResult<String> {
        Ok("Calculator history".to_string())
    }
}

Generated code includes:

  • JSON-RPC request/response handling
  • Automatic schema generation
  • Parameter validation
  • Type-safe serialization
  • Handler registration
  • Error handling

Modular Architecture for Maximum Flexibility

TurboMCP is designed as a collection of eight specialized crates, each serving a specific purpose:

Crate Purpose
turbomcp Main SDK with ergonomic APIs
turbomcp-core Foundation with SIMD message handling
turbomcp-protocol MCP specification implementation
turbomcp-transport Multi-protocol transport layer
turbomcp-server Server framework and middleware
turbomcp-client Client implementation
turbomcp-macros Procedural macro definitions
turbomcp-cli Development and debugging tools
// High-level ergonomic usage
use turbomcp::prelude::*;
// Uses all the crates together for maximum productivity

// Selective usage for specific needs
use turbomcp_core::{Message, Context};
use turbomcp_transport::stdio::StdioTransport;
// Use only the components you need

// Custom transport implementations
use turbomcp_core::{Message, Handler};
use turbomcp_protocol::JsonRpcMessage;
// Build custom transport layers while reusing core infrastructure

Flexible Transport Configuration

TurboMCP provides flexible transport selection with 10+ feature flags for progressive enhancement. Choose exactly the features you need for your deployment scenario without changing your server code.

use turbomcp::prelude::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let server = FileServer::new();
    
    // Runtime transport selection
    match std::env::var("TRANSPORT").as_deref() {
        Ok("tcp") => {
            let port: u16 = std::env::var("PORT")
                .unwrap_or_else(|_| "8080".to_string())
                .parse()
                .unwrap_or(8080);
            server.run_tcp(format!("127.0.0.1:{}", port)).await?
        }
        Ok("unix") => {
            let path = std::env::var("SOCKET_PATH")
                .unwrap_or_else(|_| "/tmp/mcp.sock".to_string());
            server.run_unix(path).await?
        }
        _ => server.run_stdio().await?  // Default fallback
    }
    Ok(())
}

Deployment options:

  • Standard STDIO: Works everywhere, no network complexity
  • Network Options: TCP for network deployment, Unix sockets for server applications
  • Compile Selectively: Build TCP-only servers with --features "internal-deps,tcp"
  • Runtime Configuration: Same binary, different transports via environment variables
# Feature Selection Examples

# Full experience (default)
turbomcp = "1.0"  # All features: schema-generation, context-injection, uri-templates, database, SIMD

# Deployment-optimized builds
turbomcp = { version = "1.0", default-features = false, features = ["minimal"] }     # STDIO only
turbomcp = { version = "1.0", default-features = false, features = ["network"] }     # STDIO + TCP
turbomcp = { version = "1.0", default-features = false, features = ["server-only"] }  # TCP + Unix

# Feature-specific builds
turbomcp = { version = "1.0", features = ["simd", "schema-generation"] }  # Performance + schemas
turbomcp = { version = "1.0", features = ["database", "uri-templates"] }   # DB + URI matching

# Complete feature reference: https://github.com/Epistates/turbomcp

Performance Benchmarks

Our benchmarks demonstrate TurboMCP’s performance advantages in real-world conditions. All benchmarks were conducted on consumer hardware (MacBook Pro M3, 32GB RAM).

Metric serde_json TurboMCP Improvement
Parse Speed 1.2 GB/s 3.1 GB/s 2.6x faster
Memory Usage 450 MB 280 MB 38% reduction
Latency (p99) 15ms 6ms 2.5x faster
Throughput 8,500 req/s 21,000 req/s 2.5x increase

Headline figures: 2-3x faster on a laptop, under 1ms tool call latency, and a 38% memory reduction.

Getting Started

Installation

[dependencies]
turbomcp = "1.0"
tokio = { version = "1.0", features = ["full"] }

Basic Example

use turbomcp::prelude::*;

#[derive(Clone)]
struct EchoServer;

#[server]
impl EchoServer {
    #[tool("Echo a message back")]
    async fn echo(&self, message: String) -> McpResult<String> {
        Ok(format!("Echo: {}", message))
    }
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let server = EchoServer;
    server.run_stdio().await?;
    Ok(())
}

Ready to get started? See the TurboMCP repository on GitHub and the documentation on docs.rs.

Community and Open Source

Why We Open-Sourced TurboMCP

We built TurboMCP to solve our own production challenges, but we believe the broader community can benefit from high-performance MCP infrastructure. The Rust ecosystem has given us tremendous value through excellent crates and community support. Open-sourcing TurboMCP is our way of contributing back.

Our commitment:

  • Long-term maintenance
  • Community-driven development
  • Comprehensive documentation
  • Enterprise support options

How to contribute:

  • Additional transport protocols
  • Enhanced observability
  • Developer tooling
  • Documentation and examples

Conclusion

TurboMCP represents our vision for robust MCP infrastructure: fast, reliable, and developer-friendly. With flexible transport options and selective compilation, developers can choose the right deployment approach for their needs.

By providing runtime transport configuration and feature-gated compilation, TurboMCP offers deployment flexibility without code changes. The same server implementation works as a local STDIO tool or as a dedicated network service.

The future of AI applications depends on solid infrastructure foundations. TurboMCP provides both a high-performance implementation and practical deployment flexibility for real-world production requirements.

Start with our comprehensive examples, join the community discussions, and help us build the future of robust MCP infrastructure: GitHub repository or crates.io. See also the TurboMCP product page.

  • Rust
  • MCP
  • SIMD
  • Open Source
  • Performance
  • AI Infrastructure

Keep reading

Want this running in your business?

We build and deploy production AI for enterprises. Let's talk about what you're working on.