This is not an officially supported Google product.
GoDoctor is an intelligent, AI-powered companion for the modern Go developer. It integrates seamlessly with AI-powered IDEs and other development tools through the Model Context Protocol (MCP), providing a suite of powerful features to enhance your workflow.
This project was developed and refined through an iterative process of AI-driven self-review, where GoDoctor's own code review tool was used to improve its own source code.
- AI-Powered Code Review: Get instant, context-aware feedback on your Go code. The
review_codetool analyzes your code for quality, clarity, and adherence to Go best practices. - On-Demand Documentation: Instantly retrieve documentation for any symbol in the Go standard library or your project's dependencies using the
get_documentationtool. - Flexible Transports: Communicate with the
godoctorserver via standard I/O or over the network with a new HTTP mode. - MCP Compliant: Built on the Model Context Protocol for broad compatibility with modern development tools.
-
Prerequisites:
- Go 1.18 or later
make- A Gemini API Key (for the code review tool).
-
Clone and Build:
git clone https://github.com/danicat/godoctor.git cd godoctor make buildThis will create the
godoctorserver in thebin/directory. You can also runmake installto install the binary in your$GOPATH/bindirectory.
The code_review tool requires a Gemini API Key to function. The server can be configured to find this key in two ways:
-
Default Environment Variable (Recommended): By default, the
godoctorserver will look for the API key in an environment variable namedGEMINI_API_KEY.# Set the default environment variable export GEMINI_API_KEY="your-api-key" # Run the server (it will find the key automatically) ./bin/godoctor --listen :8080
-
Custom Environment Variable (Override): You can tell the server to look for the key in a different environment variable by using the
--api-key-envflag. This is useful for environments where you might have multiple keys or need to avoid naming conflicts.# Set a custom environment variable export MY_APP_API_KEY="your-api-key" # Tell the server to use the custom variable ./bin/godoctor --listen :8080 --api-key-env MY_APP_API_KEY
The godoctor binary is the MCP server. It can be run in two modes.
- Standard I/O (default): The server communicates over
stdinandstdout. - HTTP Mode: The server can listen for connections on a network port.
# Run the server in HTTP mode, listening on port 8080
./bin/godoctor --listen :8080This project follows the standard Go project layout.
cmd/godoctor: The source code for the MCP server.internal/tool: The implementation of thereview_codeandget_documentationtools.
To run the test suite:
make testYou can send the JSON-RPC payloads directly to the server process if it is running in stdio mode. Example:
(
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18"}}';
echo '{"jsonrpc":"2.0","method":"notifications/initialized","params":{}}';
echo '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}';
) | ./bin/godoctorAnd for tool calls:
(
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18"}}';
echo '{"jsonrpc":"2.0","method":"notifications/initialized","params":{}}';
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_documentation", "arguments":{"package":"fmt"}}}';
) | ./bin/godoctor