feat(auth): add OAuth 2.1 provider for MCP connector support#3274
feat(auth): add OAuth 2.1 provider for MCP connector support#3274waleedlatif1 merged 11 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR implements a complete OAuth 2.1 Authorization Code + PKCE provider to enable MCP connector support for Claude.ai. The implementation adds four new database tables (oauth_application, oauth_access_token, oauth_consent, jwks) with proper foreign keys and indexes, integrates Better Auth's Key Changes:
Security Posture:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as Claude.ai
participant Auth as /api/auth/oauth2
participant Consent as /oauth/consent
participant User as User Browser
participant MCP as /api/mcp/copilot
participant DB as Database
Client->>Auth: GET /authorize with client_id, redirect_uri, code_challenge, scope
Auth->>User: Redirect to /login (if not authenticated)
User->>Auth: Login complete
Auth->>Consent: Redirect to consent page with consent_code
Consent->>DB: Fetch client info
DB-->>Consent: Return client metadata
User->>Consent: Click Allow or Deny
Consent->>Auth: POST /consent with accept and consent_code
Auth->>DB: Store consent and generate auth code
Auth-->>Client: Redirect with authorization code
Client->>Auth: POST /token with code and code_verifier
Auth->>DB: Verify PKCE and create access token
DB-->>Auth: Return access and refresh tokens
Auth-->>Client: Return token response
Client->>MCP: POST /copilot with Bearer token
MCP->>DB: Validate token and check scopes
DB-->>MCP: Return userId and scopes
MCP-->>Client: Execute MCP tool request
Last reviewed commit: c45ad4b |
|
@cursor review |
|
@greptile |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Summary
oidcProviderandjwtpluginsType of Change
Testing
Tested manually
Checklist