Skip to content

Production Go MCP Server Template

Production-ready, dual-transport, zero-trust Model Context Protocol server starter template in Go.
  • Dual-Transport Ingress: A single HTTP multiplexer endpoint (/sse and /) serves both modern Streamable HTTP and legacy Server-Sent Events (SSE).
  • Stateless Serverless Mode: Stateless: true in StreamableHTTPOptions ensures requests survive Cloud Run cold starts and container recycling without 404 session not found errors.
  • Zero-Trust OAuth 2.1: Supports RFC 7591 Dynamic Client Registration (DCR), Client ID Metadata Documents (CIMD), and PKCE S256 with an SSRF-safe connection dialer.
  • Granular Access-Scoped Tools: Tools declare specific required scopes (tools:read, admin:access). Generic type-safe decorators enforce authorization boundaries per tool before execution.
  • Sub-Millisecond Execution: Ephemeral auth codes use TTL stores during handshakes, while active tool queries validate stateless signed HMAC-SHA256 JWTs locally in memory.

Go MCP Server Ingress Architecture (Dark Theme) Go MCP Server Ingress Architecture (Light Theme)
  • Cursor (IDE): Connect over SSE with Bearer header authentication.
  • Claude Desktop: Remote MCP configuration with auto-reconnect.
  • OpenCode: Native OAuth 2.1 + CIMD dynamic login flow.
  • Gemini Spark: Auto-registers via RFC 9728 and RFC 7591 DCR seamlessly.
  • Antigravity Desktop (AGY 2.0): Native desktop MCP client with stream multiplexing.
  • Antigravity CLI (agy): CLI tool execution over stateless Streamable HTTP.