godoc-mcp is a Model Context Protocol (MCP) server that provides efficient access to Go documentation. It helps LLMs understand Go projects by providing direct access to package documentation without needing to read entire source files. godoc-mcp can vastly improve the performance of using LLMs to develop in Go by substantially reducing the number of tokens needed to understand and make use of Go
Add this skill
npx mdskills install mrjoshuak/godoc-mcpWell-documented Go documentation server with efficient token usage and comprehensive setup instructions
1# godoc-mcp23[](https://goreportcard.com/report/github.com/mrjoshuak/godoc-mcp)4[](https://pkg.go.dev/github.com/mrjoshuak/godoc-mcp)5[](LICENSE)67## Overview89`godoc-mcp` is a Model Context Protocol (MCP) server that provides efficient access to Go documentation. It helps LLMs understand Go projects by providing direct access to package documentation without needing to read entire source files. `godoc-mcp` can vastly improve the performance of using LLMs to develop in Go by substantially reducing the number of tokens needed to understand and make use of Go packages.1011## Getting Started1213```bash14go install github.com/mrjoshuak/godoc-mcp@latest15```1617## Why Use godoc-mcp?1819In a sentence: **`godoc-mcp` provides a more token efficient way for LLMs to understand Go projects.**2021Traditional file-reading approaches require LLMs to process entire source files often many files to understand a single package. `godoc-mcp` provides several advantages:22231. **Token Efficiency**: Returns only the essential documentation, reducing token usage significantly242. **Structured Information**: Provides official package documentation in a consistent, well-structured format253. **Project Navigation**: Smart handling of project structures helps LLMs understand multi-package projects264. **Integration Ready**: Works alongside other MCP servers, enabling both high-level and detailed code analysis275. **Performance**: Caching and optimized token usage make `godoc-mcp` a fast and efficient tool for Go development286. **Local**: Does not require an internet connection to access documentation2930With `godoc-mcp`, a LLM can get precisely the information it needs without having to read entire source files. Here are the different levels of detail that an LLM can get.3132- Documentation for one exported symbol33- The complete source for one symbol34- A list of all exported symbols (the concise documentation)35- A list of all symbols including unexported symbols36- The full documentation for a package37- The entire source for a package3839This makes `godoc-mcp` an essential tool for Go developers using LLMs by enabling LLMs to understand significantly more, and in more detail, about the context than previously possible in any programming language.4041## Features4243The server will:441. For directories with Go files: Return package documentation452. For directories without Go files: List available Go packages in subdirectories463. For import paths: Return standard library or third-party package documentation4748- **Efficient Documentation Access**: Retrieves official Go documentation with minimal token usage49- **Smart Package Discovery**: When pointed at a directory without Go files, lists available Go packages in subdirectories50- **Flexible Path Support**:51 - Local file paths (e.g., "/full/path/to/mypackage")52 - Import paths (e.g., "io", "github.com/user/repo")53- **Automatic Module Context**:54 - Creates temporary Go projects when needed55 - Automatically sets up module context for external packages56 - No manual module setup required for any package documentation57 - Handles cleanup of temporary projects58- **Module-Aware**: Supports documentation for third-party packages through working directory context (i.e. it will run `go doc` from the working directory)59- **Performance Optimized**:60 - Built-in response caching61 - Efficient token usage through focused documentation retrieval62 - Metadata about response sizes63 - Smart handling of standard library vs external packages6465### Examples6667In addition to providing documentation while working on coding tasks. `godoc-mcp` can also be used to explore Go projects and packages. Here are some examples for general prompting:6869#### Project Understanding7071"I'm looking at a Go project at /path/to/some/project. What packages does it contain and what do they do?"7273#### Package Interface Understanding7475"What interfaces does the io package provide? I'm particularly interested in anything related to reading."7677#### Implementation Guidance7879"I need to implement the io.Reader interface. Show me its documentation and any related types I should know about."8081#### API Usage8283"Show me the documentation for the Resource type in the /path/to/some/project. I need to understand how to create and use it."8485#### Library Exploration8687"I'm in /path/to/some/project which uses github.com/gorilla/mux. Show me the documentation for the Router type."8889#### Method Discovery9091"What methods are available on the http.Request type? I'm working with standard library HTTP handlers."9293#### Focused Learning9495"Explain how to configure the Server type in the /path/to/project/server package."9697#### Package Browsing9899"I'm in a new Go project directory and see multiple packages. Can you show me what each one does?"100101## Usage102103### Transport Options104105godoc-mcp supports three transport modes:106107- **stdio** (default): Standard input/output, for local MCP clients like Claude Desktop108- **sse**: Server-Sent Events over HTTP, for web-based MCP clients109- **http**: Streamable HTTP, the MCP specification's recommended HTTP transport110111```bash112# Default stdio mode113godoc-mcp114115# SSE mode on port 8080116godoc-mcp --transport sse --addr :8080117118# Streamable HTTP mode119godoc-mcp --transport http --addr :9090120```121122### Docker123124```bash125docker pull ghcr.io/mrjoshuak/godoc-mcp:latest126```127128For use with [Docker MCP Gateway](https://docs.docker.com/ai/mcp-catalog-and-toolkit/mcp-gateway/), add to your MCP configuration:129130```json131{132 "mcpServers": {133 "godoc": {134 "command": "docker",135 "args": ["run", "-i", "--rm", "ghcr.io/mrjoshuak/godoc-mcp:latest"]136 }137 }138}139```140141To access local project documentation, mount your project directory and use `/workspace` as the `working_dir` parameter:142143```json144{145 "mcpServers": {146 "godoc": {147 "command": "docker",148 "args": ["run", "-i", "--rm", "-v", "/path/to/project:/workspace", "ghcr.io/mrjoshuak/godoc-mcp:latest"]149 }150 }151}152```153154To run with SSE transport via Docker:155156```bash157docker run --rm -p 8080:8080 ghcr.io/mrjoshuak/godoc-mcp:latest --transport sse --addr :8080158```159160### Claude Code161162```bash163claude mcp add godoc-mcp -- godoc-mcp164```165166### Claude Desktop167168To add to the Claude desktop app, edit your MCP config:169170```json171{172 "mcpServers": {173 "godoc": {174 "command": "godoc-mcp"175 }176 }177}178```179180If `go doc` can't find your Go installation, add environment variables:181182```json183{184 "mcpServers": {185 "godoc": {186 "command": "godoc-mcp",187 "env": {188 "GOPATH": "/path/to/go",189 "GOMODCACHE": "/path/to/go/pkg/mod"190 }191 }192 }193}194```195196### Tool Parameters197198When connected to an MCP-capable LLM (like Claude), godoc-mcp provides the `get_doc` tool with the following parameters:199200- `path` (required): Path to the Go package or file (import path or file path)201- `target` (optional): Specific symbol to document (function, type, etc.)202- `cmd_flags` (optional): Additional go doc command flags (allowed: `-all`, `-src`, `-u`, `-short`, `-c`)203- `working_dir` (optional): Working directory for module-aware documentation (if not provided, a temporary project will be created automatically)204- `page` (optional): Page number for paginated results (default: 1)205- `page_size` (optional): Lines per page, 100-5000 (default: 1000)206207## Troubleshooting208209- For local paths, ensure they contain Go source files or point to directories containing Go packages210- If you see module-related errors, ensure GOPATH and GOMODCACHE environment variables are set correctly in your MCP server configuration211- The server automatically handles module context for external packages, but you can still provide a specific working_dir if needed for special cases212213## License214215This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.216
Full transparency — inspect the skill content before installing.