You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Offer Clear OAuth for a server with stored credentials, connected or not (#3099) - #3100
The header's Clear OAuth icon (#3065, PR #3091) only exists while you're connected. Now every server card has a Clear OAuth button whenever that server has stored OAuth credentials, whether it is connected or not. The server list also gets a selection, and while disconnected, the header offers Clear OAuth for the selected server.
Selection. Clicking a card selects it and gives it a blue selected border (new Card theme variant and --inspector-selected-border token). That includes a click on one of the card's buttons, so the server you last acted on is the selected one. Connecting selects that server too, so it stays selected after you disconnect. Removing it from the catalog clears the selection.
Header while disconnected.ViewHeader's disconnected variant takes clearSelectedOAuth: { serverName, onClear }. When the selected server has stored credentials, the header shows the Clear OAuth icon and the same confirmation, worded for a clear that ends no session. The name travels with the handler, so the prompt can't name one server while clearing another.
When it shows. It shows when the server has a stored access token, the same test the header applies. useStoredOAuthServerIds reads the shared web OAuth store directly, keyed by the same URL the clear deletes from, because an idle server has no live client to ask. The live session is looked up at its client's URL (oauthLookupTargets), because an entry edited while connected still authorizes, and is cleared, at the old URL. The store has no change event, so the hook re-reads whenever a clear settles or the session changes. stdio servers never show the button.
What it does. Clicking it opens the existing ClearOAuthConfirmModal, then runs the same runClear path: per-server in-flight guard, revoke-on-clear, error toast and success toast. A connected server is disconnected, exactly as with Clear a server's OAuth state from a header icon (#3065) #3091. A disconnected server just has its stored state removed. The modal takes two new props. disconnects means the prompt only mentions disconnecting when that will actually happen. revokes, read from the server's oauth.revokeOnClear (the same setting the clear uses), means the prompt says whether the grant will also be revoked at the authorization server. Without that, "will be removed" alone read as a local delete that leaves the grant live. That includes the case of a different entry that shares the session's URL (Clearing OAuth for one catalog entry silently kills another entry that shares its URL #2217).
Read-only sessions keep it. Credentials are runtime state, not catalog data, so it isn't hidden with Edit/Remove, matching Connection Info.
A fix the disconnected path depended on
After a disconnect, activeServerId is cleared but the InspectorClient stays around until the next connect. resolveOAuthClearIdentity read that client's URL as if it belonged to a live session. So a clear after disconnecting was treated as a shared-key clear. It was routed through the dead client and toasted "The active session authorizes against the same URL, so its stored tokens went too". The Settings → Authorization clear already had this bug, and the new button would have shown it on every use. It now counts a session as live only while activeServerId is set.
Docs: docs/mcp-server-configuration.md now mentions the card button.
Tests
useStoredOAuthServerIds.test.tsx covers:
reports only servers with a stored access token, and skips stdio servers
re-reads on a revision bump, but not for a new array of the same servers
offers nothing when the store is unreadable
drops an out-of-order read, whether it succeeded or failed
ServerCard.test.tsx covers: no button without a handler, the button on a disconnected or connected server, and the button kept in a read-only session.
ServerCard.test.tsx (selection) covers: the selected border, the highlight border winning over it, and selecting on a click anywhere on the card or on one of its buttons.
ServerListScreen.test.tsx: only the listed ids get the button, only the selected card is marked, and a card click selects its server.
ViewHeader.test.tsx (disconnected) covers: no icon with nothing selected, confirm-then-clear with no disconnect wording, and an open prompt dropped when the selection stops offering a clear.
oauthClearKey.test.ts: oauthLookupTargets uses the client's config for the live session only.
ClearOAuthConfirmModal.test.tsx: the disconnect wording by default, and the stored-state-only wording with disconnects={false}.
oauthClearKey.test.ts: a client whose session has ended is not an active session.
New stories: ServerCard/DisconnectedWithStoredOAuth (selected), ViewHeader/UnconnectedWithSelectedOAuth, ClearOAuthConfirmModal/OpenWhileDisconnected.
npm run local:gate passes.
Screenshots (1280×900, Chromium)
Taken against oauth-revocation-http.json with an isolated HOME. Before authorizing, neither card had the button.
Connected, after authorizing. The card has Clear OAuth, and so does the header:
Disconnected, with tokens still stored, after a page reload and a click on the card to select it. The card has the blue selected border and its Clear OAuth button, and the header shows the Clear OAuth icon. The stdio card has neither:
Clicking the header icon. The confirmation for a disconnected server doesn't mention disconnecting, and it says the grant will be revoked at the authorization server. With oauth.revokeOnClear off, it would instead say that tokens already issued stay valid until they expire:
After confirming, the stored state is gone, both controls disappear and the toast is correct:
The header's Clear OAuth (#3065) only exists while connected. Each server
card now offers Clear OAuth whenever that server has a stored access token,
connected or not: confirmed first, then the same runClear path. A
disconnected server's state is removed with nothing to disconnect.
Also stops resolveOAuthClearIdentity treating the kept-after-disconnect
client as a live session, which routed a post-disconnect clear through the
dead client and toasted that an active session lost its tokens.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The OAuth credential lookup uses the edited URL while clearing still targets the connected URL, so Clear OAuth can be hidden or offered for credentials it will not clear.
Adds Clear OAuth to web server cards so stored credentials can be cleared without connecting first, addressing #3099 through the existing confirmation and clear flow.
Changes:
Reads stored credentials to show card actions for eligible servers, including read-only sessions.
Adjusts confirmation wording for disconnected servers and stops treating retained clients as live sessions after disconnect.
Adds focused tests, stories, and documentation for the new behavior.
File
Description
docs/mcp-server-configuration.md
Documents card and header clear actions.
clients/web/src/utils/oauthClearKey.ts
Excludes ended sessions from active-key resolution.
A connected entry edited from X to Y still authorizes, and is cleared, at X.
The card read Y, so it could hide Clear OAuth when only X held tokens or offer
it on tokens the clear would not touch. oauthLookupTargets swaps in the
client's config for the active entry, under the same live-session rule as
resolveOAuthClearIdentity.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
Clicking a card selects it (blue border); connecting selects that server too,
so it stays selected after a disconnect. While disconnected, the header shows
Clear OAuth for the selected server when it has stored credentials, with the
same confirmation, worded for a clear that ends no session.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
cliffhall
changed the title
Offer Clear OAuth on a server's card, connected or not (#3099)
Offer Clear OAuth for a server with stored credentials, connected or not (#3099)
Nov 30, 2026
Use live transport config when looking up active OAuth credentials — fixed in 64ba9fa (oauthLookupTargets), replied inline.
Also pushed since round 1 (1524095): card selection, and the header's Clear OAuth for the selected server while disconnected, as requested by the maintainer. The PR body is updated.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
OAuth clearing can silently do nothing, miss stored credentials, or change targets after connection/configuration transitions, alongside inaccessible keyboard selection and a hook test read/render loop.
The inline { getTokens } creates a new storage object on every hook render. Each successful read publishes a fresh ["a"] array, which rerenders the hook and changes its storage dependency, causing another read while the test remains mounted. Hoist the storage object outside the render callback so this test exercises the intended reads rather than a read/render loop.
- Make the server name a button (aria-pressed) so a card can be selected
from the keyboard without touching its connection toggle.
- Drop an open header Clear OAuth prompt when the connection state flips,
so a connected prompt never turns into a clear of a different URL.
- Keep an entry edited to stdio on its own config in oauthLookupTargets,
so the card is never offered a clear that would do nothing.
- Hoist the storage object in the stale-read hook tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
"Will be removed" alone read as a local delete that leaves the grant live.
The prompt now says the grant is revoked at the authorization server (where
it supports revocation), or, with oauth.revokeOnClear off, that tokens
already issued stay valid until they expire. Read from the same setting the
clear uses, for the card, and for the header connected or not.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
Copilot round 2: five findings, four fixed, one declined.
Failed connect → edit → clear identity — declined as out of scope (an edge case of the existing clear-identity rule, which the Settings clear shares); replied inline.
Keyboard-inaccessible selection — fixed in 5c0036a: the server name is a button with aria-pressed.
Connected prompt survives disconnect — fixed in 5c0036a: the prompt is dropped when the connection state flips.
HTTP→stdio edit offers a no-op clear — fixed in 5c0036a.
Suppressed: read/render loop in a hook test — fixed in 5c0036a by hoisting the storage object.
Also since round 2, at the maintainer's request (8846ab0, 23b5d2b): the confirmation now says whether the grant will be revoked at the authorization server (per oauth.revokeOnClear), instead of only that the tokens are removed.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
An open confirmation can delete or revoke the wrong server’s credentials after disconnection, and long server names can overflow adjacent controls when selection is enabled.
Dismiss credential confirmation when the active session changes
clients/web/src/App.tsx:1673
If a connected entry is edited from URL X to Y, with credentials at both URLs, the card's confirmation initially targets the live client's X. A disconnect while the prompt is open leaves the entry clearable, but confirming now deletes or revokes Y's credentials instead. Dismiss the card confirmation when the active session changes, and add a regression test for disconnecting while the target remains clearable.
- Let the server-name select button shrink (miw 0), so a long name still
truncates instead of overrunning the status and connect controls.
- Drop an open card Clear OAuth confirmation when the active session
changes, so a prompt opened while connected cannot confirm a clear of a
different URL after a disconnect.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
Copilot round 3: two findings, both fixed in e0d3774.
Long names overflow with selection enabled — the select button gets miw={0}; replied inline.
Previously missed: card confirmation survives a session change — the card's pending Clear OAuth target is now dropped whenever the active session changes (same useValueChange on activeServerId that selects the connected server), so a prompt opened while connected can't confirm a clear of a different URL after a disconnect. No unit test: this wiring lives in App.tsx, the composition root outside the coverage whitelist; useValueChange itself is tested.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because a failed OAuth clear can leave credentials stored while hiding retry controls, and App-level tests do not cover the new flow.
Copilot round 4: no open issues — review loop closed on a clean round.
On the headline's two notes for human assessment:
A failed clear leaving credentials stored while hiding the controls — every settled clear (success or failure) re-reads the store, so a server whose credentials survived keeps its button. The button only goes when the store itself is unreadable, which is the hook's deliberate choice (never offer a clear for credentials it can't confirm exist); that failure surfaces as the clear's own error toast, which doesn't auto-close.
No App-level tests — App.tsx is the composition root outside the coverage whitelist; the new behavior lives in tested units (useStoredOAuthServerIds, oauthLookupTargets, ServerCard, ServerListScreen, ViewHeader, ClearOAuthConfirmModal) and was verified end to end in the browser (screenshots above).
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
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.
Closes #3099
What changed
The header's Clear OAuth icon (#3065, PR #3091) only exists while you're connected. Now every server card has a Clear OAuth button whenever that server has stored OAuth credentials, whether it is connected or not. The server list also gets a selection, and while disconnected, the header offers Clear OAuth for the selected server.
selectedborder (new Card theme variant and--inspector-selected-bordertoken). That includes a click on one of the card's buttons, so the server you last acted on is the selected one. Connecting selects that server too, so it stays selected after you disconnect. Removing it from the catalog clears the selection.ViewHeader's disconnected variant takesclearSelectedOAuth: { serverName, onClear }. When the selected server has stored credentials, the header shows the Clear OAuth icon and the same confirmation, worded for a clear that ends no session. The name travels with the handler, so the prompt can't name one server while clearing another.useStoredOAuthServerIdsreads the shared web OAuth store directly, keyed by the same URL the clear deletes from, because an idle server has no live client to ask. The live session is looked up at its client's URL (oauthLookupTargets), because an entry edited while connected still authorizes, and is cleared, at the old URL. The store has no change event, so the hook re-reads whenever a clear settles or the session changes. stdio servers never show the button.ClearOAuthConfirmModal, then runs the samerunClearpath: per-server in-flight guard, revoke-on-clear, error toast and success toast. A connected server is disconnected, exactly as with Clear a server's OAuth state from a header icon (#3065) #3091. A disconnected server just has its stored state removed. The modal takes two new props.disconnectsmeans the prompt only mentions disconnecting when that will actually happen.revokes, read from the server'soauth.revokeOnClear(the same setting the clear uses), means the prompt says whether the grant will also be revoked at the authorization server. Without that, "will be removed" alone read as a local delete that leaves the grant live. That includes the case of a different entry that shares the session's URL (Clearing OAuth for one catalog entry silently kills another entry that shares its URL #2217).A fix the disconnected path depended on
After a disconnect,
activeServerIdis cleared but theInspectorClientstays around until the next connect.resolveOAuthClearIdentityread that client's URL as if it belonged to a live session. So a clear after disconnecting was treated as a shared-key clear. It was routed through the dead client and toasted "The active session authorizes against the same URL, so its stored tokens went too". The Settings → Authorization clear already had this bug, and the new button would have shown it on every use. It now counts a session as live only whileactiveServerIdis set.docs/mcp-server-configuration.mdnow mentions the card button.Tests
useStoredOAuthServerIds.test.tsxcovers:ServerCard.test.tsxcovers: no button without a handler, the button on a disconnected or connected server, and the button kept in a read-only session.ServerCard.test.tsx(selection) covers: the selected border, the highlight border winning over it, and selecting on a click anywhere on the card or on one of its buttons.ServerListScreen.test.tsx: only the listed ids get the button, only the selected card is marked, and a card click selects its server.ViewHeader.test.tsx(disconnected) covers: no icon with nothing selected, confirm-then-clear with no disconnect wording, and an open prompt dropped when the selection stops offering a clear.oauthClearKey.test.ts:oauthLookupTargetsuses the client's config for the live session only.ClearOAuthConfirmModal.test.tsx: the disconnect wording by default, and the stored-state-only wording withdisconnects={false}.oauthClearKey.test.ts: a client whose session has ended is not an active session.App.test.tsx: the Open the monitoring sidebar to the Network panel when a connection fails during OAuth #2108 storage-failure test now rejects everyload(), not just the first. The server list's own mount-time read was using up the one-shot rejection before the callback ran.ServerCard/DisconnectedWithStoredOAuth(selected),ViewHeader/UnconnectedWithSelectedOAuth,ClearOAuthConfirmModal/OpenWhileDisconnected.npm run local:gatepasses.Screenshots (1280×900, Chromium)
Taken against
oauth-revocation-http.jsonwith an isolatedHOME. Before authorizing, neither card had the button.Connected, after authorizing. The card has Clear OAuth, and so does the header:
Disconnected, with tokens still stored, after a page reload and a click on the card to select it. The card has the blue selected border and its Clear OAuth button, and the header shows the Clear OAuth icon. The stdio card has neither:
Clicking the header icon. The confirmation for a disconnected server doesn't mention disconnecting, and it says the grant will be revoked at the authorization server. With
oauth.revokeOnClearoff, it would instead say that tokens already issued stay valid until they expire:After confirming, the stored state is gone, both controls disappear and the toast is correct:
🤖 Generated with Claude Code