Install
$ agentstack add mcp-ajitpratap0-mcp-sdk-go ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Model Context Protocol Go SDK
> Enterprise-Grade MCP Implementation • 98% Specification Compliance • Production Ready
A comprehensive, high-performance implementation of the Model Context Protocol (MCP) specification in Go, featuring enterprise authentication, observability, and developer tools.
[](https://pkg.go.dev/github.com/ajitpratap0/mcp-sdk-go) [](https://github.com/ajitpratap0/mcp-sdk-go/blob/main/LICENSE) [](https://codecov.io/gh/ajitpratap0/mcp-sdk-go) [](https://goreportcard.com/report/github.com/ajitpratap0/mcp-sdk-go) [](https://github.com/ajitpratap0/mcp-sdk-go/actions)
🎯 Overview
This SDK provides the most comprehensive Go implementation of the Model Context Protocol, designed for production deployments with enterprise-grade features:
- 🏗️ Production Ready: Enterprise authentication, observability, and deployment tools
- ⚡ High Performance: Sub-10ms latency, 50,000+ ops/s batch throughput, zero memory leaks
- 🔐 Enterprise Security: Bearer tokens, API keys, RBAC, rate limiting, and session management
- 📊 Full Observability: OpenTelemetry tracing, Prometheus metrics, and comprehensive monitoring
- 🛠️ Developer Experience: Hot reload server, code generation, protocol validation, and debugging tools
- 🚀 Cloud Native: Docker/Kubernetes deployment, auto-scaling, and production monitoring
📈 Project Status
- MCP Compliance: 98% specification compliant
- Test Coverage: 40+ test files with >85% coverage
- Architecture: Modern, middleware-based design with configuration-driven approach
- Production Deployments: Battle-tested enterprise features
🌟 Key Features
🏗️ Core Protocol
- Full JSON-RPC 2.0 Implementation with batch processing support
- Complete MCP Lifecycle Management with capability negotiation
- Modern Configuration-Driven Architecture with middleware composition
- Comprehensive Error Handling with proper MCP error codes and recovery
🚀 Transport Layer
- Intelligent Transport Selection: Stdio (MCP required) and Streamable HTTP with reliability
- Built-in Middleware Stack: Authentication, rate limiting, observability, and reliability
- Connection Management: Pooling, retry logic, circuit breakers, and graceful degradation
- Batch Processing: High-performance JSON-RPC 2.0 batch operations
🔐 Enterprise Authentication
- Pluggable Auth Providers: Bearer tokens, API keys, extensible for OAuth2/OIDC
- Role-Based Access Control (RBAC): Hierarchical permissions with inheritance
- Rate Limiting: Token bucket algorithm with per-user/per-token/global limits
- Session Management: Secure token generation, caching, and lifecycle management
📊 Production Observability
- OpenTelemetry Integration: Distributed tracing with OTLP, gRPC, and HTTP exporters
- Prometheus Metrics: MCP-specific metrics with custom dashboards
- Performance Monitoring: Sub-millisecond latency tracking and regression detection
- Health Checks: Comprehensive health endpoints with dependency monitoring
🛠️ Developer Experience
- Hot Reload Development Server: File watching with real-time dashboard
- Code Generation Tools: Provider scaffolding with comprehensive templates
- Protocol Validation: MCP compliance testing and performance benchmarking
- Advanced Debugging: Request tracing, error analysis, and performance profiling
🏢 Production Deployment
- Container Support: Docker images with multi-stage builds and security scanning
- Kubernetes Integration: Helm charts, operators, and auto-scaling configurations
- Load Balancing: HAProxy configurations and traffic management
- Monitoring Stack: Grafana dashboards, Prometheus, and alerting rules
🚀 Quick Start
Basic Client
import (
"context"
"log"
"github.com/ajitpratap0/mcp-sdk-go/pkg/client"
"github.com/ajitpratap0/mcp-sdk-go/pkg/protocol"
"github.com/ajitpratap0/mcp-sdk-go/pkg/transport"
)
func main() {
// Modern config-driven transport creation
config := transport.DefaultTransportConfig(transport.TransportTypeStreamableHTTP)
config.Endpoint = "https://api.example.com/mcp"
// Enable enterprise features
config.Features.EnableAuthentication = true
config.Features.EnableObservability = true
config.Features.EnableReliability = true
transport, err := transport.NewTransport(config)
if err != nil {
log.Fatal(err)
}
client := client.New(transport,
client.WithName("MyClient"),
client.WithVersion("1.0.0"),
client.WithCapability(protocol.CapabilitySampling, true),
)
ctx := context.Background()
if err := client.Initialize(ctx); err != nil {
log.Fatal(err)
}
defer client.Close()
// Use client with automatic pagination and error handling
allTools, err := client.ListAllTools(ctx, "")
if err != nil {
log.Printf("Error listing tools: %v", err)
return
}
for _, tool := range allTools {
log.Printf("Tool: %s - %s", tool.Name, tool.Description)
}
}
Enterprise Server
import (
"context"
"github.com/ajitpratap0/mcp-sdk-go/pkg/server"
"github.com/ajitpratap0/mcp-sdk-go/pkg/transport"
"github.com/ajitpratap0/mcp-sdk-go/pkg/auth"
)
func main() {
// Configure enterprise-grade transport
config := transport.DefaultTransportConfig(transport.TransportTypeStreamableHTTP)
config.Endpoint = "https://api.example.com/mcp"
// Enable authentication
config.Features.EnableAuthentication = true
config.Security.Authentication = &transport.AuthenticationConfig{
Type: "bearer",
Required: true,
TokenExpiry: 10 * time.Minute,
}
// Enable comprehensive observability
config.Features.EnableObservability = true
config.Observability.EnableMetrics = true
config.Observability.EnableTracing = true
config.Observability.EnableLogging = true
transport, err := transport.NewTransport(config)
if err != nil {
log.Fatal(err)
}
server := server.New(transport,
server.WithName("Enterprise MCP Server"),
server.WithVersion("2.0.0"),
server.WithToolsProvider(createEnterpriseToolsProvider()),
server.WithResourcesProvider(createResourcesProvider()),
)
ctx := context.Background()
log.Println("Starting enterprise MCP server...")
if err := server.Start(ctx); err != nil {
log.Fatal(err)
}
}
📚 Comprehensive Examples
🏗️ Core Examples
- [Simple Server](examples/simple-server/) - Basic MCP server implementation
- **[Streamable HTTP Client/Server](examples/streamable-http-)* - HTTP transport examples
- [Stdio Client](examples/stdio-client/) - Standard stdio transport
- [Batch Processing](examples/batch-processing/) - High-performance batch operations
- [Pagination](examples/pagination-example/) - Manual and automatic pagination
🔐 Enterprise Features
- [Authentication](examples/authentication/) - Bearer tokens, API keys, RBAC integration
- [Observability](examples/observability/) - OpenTelemetry tracing and Prometheus metrics
- [Metrics Reporting](examples/metrics-reporting/) - Comprehensive monitoring and alerting
- [Error Recovery](examples/error-recovery/) - Advanced error handling patterns
🛠️ Developer Tools
- [Development Server](examples/development-server/) - Hot reload with live dashboard
- [Code Generator](examples/code-generator/) - Provider scaffolding and templates
- [Protocol Validator](examples/protocol-validator/) - MCP compliance testing
- [Custom Transport](examples/custom-transport/) - Building custom transport implementations
🏢 Production Deployment
- [Production Deployment](examples/production-deployment/) - Docker, Kubernetes, monitoring
- [Multi-Server Setup](examples/multi-server/) - Load balancing and failover
- [LLM Integration](examples/llm-completion/) - AI provider integration patterns
- [Plugin Architecture](examples/plugin-architecture/) - Extensible provider system
🏗️ Architecture
Layered Design
┌─────────────────────────────────────────────────────────┐
│ Examples & Production Deployments │
├─────────────────────────────────────────────────────────┤
│ Client & Server APIs │
│ • Authentication & Authorization │
│ • Resource Management & Subscriptions │
│ • Tool Execution & Context Management │
├─────────────────────────────────────────────────────────┤
│ Middleware Stack │
│ • Authentication (Bearer, API Key, RBAC) │
│ • Rate Limiting (Token Bucket Algorithm) │
│ • Observability (OpenTelemetry, Prometheus) │
│ • Reliability (Retries, Circuit Breakers) │
├─────────────────────────────────────────────────────────┤
│ Transport Layer │
│ • StdioTransport (MCP Required) │
│ • StreamableHTTPTransport (Production) │
│ • Custom Transport Interface │
├─────────────────────────────────────────────────────────┤
│ Protocol Layer │
│ • JSON-RPC 2.0 with Batch Processing │
│ • MCP Message Types & Validation │
│ • Error Handling & Recovery │
├─────────────────────────────────────────────────────────┤
│ Core Utilities │
│ • Pagination & Collection Management │
│ • Schema Validation & Type Safety │
│ • Performance Benchmarking & Testing │
└─────────────────────────────────────────────────────────┘
Modern Configuration System
// Enterprise transport configuration
config := transport.DefaultTransportConfig(transport.TransportTypeStreamableHTTP)
// Security configuration
config.Security.Authentication = &transport.AuthenticationConfig{
Type: "bearer",
Required: true,
TokenExpiry: 10 * time.Minute,
EnableCache: true,
CacheTTL: 5 * time.Minute,
}
config.Security.RateLimit = &transport.RateLimitConfig{
RequestsPerMinute: 1000,
BurstLimit: 100,
EnablePerUser: true,
}
// Observability configuration
config.Observability.Tracing = &transport.TracingConfig{
EnableTracing: true,
ServiceName: "mcp-server",
SamplingRate: 0.1,
ExporterType: "otlp",
ExporterEndpoint: "http://jaeger:14268/api/traces",
}
config.Observability.Metrics = &transport.MetricsConfig{
EnableMetrics: true,
MetricsPath: "/metrics",
EnableCustom: true,
ExporterType: "prometheus",
}
// Reliability configuration
config.Reliability.Retry = &transport.RetryConfig{
EnableRetry: true,
MaxRetries: 3,
InitialDelay: time.Second,
MaxDelay: 30 * time.Second,
BackoffMultiplier: 2.0,
}
transport, err := transport.NewTransport(config)
📊 Performance & Benchmarks
Performance Targets (All Met)
- Latency: P99 85% coverage, race detection
- ⚡ Performance: Sub-10ms latency, 50,000+ ops/s throughput
- 🔐 Security: Enterprise authentication, RBAC, rate limiting
- 📊 Observability: OpenTelemetry, Prometheus, comprehensive monitoring
- 🛠️ Developer Experience: Hot reload, code generation, protocol validation
- 🏢 Production: Docker/K8s deployment, auto-scaling, monitoring
📄 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Built for Production • Enterprise Ready • Developer Friendly
The most comprehensive Model Context Protocol implementation for Go
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: ajitpratap0
- Source: ajitpratap0/mcp-sdk-go
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.