Skip to content

feat: add OAuth authorization flow for config.json-bootstrapped pending_verification MCP clients - #3872

Merged
Pratham-Mishra04 merged 1 commit into
devfrom
05-29-feat_ui_support_for_pending_auth_mcps
Aug 8, 2026
Merged

feat: add OAuth authorization flow for config.json-bootstrapped pending_verification MCP clients#3872
Pratham-Mishra04 merged 1 commit into
devfrom
05-29-feat_ui_support_for_pending_auth_mcps

Conversation

@Pratham-Mishra04

Copy link
Copy Markdown
Collaborator

Summary

MCP clients declared via config.json can be bootstrapped into a pending_verification state 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 the pending_verification state, which triggers the same OAuth2 popup flow used during UI-based client creation.

Changes

  • Added initiateMCPClientVerification API mutation that calls POST /mcp/client/:id/initiate-verification, returning an OAuthFlowResponse with an authorize_url and oauth_config_id.
  • Added pending_verification to the MCPConnectionState type and its corresponding badge color (bg-yellow-100 text-yellow-800).
  • In MCPClientSheet, when a client is in pending_verification state and the user has update access, an Authorize button is shown in the sheet header. Clicking it calls initiate-verification and opens the OAuth2Authorizer dialog on success.
  • The sheet description is contextually updated for pending_verification clients to explain that a one-time OAuth authorization is required.
  • The sheet's close handler is guarded against closing while the bootstrap OAuth dialog is open.

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

  1. Bootstrap an MCP client via config.json with an OAuth-based server so it lands in pending_verification state.
  2. Open the MCP Registry in the UI and click on the client.
  3. Verify the sheet header shows the pending_verification badge and an Authorize button.
  4. Verify the sheet description reads: "This client was declared in config.json and needs a one-time OAuth authorization before it can be used."
  5. Click Authorize and confirm the OAuth popup opens.
  6. Complete the OAuth flow and verify the client transitions out of pending_verification and the sheet closes.
cd ui
pnpm i || npm i
pnpm build || npm run build

Screenshots/Recordings

Add before/after screenshots of the MCP client sheet in pending_verification state.

Breaking changes

  • No

Related issues

Security considerations

The Authorize button is gated behind RbacResource.MCPGateway / RbacOperation.Update access, ensuring only authorized admins can initiate the OAuth verification flow for config-bootstrapped clients.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added OAuth authorization for MCP clients requiring verification.
    • Added an Authorize action with progress feedback and automatic status refresh.
    • Added support for the new Pending verification connection status.
    • Updated status styling to clearly identify clients awaiting verification.
    • Added contextual guidance when authorization is pending.

Walkthrough

Adds the pending_verification MCP state, a verification-initiation mutation, and table actions that launch and complete bootstrap OAuth authorization. The client sheet adds a conditional authorization description and formatting updates.

Changes

Bootstrap OAuth Verification Flow

Layer / File(s) Summary
Verification state and API contract
ui/lib/types/mcp.ts, ui/lib/constants/config.ts, ui/lib/store/apis/mcpApi.ts
Adds pending_verification, yellow status styling, and the verification response type, mutation, and generated hook.
Table authorization flow
ui/app/workspace/mcp-registry/views/mcpClientsTable.tsx
Adds the Authorize action, verification request handling, authorization progress state, OAuth2Authorizer integration, completion callbacks, and client refresh behavior.
OAuth popup reuse
ui/app/workspace/mcp-registry/views/oauth2Authorizer.tsx
Allows the authorizer to reuse the synchronously opened popup once and to open new popups for later attempts.
Client sheet updates
ui/app/workspace/mcp-registry/views/mcpClientSheet.tsx
Adds the virtual-key query import, a pending-verification description, and formatting updates to TLS mappings, fallback literals, handlers, and header parsing.

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
Loading

Possibly related PRs

  • maximhq/bifrost#3871: Implements related MCP client support for pending_verification and the verification endpoint.
  • maximhq/bifrost#3873: Modifies the same MCP client bootstrap OAuth flow and table component.
  • maximhq/bifrost#3875: Shares pending_verification handling in the MCP client table and related verification flow.

Suggested reviewers: akshaydeo, danpiths, roroghost17

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the OAuth authorization feature for config.json-bootstrapped pending_verification MCP clients.
Description check ✅ Passed The description covers the purpose, changes, testing steps, affected areas, security, and breaking changes, with only minor checklist and screenshot gaps.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 05-29-feat_ui_support_for_pending_auth_mcps

Comment @coderabbitai help to get the list of available commands.

