Labsco
MCP SERVER

MCP LSP Go

by hloiseaufcms

Give an assistant gopls — definitions, references, hover, completion, rename, code actions — plus go test, coverage, tidy, and govulncheck.

Code Intelligence & Repository Indexing
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