mcpproxy-go icon indicating copy to clipboard operation
mcpproxy-go copied to clipboard

[Bug]: MCP upstream list reports sign-in required with a valid OAuth token

Open neylwalecki opened this issue 2 months ago • 0 comments

What happened?

upstream_servers with operation=list can report a false OAuth sign-in requirement for an upstream that already has a valid stored token. The CLI/runtime health projection reports that same upstream as healthy.

The synthetic reproduction gives these outputs for an enabled server in Ready with one callable tool and a token expiring in 48 hours:

Surface Summary Status Usable
Runtime.GetAllServers (CLI/management projection) Connected (1 tool) ready true
MCP upstream_servers/list Authentication required sign_in_required false

This was observed with v0.70.0 personal on macOS arm64 and reproduced independently on upstream main at f2e58df33724dca64c064ffd229bb8455442ad41. The installed app build was modified, so the source-level reproduction is the reproducible evidence rather than a claim of byte-identical release behavior.

Expected behavior

The MCP listing should use the same canonical OAuth/health state as the runtime. A valid token should not require a new sign-in. Missing/expired tokens, OAuth failures, explicit logout and effective authentication rejection must continue to produce an unusable/sign-in-required state. Disabled and quarantined servers must remain unavailable.

Reproduction

  1. Create a runtime backed by a temporary directory, without starting its supervisor or connecting to external services.
  2. Persist an enabled HTTP server with an explicit empty OAuth config and a synthetic OAuthTokenRecord, using oauth.GenerateServerKey(name, url) and an expiry 48 hours in the future.
  3. Add the managed client with AddServerConfig (no Connect), transition its state to Ready, and seed the matching StateView entry with one callable tool.
  4. Compare Runtime.GetAllServers() with the real MCP handleUpstreamServers dispatcher using operation=list.
  5. The runtime returns ready/usable=true; the MCP listing returns sign_in_required/usable=false.

The accompanying regression uses .invalid URLs, synthetic tokens and temporary storage only. It does not require a real OAuth provider or any operator credentials.

Cause

handleListUpstreams passes OAuthRequired to the health calculator but omits OAuthStatus and token-expiry/refresh metadata. The calculator treats empty OAuth status as a sign-in requirement. Runtime.GetAllServers supplies the canonical state.

This is separate from #1172, which covers stale OAuth records after switching to static header authentication, and from tool-search/annotation filtering. Those behaviors do not need to change to fix this projection.

Checks

  • Searched existing issues and PRs; no duplicate of this MCP/runtime projection divergence found.
  • Confirmed a failing synthetic regression on the unmodified upstream production code.
  • No real tokens, private endpoints, accounts or logs are included.

neylwalecki avatar Oct 05 '26 18:10 neylwalecki