Overview
The MCP server currently uses simple Bearer token authentication for HTTP transports (streamable-http, sse). The MCP specification recommends OAuth 2.1 for multi-tenant and public deployments. This issue tracks implementing proper OAuth 2.1 support.
Background
Current Auth Stack
| Transport |
Auth Method |
Status |
| stdio |
None (local) |
✅ Implemented |
| streamable-http |
Bearer token |
✅ Implemented (Phase 4) |
| sse |
Bearer token |
✅ Implemented (Phase 4) |
| streamable-http |
OAuth 2.1 |
❌ Not implemented |
| sse |
OAuth 2.1 |
❌ Not implemented |
Requirements
Core OAuth 2.1 Flow
MCP-Specific Requirements
Configuration
Security
Testing
Documentation
Design Considerations
- Backward Compatibility: Must not break existing Bearer token auth. OAuth should be opt-in via config.
- External IdP vs Built-in: Consider supporting delegation to external OAuth providers (Google Cloud Identity, Auth0, Okta) rather than implementing a full OAuth server.
- MCP Spec Compliance: Follow the MCP authorization spec exactly for interoperability with all MCP clients.
- Scope Mapping: Map OAuth scopes to MCP tool categories (e.g.,
mcp:tools:read, mcp:tools:write, mcp:resources:read).
Related
Acceptance Criteria
- MCP clients can authenticate via OAuth 2.1 Authorization Code + PKCE flow
- Existing Bearer token auth continues to work unchanged
- OAuth is opt-in via configuration (
MCP_OAUTH_ENABLED=true)
- All tests pass (unit, integration, E2E)
- Documentation covers setup, configuration, and security
- Cloud Run deployment docs updated with OAuth setup instructions
Overview
The MCP server currently uses simple Bearer token authentication for HTTP transports (streamable-http, sse). The MCP specification recommends OAuth 2.1 for multi-tenant and public deployments. This issue tracks implementing proper OAuth 2.1 support.
Background
BearerTokenMiddlewareinsrc/devrev_mcp/middleware/auth.pyvalidates a single static tokenCurrent Auth Stack
Requirements
Core OAuth 2.1 Flow
MCP-Specific Requirements
/.well-known/oauth-authorization-servermetadata endpointConfiguration
MCPServerConfig(issuer, client credentials, JWKS URI, etc.)MCP_OAUTH_*prefixSecurity
Testing
Documentation
deploy/README.mdDesign Considerations
mcp:tools:read,mcp:tools:write,mcp:resources:read).Related
Acceptance Criteria
MCP_OAUTH_ENABLED=true)