MCP Gate
c-premus/mcp-gate
Proxy OAuth 2.1 com validação JWT para servidores MCP
Ver no GitHubProxy reverso OAuth 2.1 para servidores MCP que implementa RFC 9728 e validação JWT. Protege servidores MCP com autenticação delegada a um servidor de autorização externo, permitindo integração segura com Claude.ai.
Instalação
npx convez-ai c-premus/mcp-gate1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Proteger servidores MCP com autenticação OAuth 2.1
- Integrar MCP servers privados com Claude.ai de forma segura
- Implementar autorização centralizada em arquiteturas de microsserviços MCP
Veredito

Solução sólida e bem arquitetada para quem precisa expor servidores MCP protegidos. Implementa corretamente o padrão OAuth 2.1 com validação stateless, suporta escalabilidade horizontal e oferece observabilidade via logs estruturados — essencial para ambientes de produção.
README
A tradução para o português deste README ainda está na fila.
mcp-gate
OAuth 2.1 reverse proxy for MCP servers. Implements RFC 9728 Protected Resource Metadata and JWT validation, delegating authentication to an external authorization server.
Read the blog post: I couldn't find an OAuth 2.1 proxy for MCP servers, so I built one
What it does
mcp-gate sits in front of any MCP server and adds the MCP Authorization specification (2025-11-25) endpoints required by Claude.ai custom connectors:
/.well-known/oauth-protected-resource— Serves RFC 9728 metadata pointing clients to the authorization server/healthz— Health check for container orchestration/*— Validates Bearer JWT tokens via JWKS, then reverse-proxies to the upstream MCP server
Every request is logged as structured JSON (method, path, status, duration_ms, client_ip, user_agent) for Loki/Alloy ingestion.
Architecture
Claude.ai → Reverse Proxy → mcp-gate (JWT validation) → MCP Server → Backend
↕
Authorization Server (OAuth 2.1 / OIDC)
Quick Start
export LISTEN_ADDR=0.0.0.0:8080
export UPSTREAM_URL=http://mcp-server:8000
export RESOURCE_URI=https://mcp.example.com
export AUTHORIZATION_SERVER=https://auth.example.com/application/o/mcp/
export JWKS_URI=https://auth.example.com/application/o/mcp/jwks/
export EXPECTED_ISSUER=https://auth.example.com/application/o/mcp/
export EXPECTED_AUDIENCE=your-client-id
go run ./cmd/mcp-gate
Docker
docker pull cpremus/mcp-gate:latest
Images are published to Docker Hub and GHCR on each release. Available tags: latest, version (e.g. v1.2.0).
Setup
See the Setup Guide for step-by-step instructions on:
- Creating an OAuth client in your OIDC provider (Keycloak, Authentik, Okta, Auth0, etc.)
- Configuring mcp-gate
- Connecting Claude.ai to the protected MCP server
Configuration
All configuration is via environment variables. See the Setup Guide for the full list.
Horizontal scaling
mcp-gate validates JWTs statelessly and is safe to run as multiple replicas behind a load balancer. The per-IP rate limiter defaults to in-memory state, which means the configured RPS holds per replica. Set REDIS_ADDR=host:port to back the limiter with Redis so the configured RPS is enforced globally across replicas. REDIS_USERNAME, REDIS_PASSWORD, and REDIS_DB are read separately so Vault can inject a password as a single secret. Redis errors fail open (the request passes through and a counter is incremented) so a Redis hiccup never blackholes user traffic.
License
MIT