megagrindstone/gopls-mcp

By megagrindstone

Updated about 1 year ago

Go language server MCP integration for AI assistants. Navigate and explore Go code naturally.

Image
Languages & frameworks
Machine learning & AI
Developer tools
0

1.1K

megagrindstone/gopls-mcp repository overview

gopls-mcp: Go Language Server for MCP

GitHub release Docker Hub CI License: MIT

A Model Context Protocol (MCP) server that integrates gopls with AI coding assistants like Claude Code, Claude Desktop, and VS Code. Developed in collaboration with Claude Code to provide comprehensive Go development assistance.

✨ Features

14 comprehensive Go development tools with full multi-workspace support:

🏢 Workspace Management (1)
  • 📋 List Workspaces - Discover and enumerate all configured Go workspaces
🎯 Core Navigation (3)
  • 🎯 Go to Definition - Navigate to symbol definitions across workspaces
  • 🔍 Find References - Locate all references to functions, variables, and types
  • 📖 Hover Information - Get documentation, type information, and signatures
🔍 Diagnostic & Analysis (3)
  • 🚨 Get Diagnostics - Get compilation errors, warnings, and diagnostics
  • 📄 Document Symbols - Get outline of symbols defined in Go files
  • 🔎 Workspace Symbols - Search for symbols across entire workspaces
💡 Code Assistance (2)
  • ✍️ Signature Help - Get function signature help and parameter information
  • 🤖 Code Completions - Get intelligent code completion suggestions
🧭 Advanced Navigation (2)
  • 🏷️ Type Definition - Navigate to type definitions of symbols
  • 🔗 Find Implementations - Find all implementations of interfaces or methods
🛠️ Code Maintenance (3)
  • ✨ Format Document - Format Go files according to gofmt standards
  • 📦 Organize Imports - Organize and clean up import statements
  • 💭 Inlay Hints - Get inlay hints for implicit parameter names and types

🚀 Quick Start

1. Start the Server

Single Workspace:

docker run -d -v /path/to/go/project:/workspace -p 8080:8080 megagrindstone/gopls-mcp:latest

Multiple Workspaces:

docker run -d \
  -v /path/to/project1:/workspace1 \
  -v /path/to/project2:/workspace2 \
  -v /path/to/project3:/workspace3 \
  -p 8080:8080 \
  megagrindstone/gopls-mcp:latest -workspace /workspace1,/workspace2,/workspace3
2. Integrate with Claude Code
claude mcp add --transport http gopls-mcp http://localhost:8080
3. Use Natural Language

Ask Claude Code about your Go code across multiple workspaces:

  • "Where is the ProcessRequest function defined in project1?"
  • "Show me all places where UserService is used across all workspaces"
  • "What compilation errors are in main.go?"
  • "Format this Go file and organize imports"

🔧 Configuration

Transport Options

HTTP Transport (Default):

docker run -v /path/to/project:/workspace -p 8080:8080 megagrindstone/gopls-mcp:latest

Stdio Transport:

docker run -i -v /path/to/project:/workspace megagrindstone/gopls-mcp:latest -transport stdio
Logging Configuration
# Debug logging with JSON format
docker run -e LOG_LEVEL=DEBUG -e LOG_FORMAT=json \
  -v /path/to/project:/workspace -p 8080:8080 \
  megagrindstone/gopls-mcp:latest

📚 Integration Examples

Claude Desktop (Single Workspace)
{
  "mcpServers": {
    "gopls-mcp": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-v", "/path/to/your/go/project:/workspace",
        "-p", "8080:8080",
        "megagrindstone/gopls-mcp:latest"
      ]
    }
  }
}
Claude Desktop (Multiple Workspaces)
{
  "mcpServers": {
    "gopls-mcp": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-v", "/path/to/project1:/workspace1",
        "-v", "/path/to/project2:/workspace2",
        "-v", "/path/to/project3:/workspace3",
        "-p", "8080:8080",
        "megagrindstone/gopls-mcp:latest",
        "-workspace", "/workspace1,/workspace2,/workspace3"
      ]
    }
  }
}
Other MCP Hosts
{
  "servers": {
    "gopls-mcp": {
      "type": "http",
      "url": "http://localhost:8080"
    }
  }
}

🏷️ Available Tags

  • latest - Latest stable release (v0.3.0)
  • v* - Semantic version tags (e.g., v0.3.0, v0.2.1)
  • main - Latest development build

🌐 Multi-Platform Support

  • linux/amd64 - Intel/AMD 64-bit
  • linux/arm64 - ARM 64-bit (Apple Silicon, ARM servers)

⚠️ Important Note

This project uses the Model Context Protocol Go SDK which is currently in early development (v0.1.0). This project will not have stable releases until the go-sdk reaches stability. Please consider this when using in production environments.

📋 Requirements

  • Go workspace with valid go.mod file
  • Proper Go module structure
  • Docker runtime

Developed by Gerard Adam in collaboration with Claude Code | MIT License

Tag summary

Content type

Image

Digest

sha256:12f777f15

Size

259.1 MB

Last updated

about 1 year ago

docker pull megagrindstone/gopls-mcp