mcp-gopls
MCP LSP 转到
模型上下文协议 (MCP) 服务器允许像 Claude 这样的 AI 助手与 Go 的语言服务器协议 (LSP) 交互并受益于高级 Go 代码分析功能。
概述
该 MCP 服务器可帮助 AI 助手:
使用 LSP 分析 Go 代码
导航至定义并查找参考
检查代码诊断
获取符号的悬停信息
获取完成建议
Related MCP server: mcp-pprof-anaylzer
建筑学
该项目使用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 代码的测试覆盖率 |
使用示例
将服务器与支持 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
This server cannot be deployed
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
The OpenRouter MCP server plugs OpenRouter into the AI tools you already use. Once connected, your assistant can pull live OpenRouter data (models, prices, your credits, rankings, and docs) and send quick test messages, all without leaving your editor.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to control Unreal E…
Related MCP Servers
- AlicenseNot gradedqualityCmaintenancegodoc-mcp is a Model Context Protocol (MCP) server that provides efficient access to Go documentation. It helps LLMs understand Go projects by providing direct access to package documentation without needing to read entire source files.124MIT
- AlicenseNot gradedqualityCmaintenanceThis is a Model Context Protocol (MCP) server implemented in Go, providing a tool to analyze Go pprof performance profiles.50MIT
- FlicenseNot gradedqualityDmaintenanceGo Development MCP Server for Claude Desktop and other AI tools3-
- AlicenseNot gradedqualityAmaintenancehttps://gopls-mcp.org/ MCP server for golang projects development: Expand AI Code Agent ability boundary to have a semantic understanding and determinisic information for golang projects.57BSD 3-Clause