godoc
The MCP server to search local Go pacakge
claude mcp add --transport stdio budougumi0617-godoc-mcp godoc-mcp \
--env HOME="<path to home, e.g. ${env:HOME}>" \
--env GOPATH="<path to GOPATH, e.g. ${env:HOME}/go>" \
--env GOCACHE="<path to Go build cache, e.g. ${env:HOME}/Library/Caches/go-build>" \
--env GODOC_MCP_ROOT_DIR="<path to the root directory of the Go project to analyze>"How to use
godoc-mcp exposes information about Go packages, types, functions, constants, and variables through MCP. After starting the server, clients can query for a list of packages, inspect package contents (structs, functions, methods), and retrieve detailed docs for structs, functions, methods, constants, and variables. The included tools allow you to enumerate packages with comments, inspect package contents, and fetch detailed documentation for specific program elements (e.g., structs, functions, methods, constants, and variables). Use these MCP endpoints to integrate Go code documentation into your tools, IDEs, or documentation pipelines.
How to install
Prerequisites:
- Go 1.24.2 or later
- A compatible MCP client or tooling that can communicate with MCP servers
Installation steps:
-
Ensure Go is installed and available in your PATH.
-
Build the godoc-mcp server from source (assuming you have the repository checked out):
make build
-
Run the server:
./godoc-mcp -root <path-to-go-project>
If you prefer to run with MCP tooling via npx/uvx, set up an MCP config (as shown in mcp_config) and start the MCP client accordingly.
Additional notes
Tips:
- The server analyzes a Go project tree rooted at the directory specified by -root. If omitted, it uses the current directory or the GODOC_MCP_ROOT_DIR environment variable.
- Ensure your GOPATH and Go toolchain are available in the environment where the server runs.
- If you encounter JSON-RPC or network-related issues, verify that your MCP client is configured to communicate with the stdio-based server (as shown in the example config).
- The environment variables GOPATH and GOCACHE may influence the analysis performance and should be set to appropriate paths if needed.
- Typical issues involve missing module dependencies in the Go project; run go mod download or set GOFLAGS accordingly to resolve module resolution problems.
Related MCP Servers
weather
A lightweight Model Context Protocol (MCP) server that enables AI assistants like Claude to retrieve and interpret real-time weather data. Discuss on Hacker News:
sandbox
A Model Context Protocol (MCP) server that enables LLMs to run ANY code safely in isolated Docker containers.
github-brain
An experimental GitHub MCP server with local database.
mcp-tts
MCP Server for Text to Speech
tasker
An MCP server for Android's Tasker automation app.
kai
An MCP Server for Kubernetes