Pratham-Mishra04 commented May 29, 2026

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

This looks safe to merge.

  • Verification initiation failures now display destructive toasts.
  • Unexpected successful response shapes also display an error.
  • No blocking issue remains in the updated flow.

Important Files Changed

Filename Overview
ui/app/workspace/mcp-registry/views/mcpClientSheet.tsx Adds the authorization action, OAuth dialog lifecycle, contextual description, and user-facing initiation errors.
ui/app/workspace/mcp-registry/views/mcpClientsTable.tsx Disables reconnect for clients awaiting OAuth verification.
ui/lib/store/apis/mcpApi.ts Adds and exports the client verification initiation mutation.
ui/lib/types/mcp.ts Adds pending verification to the MCP connection state.
ui/lib/constants/config.ts Adds badge styling for the pending verification state.

Reviews (6): Last reviewed commit: "feat: ui support for pending auth mcps" | Re-trigger Greptile

Comment thread ui/lib/store/apis/mcpApi.ts
Comment thread ui/app/workspace/mcp-registry/views/mcpClientSheet.tsx Outdated
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 05-29-feat_support_for_shared_oauth_mcp_servers_from_config.json branch from 90587d2 to f63648d Compare July 1, 2026 10:15
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 05-29-feat_ui_support_for_pending_auth_mcps branch from 2e6de8c to 41d8011 Compare July 1, 2026 10:15
@coderabbitai
coderabbitai Bot requested a review from roroghost17 July 1, 2026 10:16

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between f63648d and 41d8011.

📒 Files selected for processing (4)
  • ui/app/workspace/mcp-registry/views/mcpClientSheet.tsx
  • ui/lib/constants/config.ts
  • ui/lib/store/apis/mcpApi.ts
  • ui/lib/types/mcp.ts

Comment thread ui/app/workspace/mcp-registry/views/mcpClientSheet.tsx Outdated
Comment thread ui/lib/store/apis/mcpApi.ts Outdated
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 05-29-feat_support_for_shared_oauth_mcp_servers_from_config.json branch from f63648d to 73722bd Compare July 2, 2026 05:29
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 05-29-feat_ui_support_for_pending_auth_mcps branch 2 times, most recently from dc2f30a to ae90a7d Compare July 2, 2026 13:53
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 05-29-feat_support_for_shared_oauth_mcp_servers_from_config.json branch from 73722bd to 697b86f Compare July 2, 2026 13:53
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 78aaeec and fd4d929.

📒 Files selected for processing (6)
  • ui/app/workspace/mcp-registry/views/mcpClientSheet.tsx
  • ui/app/workspace/mcp-registry/views/mcpClientsTable.tsx
  • ui/app/workspace/mcp-registry/views/oauth2Authorizer.tsx
  • ui/lib/constants/config.ts
  • ui/lib/store/apis/mcpApi.ts
  • ui/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

Comment thread ui/app/workspace/mcp-registry/views/oauth2Authorizer.tsx
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 6, 2026
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 05-29-feat_ui_support_for_pending_auth_mcps branch from fd4d929 to 561a8a5 Compare August 8, 2026 08:43
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 05-29-feat_support_for_shared_oauth_mcp_servers_from_config.json branch from 78aaeec to 30b6653 Compare August 8, 2026 08:43

Pratham-Mishra04 commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

Merge activity

  • Aug 8, 8:47 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Aug 8, 8:50 AM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 8, 8:51 AM UTC: @Pratham-Mishra04 merged this pull request with Graphite.

@Pratham-Mishra04
Pratham-Mishra04 changed the base branch from 05-29-feat_support_for_shared_oauth_mcp_servers_from_config.json to graphite-base/3872 August 8, 2026 08:48
@Pratham-Mishra04
Pratham-Mishra04 changed the base branch from graphite-base/3872 to dev August 8, 2026 08:48
@Pratham-Mishra04
Pratham-Mishra04 dismissed coderabbitai[bot]’s stale review August 8, 2026 08:48

The base branch was changed.

…r-safe bootstrap authorize flow, handle OAuth 409 conflict
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 05-29-feat_ui_support_for_pending_auth_mcps branch from 561a8a5 to 8123a93 Compare August 8, 2026 08:49
@Pratham-Mishra04
Pratham-Mishra04 merged commit 8ee4a70 into dev Aug 8, 2026
14 of 15 checks passed
@Pratham-Mishra04
Pratham-Mishra04 deleted the 05-29-feat_ui_support_for_pending_auth_mcps branch August 8, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants