claude-code - 💡(How to fix) Fix /mcp dialog hangs for several seconds when an HTTP MCP server has stale OAuth tokens but reports "Connected" [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54649Fetched 2026-04-30 06:39:52
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×4commented ×1

A connected HTTP MCP server with an expired/stale OAuth token (where silent refresh fails or the refresh token is no longer valid) causes the /mcp dialog to hang for several seconds every time it's opened. The server is shown as ✓ Connected the entire time — there is no UI signal that the slowness is auth-related, which made this very hard to diagnose.

Root Cause

Expected: dialog opens promptly. If a server cannot serve tools because of auth, it should be marked "Needs auth" / "Disconnected", not "Connected".

RAW_BUFFERClick to expand / collapse

Summary

A connected HTTP MCP server with an expired/stale OAuth token (where silent refresh fails or the refresh token is no longer valid) causes the /mcp dialog to hang for several seconds every time it's opened. The server is shown as ✓ Connected the entire time — there is no UI signal that the slowness is auth-related, which made this very hard to diagnose.

Repro

  1. Have any HTTP MCP server with OAuth configured. In my case it was the official Granola MCP (https://mcp.granola.ai/mcp), but the symptom looks transport/server-agnostic.
  2. Let its access token reach a state where it cannot be silently refreshed.
  3. Open /mcp.

Expected: dialog opens promptly. If a server cannot serve tools because of auth, it should be marked "Needs auth" / "Disconnected", not "Connected".

Actual: dialog stalls for several seconds while Claude Code apparently retries against the stale token. The server is shown as ✓ Connected the entire time. Re-authenticating that one server via /mcp makes the dialog load instantly again.

Diagnosis

Bisecting and per-server connect timings in ~/.claude/debug/<session>.txt showed only normal connect times (150ms–650ms) for every server. The hang was not visible as a connection failure; it appeared only during /mcp dialog open. The fix that worked was clicking "Reconnect" / re-authenticating the offending server.

Suggestions

  • Surface stale-auth state explicitly (e.g. "Needs reauth") instead of "Connected" when a token refresh has failed or the token is past expiry and the server has not responded successfully.
  • Cap or short-circuit the refresh attempt during /mcp dialog open so a single misbehaving server can't stall the whole dialog.
  • Consider proactively prompting for re-auth on next session start when the refresh token is known to be invalid.

Environment

  • Claude Code: 2.1.123
  • Platform: macOS (Darwin 25.3.0)
  • Transport: HTTP MCP with OAuth

extent analysis

TL;DR

Implement a mechanism to detect and handle stale OAuth tokens, such as surfacing a "Needs reauth" state or capping refresh attempts, to prevent the /mcp dialog from stalling.

Guidance

  • Investigate the OAuth token refresh mechanism to identify why silent refresh is failing or the refresh token is becoming invalid.
  • Consider adding a timeout or retry limit for token refresh attempts during /mcp dialog open to prevent stalling.
  • Implement a UI indicator to show when a server is in a "Needs reauth" state, rather than displaying "Connected".
  • Review the authentication flow to determine if proactive re-auth prompts can be added when a refresh token is known to be invalid.

Example

No code example is provided as the issue does not contain specific implementation details.

Notes

The solution may require modifications to the OAuth token handling and refresh mechanism, as well as updates to the UI to display authentication state accurately.

Recommendation

Apply a workaround to cap or short-circuit the refresh attempt during /mcp dialog open to prevent stalling, as this can provide a temporary fix until a more comprehensive solution is implemented.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix /mcp dialog hangs for several seconds when an HTTP MCP server has stale OAuth tokens but reports "Connected" [1 comments, 2 participants]