go
Go-MCP is a powerful Go(Golang) version of the MCP SDK that implements the Model Context Protocol (MCP) to facilitate seamless communication between external systems and AI applications.
claude mcp add --transport stdio thinkinaixyz-go-mcp go run . \ --env GO_VERSION="1.18+ (or newer)"
How to use
This MCP server is a Go-based implementation of the Model Context Protocol (MCP). It exposes a server capable of handling MCP tools via an SSE/HTTP transport and related protocols, enabling external systems to discover, invoke, and stream responses from registered tools. The repository provides a complete server example, client and server transports, and a straightforward integration with common Go web frameworks. You can list available tools, register tool handlers, and run a microservice that participates in MCP-based workflows. Use the included server example to register tools and expose them over SSE or HTTP POST transport as described in the examples.
To interact with the server, connect through the configured transport (SSE/HTTP in the examples), instantiate the MCP server, register tools with their input schemas, and implement handlers that return protocol-encoded results. The library modules include protocol definitions, transport adapters, and server wiring to help you build custom MCP-enabled services in Go.
How to install
Prerequisites:
- Go 1.18 or higher installed on your machine
- A working Go module environment (Go workspace is optional with modules)
Installation steps:
- Install the MCP library package using the Go tool:
go get github.com/ThinkInAIXYZ/go-mcp
- Create a small Go module for your MCP server or use the repository directly. If you’re starting from scratch, initialize a module:
mkdir my-mcp-server
cd my-mcp-server
go mod init github.com/yourname/my-mcp-server
-
Import and wire up the MCP server in your code. See the Quick Start and Server Example in the repository for reference. You can copy the example main function, adapt the tool definitions and handlers, and run your server locally.
-
Run the server:
go run ./...
- Ensure network accessibility for your transport endpoints (e.g., 127.0.0.1:8080 for SSE server example).
Additional notes
Tips and common considerations:
- The Go-MCP project emphasizes a three-layer architecture: Transport, Protocol, and User layers. Choose the transport that best fits your deployment scenario (HTTP SSE/POST, Streamable HTTP, or Stdio).
- When deploying, prefer static compilation for simple distribution, leveraging Go’s build steps to generate a single binary.
- Define input schemas for tools using struct tags as shown in the server example. This helps with validation and automatic tooling integration.
- If you run into transport issues, verify that the server is listening on the expected address and that any firewalls allow traffic to the configured port.
- For deployment in containers, you can wrap the Go binary in a minimal image; the MCP server supports static compilation without heavy runtime dependencies.
- Check the repository’s examples for Gin integration and other transport adapters to fit your existing Go web services.
Related MCP Servers
trpc-agent-go
trpc-agent-go is a powerful Go framework for building intelligent agent systems using large language models (LLMs) and tools.
station
Station is our open-source runtime that lets teams deploy agents on their own infrastructure with full control.
tiger-cli
Tiger CLI is the command-line interface for Tiger Cloud. It includes an MCP server for helping coding agents write production-level Postgres code.
gopls
MCP server for golang projects development: Expand AI Code Agent ability boundary to have a semantic understanding and determinisic information for golang projects.
kubernetes
A Model Context Protocol (MCP) server for the Kubernetes API.
gcp-cost
💰 An MCP server that enables AI assistants to estimate Google Cloud costs, powered by Cloud Billing Catalog API and built with Genkit for Go