MCP Golang

v1.0.0Developer Toolsstable

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

mcp-golangmcpai-integration
Share:
1,223
Stars
0
Downloads
0
Weekly
0/5

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

Write MCP servers using minimal Go code.
Build servers quickly with Go's simplicity and performance.
metoro-io

Maintainer

LicenseMIT
Languagego
Versionv1.0.0
UpdatedMay 16, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mcp-golang

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

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-golang
2

Create 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()
}
3

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"`
}
4

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)
}
5

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 .
6

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.

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.

Quick Config Preview

{ "mcpServers": { "mcp-golang": { "command": "npx", "args": ["-y", "mcp-golang"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides