Skip to content

fix(servers): complete MCP OAuth callback UX - #199

Merged
vishu-bh merged 6 commits into
mainfrom
fix/4684-mcp-oauth-callback-ux
Oct 29, 2026
Merged

vishu-bh merged 6 commits into
mainfrom
fix/4684-mcp-oauth-callback-ux

Conversation

@vishu-bh

@vishu-bh vishu-bh commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

OAuth authorization on the MCP Servers page opens the server's Components view, shows success inline, and reloads tools, resources, and prompts. Failures display the provider's bounded, validated plain-text reason in a dialog with retry. Dismissal preserves the shared Authorization required or Authorization expired status with an adjacent authorization action.

  • Only offer Authorize when the caller's token is missing or expired; preserve shared status icons, explanatory popovers, and compact table labels.
  • Keep authorization and component refresh independent. Panel refresh failures use inline feedback with retry, while table refresh failures use toasts. Refresh conflicts show a conflict toast without an ineffective retry action.
  • Handle cancellation, duplicate clicks, and late callbacks scoped to the initiating server; restore dialog focus to Authorize or the panel close control.
  • Reuse existing localized status text and preserve main's targeted refresh updates that avoid table flicker. Manual creation/editing and catalog OAuth flows retain their existing behavior.

Fixes IBM/mcp-context-forge#4684.

Validation

  • Full unit suite: 227 files passed; 3,817 tests passed and 1 skipped.
  • npm run build and npm run lint passed.
  • Formatting and git diff --check passed for the changes.
  • Four focused OAuth browser tests passed using installed Google Chrome, including failure → dismissal → retry → success with fresh components and the existing creation flow.
  • Regression coverage includes single-message refresh failures, table-versus-panel feedback, 409 without inline retry, expired and compact status presentation, valid/loading token action visibility, bounded/malformed provider descriptions, and dialog focus restoration.
  • Standalone e2e type checking previously reported errors in unchanged e2e/tools.spec.ts and src/utils/errors.ts.

Manual verification

On an existing OAuth authorization-code server without a valid caller token, deny consent, dismiss the failure dialog, retry from Authorization required, and complete authorization. Confirm inline success and freshly loaded components, then use Refresh components without reopening OAuth. Check that expired tokens retain Authorization expired, valid tokens do not offer Authorize, Escape dismisses only the dialog, and closing a pending popup produces no failure dialog.

@vishu-bh
vishu-bh marked this pull request as ready for review October 21, 2026 14:09
@vishu-bh
vishu-bh force-pushed the fix/4684-mcp-oauth-callback-ux branch from ceb9a29 to 54fada7 Compare October 21, 2026 14:10

@a-effort a-effort 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.

Change requests inline; lmk if you want to discuss any of these proposals. 🙌

Comment thread src/pages/Servers.tsx Resolved
Comment thread src/i18n/locales/en-US/mcpServer.json Resolved
Comment thread src/pages/Servers.tsx Resolved
@vishu-bh
vishu-bh force-pushed the fix/4684-mcp-oauth-callback-ux branch from 54fada7 to c7605dc Compare October 22, 2026 12:16
@vishu-bh
vishu-bh requested a review from a-effort October 22, 2026 12:19

@a-effort a-effort 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.

Reviewed again; nice work on addressing change requests! I notice that IBM/mcp-context-forge#4684 which was created in May had gone stale and the proposed interaction for servers that need authentication was established afterwards in #130. We should use that pattern. Details:

Here's a quick demo of the desired interaction: #130 (comment) (0:23 clicking "Auth" triggers a popup for OAuth without triggering the drawer to open). After auth is complete, the status changes to active (or remains the same if it was unsuccessful as the popup communicates failure).

We should use this pattern in the drawer, also. I created a couple of mockups to show the desired changes: authorization required / auth succeeded

I also moved the button for refresh to next to the search icon and changed the styling to match that. This should persist and uses the same mechanism as the refresh overflow menu item for the server in the server table.

Lmk if there are questions / things to discuss and apologies for any confusion coming from that stale issue.

Comment thread src/pages/Servers.tsx Resolved
Comment thread src/pages/Servers.tsx Resolved
Comment thread src/pages/Servers.tsx Resolved
ShaoLOWu added a commit to ShaoLOWu/contextforge-web-ui that referenced this pull request Oct 23, 2026
Closing the OAuth popup without completing authorization is a deliberate
user action, not a failure, so ServerCatalog no longer reports it.
Previously both `handleAuthorize` (page-level notice above the grid) and
`handleOAuthSubmit` (notice inside the Add-server dialog) passed the raw
`OAuthCancelledError` message ("OAuth authorization was cancelled",
untranslated) straight into their notification state.

Both catch blocks now return early on `OAuthCancelledError` instead of
notifying, mirroring the MCP Servers page (Servers.tsx), which already
discards the cancellation silently. Genuine authorization failures keep
surfacing their reason, and the dialog stays open for a retry in both
cases.

Tests: the cancelled-authorization test now uses `OAuthCancelledError`
and asserts no cancellation notice appears anywhere (previously it
rejected with a plain `Error` carrying the same text, covering cancel
and failure identically); a new dialog test covers the real-failure path
(provider reason still shown), and a new page-level test covers the
Authorize menu action staying quiet on cancellation.

Fixes IBM/mcp-context-forge#7303 (the catalog UI lives in this repo).

Note: surfacing the provider's denial reason via `OAuthAuthorizationError`
(the remaining suggestion in that issue) lands naturally after contextforge-org#199 adds
the class to `src/api/servers.ts`; this PR intentionally does not
duplicate it.

Verification: `vitest run src/pages/ServerCatalog.test.tsx` 78/78 green;
`tsc -b tsconfig.app.json` clean (after `orval` generation); eslint and
prettier clean on both changed files.

Assisted-by: AI (Claude via WorkBuddy) — diff reviewed and verified by
the human contributor before submission.
Signed-off-by: ShaoLOWu <[email protected]>
@vishu-bh
vishu-bh force-pushed the fix/4684-mcp-oauth-callback-ux branch from 45bc70b to 6254659 Compare October 27, 2026 13:18

@a-effort a-effort 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.

LGTM! 🚀

@marekdano marekdano 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.

LGTM 🚀

@vishu-bh
vishu-bh merged commit a68d024 into main Oct 29, 2026
5 checks passed
@vishu-bh
vishu-bh deleted the fix/4684-mcp-oauth-callback-ux branch October 29, 2026 13:26
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.

[CHORE]: MCP server OAuth callback ux

3 participants