
redpanda-data/protoc-gen-go-mcp
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
redpanda-data/protoc-gen-go-mcp は、https://github.com/redpanda-data/protoc-gen-go-mcp. からインポートされた MCP サーバー候補です。
概要
redpanda-data/protoc-gen-go-mcp は、https://github.com/redpanda-data/protoc-gen-go-mcp. からインポートされた MCP サーバー候補です。
概要(AI 翻訳)
protoc-gen-go-mcp は、gRPCまたはConnectRPCのAPI向けにモデルコンテキストプロトコル(MCP)サーバーを生成するプロトコルバッファコンパイラプラグインです。
各protobufサービスごとに*.pb.mcp.goファイルを生成し、ハンドラを直接gRPCサーバーやクライアントに委任できるようにします。内部では、MCPはツール入力にJSONスキーマを使用しています。protoc-gen-go-mcpはメソッド入力ディスクリプタからこれらのスキーマを自動的に生成します。
生成コードはMCPライブラリに依存しない:サーバー作成時に薄いアダプターを使ってmodelcontextprotocol/go-sdk、またはmark3labs/mcp-goを選べます。再生成は不要です。
特徴
.protoサービスからMCPハンドラーを自動的に生成する- メソッド入力用のJSONスキーマ出力
- gRPCまたはConnectRPCサーバー/クライアントへの有線接続
- [[T6]との容易な統合
- ランタイムLLMプロバイダー選択 – 標準的なMCPまたはOpenAI互換スキーマ
- MCPライブラリに依存しない – 公式のgo-sdkおよびmark3labs/mcp-goの両方に対応しています
使用法
コードを生成
buf.gen.yamlにエントリーを追加:
標準の*.pb.goファイルも生成する必要があります。protoc-gen-go-mcpはデフォルトで別のサブフォルダ{$servicename}mcpを使用し、'*pbをインポートします。
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
protoc-gen-go-mcp
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.
Generated code is MCP-library-agnostic: pick modelcontextprotocol/go-sdk (the official SDK) or mark3labs/mcp-go at server creation time through a thin adapter – no regeneration needed.
Features
- Auto-generates MCP handlers from your
.protoservices - Outputs JSON Schema for method inputs
- Wire up to gRPC or ConnectRPC servers/clients
- Easy integration with
buf - Runtime LLM provider selection – standard MCP or OpenAI-compatible schemas
- MCP library agnostic – official go-sdk and mark3labs/mcp-go both supported
Usage
Generate code
Add entry to your buf.gen.yaml:
...
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:
tree pkg/testdata/gen/
gen
go
testdata
test_service.pb.go
testdataconnect/
test_service.connect.go
testdatamcp/
test_service.pb.mcp.go
Setting up the MCP server
Generated code programs against the runtime.MCPServer interface. You choose the backing MCP library by importing the corresponding adapter package.
With the official go-sdk (recommended)
import (
"github.com/modelcontextprotocol/go-sdk/mcp"
"github.com/redpanda-data/protoc-gen-go-mcp/pkg/runtime/gosdk"
)
// Create server -- raw is *mcp.Server for transport, s is runtime.MCPServer for tools.
raw, s := gosdk.NewServer("my-server", "1.0.0")
testdatamcp.RegisterTestServiceHandler(s, &srv)
// Serve over stdio
raw.Run(ctx, &mcp.StdioTransport{})
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →