Home

Awesome

godoc-mcp

Go Report Card GoDoc License

Overview

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.

Getting Started

go install github.com/mrjoshuak/godoc-mcp@latest

Why Use godoc-mcp?

In a sentence: godoc-mcp provides a more token efficient way for LLMs to understand Go projects.

Traditional file-reading approaches require LLMs to process entire source files often many files to understand a single package. godoc-mcp provides several advantages:

  1. Token Efficiency: Returns only the essential documentation, reducing token usage significantly
  2. Structured Information: Provides official package documentation in a consistent, well-structured format
  3. Project Navigation: Smart handling of project structures helps LLMs understand multi-package projects
  4. Integration Ready: Works alongside other MCP servers, enabling both high-level and detailed code analysis
  5. Performance: Caching and optimized token usage make godoc-mcp a fast and efficient tool for Go development
  6. Local: Does not require an internet connection to access documentation

With 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.

This 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.

Features

The server will:

  1. For directories with Go files: Return package documentation
  2. For directories without Go files: List available Go packages in subdirectories
  3. For import paths: Return standard library or third-party package documentation

Examples

In 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:

Project Understanding

"I'm looking at a Go project at /path/to/some/project. What packages does it contain and what do they do?"

Package Interface Understanding

"What interfaces does the io package provide? I'm particularly interested in anything related to reading."

Implementation Guidance

"I need to implement the io.Reader interface. Show me its documentation and any related types I should know about."

API Usage

"Show me the documentation for the Resource type in the /path/to/some/project. I need to understand how to create and use it."

Library Exploration

"I'm in /path/to/some/project which uses github.com/gorilla/mux. Show me the documentation for the Router type."

Method Discovery

"What methods are available on the http.Request type? I'm working with standard library HTTP handlers."

Focused Learning

"Explain how to configure the Server type in the /path/to/project/server package."

Package Browsing

"I'm in a new Go project directory and see multiple packages. Can you show me what each one does?"

Usage

To add to the Claude desktop app:

{
  "mcpServers": {
    # other MCP servers ...
    "godoc": {
      "command": "/path/to/godoc-mcp",
      "args": []
    }
  }
}

When connected to an MCP-capable LLM (like Claude), godoc-mcp provides the get_doc tool with the following parameters:

Advanced cmd_flags values that an LLM can leverage:

Troubleshooting

License

This project is licensed under the MIT License - see the LICENSE file for details.