mcpField
M
mcp-grpc-transport

mcp-grpc-transport

Local
github.com/rustycl0ckDeveloper Tools4Updated 71w ago

About mcp-grpc-transport

mcp-grpc-transport adds gRPC communication to MCP servers built with two supported Go libraries. It is intended for hosting servers remotely while reusing existing authentication and authorization infrastructure.

Key features

  1. 01gRPC transport for MCP
  2. 02Support for two Go MCP libraries
  3. 03Configurable server options
  4. 04CLI client for local testing

Use cases

  1. 01Host an MCP server on a remote instance
  2. 02Use existing gRPC authentication and authorization processes
  3. 03Test MCP requests from the command line

MCP support

It provides a gRPC transport for communication between MCP clients and servers, with support for metoro-io/mcp-golang and mark3labs/mcp-go.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

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

Supports only the two most widely used libraries currently:

Usage

With metoro-io library

Tip

Full example is available at examples/metoro-io-server/main.go

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)
}
With mark3labs library

Tip

Full example is available at examples/mark3labs-server/main.go

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

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

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.