Gopls MCP
Gopls, the language server for Go, now comes with a built-in MCP support1. MCPs are all the rage and here the excitement is warranted by an actual use-case. The gopls MCP provides multiple tools that make LLMs efficient when working in Go codebases:
go_workspaceto understand the overall structure of the workspacego_searchfor looking for a specific type, function, or variablego_file_contextthat returns contents of a file and how it connects to other files in the same packagego_package_apito understand package’s public API, even for third-part dependenciesgo_symbol_referencesfor finding all references to an identifiergo_diagnosticsthat reports any build or analysis errorsgo_vulncheckwhich runs vulnerability scan over dependencies and returns any findings
To instruct LLMs to use these tools, there are built-in instructions under gopls mcp -instructions. I have tried relying on the MCP without explicit instructions in which case the tools seemed mostly ignored. The fix for that is to either manually paste the instructions into the context, or use either AGENTS.md or Agent Skills, both nowadays supported by majority of LLM tools.
The installation of Gopls MCP varies by tool but for codex it is as simple as:
codex mcp add gopls gopls mcp
or by manually adding it to your configuration under ~/.codex/config.toml:
[mcp_servers.gopls]
command = "gopls"
args = ["mcp"]
And if you are afraid of the instructions getting outdated, I found this to work well:
**IMPORTANT**: Before working with Go code run `gopls mcp -instructions` to read Go-specific instructions.