Loading...

MCP server exposing Go's LSP (gopls) for AI assistants, enabling code navigation, diagnostics, testing, and refactoring capabilities.
Boost this tool
Subscribe to listing upgrades or segmented pushes.
MCP server exposing Go's LSP (gopls) for AI assistants, enabling code navigation, diagnostics, testing, and refactoring capabilities.
This server provides powerful code analysis and manipulation capabilities. It's safe for read-only operations like code navigation and diagnostics. However, running tests or applying code actions carries a moderate risk of unintended changes and should be carefully reviewed.
Performance depends on the size of the Go workspace and the complexity of the code. Long-running commands may impact responsiveness.
The primary cost is the computational resources used by the server. Consider the cost of running gopls and other tools.
npx -y @mark3labs/mcp-inspector \{
"mcpServers": {
"mcp-gopls": {
"command": "mcp-gopls",
"args": ["--workspace", "/absolute/path/to/your/go/project"],
"env": {
"MCP_GOPLS_LOG_LEVEL": "info"
}
}
}
}go_to_definitionNavigates to the definition of a specified symbol.
Read-only operation, no side effects.
find_referencesLists all references to a specified symbol.
Read-only operation, no side effects.
check_diagnosticsFetches cached diagnostics for a specified file.
Read-only operation, no side effects.
get_hover_infoReturns hover information for a symbol at a given position.
Read-only operation, no side effects.
get_completionReturns code completion suggestions at a given position.
Read-only operation, no side effects.
format_documentFormats the specified Go document.
Modifies the document, but generally non-destructive.
rename_symbolRenames a symbol throughout the workspace.
Modifies code structure, potential for errors.
list_code_actionsLists available code actions for a given range.
Code actions can modify code, review before applying.
search_workspace_symbolsSearches for symbols within the workspace.
Read-only operation, no side effects.
analyze_coverageAnalyzes code coverage for specified packages.
Read-only analysis, no code modification.
run_go_testExecutes Go tests for specified packages.
Can modify files (e.g., generate test coverage files).
run_go_mod_tidyRuns `go mod tidy` to synchronize the go.mod file.
Modifies go.mod and go.sum, potentially altering dependencies.
run_govulncheckRuns `govulncheck` to identify known vulnerabilities.
Read-only analysis, no code modification.
module_graphGenerates a module graph of dependencies.
Read-only operation, no side effects.
None
local
This server provides powerful code analysis and manipulation capabilities. It's safe for read-only operations like code navigation and diagnostics. However, running tests or applying code actions carries a moderate risk of unintended changes and should be carefully reviewed.
The level of autonomy depends on the specific tool being used. Some tools are read-only, while others can modify code. Exercise caution when using tools that can modify code.
Production Tip
Monitor the server's logs and resource usage to ensure it's operating within acceptable limits.
It exposes Go's LSP (gopls) to AI assistants via the Model Context Protocol (MCP).
Go 1.25 and later are supported.
Use `go install github.com/hloiseau/mcp-gopls/v2/cmd/mcp-gopls@latest`.
Edit the Cursor settings JSON and add an entry for mcp-gopls with the workspace path.
It specifies the absolute path to your Go project.
Potential unintended code modifications and exposure of sensitive code.
Check the server's logs for errors and resource usage.