Track MCP LogoTrack MCP
Track MCP LogoTrack MCP

The world's largest repository of Model Context Protocol servers. Discover, explore, and submit MCP tools.

Product

  • Categories
  • Top MCP
  • New & Updated
  • Submit MCP

Company

  • About

Legal

  • Privacy Policy
  • Terms of Service
  • Cookie Policy

© 2026 TrackMCP. All rights reserved.

Built with ❤️ by Krishna Goyal

    Protoc Gen Go Mcp

    Go protobuf compiler extension to turn any gRPC service into an MCP server

    169 stars
    Go
    Updated Oct 24, 2025

    Table of Contents

    • ✨ Features
    • 🔧 Usage
    • Generate code
    • Wiring Up MCP with gRPC server (in-process)
    • Runtime LLM Provider Selection
    • Wiring up with grpc and connectrpc client
    • Extra properties
    • LLM Provider Compatibility
    • Standard MCP
    • OpenAI Compatible
    • Migration from openai_compat flag
    • Development & Testing
    • Commands
    • Development Workflow
    • Golden File Testing
    • ⚠️ Limitations
    • 🗺️ Roadmap
    • 💬 Feedback

    Table of Contents

    • ✨ Features
    • 🔧 Usage
    • Generate code
    • Wiring Up MCP with gRPC server (in-process)
    • Runtime LLM Provider Selection
    • Wiring up with grpc and connectrpc client
    • Extra properties
    • LLM Provider Compatibility
    • Standard MCP
    • OpenAI Compatible
    • Migration from openai_compat flag
    • Development & Testing
    • Commands
    • Development Workflow
    • Golden File Testing
    • ⚠️ Limitations
    • 🗺️ Roadmap
    • 💬 Feedback

    Documentation

    protoc-gen-go-mcp

    Test

    Go Report Card

    codecov

    **protoc-gen-go-mcp** is a Protocol Buffers compiler plugin that generates Model Context Protocol (MCP) servers for your gRPC or ConnectRPC APIs.

    It generates *.pb.mcp.go files for each protobuf service, enabling you to delegate handlers directly to gRPC servers or clients. Under the hood, MCP uses JSON Schema for tool inputs—protoc-gen-go-mcp auto-generates these schemas from your method input descriptors.

    ⚠️ Currently supports mark3labs/mcp-go as the MCP server runtime. Future support is planned for official Go SDKs and additional runtimes.

    ✨ Features

    • 🚀 Auto-generates MCP handlers from your .proto services
    • 📦 Outputs JSON Schema for method inputs
    • 🔄 Wire up to gRPC or ConnectRPC servers/clients
    • 🧩 Easy integration with [buf](https://buf.build)
    • 🎯 Runtime LLM provider selection - Choose between standard MCP and OpenAI-compatible schemas at runtime

    🔧 Usage

    Generate code

    Add entry to your buf.gen.yaml:

    code
    ...
    plugins:
      - local:
          - go
          - run
          - github.com/redpanda-data/protoc-gen-go-mcp/cmd/protoc-gen-go-mcp@latest
        out: ./gen/go
        opt: paths=source_relative

    You need to generate the standard *.pb.go files as well. protoc-gen-go-mcp by defaults uses a separate subfolder {$servicename}mcp, and imports the *pb.go files - similar to connectrpc-go.

    After running buf generate, you will see a new folder for each package with protobuf Service definitions:

    code
    tree pkg/testdata/gen/
    gen
    └── go
        └── testdata
            ├── test_service.pb.go
            ├── testdataconnect/
            │   └── test_service.connect.go
            └── testdatamcp/
                └── test_service.pb.mcp.go

    Wiring Up MCP with gRPC server (in-process)

    Example for in-process registration:

    go
    srv := testServer{} // your gRPC implementation
    
    // Register all RPC methods as tools on the MCP server
    testdatamcp.RegisterTestServiceHandler(mcpServer, &srv)

    Each RPC method in your protobuf service becomes an MCP tool.

    Runtime LLM Provider Selection

    New! You can now choose LLM compatibility at runtime without regenerating code:

    go
    // Option 1: Use convenience function with runtime provider selection
    provider := testdatamcp.LLMProviderOpenAI // or LLMProviderStandard
    testdatamcp.RegisterTestServiceHandlerWithProvider(mcpServer, &srv, provider)
    
    // Option 2: Register specific handlers directly
    testdatamcp.RegisterTestServiceHandler(mcpServer, &srv)        // Standard MCP
    testdatamcp.RegisterTestServiceHandlerOpenAI(mcpServer, &srv)  // OpenAI-compatible
    
    // Option 3: Register both for different tool names
    testdatamcp.RegisterTestServiceHandler(mcpServer, &srv)
    testdatamcp.RegisterTestServiceHandlerOpenAI(mcpServer, &srv)

    Environment variable example:

    go
    providerStr := os.Getenv("LLM_PROVIDER")
    var provider testdatamcp.LLMProvider
    switch providerStr {
    case "openai":
        provider = testdatamcp.LLMProviderOpenAI
    case "standard":
        fallthrough
    default:
        provider = testdatamcp.LLMProviderStandard
    }
    testdatamcp.RegisterTestServiceHandlerWithProvider(mcpServer, &srv, provider)

    ➡️ See the full example for details.

    Wiring up with grpc and connectrpc client

    It is also possible to directly forward MCP tool calls to gRPC clients.

    go
    testdatamcp.ForwardToTestServiceClient(mcpServer, myGrpcClient)

    Same for connectrpc:

    go
    testdatamcp.ForwardToConnectTestServiceClient(mcpServer, myConnectClient)

    This directly connects the MCP handler to the connectrpc client, requiring zero boilerplate.

    Extra properties

    It's possible to add extra properties to MCP tools, that are not in the proto. These are written into context.

    go
    // Enable URL override with custom field name and description
    option := runtime.WithExtraProperties(
        runtime.ExtraProperty{
            Name:        "base_url",
            Description: "Base URL for the API",
            Required:    true,
            ContextKey:  MyURLOverrideKey{},
        },
    )
    
    // Use with any generated function
    testdatamcp.RegisterTestServiceHandler(mcpServer, &srv, option)
    testdatamcp.ForwardToTestServiceClient(mcpServer, client, option)

    LLM Provider Compatibility

    The generator now creates both standard MCP and OpenAI-compatible handlers automatically. You can choose which to use at runtime:

    Standard MCP

    • Full JSON Schema support (additionalProperties, anyOf, oneOf)
    • Maps represented as JSON objects
    • Well-known types use native JSON representations

    OpenAI Compatible

    • Restricted JSON Schema (no additionalProperties, anyOf, oneOf)
    • Maps converted to arrays of key-value pairs
    • Well-known types (Struct, Value, ListValue) encoded as JSON strings
    • All fields marked as required with nullable unions

    Migration from openai_compat flag

    The old openai_compat=true protoc option is deprecated but still supported for backward compatibility. With the new approach:

    Before (compile-time):

    yaml
    # buf.gen.yaml
    plugins:
      - local: [.../protoc-gen-go-mcp]
        out: ./gen/go
        opt: paths=source_relative,openai_compat=true

    After (runtime):

    go
    // Choose at runtime
    testdatamcp.RegisterTestServiceHandlerWithProvider(server, srv, testdatamcp.LLMProviderOpenAI)

    Development & Testing

    Commands

    All commands use just:

    bash
    just build                # Build everything (Bazel)
    just test-unit            # Unit + golden tests (no API keys needed)
    just test                 # All tests including conformance/integration (needs API keys)
    just test-cover           # Tests with coverage report
    just generate             # Regenerate proto code + descriptor set
    just lint                 # Run golangci-lint
    just fmt                  # Format code
    just install              # Install binary to GOPATH/bin
    just gazelle              # Sync BUILD files from go.mod
    
    # View all available commands
    just --list

    Development Workflow

    bash
    # 1. Edit proto or generator code
    # 2. Regenerate
    just generate
    # 3. Run tests
    just test-unit

    Golden File Testing

    The generator uses golden file testing to ensure output consistency. Tests re-run the generator in-process from compiled descriptors and compare against checked-in *.pb.mcp.go files.

    To add new tests: Drop a .proto file in pkg/testdata/proto/testdata/ and run just generate. The golden test automatically discovers all generated files and compares them.

    ⚠️ Limitations

    • No interceptor support (yet). Registering with a gRPC server bypasses interceptors.
    • Tool name mangling for long RPC names: If the full RPC name exceeds 64 characters (Claude desktop limit), the head of the tool name is mangled to fit.

    🗺️ Roadmap

    • Reflection/proxy mode
    • Interceptor middleware support in gRPC server mode
    • Support for the official Go MCP SDK (once published)

    💬 Feedback

    We'd love feedback, bug reports, or PRs! Join the discussion and help shape the future of Go and Protobuf MCP tooling.

    Similar MCP

    Based on tags & features

    • YU

      Yutu

      Go·
      317
    • MC

      Mcp K8s

      Go·
      128
    • MC

      Mcpjungle

      Go·
      617
    • AN

      Anyquery

      Go·
      1.4k

    Trending MCP

    Most active this week

    • PL

      Playwright Mcp

      TypeScript·
      22.1k
    • SE

      Serena

      Python·
      14.5k
    • MC

      Mcp Playwright

      TypeScript·
      4.9k
    • MC

      Mcp Server Cloudflare

      TypeScript·
      3.0k
    View All MCP Servers

    Similar MCP

    Based on tags & features

    • YU

      Yutu

      Go·
      317
    • MC

      Mcp K8s

      Go·
      128
    • MC

      Mcpjungle

      Go·
      617
    • AN

      Anyquery

      Go·
      1.4k

    Trending MCP

    Most active this week

    • PL

      Playwright Mcp

      TypeScript·
      22.1k
    • SE

      Serena

      Python·
      14.5k
    • MC

      Mcp Playwright

      TypeScript·
      4.9k
    • MC

      Mcp Server Cloudflare

      TypeScript·
      3.0k