What is hloiseaufcms mcp gopls
MCP LSP Go
A Model Context Protocol (MCP) server that allows AI assistants like Claude to interact with Go's Language Server Protocol (LSP) and benefit from advanced Go code analysis features.
Overview
This MCP server helps AI assistants to:
- Use LSP to analyze Go code
- Navigate to definitions and find references
- Check code diagnostics
- Get hover information for symbols
- Get completion suggestions
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
- LSP Integration: Connection to Go's Language Server Protocol for code analysis
- Code Navigation: Finding definitions and references in the code
- Code Quality: Getting diagnostics and errors
- Advanced Information: Hover information and completion suggestions
Project Structure
.
├── 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
Installation
go install github.com/hloiseaufcms/mcp-gopls/cmd/mcp-gopls@latest
Add to Cursor
{
"mcpServers": {
"mcp-gopls": {
"command": "mcp-gopls"
}
}
}
MCP Tools
The MCP server provides the following tools:
Tool | Description |
---|---|
go_to_definition |
Navigate to the definition of a symbol |
find_references |
Find all references to a symbol |
check_diagnostics |
Get diagnostics for a file |
get_hover_info |
Get detailed information about a symbol |
get_completion |
Get completion suggestions at a position |
analyze_coverage |
Analyze test coverage for Go code |
Usage Example
Using the server with AI assistants that support MCP:
# 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?
Development
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
Prerequisites
- Go 1.21 or higher
- gopls installed (
go install golang.org/x/tools/gopls@latest
)
Integration with Ollama
This MCP server can be used with any tool that supports the MCP protocol. For Ollama integration:
- Make sure Ollama is running
- The MCP server runs independently and communicates through stdin/stdout
- Configure your client to use the MCP server as a tool provider
License
Apache License 2.0
Leave a Comment
Frequently Asked Questions
What is MCP?
MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, providing a standardized way to connect AI models to different data sources and tools.
What are MCP Servers?
MCP Servers are lightweight programs that expose specific capabilities through the standardized Model Context Protocol. They act as bridges between LLMs like Claude and various data sources or services, allowing secure access to files, databases, APIs, and other resources.
How do MCP Servers work?
MCP Servers follow a client-server architecture where a host application (like Claude Desktop) connects to multiple servers. Each server provides specific functionality through standardized endpoints and protocols, enabling Claude to access data and perform actions through the standardized protocol.
Are MCP Servers secure?
Yes, MCP Servers are designed with security in mind. They run locally with explicit configuration and permissions, require user approval for actions, and include built-in security features to prevent unauthorized access and ensure data privacy.
Related MCP Servers
chrisdoc hevy mcp
sylphlab pdf reader mcp
An MCP server built with Node.js/TypeScript that allows AI agents to securely read PDF files (local or URL) and extract text, metadata, or page counts. Uses pdf-parse.
aashari mcp server atlassian bitbucket
Node.js/TypeScript MCP server for Atlassian Bitbucket. Enables AI systems (LLMs) to interact with workspaces, repositories, and pull requests via tools (list, get, comment, search). Connects AI directly to version control workflows through the standard MCP interface.
aashari mcp server atlassian confluence
Node.js/TypeScript MCP server for Atlassian Confluence. Provides tools enabling AI systems (LLMs) to list/get spaces & pages (content formatted as Markdown) and search via CQL. Connects AI seamlessly to Confluence knowledge bases using the standard MCP interface.
prisma prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB
Zzzccs123 mcp sentry
mcp sentry for typescript sdk
zhuzhoulin dify mcp server
zhongmingyuan mcp my mac
zhixiaoqiang desktop image manager mcp
MCP 服务器,用于管理桌面图片、查看详情、压缩、移动等(完全让Trae实现)
zhixiaoqiang antd components mcp
An MCP service for Ant Design components query | 一个减少 Ant Design 组件代码生成幻觉的 MCP 服务,包含系统提示词、组件文档、API 文档、代码示例和更新日志查询
Submit Your MCP Server
Share your MCP server with the community
Submit Now