go_to_definitionLABSCO SUMMARY
The compiler's view of your code, instead of the model's guess from grep.
An assistant that can ask for references does not have to search for a name and hope it caught every call site, and a rename comes back as the edits gopls would make. The tooling half is what separates this from the language server's own built-in MCP mode: running tests, reading coverage per function, tidying modules, and running govulncheck all return structured results the model can act on directly.
What it is
An MCP server that drives gopls, the official Go language server, over LSP, and adds the Go command-line tooling an assistant would otherwise shell out for. It runs against one workspace root you pass at launch and returns structured results rather than terminal text.
What you get
- Navigation: go_to_definition, find_references, and search_workspace_symbols
- Understanding a symbol: get_hover_info and get_completion at a file position
- Editing: format_document, rename_symbol, and list_code_actions over a range
- check_diagnostics for a file, straight from the language server
- Test and tooling runs with structured output: run_go_test, analyze_coverage in summary or per-function form, run_go_mod_tidy, run_govulncheck, and module_graph
- Two workspace resources — a JSON summary of top-level directories and Go files, and the raw go.mod
- Two prompts: summarize_diagnostics turns diagnostics into actionable guidance, refactor_plan turns them into a checklist
- Progress streaming, so long-running commands report status instead of going silent
Requirements
No account and no key — it works against a Go repository you already have. Install with go install github.com/hloiseau/mcp-gopls/v2/cmd/mcp-gopls@latest, then launch it as mcp-gopls --workspace pointed at an absolute project path; there is also a container at ghcr.io/hloiseau/mcp-gopls with the workspace bind-mounted. gopls does the analysis, and the server sets GOTOOLCHAIN=local for it so a Go toolchain that has not been published yet does not block startup. Behaviour is tuned with --gopls-path, --log-level, --rpc-timeout, and --shutdown-timeout, or the matching MCP_GOPLS_* environment variables. Tested with Go 1.25.x.
Setup effort
One command — go install github.com/hloiseau/mcp-gopls/v2/cmd/mcp-gopls@latest
USE CASES
Finding out what a change would break
Ask for every reference to the symbol, then see which code actions the language server already offers on that range.
Renaming across a package safely
Compute the rename edits from the language server rather than a find-and-replace, then format what changed.
Fixing what the compiler is complaining about
Pull diagnostics for the file, read the type at the failing position, then re-run the tests.
Finding the paths the tests never touch
Run coverage per function to see which branches nothing exercises, then run the tests you added.
Cleaning up dependencies before a release
Sync go.mod, scan for known vulnerabilities, and read the module graph to see where a transitive dependency came from.
14 tools
Listed in project docs. Your client may show a different list.
find_referencescheck_diagnosticsget_hover_infoget_completionformat_documentrename_symbollist_code_actionssearch_workspace_symbolsanalyze_coveragerun_go_testrun_go_mod_tidyrun_govulncheckmodule_graphBEFORE YOU INSTALL
What to know first
Tools you get
14 tools named in the project's documentation.
Requires
- go on PATH
- Go 1.25+
INSTALLATION
Connect your client
Server setup
go install github.com/hloiseau/mcp-gopls/v2/cmd/mcp-gopls@latestMCP Clients
Cursor, Claude Desktop
{
"mcpServers": {
"mcp-gopls": {
"command": "mcp-gopls",
"args": [
"--workspace",
"<YOUR_PATH_TO_GO_PROJECT>"
],
"env": {
"MCP_GOPLS_LOG_LEVEL": "info"
}
}
}
}GitHub Copilot in VS Code
{
"servers": {
"mcp-gopls": {
"type": "stdio",
"command": "mcp-gopls",
"args": [
"--workspace",
"<YOUR_PATH_TO_GO_PROJECT>"
],
"env": {
"MCP_GOPLS_LOG_LEVEL": "warn"
}
}
}
}Docker MCP Gateway
docker run --rm -i -v <YOUR_PATH_TO_GO_PROJECT>:/workspace ghcr.io/hloiseau/mcp-gopls:latest --workspace /workspace