Overview
MCP Gateway provides a centralized authentication layer that eliminates the need to manage credentials for individual MCP servers. Users authenticate once with the gateway, and all subsequent requests to MCP servers are automatically verified and authorized.Benefits of Gateway Authentication
Single Sign-On (SSO)
Users authenticate once and get access to all authorized MCP servers:- No need to manage multiple API keys
- Consistent authentication experience
- Automatic token refresh
- Session management
Credential Security
MCP server credentials are securely stored at the gateway:- Users never see server API keys
- Credentials are encrypted at rest
- Automatic rotation support
- Audit trail for all access
Identity Forwarding
The gateway automatically forwards user identity to MCP servers:- User email and name
- Team and organization info
- Custom roles and attributes
- Request context
Authentication Methods
MCP Gateway supports multiple authentication methods to fit your organization’s needs.Bearer Token Authentication
The simplest method using API tokens:Generate tokens via the gateway API or console. Tokens can be scoped to specific users, teams, and permissions.
API Key Authentication
Use API keys with configurable scopes and expiration:OAuth 2.0 / OIDC
Integrate with your existing identity provider:- Okta
- Auth0
- Azure AD
- Google Workspace
- Custom OIDC providers
OAuth/OIDC authentication provides the most secure and scalable solution for enterprise deployments.
mTLS (Mutual TLS)
For maximum security with client certificate authentication:- High-security environments
- B2B integrations
- Regulated industries
- Zero-trust architectures
Configuring Authentication
Choose authentication method
Select the authentication method that fits your requirements:
- Bearer tokens: Quick setup, good for development
- API keys: Production-ready, simple to manage
- OAuth/OIDC: Enterprise SSO integration
- mTLS: Maximum security
Token Management
Creating Tokens
Generate tokens with specific permissions and expiration:Revoking Tokens
Instantly revoke access when needed:Token Rotation
Rotate tokens before expiration:Identity Forwarding
The gateway automatically forwards user identity to MCP servers in request headers:- Personalize responses
- Apply user-specific permissions
- Track user activity
- Implement custom authorization logic
Identity forwarding is automatically enabled and requires no additional configuration.
Security Best Practices
Token Security
Use short-lived tokens
Use short-lived tokens
Set appropriate expiration times:
- Development: 7-30 days
- Production: 1-7 days
- CI/CD: 1-24 hours
- Implement automatic rotation
Scope tokens appropriately
Scope tokens appropriately
Grant minimum required permissions:
- Limit to specific servers
- Restrict to necessary tools
- Use team-based scoping
- Regular permission audits
Secure token storage
Secure token storage
Store tokens securely:
- Use environment variables
- Never commit to version control
- Encrypt in CI/CD systems
- Use secret managers (AWS Secrets Manager, Vault)
Monitor and audit
Monitor and audit
Track authentication activity:
- Log all authentication attempts
- Alert on failed attempts
- Monitor token usage patterns
- Regular access reviews
TLS/SSL Configuration
Always use HTTPS in production:Example: Complete Auth Setup
Here’s a complete authentication configuration example:gateway-config.json
Next Steps
Access Control
Configure granular permissions and role-based access
Monitoring
Track authentication events and security metrics