Sponsored by Deepsite.site

mcp-grpc-transport

Created By
rustycl0cka year ago
gRPC transport for MCP servers
Content

mcp-grpc-transport

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

Only supports metoro-io/mcp-golang library currently

Usage

In the metoro-io/mcp-golang server 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(1024*1024),        // 1MB
			grpc.Creds(insecure.NewCredentials()), // TODO: Use TLS in production!
		),
	)

	// Create a new server with the transport
	server := mcp_golang.NewServer(serverTransport)
}

Example

Start the server:

$ 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's mcp.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"}]}}

License

MIT

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
ChatWiseThe second fastest AI chatbot™
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Playwright McpPlaywright MCP server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
CursorThe AI Code Editor
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Amap Maps高德地图官方 MCP Server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
DeepChatYour AI Partner on Desktop
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
RedisA Model Context Protocol server that provides access to Redis databases. This server enables LLMs to interact with Redis key-value stores through a set of standardized tools.
Tavily Mcp
WindsurfThe new purpose-built IDE to harness magic
Serper MCP ServerA Serper MCP Server