Skip to main content
Glama

MCP LSP ゴー

Claude のような AI アシスタントが Go の Language Server Protocol (LSP) と対話し、高度な Go コード分析機能のメリットを享受できるようにする Model Context Protocol (MCP) サーバー。

概要

この MCP サーバーは、AI アシスタントが次のことを実行できるように支援します。

  • LSPを使ってGoコードを分析する

  • 定義に移動して参照を見つける

  • コード診断をチェックする

  • シンボルのホバー情報を取得する

  • 補完候補を取得する

Related MCP server: mcp-server-leetcode

建築

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

サーバーは、言語サーバー プロトコル (LSP) を介して、Go の公式言語サーバーであるgoplsと通信します。

特徴

  • LSP 統合: コード分析のための Go の言語サーバー プロトコルへの接続

  • コードナビゲーション: コード内の定義と参照を見つける

  • コード品質: 診断とエラーの取得

  • 詳細情報: ホバー情報と補完候補

プロジェクト構造

.
├── 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/hloiseaufcms/mcp-gopls/cmd/mcp-gopls@latest

カーソルに追加

{
  "mcpServers": {
    "mcp-gopls": {
      "command": "mcp-gopls"
    }
  }
} 

MCPツール

MCP サーバーは次のツールを提供します。

道具

説明

go_to_definition

シンボルの定義に移動する

find_references

シンボルへのすべての参照を検索する

check_diagnostics

ファイルの診断情報を取得する

get_hover_info

シンボルの詳細情報を取得する

get_completion

位置の完了候補を取得する

analyze_coverage

Goコードのテストカバレッジを分析する

使用例

MCP をサポートする AI アシスタントでサーバーを使用する:

# Ask the AI to get information about the code
Can you find the definition of the `ServeStdio` function in this project?

# Ask for diagnostics
Are there any errors in my main.go file?

# Ask for information about a symbol
What does the Context.WithTimeout function do in Go?

発達

git clone https://github.com/hloiseaufcms/mcp-gopls.git
cd mcp-gopls
go mod tidy
go build -o mcp-gopls cmd/mcp-gopls/main.go
./mcp-gopls

前提条件

  • Go 1.24以上

  • gopls がインストールされていること ( go install golang.org/x/tools/gopls@latest )

ライセンス

Apacheライセンス2.0

-
security - not tested
A
license - permissive license
-
quality - not tested

Resources

Looking for Admin?

Admins can modify the Dockerfile, update the server description, and track usage metrics. If you are the server author, to access the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hloiseaufcms/mcp-gopls'

If you have feedback or need assistance with the MCP directory API, please join our Discord server