
metoro-io/mcp-golang
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
数行のgoコードでモデルコンテキストプロトコルサーバーを書き込むことができます。ドキュメントはhttps://mcpgolang.comで。[[T1]によって作成されました。
概要
mcp-golangは、GoにおけるModel Context Protocolの非公式実装です。 数行のコードでGolangでMCPサーバーとクライアントを書いてください。 - 🛡️ ** - ツールの引数をネイティブのgo構造体として定義し、残りはmcp-golangに任せます。スキーマ生成、非直列化、エラー処理などを自動で行う。- 🚛 - 組み込みのトランスポート(stdioで完全な機能サポート、HTTPで状態なし通信)を使うか、自分で作成してください。- ⚡ - mcp-golangはツール、プロンプト、リソースを除くすべてのMCPエンドポイントを生成します。- 🧩 ライブラリはトランスポート、プロトコル、サーバー/クライアントの3つのコンポーネントに分かれています。すべてを使うか、必要なものを使ってください。- 🔄 - stdioトランスポートを通じてサーバーとクライアントの両方の実装を完全にサポートします。 Go Get github.com/metoro-io/mcp-golang でインストールしてください 標準的なHTTPトランスポートまたはGinフレームワークを使ってHTTPベースのサーバーを作成することもできます。 注:HTTPトランスポートはステートレスで、通知のような双方向機能をサポートしていません。
概要(AI 翻訳)
mcp-golangは、GoにおけるModel Context Protocolの非公式実装です。
数行のコードでGolangでMCPサーバーとクライアントを書いてください。
https://mcpgolang.com のドキュメンタリー
ハイライト
- 🛡️ 型安全性 - ツールの引数をネイティブのGo構造体として定義し、残りはmcp-golangで処理します。自動スキーマ生成、デシリアライズ、エラー処理など。
- 🚛 カスタムトランスポート - 組み込みトランスポート(stdioで完全な機能サポート、HTTPでステートレス通信)を使うか、自分で作成してください。
- ⚡ 低ボイラープレート - mcp-golangはツール、プロンプト、リソースを除くすべてのMCPエンドポイントを生成します。
- 🧩 モジュール式 - ライブラリはトランスポート、プロトコル、サーバー/クライアントの3つのコンポーネントに分かれています。すべてを使うか、必要なものを使ってください。
- 🔄 双方向 - stdioトランスポートを通じてサーバーとクライアントの両方の実装を完全にサポートします。
使用例
go get github.com/metoro-io/mcp-golangでインストール
サーバー例
HTTPサーバーの例
標準的なHTTPトランスポートまたはGinフレームワークを使ってHTTPベースのサーバーを作成することもできます。
注:HTTPトランスポートはステートレスで、通知のような双方向機能をサポートしていません。
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
mcp-golang
mcp-golang is an unofficial implementation of the Model Context Protocol in Go.
Write MCP servers and clients in golang with a few lines of code.
Docs at https://mcpgolang.com
Highlights
- 🛡️Type safety - Define your tool arguments as native go structs, have mcp-golang handle the rest. Automatic schema generation, deserialization, error handling etc.
- 🚛 Custom transports - Use the built-in transports (stdio for full feature support, HTTP for stateless communication) or write your own.
- ⚡ Low boilerplate - mcp-golang generates all the MCP endpoints for you apart from your tools, prompts and resources.
- 🧩 Modular - The library is split into three components: transport, protocol and server/client. Use them all or take what you need.
- 🔄 Bi-directional - Full support for both server and client implementations through stdio transport.
Example Usage
Install with go get github.com/metoro-io/mcp-golang
Server Example
package main
import (
"fmt"
"github.com/metoro-io/mcp-golang"
"github.com/metoro-io/mcp-golang/transport/stdio"
)
// Tool arguments are just structs, annotated with jsonschema tags
// More at https://mcpgolang.com/tools#schema-generation
type Content struct {
Title string `json:"title" jsonschema:"required,description=The title to submit"`
Description *string `json:"description" jsonschema:"description=The description to submit"`
}
type MyFunctionsArguments struct {
Submitter string `json:"submitter" jsonschema:"required,description=The name of the thing calling this tool (openai, google, claude, etc)"`
Content Content `json:"content" jsonschema:"required,description=The content of the message"`
}
func main() {
done := make(chan struct{})
server := mcp_golang.NewServer(stdio.NewStdioServerTransport())
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →設定
{
"mcpServers": {
"golang-mcp-server": {
"command": "<your path to golang MCP server go executable>",
"args": [],
"env": {}
}
}
}