Security
Authentication
API keys, OAuth, and access control for RouterMCP.
Authentication
RouterMCP supports multiple authentication methods for securing access to your MCP gateway.
Project Authentication
Each project can be configured with an authentication mode:
| Mode | Description | Use Case |
|---|---|---|
none | No authentication required | Development, internal tools |
api_key | Requires Authorization: Bearer header | Production, external access |
API Key Authentication
When authMode is set to api_key:
POST /v1/mcp/my-project/request
Authorization: Bearer rmc_1234567890abcdef
Content-Type: application/jsonAPI keys are shown only once when created. Store them securely.
Upstream Authentication
RouterMCP can authenticate with upstream MCP servers using:
| Type | Description |
|---|---|
none | No authentication |
bearer | Bearer token in Authorization header |
oauth | OAuth 2.0 flow with token refresh |
Bearer Token
{
"mcpServers": {
"github": {
"url": "https://mcp.github.com",
"authType": "bearer",
"authBearer": "${GITHUB_TOKEN}"
}
}
}OAuth
RouterMCP Cloud handles OAuth flows automatically:
- Configure OAuth in the dashboard
- User authorizes via OAuth provider
- RouterMCP stores and refreshes tokens
- Tokens are injected into upstream requests
Best Practices
- Use API key auth in production - Never expose unauthenticated endpoints
- Rotate keys periodically - Create new keys and revoke old ones
- Use environment variables - Never hardcode credentials
- Per-server credentials - Don't share tokens across servers
- Monitor audit logs - Watch for unauthorized access attempts