Get the FREE Ultimate OpenClaw Setup Guide →

go

A Go implementation of the Model Context Protocol (MCP) - an open protocol that enables seamless integration between LLM applications and external data sources and tools.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio megagrindstone-go-mcp docker run -i megagrindstone/go-mcp:latest \
  --env MCP_LOG_LEVEL="debug (optional, default info)" \
  --env MCP_SERVER_PORT="8080 (optional, default 8080)"

How to use

go-mcp is a Go implementation of the Model Context Protocol (MCP). The repository provides a library that implements the MCP protocol, including JSON-RPC 2.0 messaging, transport options, and modular server/client capabilities. As a user, you typically integrate this library into your own MCP server or client implementation in Go. The server supports prompts, resources, and tools, along with real-time updates via transports such as Server-Sent Events (SSE) or Standard IO. The examples in the repository illustrate how to define a server, expose tool capabilities, and wire up a transport so clients can connect, discover tools, execute tool calls, subscribe to resources, and exchange prompts and responses in real time.

How to install

Prerequisites:

  • Go installed (1.18+ recommended)
  • Git

Install the library:

go get github.com/MegaGrindStone/go-mcp

If you are building your own MCP server using this library, create a Go module for your project and import the MCP package paths as needed. Then implement the server interfaces (e.g., tool server, resource server, prompt server) and start serving via your chosen transport (SSE or Standard IO) following the usage patterns shown in the README.

Example steps to get started:

mkdir my-mcp-server
cd my-mcp-server
go mod init github.com/your/module
go get github.com/MegaGrindStone/go-mcp

Create a main.go that wires a tool server and a transport, then start the MCP server (see the README for example snippets).

package main

import (
  // standard imports
  "context"
  "net/http"
  "time"
  mcp "github.com/MegaGrindStone/go-mcp"
  // other needed imports for your server
)

func main() {
  // Implement your server here by extending the interfaces provided by go-mcp
  // Example: initialize a tool server and an SSE or StdIO transport
  _ = context.Background()
  _ = time.Second
  // This is a placeholder to indicate where to place your server startup logic.
}

Build and run your server with:

go run main.go

Or build a binary and execute it:

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

Additional notes

Notes:

  • This repository provides a Go library. The README demonstrates how to implement an MCP server and client using the library; there is no single runnable server binary provided. Plan to build your own server application around the library if you need a runnable service.
  • The project emphasizes stability after v1.0.0 and recommends pinning versions when consuming as a dependency.
  • Transport options include Server-Sent Events (SSE) and Standard IO. Choose the transport that matches your deployment scenario (web-based updates vs. CLI usage).
  • When using the docker option in mcp_config, ensure the image name matches a published or built image your environment can pull. Include environment variables as needed for logging, ports, or feature toggles.
  • If you publish a server image, consider tagging stable versions and documenting the exposed endpoints and capabilities (tools, prompts, resources) for clients.

Related MCP Servers

Sponsor this space

Reach thousands of developers