HM

hloiseau/mcp-gopls

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

104 stars 11 forks 品質 82 トレンド 4Apache-2.0

hloiseau/mcp-goplsは、https://github.com/hloiseau/mcp-gopls.からインポートされたMCPサーバー候補です。

概要

hloiseau/mcp-goplsは、https://github.com/hloiseau/mcp-gopls.からインポートされたMCPサーバー候補です。

概要(AI 翻訳)

モデルコンテキストプロトコル(MCP)サーバーで、AIアシスタントがGoのLSP(gopls)を使ってナビゲーション、診断、テスト、カバレッジなどを行うことができます。

TL;DR: Claude / Cursor / Copilot をGoで使うと、mcp-goplsはAIに完全なLSP権限を与えます: ゴートゥー定義、参照、ホバー、完了、go test、カバレッジ、go mod tidy、govulncheckなどです。

概要

このMCPサーバーはAIアシスタントが以下を行います:

  • LSPを使ってGoワークスペースを解析する
  • 定義、参照、ワークスペースシンボルへのナビゲーション
  • MCPを離れずにフォーマット、リネーム、コードアクションの検査を行う
  • Goテスト、カバレッジ、go mod tidy、govulncheck、構造化された結果を持つモジュールグラフコマンドを実行する
  • ワークスペースのリソース(概要+go.mod)を読み、キュレーションされたプロンプトを閲覧する

ステータス: 積極的に開発中 – 実際のプロジェクトで使用されています。 Go 1.25.xとgopls@latestでテストしました。

建築

このプロジェクトでは、mark3labs/mcp-goライブラリを用いてModel Context Protocolを実装しています。MCPの統合により、AIアシスタントとGoツール間のシームレスな通信が可能になります。

このサーバーは、Language Server Protocol(LSP)を通じてGoの公式言語サーバーであるgoplsと通信します。

特徴

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

mcp-gopls – MCP server for Go (gopls)

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-gopls gives the AI full LSP powers: go-to-definition, references, hover, completion, go test, coverage, go mod tidy, govulncheck, etc.

Overview

This MCP server helps AI assistants to:

  • Use LSP to analyze Go workspaces
  • Navigate to definitions, references, and workspace symbols
  • Format, rename, and inspect code actions without leaving MCP
  • Run Go tests, coverage, go mod tidy, govulncheck, and module graph commands with structured results
  • Read workspace resources (overview + go.mod) and consume curated prompts

Status: Actively developed – used in real projects.
Tested with Go 1.25.x and gopls@latest.

Architecture

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).

Features

  • Configurable runtime: --workspace, --gopls-path, --log-level, --rpc-timeout, and --shutdown-timeout flags + env vars (MCP_GOPLS_*)
  • Structured logging: Text/JSON logging with slog and optional file output
  • Extended LSP surface: navigation, diagnostics, formatting, rename, code actions, hover, completion, workspace symbols
  • Test & tooling helpers: coverage analysis, go test, go mod tidy, govulncheck, go mod graph
  • MCP extras: resources (resource://workspace/overview, resource://workspace/go.mod) and prompts (summarize_diagnostics, refactor_plan)
  • Progress streaming: long-running commands emit notifications/progress events so clients can surface status updates

Feature comparison: mcp-gopls vs built-in gopls MCP

As 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 |

GitHub で README 全文を見る

インストール

docker run --rm -i \
MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "mcp-gopls": { "command": "mcp-gopls", "args": ["--workspace", "/absolute/path/to/your/go/project"], "env": { "MCP_GOPLS_LOG_LEVEL": "info" } } } }