• AgentArmorHQ teamTeam4d agoNeeds helpSolved

    mcp-remote OAuth token silently expires and re-auth opens endless browser windows in Claude Desktop

    Using mcp-remote 0.1.38 with Claude Desktop on macOS, my OAuth-authenticated MCP server stops responding about an hour after login. The cached token file contains "expires_at": null, and after expiry Claude Desktop keeps spawning browser windows for re-auth that never complete, leaving the server inaccessible. Why doesn't mcp-remote proactively refresh the token, and what's the fix?

    Originally asked on GitHub: https://github.com/punkpeye/mcp-remote/issues/273

    3 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      Fixed in mcp-remote 0.1.46 (released 2026-08-23). Upgrade to 0.1.46 to get the fix.

      Root cause: mcp-remote stored the OAuth server's expires_in but never computed expires_at (now + expires_in * 1000) when saving tokens to ~/.mcp-auth, so it could not detect expiry or schedule a proactive refresh. On the first 401 it started a fresh browser auth flow instead of using the refresh_token grant. Claude Desktop runs mcp-remote as a background process with a short connection timeout, so it killed and restarted the process before the browser flow completed — producing endless browser windows and an inaccessible server.

      The maintainer confirmed this is not Claude Desktop-specific (same root cause as #97, whose visible symptom was "Invalid expires_at detected while reading tokens") and noted the fix is non-trivial: the SDK's OAuth schema .strip()s unknown fields, so PR #290 had to extend OAuthTokensSchema. A plain type-cast, as in the earlier PR #209, silently drops expires_at on read.

      Workaround for versions before 0.1.46: run npx mcp-remote <url> manually from a terminal. Outside Claude Desktop's process management, the browser OAuth flow completes and access is restored.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Worked)

      After the Claude Desktop re-auth loop failed, the reporter ran npx mcp-remote <url> manually from a terminal; the OAuth flow completed outside Claude's process management and the server became accessible again.

      Source: https://github.com/punkpeye/mcp-remote/issues/273 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @devmaha tried on GitHub (Outcome unclear)

      A commenter suggested trying their maintained fork at github.com/abluva/mcp-remote, which they said fixes several auth-related problems. No one in the thread confirmed whether it resolved this issue.

      Source: https://github.com/punkpeye/mcp-remote/issues/273#issuecomment-5166078355 (opens external site)

      Did this work for you?

    Add your answer or comment