Skip to content

fix(web-ui): offer Login on quarantined servers that need OAuth sign-in - #1366

Merged
github-actions[bot] merged 4 commits into
mainfrom
claude/brave-mayer-ac613d
Sep 26, 2026
Merged

github-actions[bot] merged 4 commits into
mainfrom
claude/brave-mayer-ac613d

Conversation

@Dumbris

@Dumbris Dumbris commented Sep 25, 2026

Copy link
Copy Markdown
Member

Problem

A remote OAuth server imported with quarantine enabled (e.g. GitHub MCP at https://api.githubcopilot.com/mcp/) sits in pending auth and cannot connect until the user signs in. GET /api/v1/servers nevertheless returned:

{"level": "healthy", "admin_state": "quarantined", "action": "approve"}

On the Servers page the card showed a "Sign-in required" chip and a red "This server needs you to sign in…" alert, but no Login button — ServerCard.vue rendered Login only when health.action === 'login'. The server detail page already offered "Log in" in the same state (its SignInPanel keys on oauthSignInState()).

Changes

Web UI — frontend/src/components/ServerCard.vue

  • Login renders whenever oauthSignInState(server) is non-null, alongside Approve (not instead of it).
  • The red error alert is suppressed in that state, matching the existing action === 'login' behaviour (FR-018).
  • Disabled servers are excluded: their diagnostic is frozen from before they were disabled, and Enable is the next step.
  • data-test hooks added: server-card-login, server-card-approve.

Health — internal/health/calculator.go

  • The quarantined early-return now detects a server awaiting OAuth sign-in (pending auth state, a login-required error, or an OAuth error on a configured-OAuth server) and reports degraded for a first sign-in / unhealthy for re-auth, with summary Quarantined — Sign-in required. admin_state and action: approve are unchanged, so the review flow and the tray's quarantine badge exemption are unaffected.
  • Detection does not require OAuthRequired: it is false for autodetected OAuth (GitHub), so it keys on the specific login-required markers instead.
  • In the error state, a non-login OAuth match stays in the existing transport-fault branch — mcp-go wraps transport failures in "authentication strategies failed", and that branch names the real cause.

Reviewer notes

  • Tray "Upstream Servers (N/M)" and SSE connected_servers count level == "healthy"; quarantined servers awaiting sign-in now drop out of N (same as the existing quarantined transport-fault case).
  • Follow-up (separate task): the macOS tray (Models.swift isOAuthLoginRequired) and mcpproxy doctor still key only on action == "login", so they offer no sign-in for this state.

Testing

  • New vitest frontend/tests/unit/server-card-quarantined-oauth-login.spec.ts (fails 4/4 without the card change); full frontend unit suite 1347/1347, vue-tsc clean.
  • New Go tests in internal/health/calculator_quarantine_fault_test.go (fail before the calculator change); internal/health, runtime, httpapi, tray packages, and the CI -race -tags server subset of internal/server + httpapi pass. golangci-lint v2 (bare + --build-tags server): 0 issues.
  • Live on a scratch core with the real GitHub MCP URL, quarantined: API returns pending auth / degraded / Quarantined — Sign-in required / approve; the card shows Approve + Login + "Sign-in required" chip with no red alert, and clicking Login issues POST /api/v1/servers/github/login. ./scripts/run-web-smoke.sh: 28 passed, 2 skipped.
  • Cross-model review (zcode / GLM-5.3): round 1 findings addressed; round 2 clean.

A remote OAuth server imported with quarantine on (e.g. GitHub MCP at
api.githubcopilot.com) reported health {level: healthy, action: approve}
while it could not connect until the user signed in. The Servers card
showed a "Sign-in required" chip and a red "needs you to sign in" alert
but no Login button, because Login rendered only for action == login.

- ServerCard: render Login whenever oauthSignInState() is set (as
  ServerDetail's SignInPanel already does), alongside Approve; suppress
  the redundant red error; skip disabled servers, whose diagnostic is
  stale and whose next step is Enable.
- health calculator: a quarantined server awaiting OAuth sign-in now
  reports degraded (first sign-in) or unhealthy (re-auth) with summary
  "Quarantined — Sign-in required"; admin_state and the Approve action
  are unchanged. Non-login OAuth matches in the "error" state stay in
  the transport-fault branch so wrapped transport failures keep naming
  the real cause.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 349a946
Status: ✅  Deploy successful!
Preview URL: https://937fe18d.mcpproxy-docs.pages.dev
Branch Preview URL: https://claude-brave-mayer-ac613d.mcpproxy-docs.pages.dev

View logs

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: claude/brave-mayer-ac613d

Available Artifacts

  • archive-darwin-amd64 (30 MB)
  • archive-darwin-arm64 (27 MB)
  • archive-linux-amd64 (18 MB)
  • archive-linux-arm64 (16 MB)
  • archive-windows-amd64 (30 MB)
  • archive-windows-arm64 (26 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (24 MB)
  • installer-dmg-darwin-arm64 (22 MB)
  • smart-mcp-proxymcpproxy-goVGVP7X.dockerbuild (0 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 36218816793 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Dumbris and others added 3 commits September 26, 2026 06:56
quarantinedAwaitingSignIn's final fallback required OAuthRequired=true
to treat a broken-stored-token re-auth error as unhealthy. Autodetected
OAuth sets OAuthRequired=false by design, so a quarantined server whose
stored token broke (the connection_oauth.go server-5xx path, message
containing "re-login available" / "server error with stored token")
fell through to the default healthy/"Quarantined for review", hiding a
broken token behind a green health level.

Add an unconditional isOAuthReauthError check mirroring the existing
isOAuthLoginRequiredError check: the reauth marker text is as specific
and trustworthy as the login markers already exempted from the
OAuthRequired gate.

zcode review (plan mode, static trace of every quarantined-path test
case): fix correctly targets the root cause, no regressions in the
transport-fault ("error" state) branch or the existing reauth/sign-in
tests, and the marker text has effectively zero real-world misfire
surface. Verdict: approve, ship as-is.

Addresses zcode finding on internal/health/calculator.go:596-604
(quarantinedAwaitingSignIn) from the branch review.
Enabled, non-quarantined servers with autodetected OAuth (OAuthRequired
is deliberately false — see the comment above quarantinedAwaitingSignIn)
had health.action stuck on 'restart' when their stored token broke, even
though diagnostics.classifyOAuth (which carries no OAuthRequired hint at
all) still assigned MCPX_OAUTH_REAUTH_REQUIRED / MCPX_OAUTH_LOGIN_REQUIRED
from the same raw error text. The two signals then disagreed: ServerCard.vue
derives showLogin from the OAuth diagnostic code independent of
health.action, so the card rendered a Restart button (from health.action)
and a Login button (from the diagnostic) side by side, with the
explanatory error alert suppressed because showLogin also short-circuits
shouldShowError.

The calculator's "error"/"disconnected" branches only promoted
Restart -> Login when input.OAuthRequired was true. Add
oauthActionApplies(), which keeps that behaviour for configured OAuth and
additionally trusts the two specific, unambiguous login/reauth markers
("login available", "re-login available", "server error with stored
token", etc.) without the OAuthRequired gate — mirroring the existing
quarantinedAwaitingSignIn rationale and the already-merged fix for the
quarantined path in this same commit history. isOAuthRelatedError's
connection-fault exclusion runs first in both branches, so a
connection-refused error wrapped in mcp-go's "authentication strategies
failed" text still reports Restart, not Login (regression-tested).

zcode finding: frontend/src/components/ServerCard.vue:471-476 (showLogin)
vs internal/health/calculator.go:236,256 (OAuthRequired gate) vs
internal/diagnostics/classifier.go:66-90 (classifyOAuth, no OAuthRequired
hint) — confirmed genuine by tracing the code paths and reproduced with a
failing test before the fix (calculator_autodetected_oauth_reauth_test.go).
Root-caused at the backend (single source of truth for the action), not
patched in the frontend, matching the sibling fix in this branch's history.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
zcode finding on frontend/src/components/ServerCard.vue:471-475: showLogin's
first branch (`if (healthAction.value === 'login') return true`) ran before
the disabled-server exclusion on the next line, contradicting its own
comment ("A disabled server is excluded"). disableServer()
(frontend/src/stores/servers.ts:208-217) optimistically sets
`server.enabled = false` immediately but does not clear
`server.health`/`server.diagnostic` — those only update once the
SSE-triggered refresh lands. During that window a server whose stale
health.action was still 'login' the instant before it was disabled (the
sibling fix's own headline scenario: an enabled autodetected-OAuth server
with a broken token) rendered the primary Login button instead of Enable.
Self-corrects once the SSE refresh arrives, but was a genuine, easily
triggered ordering bug.

Fix: delete the redundant first branch. oauthSignInState() already returns
'login' whenever health.action === 'login' (frontend/src/utils/health.ts),
so `signInState.value !== null` covers the same case — the disabled-server
checks now run unconditionally first.

Verified test-first: added a case reproducing the exact race (enabled:
false, health.admin_state still 'enabled', health.action still 'login')
that failed before the fix and passes after; confirmed by reverting the
ServerCard.vue change alone and re-running the spec. Full frontend suite
(1348 tests / 136 files) and `npm run build` pass; `go build ./...`
unaffected (no Go files touched).

@github-actions github-actions Bot 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.

Approved (Model B): Paperclip review verdicts = ACCEPT and qa-gate green at this head SHA. Arming auto-merge; GitHub merges when all required checks pass.

@github-actions
github-actions Bot merged commit 01ccfdf into main Sep 26, 2026
50 of 52 checks passed
Dumbris added a commit that referenced this pull request Sep 26, 2026
Base PRs #1376 (109-c health vocabulary) and #1366 (login on quarantined
OAuth servers) are squash-merged into main; this branch's base is retargeted
from 109-c-health-vocabulary to main and main is merged in.

Conflict resolution preserves both sides' intent:
- internal/health/calculator.go: kept main's quarantinedAwaitingSignIn/
  oauthActionApplies generalization (#1366) over this branch's narrower
  OAuthRequired-only check, so a quarantined server needing OAuth sign-in
  reports actions=[login, approve] with login as health.action.
- ServerCard.vue / macOS ServersView.swift, MCPProxyApp.swift,
  DashboardView.swift: kept this branch's Spec 109-e single-primary-action
  redesign, which already reads health.actions[0] and independently gates
  the quarantined Review path in the ⋯ menu / tray submenu — the #1366
  login behaviour surfaces correctly as the ONE primary action for that
  state without reintroducing separate Approve/Login buttons.
- frontend/src/utils/health.ts, AdminServers.vue, UserServers.vue: kept
  main's healthStatusTextOrEmpty() consolidation and the fixed
  quarantined/disabled fallback ordering (FR-011 round finding).
- Rewrote server-card-quarantined-oauth-login.spec.ts and
  server-card-approve-review-navigation.spec.ts (both added by main,
  testing the pre-109-e per-action button design) against the merged
  single-primary-action design; fixtures now match calculator.go's actual
  actions=[login, approve] output.
- Added a race guard to ServerCard's primaryAction: disableServer()'s
  optimistic update flips `enabled` immediately but `health` only refreshes
  on the next SSE payload, so a stale 'login' action is forced to 'enable'
  when `enabled` is false — restores a guarantee the pre-merge showLogin
  computed had that the unified primaryAction had dropped.
- Regenerated oas/swagger.yaml, oas/docs.go, and frontend/src/types/
  contracts.ts (no net diff — contracts unchanged by this merge).

Verification: go build ./... (bare + -tags server); go test -race on
internal/health, cmd/mcpproxy; go test -race -tags server (CI -skip regex)
on internal/serveredition, config, oauth, server, httpapi, storage; golangci-lint
v2 (bare + --build-tags server, pre-existing canaries only); frontend npm run
build (vue-tsc + vite) and npx vitest run (168 files, 1487 tests); macOS
swift test (1259 tests, 1 pre-existing unrelated failure, confirmed on a
clean checkout without this branch's changes).
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.

2 participants