MCP ExplorerExplorer

Godoc Mcp

@budougumi0617on a year ago
2 MIT
FreeCommunity
AI Systems
#go#golang#mcp#mcp-server
The MCP server to search local Go pacakge

Overview

What is Godoc Mcp

godoc-mcp is a server that provides information about Go project packages, types, functions, constants, and variables via the Multi-Command Protocol (MCP). It enables flexible retrieval and utilization of Go code documentation and structure from external tools.

Use cases

Use cases for godoc-mcp include generating documentation for Go projects, inspecting package structures, and aiding in code navigation and understanding for developers working with Go.

How to use

To use godoc-mcp, start the server by running ./godoc-mcp -root <root directory of your Go project>. You can also specify the root directory using the environment variable GODOC_MCP_ROOT_DIR. Once the server is running, you can interact with it using various MCP commands to retrieve package and documentation information.

Key features

Key features of godoc-mcp include: retrieving a list of Go packages, listing exported structs, functions, and methods in a package, obtaining detailed information about structs (fields, methods, comments), functions and methods (signature, comments, examples), and constants and variables in a package.

Where to use

godoc-mcp can be used in software development environments where Go is utilized, particularly for projects that require detailed documentation and analysis of Go packages.

Content

godoc-mcp

Overview

godoc-mcp is a server that provides information about Go project packages, types, functions, constants, and variables via the Multi-Command Protocol (MCP). It allows you to flexibly retrieve and utilize Go code documentation and structure from external tools.

Main Features

  • Retrieve a list of Go packages
  • List exported structs, functions, and methods in a package
  • Get detailed information about structs (fields, methods, comments)
  • Get detailed information about functions and methods (signature, comments, examples)
  • Get detailed information about constants and variables in a package

Installation

Go 1.24.2 or later is required.

make build

Usage

Start the Server

./godoc-mcp -root <root directory of your Go project>
  • Use the -root option to specify the root directory of the Go project to analyze.
  • If omitted, the current directory or the environment variable GODOC_MCP_ROOT_DIR will be used.

Using as an MCP Tool

You can use the following tools from an MCP client:

  • golang_list_packages: Get a list of packages and their comments
  • golang_inspect_package: List structs, functions, and methods in a package
  • golang_get_struct_doc: Get detailed information about a struct
  • golang_get_func_doc: Get detailed information about a function
  • golang_get_method_doc: Get detailed information about a struct method
  • golang_get_const_and_var_doc: Get detailed information about constants and variables

Example: mcp settings for Roo Code

Test

go test ./...

Dependencies

Environment Variables

  • GOPATH: Required by golang.org/x/tools/go/packages
  • GOCACHE: Required by golang.org/x/tools/go/packages
  • GODOC_MCP_ROOT_DIR: Root directory of the Go project to analyze

License

MIT License

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers