MCP Golang
Write Model Context Protocol servers in few lines of go code. Docs at https://mcpgolang.com . Created by https://metoro.io
What is MCP Golang?
MCP Golang is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to write model context protocol servers in few lines of go code. docs at https://mcpgolang.com . created by https://metoro.io
Write Model Context Protocol servers in few lines of go code. Docs at https://mcpgolang.com . Created by https://metoro.io
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Write Model Context Protocol servers in few lines of go code
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mcp-golangConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use MCP Golang
mcp-golang is a Go library that lets developers write Model Context Protocol servers and clients with minimal boilerplate. It provides a type-safe, struct-based API for registering tools, prompts, and resources, with automatic JSON Schema generation from Go struct tags. The library supports stdio and HTTP transports out of the box, and can be extended with custom transports. Created by Metoro.io, it is the foundation for building high-performance MCP servers in Go that integrate with Claude, Cursor, and any other MCP-compatible client.
Prerequisites
- Go 1.21+ installed (the library uses modern Go features)
- A Go module initialized in your project (go mod init)
- An MCP-compatible client such as Claude Desktop or Cursor to test your server
- Familiarity with Go structs and the standard library
Add mcp-golang to your Go module
Run go get to add the mcp-golang library as a dependency in your Go project.
go get github.com/metoro-io/mcp-golangCreate a server with stdio transport
Import the library and create a new MCP server using the stdio transport. Stdio is the standard transport for MCP servers used with Claude Desktop and Claude Code.
package main
import (
mcp "github.com/metoro-io/mcp-golang"
"github.com/metoro-io/mcp-golang/transport/stdio"
)
func main() {
server := mcp.NewServer(stdio.NewStdioServerTransport())
server.Serve()
}Define tool arguments as Go structs
Use Go structs with jsonschema tags to define tool input arguments. The library automatically generates the JSON Schema for each tool from the struct definition, including descriptions and validation rules.
type GreetArgs struct {
Name string `json:"name" jsonschema:"required,description=The name of the person to greet"`
Formal bool `json:"formal" jsonschema:"description=Use formal language"`
}Register tools with handler functions
Register tools by providing a name, description, and handler function. The handler receives the parsed struct arguments and returns a result or error. The library handles serialization automatically.
err := server.RegisterTool("greet", "Greet a person by name", func(args GreetArgs) (*mcp.ToolResponse, error) {
msg := "Hello, " + args.Name + "!"
if args.Formal {
msg = "Good day, " + args.Name + "."
}
return mcp.NewToolResponse(mcp.NewTextContent(msg)), nil
})
if err != nil {
panic(err)
}Build and register the server with your MCP client
Build the server binary and add it to your MCP client configuration. The compiled binary is the value for the command field in your client config.
go build -o my-mcp-server .Configure Claude Desktop to use the server
Add the compiled binary to your claude_desktop_config.json so Claude Desktop launches your server as an MCP tool provider.
{
"mcpServers": {
"my-golang-server": {
"command": "/path/to/my-mcp-server",
"args": [],
"env": {}
}
}
}MCP Golang Examples
Client configuration
Register a compiled Go MCP server binary in Claude Desktop. Replace the command path with the actual path to your built binary.
{
"mcpServers": {
"golang-mcp-server": {
"command": "/Users/you/projects/my-mcp-server/my-mcp-server",
"args": [],
"env": {}
}
}
}Prompts to try
Once your Go MCP server is running and registered, use prompts like these to exercise the tools you registered.
- "Greet Alice formally using the greet tool"
- "What tools does this server expose?"
- "Call the greet tool with name 'Bob' and informal style"Troubleshooting MCP Golang
Claude Desktop does not see the server's tools
Ensure the command path in claude_desktop_config.json points to the compiled binary (not the source directory). Run the binary manually in a terminal to confirm it starts without errors, then restart Claude Desktop.
JSON Schema validation errors when calling tools
Check that your struct fields use correct jsonschema tags. Required fields must have the 'required' tag, and field types must be JSON-serializable. Run 'go vet ./...' to catch any struct tag syntax issues.
HTTP transport does not support notifications
This is a known limitation documented in the library: HTTP transports are stateless and do not support bidirectional features like server-sent notifications. Use the stdio transport for full MCP feature support, or implement a custom transport.
Frequently Asked Questions about MCP Golang
What is MCP Golang?
MCP Golang is a Model Context Protocol (MCP) server that write model context protocol servers in few lines of go code. docs at https://mcpgolang.com . created by https://metoro.io It connects AI assistants to external tools and data sources through a standardized interface.
How do I install MCP Golang?
Follow the installation instructions on the MCP Golang GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with MCP Golang?
MCP Golang works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MCP Golang free to use?
Yes, MCP Golang is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
MCP Golang Alternatives — Similar Developer Tools Servers
Looking for alternatives to MCP Golang? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up MCP Golang in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use MCP Golang?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.