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 installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenancegodoc-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
- 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
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that provides VSCode context and filesystem operations for AI assistants.9
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
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to control Unreal E…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/hloiseau/mcp-gopls'
If you have feedback or need assistance with the MCP directory API, please join our Discord server