
stablekernel/protoc-gen-go-mcp
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
プロトコルバッファ仕様から golang で mcp サーバーを生成するための protoc プラグイン
概要
protoc-gen-go-mcp(プロトック) ----------------- これは、プロトコルバッファ定義に基づくモデル・コンテキスト・プロトコル(MCP)サーバーを生成する protoc コンパイラ用の Topeka プラグインです。 概念的に、AIモデルは、既存のgRPCコードベースを自然言語で使用できるようにし、プロトタイプの高速化とPLM機能の活用を可能にして、試作ベースのコードベース。 - 1.20以降 - protoc 3.20以降 - protoc-gen-go-grpc 1.71以降 explicit コマンドの使用方法の Makefile をチェックします。 make を使用して、proto ファイルから MCP サーバーを生成します。 ポート2345のヘッドレスモードでデベデバッガーを起動します。 デバッグ中のファイルは $GOPATH/bin/protoc-gen-go-mcp になります。 次の launch.json 設定で VSCode に接続できます。 mcp-vibe サーバーを mcp サーバーに追加します。 プラグインは、プロトコルバッファとgRPCサーバーの既存のコード生成を使用し、必要な部品を使用して再利用します.
概要(AI 翻訳)
protoc-gen-go-mcp(プロトック)
これは、プロトコルバッファ定義に基づくモデル・コンテキスト・プロトコル(MCP)サーバーを生成する protoc コンパイラ用の Topeka プラグインです。 概念的に、AIモデルは、既存のgRPCコードベースを自然言語で使用できるようにし、プロトタイプの高速化とPLM機能の活用を可能にして、試作ベースのコードベース。
前提条件
- 1.25以降(生成されたコードのインポート) MCP SDKの公式ページです。
- protoc 29.3 (このバージョン
プラグインがテストされます。 [
Makefileを参照してください。AGENTS.md] - プロトックゲンゴ
v1.36.6および
protoc-gen-go-grpc の
v1.5.1 (
tool) ディレクティブとしてピン留めされたバージョン [go.mod]]
プラグインを実行する
explicit コマンドの使用方法の Makefile をチェックします。 make generate を使用して、proto ファイルから MCP サーバーを生成します。
####プラグインのデバッグ
ポート2345のヘッドレスモードでデベデバッガーを起動します。 下のファイル
デバッグは[$GOPATH/bin/protoc-gen-go-mcp]となります。 VSCodeで接続できます
下記の[launch.jsonの構成で。
サンプルのテスト
例[mcp-vibeサーバをインストール
mcp サーバーに [mcp-vibe サーバーを追加します
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
protoc-gen-go-mcp
This is a Topeka plugin for the protoc compiler that generates a model-context-protocol(MCP) server based on a protocol buffer definition. Conceptually, this allows an AI model to use existing gRPC codebases with natural language, allowing for rapid prototyping and usage of LLM capabilities for protobuf based codebases.
Prerequisites
- Go 1.25 or later (the generated code imports the official MCP SDK, which requires it)
- protoc 29.3 (the version this
plugin is tested against; see
MakefileandAGENTS.md) - protoc-gen-go
v1.36.6 and
protoc-gen-go-grpc
v1.5.1 (the exact versions pinned as
tooldirectives ingo.mod)
Running the plugin
Check out the Makefile for explicit command usage. Use make generate to generate the example MCP server from the proto file.
Debugging the plugin
make start-debugger
Will start the delve debugger in headless mode on port 2345. The file under
debug will be $GOPATH/bin/protoc-gen-go-mcp. You can connect to that in VSCode
with the following launch.json configuration.
{
"name": "Connect to protoc-gen-go-mcp plugin",
"type": "go",
"request": "attach",
"mode": "remote",
"remotePath": "${workspaceFolder}",
"port": 2345,
"host": "127.0.0.1"
}
Testing the example
Install the example mcp-vibe server
go install ./cmd/mcp-vibe
Add the mcp-vibe server to your mcp servers:
{
"mcpServers": {
"vibe": {
"command": "mcp-vibe"
}
}
}
What the plugin generates
A generated NewMCPServer wraps a gRPC client and an
*mcp.Server
from the official Go MCP SDK.
Once you’ve called RegisterDefaultTools() (or registered individual tools,
see below), serve that *mcp.Server the way any MCP server is served. The
two most common transports:
// client is a examplev1.VibeServiceClient for the backend gRPC service, e.g.
// examplev1.NewVibeServiceClient(conn) for a grpc.ClientConn.
// Over stdio, for CLI-launched MCP clients (see cmd/mcp-vibe/main.go for the
// full, runnable version of this).
stdioServer := mcp.NewServer(&mcp.Implementation{Name: "vibe", Version: "0.0.1"}, nil)
examplev1.NewVibeServiceMCPServer(client, stdioServer).RegisterDefaultTools()
if err := stdioServer.Run(ctx, &mcp.StdioTransport{}); err != nil {
panic(err)
}
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →設定
{
"mcpServers": {
"vibe": {
"command": "mcp-vibe"
}
}
}