Provides up-to-date Go package documentation from pkg.go.dev to MCP clients with real-time access and caching.
Configuration
View docs{
"mcpServers": {
"captjt-godoc-mcp": {
"command": "node",
"args": [
"/absolute/path/to/godoc-mcp/dist/index.js"
],
"env": {
"LOG_LEVEL": "info",
"GODOC_MCP_HOST": "localhost",
"GODOC_MCP_PORT": "8080",
"GODOC_MCP_CACHE_TTL": "3600",
"GODOC_MCP_CACHE_SIZE": "1000",
"GODOC_MCP_REQUEST_TIMEOUT": "30",
"GODOC_MCP_MAX_CONCURRENT_REQUESTS": "10"
}
}
}
}You run a dedicated MCP server that fetches real-time Go package documentation from pkg.go.dev and serves it to MCP clients. This keeps language models informed with the latest function signatures, types, and examples from the Go ecosystem, while handling network hiccups gracefully through caching and retry strategies.
You connect your MCP client to the Godoc MCP Server to request up-to-date Go package documentation. Use the available tool-like endpoints to fetch package docs, function signatures, type definitions, package listings, and code examples. You can query specific versions or the latest stable version, and you can search by package name or description. The server prioritizes fresh data from pkg.go.dev and falls back to cached results if the network is unavailable.
Prerequisites you need on your machine are Node.js and npm for running the server locally.
Step by step install flow you should follow to get the server up and running:
# Clone the repository
# Replace with your actual repository path if you manage a fork
# git clone https://github.com/captjt/godoc-mcp.git
# cd godoc-mcp
# Install dependencies
npm install
# Build the server
npm run buildConfigure the server and its environment to tailor behavior like port, host, cache, and concurrency. Values shown here align with typical options you will set in your environment. Adjust as needed for your deployment.
# Server configuration
export GODOC_MCP_PORT=8080
export GODOC_MCP_HOST=localhost
# Cache configuration
export GODOC_MCP_CACHE_TTL=3600 # seconds a package stays in cache
export GODOC_MCP_CACHE_SIZE=1000 # max number of cached packages
# Performance tuning
export GODOC_MCP_MAX_CONCURRENT_REQUESTS=10
export GODOC_MCP_REQUEST_TIMEOUT=30You can run the server in production or development mode depending on your needs. In development mode, the server can auto-reload on changes.
# Run in production mode
npm start
# Run in development mode (with auto-reload)
npm run dev
# Run with debugging log level
LOG_LEVEL=debug npm startTo connect a client, specify the MCP server as a local stdio process. The following example shows how to point a client to the local Godoc MCP Server using Node.js to execute the built entry point.
{
"mcpServers": {
"godoc": {
"command": "node",
"args": ["/absolute/path/to/godoc-mcp/dist/index.js"]
}
}
}The server is designed to gracefully handle network issues by falling back to cached data. When possible, it fetches the latest documentation from pkg.go.dev to ensure you have current information for your MCP interactions.
Retrieves comprehensive documentation for a Go package, with optional version support.
Gets detailed documentation for a specific function, with optional version support.
Retrieves documentation for types and their methods, with optional version support.
Searches for Go packages by name or description.
Retrieves example code for a package, with optional version support.
Lists all available versions of a Go package from the official module index.