Model Context Protocol (MCP) server that provides up-to-date documentation for the Go programming language standard library and builtin functions.
This project has been converted from a Zig documentation server to work with Go documentation. It provides access to Go's builtin functions and standard library documentation through MCP tools.
Tip
Add use godocs
to your prompt if you want to explicitly instruct the LLM to use Go docs tools. Otherwise, LLM will automatically decide when to utilize MCP tools based on the context of your questions.
- Go Builtin Functions: Access documentation for all Go builtin functions like
len()
,cap()
,make()
,new()
,append()
,copy()
,delete()
,complex()
,real()
,imag()
,panic()
, andrecover()
. - Standard Library Search: Search through Go's standard library packages and functions.
- Detailed Documentation: Get comprehensive documentation including function signatures, parameters, return types, and usage examples.
- Web Interface: Local web server for browsing documentation.
- Node.js 18+ or Bun 1.0+
- TypeScript compiler
- Clone the repository:
git clone <repository-url>
cd go-mcp
- Install dependencies:
npm install
# or
bun install
- Build the project:
npm run build
# or
bun run build
Start the MCP server:
# Using Node.js
node dist/mcp.js
# Using Bun
bun dist/mcp.js
# Start MCP server with defaults (go1.21 version)
go-mcp
# Use specific Go version
go-mcp --version go1.20
# Enable automatic daily updates
go-mcp --update-policy daily
# Update documentation without starting server
go-mcp update --version go1.22
# Start local web server to view documentation
go-mcp view --version go1.21
Add to your MCP configuration:
{
"mcpServers": {
"go-docs": {
"command": "node",
"args": ["dist/mcp.js", "--version", "go1.21", "--update-policy", "manual"]
}
}
}
list_builtin_functions
- Lists all available Go builtin functions with their signatures and descriptions.get_builtin_function
- Search for Go builtin functions by name and get detailed documentation.search_std_lib
- Search the Go standard library for packages and functions.get_std_lib_item
- Get detailed documentation for a specific standard library item.
go-mcp/
├── mcp/ # Source code
│ ├── mcp.ts # Main MCP server
│ ├── docs.ts # Documentation handling
│ ├── tools.ts # MCP tools implementation
│ ├── std.ts # Standard library parser
│ ├── extract-builtin-functions.ts # Builtin functions extraction
│ ├── index.html # Web interface
│ └── std.js # Web interface JavaScript
├── dist/ # Compiled output
├── package.json # Project configuration
├── tsconfig.json # TypeScript configuration
└── README.md # This file
# Build the project
npm run build
# Development mode with inspector
npm run dev
# Type checking
npm run typecheck
# Linting
npm run lint
npm run lint:fix
The server supports various Go versions:
go1.21
(default)go1.20
,go1.19
, etc.
Documentation is cached in platform-specific directories:
- Linux:
~/.cache/go-mcp/
- macOS:
~/Library/Caches/go-mcp/
- Windows:
%LOCALAPPDATA%\go-mcp\
This project has been converted from a Zig documentation server. The current implementation provides basic Go documentation functionality. Future improvements could include:
- Full Go source code parsing
- More comprehensive standard library coverage
- Better search algorithms
- Integration with Go's official documentation APIs
MIT License - see LICENSE file for details.