Gemini CLI fixes MCP OAuth refresh bug that was deleting recoverable credentials
ParthivNaresh · ghdev · 2026-07-22
A google-gemini/gemini-cli PR fixes a bug in MCP OAuth token refresh for servers configured through OAuth discovery and dynamic client registration.
What was broken:
- Refresh could fail locally before any network request was sent.
- The code looked up the client ID from stored credentials, but passed an empty config into the refresh flow.
- When refresh failed, the catch path deleted recoverable credentials, forcing users to re-authenticate on every reconnect.
What the fix does:
- Uses config.clientId ?? credentials.clientId.
- Passes the resolved client ID into refresh calls.
- Persists that client ID with the refreshed token.
- Applies the same fix in both the metadata and non-metadata token paths.
The PR includes tests and an end-to-end validation path for short-lived tokens and real DCR-enabled servers.
More from coding & agent
- NVIDIA says Nemotron 3 Ultra hit 97.1% on agentic RTL chip-design tasks — NVIDIAAI · 2026-07-27
- Tokyo Agent Forge hackathon shipped production-ready AI agents in one day — DavidBennett__ · 2026-07-27
- Long-running agents will need immutable event logs, this thread argues — sebpaquet · 2026-07-27
- Agentic Data Science in Practice: Agents Write Code but Answer Wrong Questions — hugobowne · 2026-07-27
- A VS Code extension adds Markdown-style highlighting to Alchemy string templates — samgoodwin89 · 2026-07-27
- Claude’s Stripe MCP connector is being called unusable after repeated disconnects — evielync · 2026-07-27