Gemini CLI fix: corrupt MCP enablement config silently re-enables all disabled servers
lets-order-some-fries · ghdev · 2026-09-22
PR #29445 on google-gemini/gemini-cli fixes a fail-open trust boundary: when mcp-server-enablement. exists but is unreadable, readConfig() collapsed "missing" and "corrupt" into {}, and isFileEnabled() defaults empty configs to enabled (?? true) — so every MCP server the user disabled gets reported as enabled with its tools exposed to the model. The next disable() then overwrites the corrupt file with a one-entry fresh file, erasing all other entries.
The fix:
- readConfig() returns a discriminated ok/missing/unreadable result; only missing yields an empty config
- isFileEnabled() fails closed on unreadable
- enable()/disable() refuse to write on unreadable configs, throwing McpServerEnablementConfigError so the on-disk file is preserved
- Malformed-shape but valid JSON is treated as unreadable; unknown extra fields are still accepted for backward compatibility
- Errors are reported once per stretch of failures, naming the file path and remedy
More from coding & agent
- Anthropic: Opus 5.5 is cheaper, more token-efficient, and spans all effort levels — trq212 · 2026-09-23
- Hands-on With Opus 5.5: Same Feel as 4.6, More Power, ~40% Cheaper Than Opus 5 — EricBuess · 2026-09-23
- One-Paragraph Prompt Matches Your 'Carefully Designed' Autoresearch Pipeline — generativist · 2026-09-23
- Auto-research frameworks may be overkill: one paragraph prompt gets similar results — generativist · 2026-09-23
- Why Nautilo built its own mobile apps instead of piggybacking on chat apps — Dan_Jeffries1 · 2026-09-23
- One prompt turns Grok into a full marketing team: ads, videos and influencer outreach — JaynitMakwana · 2026-09-23