A Model Context Protocol (MCP) server that lets AI assistants use Go’s LSP (`gopls`) for navigation, diagnostics, testing, coverage, and more.
MCP Gopls MCP server exists for a simple reason — assistants are far more useful when they can act on MCP Gopls directly instead of describing what you should do. A Model Context Protocol (MCP) server that lets AI assistants use Go’s LSP (gopls) for navigation, diagnostics, testing, coverage, and more.
Once MCP Gopls is connected, these are the calls the assistant has available:
go_to_definition — “Use go_to_definition on pkg/server/server.go:42.”find_references — “Ask the tool for references to ServeStdio.”check_diagnostics — “Request diagnostics for cmd/mcp-gopls/main.go.”get_hover_info — “Call get_hover_info on pkg/tools/workspace.go:88.”get_completion — “Trigger completions at pkg/server/server.go:55.”format_document — “Run the formatter over pkg/tools/refactor.go.”rename_symbol — “Rename clientFactory to newClientFactory via the tool.”list_code_actions — “List code actions for pkg/server/server.go:80-90.”search_workspace_symbols — “Search workspace symbols for NewWorkspaceConfig.”analyze_coverage — “Run analyze_coverage for ./pkg/... with per-function stats.”run_go_test — “Execute run_go_test on ./cmd/....”run_go_mod_tidy — “Invoke run_go_mod_tidy to sync go.mod.”You will need 2 environment variables: MCP_GOPLS_LOG_LEVEL, MCP_GOPLS_GOPLS_PATH. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.
go1.25.4) - gopls installed (go install golang.org/x/tools/gopls@latest) - Optional: govulncheck (go install golang.org/x/vuln/cmd/govulncheck@latest) - The server forces GOTOOLCHAIN=local for its nested gopls process. If you need a different toolchain, set GOTOOLCHAIN in the environment before launching mcp-gopls.@mark3labs/mcp-inspector on npm is all you need. Most clients run it directly, so configuration is a few lines and a restart.
Plenty of developer tooling servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. MCP Gopls's toolset — go_to_definition, find_references, check_diagnostics and 11 more — is a fair guide to whether it matches your workflow. It is maintained by hloiseaufcms; worth a glance at recent repository activity before you build anything load-bearing on it.
We check each listing at SyncDev against the project's documentation before it goes live — if something here drifts out of date, it is a bug worth reporting.
| Tool | What it does |
|---|---|
| go_to_definition | “Use go_to_definition on pkg/server/server.go:42.” |
| find_references | “Ask the tool for references to ServeStdio.” |
| check_diagnostics | “Request diagnostics for cmd/mcp-gopls/main.go.” |
| get_hover_info | “Call get_hover_info on pkg/tools/workspace.go:88.” |
| get_completion | “Trigger completions at pkg/server/server.go:55.” |
| format_document | “Run the formatter over pkg/tools/refactor.go.” |
| rename_symbol | “Rename clientFactory to newClientFactory via the tool.” |
| list_code_actions | “List code actions for pkg/server/server.go:80-90.” |
| search_workspace_symbols | “Search workspace symbols for NewWorkspaceConfig.” |
| analyze_coverage | “Run analyze_coverage for ./pkg/... with per-function stats.” |
| run_go_test | “Execute run_go_test on ./cmd/....” |
| run_go_mod_tidy | “Invoke run_go_mod_tidy to sync go.mod.” |
| run_govulncheck | “Run run_govulncheck and stream findings.” |
| module_graph | “Call module_graph to inspect dependencies.” |
{
"mcpServers": {
"mcp-gopls": {
"command": "mcp-gopls",
"args": ["--workspace", "/absolute/path/to/your/go/project"],
"env": {
"MCP_GOPLS_LOG_LEVEL": "info"
}
}
}
}Configuration as documented by the project. Restart the client after saving.
go1.25.4) - gopls installed (go install golang.org/x/tools/gopls@latest) - Optional: govulncheck (go install golang.org/x/vuln/cmd/govulncheck@latest) - The server forces GOTOOLCHAIN=local for its nested gopls process. If you need a different toolchain, set GOTOOLCHAIN in the environment before launching mcp-gopls.| Variable | Description | Required |
|---|---|---|
| MCP_GOPLS_LOG_LEVEL | Configuration value read at startup. | Optional |
| MCP_GOPLS_GOPLS_PATH | Filesystem location the server is allowed to use. | Optional |
A knowledge graph your assistant keeps between sessions — entities, relations and observations that persist.
Kill hallucinated APIs — version-accurate, up-to-date library documentation injected straight into context.
Your workspace, on speaking terms with AI — search, read and write Notion pages and databases.
A structured scratchpad for hard problems — stepwise reasoning with revisions, branches and visible logic.
Symbol-level code navigation, refactoring and memory for coding agents — the IDE brain your assistant has been missing.
Chat with your second brain — search, read and write vault notes through the Local REST API.