MCP Gopls logo

MCP Gopls

by hloiseaufcms

Connects AI clients to gopls for Go code navigation, diagnostics, editing, testing, coverage, and module tooling.

Install MCP Gopls

Run the project’s own setup commands, in order.

Setup steps from the project

hloiseaufcms/mcp-gopls installs with its own commands rather than a config we can generate, so these are copied as-is. Run them in order in a terminal. Source: github.com

  1. 1. Install
    go install github.com/hloiseau/mcp-gopls/v2/cmd/mcp-gopls@latest
    
  2. 2. Start the server
    docker run --rm -i \
      -v /absolute/path/to/your/go/project:/workspace \
      ghcr.io/hloiseau/mcp-gopls:latest \
      --workspace /workspace
    
  3. 3. Install
    git clone https://github.com/hloiseau/mcp-gopls.git
    
  4. 4. Run
    cd mcp-gopls
    
  5. 5. Install
    go build ./cmd/mcp-gopls
    

Overview

hloiseaufcms/mcp-gopls MCP server exposes Go's gopls language-server capabilities and additional Go tooling through MCP. It communicates with gopls over LSP and returns structured results for navigation, diagnostics, formatting, refactoring, tests, coverage, dependency maintenance, and vulnerability checks. The server also provides workspace resources, prompts, and progress notifications for longer-running operations. Reach for it when an AI client needs more than read-only Go code inspection, including edits, test execution, or module analysis.

Use cases

  • Navigate Go definitions and references from an AI coding client
  • Review and fix Go diagnostics with structured results
  • Run Go tests and inspect coverage through MCP
  • Format, rename, and apply Go code actions
  • Inspect modules and run vulnerability checks

Key features

  • Go LSP navigation and workspace symbol search
  • Diagnostics, hover, completion, formatting, and code actions
  • Symbol renaming through MCP
  • Go tests and coverage analysis
  • Module tidy, graph inspection, and vulnerability checks
  • Workspace resources, prompts, and progress notifications

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

26/26 checks healthy over the last 96d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 8/23/2026 via OSV.dev

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars104Stargazers on the source repository.
Last commit4mo agoMost recent push to the default branch.
Directory activity3 viewsConfig copies, upvotes, and views on AllMCPs.

How MCP Gopls works

What hloiseaufcms/mcp-gopls does

hloiseaufcms/mcp-gopls MCP server connects an MCP-compatible AI client to Go's official gopls language server. It exposes language features for a configured Go workspace, including definition lookup, reference search, hover information, completion, diagnostics, formatting, symbol renaming, code actions, and workspace symbol search.

Beyond LSP operations, the server exposes tools for running go test, analyzing coverage, applying go mod tidy, checking dependencies with govulncheck, and inspecting the module graph. It also publishes two workspace resources: an overview and the workspace's go.mod file. Curated prompts named summarize_diagnostics and refactor_plan support common diagnostic and refactoring workflows.

How it works

The server is implemented with the mark3labs/mcp-go library. It receives MCP requests from an AI client and uses the Language Server Protocol to communicate with gopls. The workspace is selected through configuration, allowing language-server operations to be scoped to a Go project.

Long-running commands can emit notifications/progress events, allowing clients to display status while tests, vulnerability checks, coverage analysis, or other operations are running. Results from the Go tooling helpers are structured for MCP clients rather than being limited to unstructured terminal output.

Setup and configuration

Install the command with Go:

bash
go install github.com/hloiseau/mcp-gopls/v2/cmd/mcp-gopls@latest

After installation, verify that mcp-gopls is available on PATH, then configure the client to invoke that binary with a workspace argument such as --workspace /absolute/path/to/project. Cursor and Claude Desktop setup examples are provided in the project documentation. A Docker image is also published at ghcr.io/hloiseau/mcp-gopls; container usage mounts a Go project at /workspace and passes --workspace /workspace.

Runtime options include --workspace, --gopls-path, --log-level, --rpc-timeout, and --shutdown-timeout. Logging supports text or JSON output and optional file output.

Tools and capabilities

The documented MCP tools include:

  • go_to_definition, find_references, and search_workspace_symbols for code navigation.
  • check_diagnostics for file or workspace diagnostics.
  • get_hover_info and get_completion for editor-style assistance.
  • format_document, rename_symbol, and list_code_actions for code changes and refactoring support.
  • run_go_test, analyze_coverage, run_go_mod_tidy, run_govulncheck, and module_graph for Go project tooling.

The server is documented as tested with Go 1.25.x and gopls@latest. The repository carries an Apache 2.0 license.

Limitations and notes

hloiseaufcms/mcp-gopls MCP server is actively developed, so behavior and coverage may change. It also does not provide a complete mapping of the MCP_GOPLS_* environment variables. The Docker examples require replacing the documented path placeholder with a real project path before use.

The README compares this project with the experimental MCP server built into gopls. That built-in option covers several read-oriented operations, but the supplied comparison identifies this project as the option with dedicated tools for editing-oriented LSP features, test execution, coverage, go mod tidy, and module-graph inspection.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about MCP Gopls

Run `go install github.com/hloiseau/mcp-gopls/v2/cmd/mcp-gopls@latest`, then verify that `mcp-gopls` is on your `PATH`.

Yes. The README includes Claude Desktop configuration instructions and uses the `mcp-gopls --workspace` command.

Yes. It provides `run_go_test` and `analyze_coverage` tools.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewMCP Gopls AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/hloiseaufcms-mcp-gopls?style=directory)](https://allmcps.com/mcp/hloiseaufcms-mcp-gopls)
HTML Embed
<a href="https://allmcps.com/mcp/hloiseaufcms-mcp-gopls"><img src="https://allmcps.com/api/badge/hloiseaufcms-mcp-gopls?style=directory" alt="MCP Gopls on AllMCPs" /></a>