An MCP (Model Context Protocol) server that wraps gopls to provide Go language server features.
Overview
What is Gopls?
Gopls is an MCP (Model Context Protocol) server that wraps gopls to provide Go language server features, enhancing the development experience for Go programmers.
How to use Gopls?
To use Gopls, install it via Go and integrate it with Claude Code or Claude Desktop by following the provided installation and configuration steps.
Key features of Gopls?
- GoToDefinition: Navigate to the definition of a symbol.
- FindReferences: Find all references to a symbol.
- GetDiagnostics: Get compile errors and static analysis findings.
- Hover: Get information about symbols under the cursor.
- SearchSymbol: Search for symbols across the workspace.
- RenameSymbol: Rename symbols across the workspace.
- FindImplementers: Find all types that implement an interface.
- ListDocumentSymbols: Get an outline of symbols defined in a file.
- FormatCode: Format Go source code according to gofmt standards.
- OrganizeImports: Organize import statements.
Use cases of Gopls?
- Enhancing code navigation and refactoring in Go projects.
- Providing real-time feedback on code quality and errors.
- Assisting in the organization and formatting of Go code.
FAQ from Gopls?
- Is Gopls suitable for production use?
While Gopls is functional, it was generated by AI without human review, so use with caution in production environments.
- What are the requirements for using Gopls?
Gopls requires Go version 1.24.3 or higher and the gopls language server.
Server Config
{
"mcpServers": {
"mcp-gopls": {
"command": "mcp-gopls",
"args": [
"-workspace",
"/path/to/your/go/project"
]
}
}
}