Get the FREE Ultimate OpenClaw Setup Guide →

gopls

MCP server for golang projects development: Expand AI Code Agent ability boundary to have a semantic understanding and determinisic information for golang projects.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio xieyuschen-gopls-mcp npx -y xieyuschen-gopls-mcp \
  --env PORT="8000" \
  --env GOPLS_LOG_LEVEL="info" \
  --env GOPLS_USE_GOPLSDIAL="false"

How to use

gopls-mcp brings the language-aware capabilities of the Go language server gopls directly into your MCP workflow. Instead of returning long strings of code or generic search results, it provides precise language constructs, definitions, references, and navigation information that are scientifically accurate and contextually relevant for the code you’re inspecting. Use it to retrieve definitions, locate references, or perform code navigation tasks that your LLM can leverage to reason about Go code with high fidelity. The server is designed to supply structured language data rather than plain text, enabling your agent to reason with the program structure, types, and symbol relationships more effectively.

To use it, start the MCP server and interact with the provided endpoints through your usual MCP client. Send requests that specify Go symbols or code locations, and expect responses that emphasize exact definitions, type information, and navigation pointers. The tool is especially useful when analyzing Go projects, refactoring code, or exploring large codebases where precise symbol resolution and references are critical for correct inferences by your AI agent.

How to install

Prerequisites:

  • Node.js and npm (or pnpm) installed on your system
  • Internet access to fetch the MCP server package

Option A: Run with npx (no installation required)

  1. Ensure Node.js and npm are installed.
  2. Start the MCP server via npx: npx -y xieyuschen-gopls-mcp

Option B: Install globally via npm (repeatable install)

  1. Ensure Node.js and npm are installed.
  2. Install the MCP package globally: npm install -g xieyuschen-gopls-mcp
  3. Run the server locally (adjust as needed for your environment): npx -y xieyuschen-gopls-mcp

Option C: Use with a package manager other than npm If you prefer yarn or pnpm, install the corresponding adapter and run the equivalent command to fetch and run the xieyuschen-gopls-mcp package.

Note: The server is a wrapper around gopls functionality delivered via an MCP-compatible interface. Ensure your environment has network access to fetch dependencies during initial setup.

Additional notes

Tips and caveats:

  • Environment variables: PORT selects the listening port; GOPLS_LOG_LEVEL controls verbosity. Adjust these in the mcp_config.env object if you need different behavior.
  • Performance: gopls-mcp is designed for fast, language-aware responses. For very large codebases, ensure sufficient resources (CPU and memory) to avoid timeouts.
  • Compatibility: This MCP server is a fork/variant of gopls. It aims to preserve the language features of gopls while exposing a clean MCP interface; it may differ slightly from upstream in edge cases.
  • Troubleshooting: If the server fails to start, check that the port is not in use, and verify Node.js/npm versions are compatible with the package. Review logs for any gopls-specific initialization errors.
  • Security: Do not expose the MCP server to untrusted networks without appropriate authentication and access controls.

Related MCP Servers

Sponsor this space

Reach thousands of developers