★ 1223 Go MIT sse 更新 9小时前

Golang

Write Model Context Protocol servers in few lines of go code. Docs at https://mcpgolang.com . Created by https://metoro.io

安装配置

{
    "mcpServers": {
        "golang-mcp-server": {
            "command": "<your path to golang MCP server go executable>",
            "args": [],
            "env": []
        }
    }
}

README 摘要

![GitHub stars](https://img.shields.io/github/stars/metoro-io/mcp-golang?style=social) ![GitHub forks](https://img.shields.io/github/forks/metoro-io/mcp-golang?style=social) ![GitHub issues](https://img.shields.io/github/issues/metoro-io/mcp-golang) ![GitHub pull requests](https://img.shields.io/github/issues-pr/metoro-io/mcp-golang) ![GitHub license](https://img.shields.io/github/license/metoro-io/mcp-golang) ![GitHub contributors](https://img.shields.io/github/contributors/metoro-io/mcp-golang) ![GitHub last commit](https://img.shields.io/github/last-commit/metoro-io/mcp-golang) [![GoDoc](https://pkg.go.dev/badge/github.com/metoro-io/mcp-golang.svg)](https://pkg.go.dev/github.com/metoro-io/mcp-golang) [![Go Report Card](https://goreportcard.com/badge/github.com/metoro-io/mcp-golang)](https://goreportcard.com/report/github.com/metoro-io/mcp-golang) ![Tests](https://github.com/metoro-io/mcp-golang/actions/workflows/go-test.yml/badge.svg) # mcp-golang mcp-golang is an unofficial implementation of the [Model Context Protocol](https://modelcontextprotocol.io/) in Go. Write MCP servers and clients in golang with a few lines of code. Docs at [https://mcpgolang.com](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 ```go 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()) err := server.RegisterTool("hello", "Say hello to a person", func(arguments MyFunctionsArguments) (*mcp_golang.ToolResponse, error) { return mcp_golang.NewToolResponse(mcp_golang.NewTextContent(fmt.Sprintf("Hello, %server!", arguments.Submitter))), nil }) if err != nil { panic(err) } err = server.RegisterPrompt("promt_test", "This is a test prompt", func(arguments Content) (*mcp_golang.PromptResponse, error) { return mcp_golang.NewPromptResponse("description", mcp_golang.NewPromptMessage(mcp_golang.NewTextContent(fmt.Sprintf("Hello, %server!", arguments.Title)), mcp_golang.RoleUser)), nil }) if err != nil { panic(err) } er...

相关 MCP

Fastapi

Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth!

★ 11868 Python sse 待补充
mcp Python sse

Chrome

Chrome MCP Server is a Chrome extension-based Model Context Protocol (MCP) server that exposes your Chrome browser funct...

★ 11659 TypeScript sse 有配置
mcp sse TypeScript

Unity

Unity MCP acts as a bridge, allowing AI assistants (like Claude, Cursor) to interact directly with your Unity Editor via...

★ 9756 C# sse 有配置
mcp sse C#

Go

A Go implementation of the Model Context Protocol (MCP), enabling seamless integration between LLM applications and exte...

★ 8720 Go sse 待补充
mcp sse Go

Agent

Build effective agents using Model Context Protocol and simple workflow patterns

★ 8327 Python sse 待补充
mcp Python sse

Registry

A community driven registry service for Model Context Protocol (MCP) servers.

★ 6836 Go sse 待补充
mcp sse Go