| Crates.io | turbomcp-grpc |
| lib.rs | turbomcp-grpc |
| version | 3.0.0-beta.3 |
| created_at | 2026-01-12 17:50:20.06454+00 |
| updated_at | 2026-01-22 16:45:30.652458+00 |
| description | gRPC transport for TurboMCP - high-performance MCP over HTTP/2 |
| homepage | https://turbomcp.org |
| repository | https://github.com/Epistates/turbomcp |
| max_upload_size | |
| id | 2038377 |
| size | 155,189 |
High-performance gRPC transport for the Model Context Protocol (MCP).
Add to your Cargo.toml:
[dependencies]
turbomcp-grpc = "3.0.0-alpha.1"
use turbomcp_grpc::server::McpGrpcServer;
use turbomcp_core::types::tools::Tool;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let server = McpGrpcServer::builder()
.server_info("my-server", "1.0.0")
.add_tool(Tool {
name: "hello".to_string(),
description: Some("Says hello".to_string()),
input_schema: serde_json::json!({
"type": "object",
"properties": {
"name": {"type": "string"}
}
}),
annotations: None,
})
.build();
tonic::transport::Server::builder()
.add_service(server.into_service())
.serve("[::1]:50051".parse()?)
.await?;
Ok(())
}
use turbomcp_grpc::client::McpGrpcClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut client = McpGrpcClient::connect("http://[::1]:50051").await?;
// Initialize the session
let init_result = client.initialize().await?;
println!("Connected to: {:?}", init_result.server_info);
// List available tools
let tools = client.list_tools().await?;
println!("Available tools: {:?}", tools);
// Call a tool
let result = client.call_tool("hello", Some(serde_json::json!({"name": "World"}))).await?;
println!("Result: {:?}", result);
Ok(())
}
The gRPC service is defined in src/proto/mcp.proto and includes:
Initialize - Session initializationPing - Health checkListTools / CallTool - Tool operationsListResources / ReadResource - Resource operationsListPrompts / GetPrompt - Prompt operationsSubscribe - Streaming notificationsComplete - Autocomplete suggestionsSetLoggingLevel - Logging configurationUse with Tower layers for composable middleware:
use turbomcp_grpc::layer::McpGrpcLayer;
use tower::ServiceBuilder;
let layer = McpGrpcLayer::new()
.timeout(Duration::from_secs(30))
.logging(true)
.timing(true);
let service = ServiceBuilder::new()
.layer(layer)
.service(inner_service);
server (default) - Enable server implementationclient (default) - Enable client implementationhealth - Enable gRPC health checking servicereflection - Enable gRPC reflection for debuggingtls - Enable TLS supportMIT