2 unstable releases
Uses new Rust 2024
| 0.3.0 | Jan 8, 2026 |
|---|---|
| 0.2.0 | Dec 5, 2025 |
#14 in #guarantee
69KB
1.5K
SLoC
turboclaude-mcp
SDK-agnostic MCP (Model Context Protocol) abstraction layer for turboclaude.
This crate provides a unified interface for interacting with MCP servers, regardless of the underlying SDK implementation.
Overview
The main component is the McpClient trait, which provides a common interface
for all MCP operations:
- Tool Operations: List and call tools
- Resource Operations: List and read resources
- Prompt Operations: List and execute prompts
- Capability Queries: Check what features the server supports
Architecture
Application Code (uses McpClient trait)
↓
SDK-specific Adapters
├── TurboMCP Adapter (`Client<T>` → `McpClient`)
└── Official SDK Adapter (`Service<R>` → `McpClient`)
↓
Underlying MCP Server
Features
- SDK Agnostic: Single interface works with any MCP SDK
- Type Safe: Compile-time guarantee of capabilities
- Async/Await: Built on tokio and async-trait
- Error Handling: Comprehensive error types
- Zero Overhead: Adapters use zero-cost abstractions where possible
Example
use turboclaude_mcp::McpClient;
async fn interact_with_server(client: &(impl McpClient + ?Sized)) -> Result<()> {
// Initialize connection
let info = client.initialize().await?;
println!("Connected to: {}", info.name);
// List tools
let tools = client.list_tools().await?;
println!("Available tools: {}", tools.len());
// Call a tool
if let Some(tool) = tools.first() {
let result = client.call_tool(&tool.name, None).await?;
println!("Result: {}", result.content);
}
Ok(())
}
Adapters
Adapters bridge the gap between SDK-specific APIs and the unified interface:
- TurboMCP Adapter (feature:
turbomcp-adapter): Wrapsturbomcp_client::Client<T> - Official Rust SDK Adapter: Wraps
rmcp::Service<R>
Enable features in your Cargo.toml:
[dependencies]
turboclaude-mcp = { path = ".", features = ["turbomcp-adapter"] }
TurboClaude MCP
Model Context Protocol integration with support for official Anthropic SDK and TurboMCP.
Features
- Unified interface for multiple MCP implementations
- Adapter pattern for different SDKs
- Factory pattern for client creation
- Server registry management
Testing
cargo test
Documentation
cargo doc --open for full API documentation
Dependencies
~18–39MB
~510K SLoC