Go SDK

v1.0.0Developer Toolsstable

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

golangmcp
Share:
8,736
Stars
0
Downloads
0
Weekly
0/5

What is Go SDK?

Go SDK is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to go implementation of the model context protocol (mcp), enabling seamless integration between llm applications and external data sources and tools.

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

This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • A Go implementation of the Model Context Protocol (MCP), ena

Use Cases

Implement Model Context Protocol in Go for LLM applications.
Integrate external data sources and tools with Go-based systems.
mark3labs

Maintainer

LicenseMIT
Languagego
Versionv1.0.0
UpdatedMay 22, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx mcp-go

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 Go SDK

mcp-go is a Go library that implements the Model Context Protocol specification, providing idiomatic Go APIs for building MCP servers with tools, resources, and prompts. It supports all three MCP transport modes — stdio, SSE, and streamable HTTP — and follows the MCP 2025-11-25 specification with backward compatibility for earlier versions. Go developers use mcp-go to build custom MCP servers that expose internal data sources, company APIs, or system tools to AI assistants like Claude, without needing to handle protocol framing, session management, or serialization manually.

Prerequisites

  • Go 1.21 or newer installed (https://go.dev/dl/)
  • An MCP client to test against, such as Claude Desktop or the MCP Inspector
  • Basic familiarity with Go module system and package management
  • go get access to github.com/mark3labs/mcp-go
1

Initialize a new Go module

Create a new directory for your MCP server and initialize a Go module.

mkdir my-mcp-server && cd my-mcp-server
go mod init github.com/yourname/my-mcp-server
2

Install mcp-go

Add the mcp-go library as a dependency to your Go module.

go get github.com/mark3labs/mcp-go
3

Create a basic server with a tool

Write a main.go that creates an MCP server, defines a tool with input parameters, registers a handler, and serves over stdio.

package main

import (
    "context"
    "log"
    "github.com/mark3labs/mcp-go/mcp"
    "github.com/mark3labs/mcp-go/server"
)

func main() {
    s := server.NewMCPServer("My Server", "1.0.0")

    tool := mcp.NewTool("greet",
        mcp.WithDescription("Greet a user by name"),
        mcp.WithString("name", mcp.Required(), mcp.Description("The name to greet")),
    )
    s.AddTool(tool, func(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolResult, error) {
        name, _ := req.RequireString("name")
        return mcp.NewToolResultText("Hello, " + name + "!"), nil
    })

    if err := server.ServeStdio(s); err != nil {
        log.Fatalf("Server error: %v", err)
    }
}
4

Build and test the server

Build the binary and verify it starts correctly. When run via stdio, the server waits for MCP protocol messages on stdin.

go build -o my-mcp-server .
./my-mcp-server
5

Register the server with your MCP client

Add your compiled server binary to your MCP client configuration. Point the command to the absolute path of your built binary.

{
  "mcpServers": {
    "my-server": {
      "command": "/absolute/path/to/my-mcp-server"
    }
  }
}

Go SDK Examples

Client configuration

Example Claude Desktop configuration for a mcp-go server binary compiled to stdio transport.

{
  "mcpServers": {
    "my-go-server": {
      "command": "/usr/local/bin/my-mcp-server",
      "args": []
    }
  }
}

Prompts to try

Once you've built an MCP server with mcp-go and registered it, these prompt patterns demonstrate interaction with your custom tools.

- "Use the greet tool to say hello to 'Alice'"
- "Call my-server's calculate tool with operation='add', x=10, y=25"
- "List all available tools from my-go-server and explain what each one does"
- "Use the query_database tool to fetch all records where status='active'"
- "Run the generate_report resource and summarize the output"

Troubleshooting Go SDK

MCP client shows 'server exited' immediately after starting

Run the binary directly in your terminal to see the error output. Common causes are panics on startup (use server.WithRecovery() to catch panics) or missing permissions on the binary (run 'chmod +x ./my-mcp-server'). The server must listen on stdio and not print anything to stdout before receiving the first MCP message.

go get fails with module fetch errors

Ensure you have a working Go installation (go version >= 1.21) and internet access to proxy.golang.org. If behind a corporate proxy, set GOPROXY=direct or configure your proxy settings. Run 'go env GOPROXY' to check your current proxy configuration.

Tool handler receives incorrect parameter types

Use req.RequireString(), req.RequireFloat(), or req.RequireBool() to extract parameters — these return typed values with error handling. Avoid using req.Params directly as it returns interface{}. Define parameter types explicitly in mcp.NewTool() using mcp.WithString(), mcp.WithNumber(), etc.

Frequently Asked Questions about Go SDK

What is Go SDK?

Go SDK is a Model Context Protocol (MCP) server that go implementation of the model context protocol (mcp), enabling seamless integration between llm applications and external data sources and tools. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Go SDK?

Follow the installation instructions on the Go SDK GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Go SDK?

Go SDK works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Go SDK free to use?

Yes, Go SDK 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-go": { "command": "npx", "args": ["-y", "mcp-go"] } } }

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

Read the full setup guide →

Ready to use Go SDK?

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