A Go gateway that converts gRPC services into MCP-compatible tools, allowing AI models like Claude to directly call your gRPC services.
ggRMCP is a high-performance Go-based gateway that converts gRPC services into MCP-compatible tools, allowing AI models like Claude to directly call your gRPC services. It acts as a translator between the gRPC world and the MCP ecosystem, providing seamless integration without requiring modifications to existing gRPC services.
ggRMCP uses gRPC reflection to discover available services and methods, generating MCP tools dynamically. This enables AI applications to interact with gRPC services as if they were native tools, enhancing the capabilities of AI models with real-time data access and processing.
ggRMCP can also be configured to read FileDescriptorSet files, enabling it to extract comments and documentation from protobuf definitions for a richer AI application experience.
This allows you to leverage existing gRPC services without needing to rewrite or adapt them for AI use cases, making it easier to integrate AI capabilities into your applications.
ggRMCP is an experimental project and is not yet production-ready.
Deployment Patterns:
The transcoding is performed in real-time with no modifications required to existing gRPC services. As a language-agnostic sidecar, ggRMCP works with gRPC services written in any language that supports gRPC reflection.
MCP is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications - it provides a standardized way to connect AI models to different data sources and tools.
graph TB
subgraph "Client Layer"
A[MCP Client<br/>Claude AI]
end
subgraph "ggRMCP Gateway"
B[HTTP Server]
C[MCP Protocol Handler]
D[Session Manager]
E[Service Discoverer]
F[Connection Manager]
G[McpTool Builder]
H[Reflection Client]
end
subgraph "gRPC Services"
I[Service A]
J[Service B]
K[Service N...]
end
A -->|HTTP/JSON-RPC| B
B --> C
C --> D
C --> E
E --> F
E --> G
E --> H
F -->|gRPC Connection| I
F -->|gRPC Connection| J
F -->|gRPC Connection| K
H -->|Reflection API| I
Component | Location | Purpose |
---|---|---|
Connection Manager | pkg/grpc/connection.go |
Manages gRPC connections with health checking and reconnection |
Service Discoverer | pkg/grpc/discovery.go |
Discovers and manages gRPC services |
Reflection Client | pkg/grpc/reflection.go |
Handles gRPC reflection API for service discovery |
MCP Handler | pkg/server/handler.go |
Implements MCP protocol over HTTP |
Session Manager | pkg/session/manager.go |
Manages user sessions with rate limiting |
Tool Builder | pkg/tools/builder.go |
Generates JSON schemas from protobuf definitions |
Header Filter | pkg/headers/filter.go |
Filters and forwards HTTP headers to gRPC services |
Configuration | pkg/config/config.go |
Centralized configuration management |
Deploy ggRMCP as a sidecar container alongside your gRPC service:
graph LR
subgraph "Pod/Container Group"
subgraph "Your Service"
A[gRPC Service<br/>Any Language]
end
subgraph "Sidecar"
B[ggRMCP Gateway]
end
A -.->|localhost:50051| B
end
C[AI Client<br/>Claude/MCP] -->|HTTP/JSON-RPC<br/>:50053| B
Benefits:
Single ggRMCP instance serving multiple gRPC backends:
graph TB
A[AI Client] -->|HTTP/JSON-RPC| B[ggRMCP Gateway]
B -->|gRPC| C[User Service<br/>Java]
B -->|gRPC| D[Order Service<br/>Python]
B -->|gRPC| E[Payment Service<br/>Go]
B -->|gRPC| F[Inventory Service<br/>C++]
make
for building (optional)protoc
for generating FileDescriptorSet files (optional)The fastest way to test ggRMCP is using the included hello-service example:
git clone https://github.com/aalobaidi/ggRMCP
cd ggRMCP
go mod download
go build -o build/grmcp ./cmd/grmcp
cd examples/hello-service
# Build and run the hello service (default port 50051)
make run
# OR manually:
# go build -o hello-service .
# ./hello-service
# OR run on a custom port:
# ./hello-service --port=50052
This starts a gRPC service on localhost:50051
(or custom port) with reflection enabled and a SayHello
method.
Choose one of the following options:
Option a: Using gRPC Reflection
# From the project root
./build/grmcp --grpc-host=localhost --grpc-port=50051 --http-port=50053 --log-level=debug
Option b: Using FileDescriptorSet (Enhanced Schemas with Comments)
# Generate the FileDescriptorSet with comments
cd examples/hello-service
make descriptor
# Start gateway with descriptor file (from project root)
cd ../../
./build/grmcp --grpc-host=localhost --grpc-port=50051 --http-port=50053 --descriptor=examples/hello-service/build/hello.binpb --log-level=debug
# Check health
curl http://localhost:50053/health
# List available tools (should show hello_helloservice_sayhello)
curl -X POST http://localhost:50053/ \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
# Call the SayHello method
curl -X POST http://localhost:50053/ \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/call","id":2,"params":{"name":"hello_helloservice_sayhello","arguments":{"name":"World","email":"[email protected]"}}}'
cd examples/hello-service
make install-tools # Install protobuf tools (protoc-gen-go, protoc-gen-go-grpc)
make setup # Install tools and generate protobuf files
make build # Build the hello service binary
make run # Build and run the service
make proto # Generate protobuf Go files
make descriptor # Generate FileDescriptorSet for ggRMCP
make clean # Clean build artifacts
make help # Show available targets
npm install -g mcp-remote
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"grpc-gateway": {
"command": "mcp-remote",
"args": ["http://localhost:50053"],
"env": {}
}
}
}
Restart Claude Desktop to apply the configuration.
Test the connection - Claude should now have access to your gRPC service methods as tools. You can:
# Check gateway health
curl http://localhost:50053/health
# List available tools via MCP
curl -X POST http://localhost:50053/ \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
# Test calling the hello service
curl -X POST http://localhost:50053/ \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/call","id":2,"params":{"name":"hello_helloservice_sayhello","arguments":{"name":"Test","email":"[email protected]"}}}'
./build/grmcp --help
Flag | Default | Description |
---|---|---|
--grpc-host |
localhost |
gRPC server hostname |
--grpc-port |
50051 |
gRPC server port |
--http-port |
50053 |
HTTP server port for MCP gateway |
--log-level |
info |
Logging level (debug, info, warn, error) |
--dev |
false |
Enable development mode with detailed logging |
--descriptor |
"" |
Path to protobuf FileDescriptorSet file (.binpb) for enhanced schemas |
# Basic usage
./build/grmcp --grpc-host=localhost --grpc-port=50051
# With custom ports and debug logging
./build/grmcp --grpc-host=127.0.0.1 --grpc-port=9090 --http-port=8080 --log-level=debug
# Using FileDescriptorSet with development mode
./build/grmcp --grpc-host=localhost --grpc-port=50051 --descriptor=service.binpb --dev
ggRMCP supports two methods for discovering gRPC services:
Each discovered gRPC method becomes an MCP tool with:
ggRMCP supports loading protobuf FileDescriptorSet files (.binpb) to extract rich documentation and comments from your protobuf definitions. This feature provides enhanced tool schemas with meaningful descriptions for services, methods, and fields.
# Generate FileDescriptorSet from your .proto files
protoc --descriptor_set_out=service.binpb \
--include_source_info \
--include_imports \
--proto_path=/path/to/protos \
your_service.proto
# Use with ggRMCP
./build/grmcp --grpc-host=localhost --grpc-port=50051 --descriptor=service.binpb
With Reflection Only:
{
"name": "user_service_get_user",
"description": "Calls the GetUser method of the user.UserService service",
"inputSchema": {
"type": "object",
"properties": {
"user_id": {"type": "string"}
}
}
}
With FileDescriptorSet:
{
"name": "user_service_get_user",
"description": "Retrieves user information by ID with full profile data",
"inputSchema": {
"type": "object",
"properties": {
"user_id": {
"type": "string",
"description": "Unique identifier for the user account"
}
}
}
}
ggRMCP includes advanced header forwarding capabilities with security-focused filtering:
graph TD
A[HTTP Request Headers] --> B[Header Filter]
B --> C{Enabled?}
C -->|No| D[Block All Headers]
C -->|Yes| E{Check Blocked List}
E -->|Blocked| D
E -->|Not Blocked| F{Forward All Mode?}
F -->|Yes| G[Forward Header]
F -->|No| H{In Allowed List?}
H -->|Yes| G
H -->|No| D
G --> I[Add to gRPC Metadata]
D --> J[Skip Header]
Default Security Settings:
cookie
, set-cookie
, host
, content-length
, mcp-session-id
authorization
, x-trace-id
, user-agent
, x-request-id
graph TD
A[Incoming Request] --> B{Session Valid?}
B -->|No| C[Create Session]
B -->|Yes| D[Check Rate Limit]
C --> D
D -->|Exceeded| E[Rate Limit Error]
D -->|OK| F[Validate Input]
F -->|Invalid| G[Validation Error]
F -->|Valid| H[Process Request]
H --> I[Response]
Endpoint | Method | Purpose |
---|---|---|
/ |
GET |
MCP capability discovery |
/ |
POST |
JSON-RPC method calls |
/health |
GET |
Health check and service status |
/metrics |
GET |
Service statistics and metrics |
{
"status": "healthy",
"timestamp": "2024-01-01T12:00:00Z",
"serviceCount": 3,
"methodCount": 15
}
# Run all tests
make test
# Run tests with coverage
go test -race -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
# Run integration tests (requires running gRPC service)
go test -tags=integration ./tests/...
# List available tools
curl -X POST http://localhost:50053/ \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
# Call the hello service example
curl -X POST http://localhost:50053/ \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/call","id":2,"params":{"name":"hello_helloservice_sayhello","arguments":{"name":"Test User","email":"[email protected]"}}}'
# Install development tools
make install-tools
# Run linting
make lint
# Run tests with race detection
make test-race
# Build and run in development mode
make dev
1. Port already in use
# Check what's using the port
lsof -ti:50051
# Kill the process
kill $(lsof -ti:50051)
2. Protobuf generation fails
# Install protobuf tools manually
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
# Make sure protoc is installed
brew install protobuf # macOS
# or apt-get install protobuf-compiler # Ubuntu
3. gRPC service not discovered
4. MCP connection issues
This project is in active development. Contributions are welcome!
git checkout -b feature/amazing-feature
)make test
)git commit -m 'Add amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
This Go implementation is part of a family of gRPC-to-MCP gateways: