agy acp writes each MCP server’s tool schemas to ~/.gemini/antigravity-cli/mcp/<name>/ and never removes the folder. mcpServerNames.assign gives each spec with a different fingerprint its own name (<name>_<8 hex>, then 16, then 64), and the fingerprint covers env. A client that passes a per-session token in env therefore gets one new folder per session. With a server of about 500 tools, that is about 2.2 MB per session and 20 to 30 folders a day, kept indefinitely.
Either of these would fix it: prune the folders a process created when it exits (and stale ones at startup, for crashes), or key the cache by the server’s base name, since the schemas don’t depend on env.
Seen with agy 1.5.2 on macOS arm64. Our client now removes these folders itself once no running agy can be using them.
Thank you for the concise report and root-cause analysis! We reproduced this on Antigravity CLI (v1.5.5) and confirmed that mcpServerNames.assign includes env in the fingerprint when creating ~/.gemini/antigravity-cli/mcp/<name>_<hash>/ schema folders and does not prune them on exit.
We have escalated this to our Antigravity CLI (agy) engineering team along with both of your suggested fixes (excluding per-session env values from the schema cache key and pruning stale directories on startup/exit). In the meantime, your cleanup workaround when no agy process is running is completely safe.
Appreciate the clean size breakdown on mcpServerNames.assign, @zzunkie.
Until agy stops hashing volatile env tokens into <name>_<hash> (or prunes orphaned directories on exit), a neat zero-cleanup workaround on macOS is moving the per-session token out of the MCP server’s env block and reading it inside a tiny wrapper script or macOS Keychain:
Keep the MCP config’s env block static ({}) so mcpServerNames.assign generates the exact same fingerprint across every session.
Write your rotating session token to a 0600 file (or Keychain entry) just before invoking agy acp, and read that token inside the MCP launcher script.
# Wrapper referenced by MCP command instead of injecting SESSION_TOKEN in env:
export SESSION_TOKEN="$(cat "$HOME/.config/my-mcp/session_token")"
exec /path/to/my-mcp-server "$@"
That locks ~/.gemini/antigravity-cli/mcp/<name>/ to a single permanent folder so you stop accumulating 20 to 30 redundant schema copies a day without needing background cleanup.