Repository navigation
fix(servers): complete MCP OAuth callback UX - #199
Conversation
ceb9a29 to
54fada7
Compare
Signed-off-by: Vishu Bhatnagar <[email protected]>
Signed-off-by: Vishu Bhatnagar <[email protected]>
54fada7 to
c7605dc
Compare
a-effort
left a comment
There was a problem hiding this comment.
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.
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]>
45bc70b to
6254659
Compare
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.
Fixes IBM/mcp-context-forge#4684.
Validation
npm run buildandnpm run lintpassed.git diff --checkpassed for the changes.e2e/tools.spec.tsandsrc/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.