Gomcp
A golang based template MCP server, 100% 18-06 MCP spec compliant.
Installation
npx gomcpAsk AI about Gomcp
Powered by Claude Β· Grounded in docs
I know everything about Gomcp. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
gomcp
Production-ready Model Context Protocol (MCP) server template in Go
Features | Quick Start | Use as Template | Documentation | Contributing
Overview
gomcp is a complete, production-ready MCP server template built with Go and the official MCP Go SDK. It implements the full MCP 2025-06-18 specification and is designed to be used as a starting point for building your own MCP servers.
Why gomcp?
- Complete Implementation - All 12 MCP features fully implemented
- Production Ready - Docker support, CI/CD, security best practices
- Well Documented - Comprehensive docs, examples, and customization guide
- Easy to Customize - Clean architecture, modular design, extensive comments
- Multiple Transports - HTTP/SSE for Cursor IDE, stdio for Claude Desktop
Features
MCP Features (12/12)
|
Infrastructure
|
Quick Start
Prerequisites
- Go 1.24+
- (Optional) Docker/Podman
Installation
# Clone the repository
git clone https://github.com/NP-compete/gomcp.git
cd gomcp
# Download dependencies
go mod download
# Build and run
make run
Running the Server
For Cursor IDE (HTTP/SSE)
make cursor
# Server runs on http://localhost:8081/mcp/sse
Configure ~/.cursor/mcp.json:
{
"mcpServers": {
"gomcp": {
"url": "http://localhost:8081/mcp/sse"
}
}
}
Restart Cursor IDE to connect.
For Claude Desktop (stdio)
# Build the binary
make build-prod
# Configure Claude Desktop
# ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
# %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"gomcp": {
"command": "/absolute/path/to/gomcp/bin/gomcp",
"args": [],
"env": {
"MCP_TRANSPORT_PROTOCOL": "stdio"
}
}
}
}
Restart Claude Desktop to connect.
With Docker
# Build and run with Docker
make docker-build
make docker-run
# Or with Docker Compose
docker-compose up -d
Use as Template
This repository is designed to be used as a template for your own MCP server.
Option 1: GitHub Template (Recommended)
Click the "Use this template" button on GitHub to create a new repository.
Option 2: Manual Clone
# Clone and remove git history
git clone https://github.com/NP-compete/gomcp.git my-mcp-server
cd my-mcp-server
rm -rf .git
git init
# Update module name
# Edit go.mod: module github.com/YOUR_USERNAME/my-mcp-server
# Then update all imports
Customization Guide
See docs/CUSTOMIZATION.md for detailed instructions on:
- Adding your own tools, prompts, and resources
- Configuring authentication
- Customizing the Docker setup
- Setting up CI/CD for your repository
Project Structure
gomcp/
βββ cmd/server/ # Application entry point
βββ internal/
β βββ api/ # HTTP handlers & routing
β βββ completion/ # Structured outputs
β βββ config/ # Configuration management
β βββ logging/ # Server-to-client logs
β βββ mcp/ # MCP server logic
β βββ pagination/ # Cursor-based pagination
β βββ prompts/ # Prompt implementations
β βββ resources/ # Resource implementations
β βββ roots/ # Filesystem roots
β βββ tools/ # Tool implementations
βββ pkg/mcpprotocol/ # MCP protocol types
βββ test/ # Integration tests
βββ docs/ # Documentation
βββ scripts/ # Utility scripts
βββ .github/ # GitHub Actions & templates
βββ Dockerfile # Container build
βββ docker-compose.yml # Local development
βββ Makefile # Build commands
Configuration
| Variable | Default | Description |
|---|---|---|
MCP_TRANSPORT_PROTOCOL | http | Transport: stdio, http, sse |
MCP_PORT | 8081 | Server port |
CURSOR_COMPATIBLE_SSE | true | Enable Cursor compatibility |
ENABLE_AUTH | true | Enable OAuth authentication |
LOG_LEVEL | INFO | Log level |
See .env.example for all options.
Testing
# Run all tests
make test
# Run with coverage
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
# Run linter
make lint
# Run security scan
make security-scan
Documentation
| Document | Description |
|---|---|
| Architecture | System design and component overview |
| Customization | Guide to customizing the template |
| Contributing | How to contribute |
| Security | Security policy |
External Resources
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Model Context Protocol - The MCP specification
- Official Go SDK - The foundation of this server
- All contributors who help improve this project
Built for the MCP community
