Repository navigation
feat(settings): list and disconnect connected apps - #2273
Merged
gkhngyk merged 2 commits intoNov 10, 2026
Merged
Conversation
PR 6 of MCP over OAuth (ansvisor#2141), stacked on feature/mcp-oauth-tokens (ansvisor#2261): it needs only the data model. Still behind MCP_OAUTH_ENABLED: while it is off the list answers 404 and the card doesn't show. - Settings › MCP & API Keys gets a Connected apps card above the keys (the approved mockup's screens 7 to 9): each app the person connected by signing in, Recognised (claude.ai, chatgpt.com, by where its code goes) or Not checked, Read and changes or Read only, where it goes back to, when it was connected and last used, and Disconnect behind a confirmation. The empty state says how to connect; in the free trial or on an ended plan a note says why connections don't work, with Choose a plan for an admin. While app sign-in is on, the endpoint box says Claude and ChatGPT connect by signing in. - GET /api/oauth/connections lists the signed-in person's own live connections (not revoked, used within 30 days) and their plan's access; DELETE /api/oauth/connections/[id] ends one of their own and every token it has, logged (revoked_by_person). Someone else's, or one already ended, is 404. The tables stay the server's (00510). - known-apps.ts holds the recognised apps, identical to the consent page's (PR 4), so the two branches merge cleanly. Part of ansvisor#2141. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9
9 of 13 tasks
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
PR 6 of the MCP over OAuth plan (#2141). Based on
main: it needs only #2261's data model, which is merged, andupstream/mainis merged into this branch, so the diff is this PR alone. It also merges cleanly into currentmain(f947d77). It doesn't need the consent PR.It adds screens 7 to 9 of the approved mockup. It is still behind
MCP_OAUTH_ENABLED: while the flag is off, the list answers 404 and the card doesn't show, so Settings looks exactly as onmain.Settings › MCP & API Keys › Connected apps (
web/src/components/settings/connected-apps-card.tsx)api-keys-section.tsxchanges little: the keys card is kept in a constant, and the section returns it under Connected apps, so the rest of the file isn't re-indented.API (
web/src/lib/mcp-oauth/connected-apps.ts)GET /api/oauth/connectionsreturns the signed-in person's live connections (not revoked, used or made within the last 30 days; older ones have no live refresh token) and whether their plan lets connections work (oauthMcpAccess, from feat(mcp): accept OAuth access tokens at /api/mcp, behind MCP_OAUTH_ENABLED (00510) #2261), plus whether they are an admin. The answer isno-store. 401 when signed out, 404 while the flag is off.DELETE /api/oauth/connections/[id]ends one of the person's own live connections and every token it has (revokeGrant(…, 'person')), and logsrevoked_by_person. Someone else's connection, one already ended, or a malformed id gets 404.subscription-guard-coverage.test.ts'sOPEN_ROUTES, placed away from feat(mcp): OAuth discovery, client registration, token and revoke endpoints #2262's entries so the two merge cleanly.web/src/lib/mcp-oauth/known-apps.tsis the recognised apps' list. It is identical to the file in the consent PR (feature/mcp-oauth-consent), so the two PRs merge cleanly in either order.web/messages/en.json:settings.connectedApps.*,settings.apiKeys_mcpEndpointHintSignInandsettings.apiKeys_planNoteSignIn.Tests
web/src/app/api/oauth/connections/route.test.ts(6 tests): only the person's own live connections are listed; a known app is named by its host; trial and ended plans; 401 and 404; Disconnect revokes and logs; someone else's, a revoked one or a bad id is 404.web/src/components/settings/connected-apps-card.test.tsx(5 tests): both kinds of app with their pills and wording; Disconnect behind the confirmation, with the DELETE, the toast and the list loaded again; the empty state with the trial note and Choose a plan; an ended plan for a member; nothing at all while the flag is off.api-keys-section.test.tsxmocks@/i18n/navigation, which the card's Choose a plan link uses. Its tests are otherwise unchanged and pass.No Help or docs change: nothing is switched on. Help and docs come with PR 7.
Related issue
Part of #2141
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd web && npx vitest run src/app/api/oauth/connections src/components/settings.MCP_OAUTH_ENABLED=trueand a connection inoauth_grants(from the consent PR, or inserted by hand), open Settings › MCP & API Keys: the Connected apps card lists it.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)help/(or no user-visible change) — see help/README.md: nothing is switched on; Help comes with PR 7Checks run:
yarn buildpasses (with CI's placeholder env).upstream/main:src/components/settings, the Settings page's tests,src/app/api/oauth,src/app/api/mcp,src/lib/mcp-oauth,src/lib/mcp, bothmcp-authtests,subscription-guard-coverageandembed-hints: 101 files, 949 tests passed.Generated by Claude Code