MCP gRPC Transport

by rustycl0ck

329 downloads
Not rated
GitHub

About

A gRPC transport for MCP, enabling communication between clients and remote MCP servers.

Details

Author
rustycl0ck
Downloads
329
Categories
Communication, API, Developer Tools

- Integrates MCP with gRPC for remote hosting.
- Currently supports the metoro-io/mcp-golang library.
- Server customization via gRPC options (port, interceptors, message size, TLS).
- Includes a ready-to-use client tool for testing and IDE integration.

Replace the default stdio transport with grpctransport.NewGrpcServerTransport() in your server code. Customize via options like WithPort and WithGrpcOpts. For clients, use the provided CLI tool (go run github.com/rustycl0ck/mcp-grpc-transport/cmd/client@latest) or configure your IDE (e.g., Cursor) to launch the client as the MCP command.

A gRPC transport for MCP, enabling communication between clients and remote MCP servers.

An MCP transport which uses gRPC for communication between the client and the MCP server. This will make it easier to host MCP servers on remote instances just like any other web servers.

Usage of gRPC as the transport, allows to reuse any existing infrastructure and processes for authentication and authorization.

[!NOTE] Supports only the two most widely used libraries currently:

- metoro-io/mcp-golang- UpstreamPR #118
-
mark3labs/mcp-go

[!TIP] Full example is available atexamples/metoro-io-server/main.go

In themetoro-io/mcp-golangserver example, just replace the transport as follows:

+ import grpctransport "github.com/rustycl0ck/mcp-grpc-transport/pkg/metoro-io-transport/grpc" func main() { ... - server := mcp_golang.NewServer(stdio.NewStdioServerTransport()) + server := mcp_golang.NewServer(grpctransport.NewGrpcServerTransport()) ... }

You can customize the server with more options if required:

import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" ) func main(){ serverTransport := grpctransport.NewGrpcServerTransport( grpctransport.WithPort(10051), grpctransport.WithGrpcOpts( grpc.UnaryInterceptor(loggingInterceptor), grpc.MaxRecvMsgSize(10241024), // 1MB grpc.Creds(insecure.NewCredentials()), // TODO: Use TLS in production! ), ) // Create a new server with the transport server := mcp_golang.NewServer(serverTransport) }

[!TIP] Full example is available atexamples/mark3labs-server/main.go

In themark3labs/mcp-goserver example, just replace the transport as follows:

+ import grpctransport "github.com/rustycl0ck/mcp-grpc-transport/pkg/mark3labs-transport/grpc" func main() { ... // Start the server - if err := server.ServeStdio(s); err != nil { - fmt.Printf("Server error: %v\n", err) - } + srv := grpctransport.NewGrpcServer(s) + if err := srv.Listen(context.Background()); err != nil { + fmt.Printf("Server error: %v\n", err) + } ... }

You can customize the server with more options if required:

import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" ) func main(){ - srv := grpctransport.NewGrpcServer(s) + srv := grpctransport.NewGrpcServer(s, grpctransport.WithPort(10051), grpctransport.WithGrpcOpts( grpc.UnaryInterceptor(loggingInterceptor), grpc.MaxRecvMsgSize(10241024), // 1MB grpc.Creds(insecure.NewCredentials()), // TODO: Use TLS in production! ), ) }
$ go run examples/metoro-io-server.go transport started... Received message... transport started... Received message...

Configure your IDE client (following confugration is for Cursor IDE'smcp.json)

{ "mcpServers": { "my-mcp-server": { "command": "go", "args": [ "run", "github.com/rustycl0ck/mcp-grpc-transport/cmd/client@latest", "--address", "localhost:50051" // Replace with actual server location if hosted remotely ] } } }

Or test the client locally directly through CLI:

$ echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | go run github.com/rustycl0ck/mcp-grpc-transport/cmd/client@latest {"id":1,"jsonrpc":"2.0","result":{"tools":[{"description":"Get the weather forecast for temperature, wind speed and relative humidity","inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{"latitude":{"description":"The latitude of the location to get the weather for","type":"number"},"longitude":{"description":"The longitude of the location to get the weather for","type":"number"}},"required":["longitude","latitude"],"type":"object"},"name":"get_weather"},{"description":"Says hello","inputSchema":{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{"name":{"description":"The name to say hello to","type":"string"}},"required":["name"],"type":"object"},"name":"hello"}]}}

Enables seamless integration with communication platform that allows you to reach your customers globally across any channel.

Interact with any other SaaS applications on behalf of your customers.

Official MCP Server to interact with Pearl API. Connect your AI Agents with 12,000+ certified experts instantly.

Platfone - Receive SMS & Virtual Numbers MCP

Virtual phone number platform for AI agents — rent numbers across 200+ countries, receive SMS, and manage the full activation lifecycle

Send emails directly from your editor using the Resend API.

Sendmux is an email inbox API and email API for AI agents.

Sinch Engage (Sinch MessageMedia in AU) MCP server, which provides Sinch Engage APIs as MCP tools.

Wavix is a global communications platform offering APIs for voice, SMS, 2FA, and phone numbers. Our MCP server brings these capabilities to AI agents and agentic workflows.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.