by hloiseau
Model Context Protocol (MCP) server for Go using gopls – LSP-powered analysis, tests, coverage, and tooling.
# Add to your Claude Code skills
git clone https://github.com/hloiseau/mcp-goplsmcp-gopls is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by hloiseau. Model Context Protocol (MCP) server for Go using gopls – LSP-powered analysis, tests, coverage, and tooling. It has 104 GitHub stars.
mcp-gopls's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/hloiseau/mcp-gopls" and add it to your Claude Code skills directory (see the Installation section above).
mcp-gopls is primarily written in Go. It is open-source under hloiseau on GitHub, so you can review or fork the full source.
Yes. AgentsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh mcp-gopls against similar tools.
No comments yet. Be the first to share your thoughts!
Unlocks once the catalog security scan passes (runs nightly).
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
A Model Context Protocol (MCP) server that lets AI assistants use Go’s LSP (gopls) for navigation, diagnostics, testing, coverage, and more.
TL;DR: If you use Claude / Cursor / Copilot with Go,
mcp-goplsgives the AI full LSP powers: go-to-definition, references, hover, completion,go test, coverage,go mod tidy,govulncheck, etc.

This MCP server helps AI assistants to:
go mod tidy, govulncheck, and module graph commands with structured resultsStatus: Actively developed – used in real projects.
Tested with Go 1.25.x andgopls@latest.
This project uses the mark3labs/mcp-go library to implement the Model Context Protocol. The MCP integration enables seamless communication between AI assistants and Go tools.
The server communicates with gopls, the official language server for Go, via the Language Server Protocol (LSP).
--workspace, --gopls-path, --log-level, --rpc-timeout, and --shutdown-timeout flags + env vars (MCP_GOPLS_*)go test, go mod tidy, govulncheck, go mod graphresource://workspace/overview, resource://workspace/go.mod) and prompts (summarize_diagnostics, refactor_plan)notifications/progress events so clients can surface status updatesmcp-gopls vs built-in gopls MCPAs of gopls v0.20.0, the built-in MCP server exposes these tools:
go_context, go_diagnostics, go_file_context, go_file_diagnostics,
go_file_metadata, go_package_api, go_references, go_rename_symbol,
go_search, go_symbol_references, go_workspace, go_vulncheck.
| Feature / capability | mcp-gopls (this project) |
Built-in gopls MCP |
|---|---|---|
| Go-to-definition | Yes (go_to_definition tool) |
No dedicated MCP tool (not in tool list) |
| Find references | Yes (find_references) |
Yes (go_references, go_symbol_references) |
| Diagnostics (file / workspace) | Yes (check_diagnostics) |
Yes (go_diagnostics, go_file_diagnostics) |
| Hover information | Yes (get_hover_info) |
No dedicated MCP tool (not in tool list) |
| Completion | Yes (get_completion) |
No dedicated MCP tool (not in tool list) |
| Formatting | Yes (format_document) |
No dedicated MCP tool (not in tool list) |
| Rename symbol | Yes (rename_symbol) |
Yes (go_rename_symbol) |
| Code actions | Yes (list_code_actions) |
No dedicated MCP tool (not in tool list) |
| Workspace symbol search | Yes (search_workspace_symbols) |
Yes (go_search) |
| Package / workspace API/context tools | No dedicated MCP tool | Yes (go_package_api, go_file_context, go_file_metadata, go_workspace, go_context) |
Run go test |
Yes (run_go_test) |
No MCP tool for running tests |
| Coverage analysis | Yes (analyze_coverage) |
No MCP tool for coverage |
go mod tidy |
Yes (run_go_mod_tidy) |
No MCP tool for go mod tidy |
govulncheck |
Yes (run_govulncheck) |
Yes (go_vulncheck) |
Module graph (go mod graph) |
Yes (module_graph) |
No MCP tool for module graph |
| Extra MCP resources | Yes (resource://workspace/overview, resource://workspace/go.mod) |
Not documented as MCP resources |
| Custom MCP prompts | Yes (summarize_diagnostics, refactor_plan) |
Not exposed as MCP prompts (only model instructions) |
| Model instructions shipped with server | No special mechanism (documented in README/docs) | Yes: gopls mcp -instructions prints usage workflows |
If you want full LSP-like editing + tooling from MCP (definition, hover, completion, format, rename, code actions, go test, coverage, go mod tidy, module graph), mcp-gopls is strictly richer.
If you mostly want read-only/introspective tools (diagnostics, symbol search, references, package API, workspace/file context, vulncheck) with no extra binary, the built-in gopls MCP is enough.
Note: The built-in
goplsMCP server is still marked experimental and its tool set may change over time. This comparison is accurate as ofgoplsv0.20.x.
.
├── cmd
│ └── mcp-gopls # Application entry point
├── pkg
│ ├── lsp # LSP client to communicate with gopls
│ │ ├── client # LSP client implementation
│ │ └── protocol # LSP protocol types and features
│ ├── server # MCP server
│ └── tools # MCP tools exposing LSP features
go install github.com/hloiseau/mcp-gopls/v2/cmd/mcp-gopls@latest
go install github.com/hloiseau/mcp-gopls/v2/cmd/mcp-gopls@latest
$PATH:mcp-gopls --help
If you prefer to run mcp-gopls in a container (for Docker MCP Gateway or other containerized setups), use the official image.
docker run --rm -i \
-v /absolute/path/to/your/go/project:/workspace \
ghcr.io/hloiseau/mcp-gopls:latest \
--workspace /workspace
Copy docs/docker-mcp.yaml, update the bind mount path, then run from that directory:
docker mcp gateway run
If your MCP catalog tooling requires a toolsUrl, use docs/tools.json as a static tool list.
Note: All clients point to the same command:
mcp-gopls --workspace /absolute/path/to/your/go/project
The configuration format differs slightly per client, but the binary and arguments remain identical.
mcp-gopls entry:{
"mcpServers": {
"mcp-gopls": {
"command": "mcp-gopls",
"args": ["--workspace", "/absolute/path/to/your/go/project"],
"env": {
"MCP_GOPLS_LOG_LEVEL": "info"
}
}
}
}
mcp-gopls.| Tool / Prompt | Example request inside Cursor Chat |
|---|---|
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.” |
summarize_diagnostics |
“Use the summarize_diagnostics prompt on the latest diagnostics.” |
refactor_plan |
“Feed refactor_plan the diagnostics JSON to plan fixes.” |
mcp-gopls and make sure it is on your $PATH.claude_desktop_config.json.
~/Library/Application Support/Claude/claude_desktop_config.json~/.config/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json{
"mcpServers": {
"mcp-gopls": {
"command": "mcp-gopls",
"args": ["--workspace", "/absolute/path/to/your/go/project"],
"env": {
"MCP_GOPLS_LOG_LEVEL": "info"
}
}
}
}
Restart Claude Desktop, open a chat, and ask it to connect to the mcp-gopls tool (Claude will show a “Tools” tab once the server is detected). Typical prompts include “list diagnostics for cmd/api/server.go” or “rename userService to accountService.”
In Cursor open Settings → MCP Servers → Edit JSON (this writes to ~/.cursor/config.json or the project-local override). Add:
{
"mcpServers": {
"mcp-gopls": {
"command": "mcp-gopls",
"args": ["--workspace", "/absolute/path/to/your/go/project"]
}
}
}
Reload Cursor (or run the `Develo