turbomcp-grpc
High-performance gRPC transport for the Model Context Protocol (MCP).
Features
- Server: Full gRPC server implementation with streaming notifications
- Client: gRPC client with automatic initialization and reconnection
- Tower Integration: Composable middleware via Tower layers
- TLS: Optional TLS 1.3 support via rustls
- Streaming: Server-streaming for real-time notifications
Installation
Add to your Cargo.toml:
[]
= "3.1.2"
Quick Start
Server
use McpGrpcServer;
use ;
async
Client
use McpGrpcClient;
async
Protocol Definition
The gRPC service is defined in src/proto/mcp.proto (package turbomcp.mcp.v1) and includes:
Initialize- Session initializationPing- Health checkListTools/CallTool- Tool operationsListResources/ListResourceTemplates/ReadResource- Resource operationsListPrompts/GetPrompt- Prompt operationsSubscribe- Server-streaming notificationsComplete- Autocomplete suggestionsSetLoggingLevel- Logging configurationListRoots/CreateSamplingMessage/Elicit- Client-capability bridges
Tower Integration
Use with Tower layers for composable middleware:
use McpGrpcLayer;
use ServiceBuilder;
let layer = new
.logging
.timing;
let service = new
.layer
.service;
Features
server(default) - Enable server implementationclient(default) - Enable client implementationhealth- Enable gRPC health checking servicereflection- Enable gRPC reflection for debuggingtls- Enable TLS support
License
MIT