feat: add OAuth authorization flow for config.json-bootstrapped pending_verification MCP clients - #3872
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds the ChangesBootstrap OAuth Verification Flow
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant MCPClientsTable
participant mcpApi
participant OAuth2Authorizer
User->>MCPClientsTable: Select Authorize
MCPClientsTable->>mcpApi: initiateMCPClientVerification(client_id)
mcpApi-->>MCPClientsTable: OAuth verification details
MCPClientsTable->>OAuth2Authorizer: Reuse or open OAuth popup
OAuth2Authorizer-->>MCPClientsTable: Success or error callback
MCPClientsTable->>MCPClientsTable: Refresh MCP clients after success
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
|
|
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (6): Last reviewed commit: "feat: ui support for pending auth mcps" | Re-trigger Greptile |
90587d2 to
f63648d
Compare
2e6de8c to
41d8011
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ui/app/workspace/mcp-registry/views/mcpClientSheet.tsx`:
- Around line 90-103: The handleStartBootstrap flow only logs failures, so a
failed verification start leaves the user with no feedback and no dialog. Update
the catch path in mcpClientSheet.tsx to surface a user-visible error (for
example via the existing useToast hook) when initiateVerification(...).unwrap()
fails, and keep the behavior limited to showing the error without opening the
bootstrap dialog. Also remove the later duplicate const { toast } = useToast()
so mcpClientSheet uses a single toast declaration.
In `@ui/lib/store/apis/mcpApi.ts`:
- Around line 239-244: The initiateMCPClientVerification mutation is typed with
the wrong response contract, so adjust the response type to match the backend
payload instead of OAuthFlowResponse. Update the type used in mcpApi.ts for
initiateMCPClientVerification to reflect the initiate-verification response
shape that includes status_url and does not require message, and rename or
introduce a dedicated type if needed so any consumers cannot safely access
response.message when it is not guaranteed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 30fdee05-60a6-48e6-8abe-22d400771510
📒 Files selected for processing (4)
ui/app/workspace/mcp-registry/views/mcpClientSheet.tsxui/lib/constants/config.tsui/lib/store/apis/mcpApi.tsui/lib/types/mcp.ts
f63648d to
73722bd
Compare
dc2f30a to
ae90a7d
Compare
73722bd to
697b86f
Compare
697b86f to
7498a83
Compare
ae90a7d to
32cf960
Compare
32cf960 to
8e33d96
Compare
7498a83 to
130c43f
Compare
8e33d96 to
669d460
Compare
5aa467f to
fd4d929
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ui/app/workspace/mcp-registry/views/oauth2Authorizer.tsx`:
- Around line 129-132: Update the initial popup initialization flow around
initialPopupConsumedRef and the auto-open effect to tolerate React Strict Mode
replay: preserve the user-activated initialPopup instead of closing or consuming
it during the replay, and ensure initialization runs only once per authorization
attempt. Also reset or replace the attempt state when authorization changes so a
newly opened popup is not ignored while the component remains mounted.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e89eff65-3f76-4b51-ae32-78962bbcb231
📒 Files selected for processing (6)
ui/app/workspace/mcp-registry/views/mcpClientSheet.tsxui/app/workspace/mcp-registry/views/mcpClientsTable.tsxui/app/workspace/mcp-registry/views/oauth2Authorizer.tsxui/lib/constants/config.tsui/lib/store/apis/mcpApi.tsui/lib/types/mcp.ts
🚧 Files skipped from review as they are similar to previous changes (5)
- ui/lib/types/mcp.ts
- ui/lib/constants/config.ts
- ui/app/workspace/mcp-registry/views/mcpClientSheet.tsx
- ui/lib/store/apis/mcpApi.ts
- ui/app/workspace/mcp-registry/views/mcpClientsTable.tsx
fd4d929 to
561a8a5
Compare
78aaeec to
30b6653
Compare
Merge activity
|
The base branch was changed.
…r-safe bootstrap authorize flow, handle OAuth 409 conflict
561a8a5 to
8123a93
Compare

Summary
MCP clients declared via
config.jsoncan be bootstrapped into apending_verificationstate that requires a one-time OAuth authorization before they can be used. Previously, there was no way to complete this authorization from the UI. This PR adds an Authorize button to the MCP client detail sheet for clients in thepending_verificationstate, which triggers the same OAuth2 popup flow used during UI-based client creation.Changes
initiateMCPClientVerificationAPI mutation that callsPOST /mcp/client/:id/initiate-verification, returning anOAuthFlowResponsewith anauthorize_urlandoauth_config_id.pending_verificationto theMCPConnectionStatetype and its corresponding badge color (bg-yellow-100 text-yellow-800).MCPClientSheet, when a client is inpending_verificationstate and the user has update access, an Authorize button is shown in the sheet header. Clicking it callsinitiate-verificationand opens theOAuth2Authorizerdialog on success.pending_verificationclients to explain that a one-time OAuth authorization is required.Type of change
Affected areas
How to test
config.jsonwith an OAuth-based server so it lands inpending_verificationstate.pending_verificationbadge and an Authorize button.pending_verificationand the sheet closes.Screenshots/Recordings
Add before/after screenshots of the MCP client sheet in
pending_verificationstate.Breaking changes
Related issues
Security considerations
The Authorize button is gated behind
RbacResource.MCPGateway/RbacOperation.Updateaccess, ensuring only authorized admins can initiate the OAuth verification flow for config-bootstrapped clients.Checklist
docs/contributing/README.mdand followed the guidelines