fix(ui-rewrite): fetch tools and activate mcp server after OAuth, add…#5076
Open
marekdano wants to merge 1 commit into
Open
fix(ui-rewrite): fetch tools and activate mcp server after OAuth, add…#5076marekdano wants to merge 1 commit into
marekdano wants to merge 1 commit into
Conversation
… activate/deactivate menu action Signed-off-by: Marek Dano <Marek.Dano@ibm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes three related gaps in the OAuth MCP server creation flow.
Closes #5026.
ExposeComponentsFormnow refetchestools/resources/prompts when
oauthNotificationtransitions to"success", using auseEffectthat callsrefetchTools,refetchResources, andrefetchPrompts. The backend/oauth/fetch-tools/{id}endpoint is called immediately after OAuth completes and itsresult surfaced as a
fetchToolsNotificationbanner.useMCPServerFormnow callstoggleEnabled(id, true)immediately after a successful OAuth handshake, so the gateway is active before
ExposeComponentsFormrenders.ServerActionsMenugains an optionalonToggleEnabledprop. When provided it renders "Deactivate" for an enabled server and"Activate" for a disabled one. The handler lives in
Servers.tsxand calls the newserversApi.toggleEnabledAPI helper, then refetches the server list.Additional changes made while addressing the above:
InlineNotificationcomponent (new): Extracts the repeated notification markup fromExposeComponentsFormandMCPServerForminto a single reusable component with correctARIA roles (
role="alert"/role="status"), decorative icons, and an accessible dismissbutton. Accepts an optional
dismissLabelprop so stacked notifications have distinctaccessible names for screen readers.
parseApiErrorutility: Extended to handle{"detail":{"message":"...","success":false}}in addition to plain-string detail and validation-error arrays. All inline error extraction
in
useMCPServerFormis replaced with calls toparseApiError.useQuery.refetchstability:refetchis now wrapped inuseCallbackso its referenceis stable across re-renders, preventing unnecessary
useEffectre-runs in consumers thatlist
refetchas a dependency.sanitizeErroris applied to the activation-failure log inuseMCPServerForm,consistent with the rest of the codebase.
Changed files
client/src/api/servers.tstoggleEnabledandfetchToolsAfterOAuthAPI methodsclient/src/components/ui/inline-notification.tsxclient/src/components/gateways/ExposeComponentsForm.tsxfetchToolsNotification, add refetchuseEffect, useInlineNotificationclient/src/components/mcp-servers/MCPServerForm.tsxfetchToolsNotification, useInlineNotificationclient/src/components/servers/ServerActionsMenu.tsxonToggleEnabledprop and menu itemclient/src/components/servers/ServersTable.tsxonToggleEnabledthrough toServerActionsMenuclient/src/pages/Servers.tsxhandleToggleEnabledhandlerclient/src/hooks/useMCPServerForm.tsparseApiError;fetchToolsNotificationstateclient/src/hooks/useQuery.tsrefetchreference withuseCallbackclient/src/lib/errorUtils.tsdetailas an object with amessagepropertyTest coverage
New and updated tests across six files (450 passing, 2 skipped):
inline-notification.test.tsx— ARIA roles, colour classes, dismiss button, customdismissLabeluseQuery.test.ts— stablerefetchreference, GET success/error,enabled: false, manualexecuteerrorUtils.test.ts— allparseApiErrorbranches including the new object-detail caseservers.test.ts—toggleEnabled,fetchToolsAfterOAuth,triggerOAuthAuthorization(popup, postMessage, cancellation, foreign-source filtering)ServerActionsMenu.test.tsx— Activate/Deactivate item rendering and callbacksuseMCPServerForm.test.ts—fetchToolsNotificationlifecycle (success, nested-detail error, plain-string error, clear);handleSubmiterror parsing for create and update