Skip to content

No-auth upstream stuck in 'Pending Auth' forever after network timeout (OAuth fallback on transport error) #1537

Closed

Description

@iqiiidi-sudo

Summary

A streamable-HTTP upstream that needs no authentication at all ends up permanently in Pending Auth / "Sign-in required" after a short network outage. It never leaves that state on its own. mcpproxy auth login cannot help, because the server has no OAuth endpoints. Restarting the daemon is the only fix.

Version / environment

  • mcpproxy-go v0.69.0, Linux (NixOS), running as a systemd service with disable_management: true. Not yet checked on v0.70.0.
  • Upstream config (no oauth block, no headers):
{ "name": "cloudflare-docs", "protocol": "streamable-http", "url": "https://docs.mcp.cloudflare.com/mcp" }
  • The server itself: initialize returns 200 without credentials. /.well-known/oauth-protected-resource[/mcp] and /.well-known/oauth-authorization-server return 404.

What happened

  1. Wi-Fi dropped for about 20 minutes and DNS stopped resolving. Every remote upstream went Ready → Error, as expected.
  2. During the outage, reconnect attempts failed with
    MCP initialize failed during no-auth strategy: server did not respond to MCP initialize within 30s ...
  3. When the network came back, every other upstream returned to Ready. On its last reconnect, cloudflare-docs went into the HTTP OAuth strategy:
    Starting OAuth flow ... has_persisted_token=false
    Preflight request for WWW-Authenticate header failed ... dial tcp: lookup docs.mcp.cloudflare.com ... i/o timeout
    Authorization Server Metadata discovery failed ... context deadline exceeded
    No OAuth scopes discovered; falling back to empty list
    MCP initialization failed after OAuth setup: no valid token available, authorization required
    State transition Connecting -> Pending Auth
    
  4. After that there were no more reconnect attempts. Hours later the server still showed status: "pending auth", health.summary: "Sign-in required", although the network had been fine for a long time.
  5. POST /api/v1/servers/{name}/restart is refused under disable_management. After systemctl restart mcpproxy, the server connected immediately via the no-auth strategy (2 tools).

Expected

  • A timeout or DNS failure in the no-auth strategy should not count as "OAuth required". This looks like the same class of problem as fix(upstream): stop misclassifying transport errors as auth failures #464, but here the trigger is a transport timeout, not the strategy-name substring.
  • If the OAuth strategy is attempted anyway and discovery finds no OAuth metadata (or discovery itself fails on a network error), the server should go to Error and keep retrying with backoff, not to a terminal Pending Auth.
  • Pending Auth should be re-evaluated periodically. For example, retry the no-auth strategy when no token exists and discovery found nothing.

Workaround

A systemd timer that restarts the daemon when a server known to need no OAuth reports pending auth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions