Skip to main content

Google Antigravity

Set up zn-gate in Google Antigravity in two minutes: add it as an MCP server, install its hooks, and what zn-gate does not cover there yet.

View .md

zn-gate supports Google Antigravity (the app, the CLI and the IDE) in two ways: hooks that run before each tool call, and an MCP server. The hooks are the automatic protection; the MCP server is optional. Install the hooks with npx -y zn-gate init or zn hooks install antigravity (below), and read what they do and do not cover.

Quick start (no coding needed)

  1. Check that Node.js is installed. Open a terminal (in most editors: menu Terminal → New Terminal; or your computer's Terminal app), type node --version and press Enter. If you see a version number (18 or later), go on. If you see "command not found", install the LTS version from nodejs.org and restart Antigravity.

  2. At the top of the agent panel, open the … menu → MCP Servers → Manage MCP Servers → View raw config. (This is the file ~/.gemini/config/mcp_config.json, where ~ is your user folder, for example C:\Users\you on Windows.)

  3. Paste this:

    {
      "mcpServers": {
        "zn-gate": {
          "command": "npx",
          "args": [
            "-y",
            "zn-gate",
            "mcp"
          ]
        }
      }
    }

    If the file already has a "mcpServers" section, add only the "zn-gate": {...} part inside it.

  4. Save the file and restart Antigravity.

Status: these steps follow Antigravity's documentation.

What zn-gate protects in Antigravity, and what it does not

zn-gate works in Antigravity through hooks (automatic, covered below) and as an MCP server: the agent can ask it to check a prompt, a tool call or a tool result (analyze_prompt, check_tool_call, check_tool_result). The agent decides when to call the MCP tools, so the server on its own is not automatic protection.

Item In Antigravity
zn-gate's checks available to the agent (MCP) Yes
Your other MCP servers checked for prompt injection and secrets Yes, if you wrap them (below)
Blocks reads and writes of .env and credential files by path Yes, with the hook (below)
Blocks shell commands that handle secrets Yes, with the hook
Removes secrets from shell output and file contents No (Antigravity hooks cannot rewrite tool output)
Blocks a secret pasted into the chat No

Antigravity has hooks (PreToolUse, PostToolUse and others, in .agents/hooks.json) that can deny or change a tool call. zn-gate installs a hook that runs before each tool call. In your own terminal, run zn hooks install antigravity (for your user: ~/.gemini/config/hooks.json) or zn hooks install antigravity --project (for one project: .agents/hooks.json). It blocks the agent from reading or writing secret files by path and from running shell commands that handle secrets, and it protects its own hook files from edits by the agent. A search across a folder asks for confirmation when the folder holds a plain-text .env or key file, but matching lines and command output are not redacted, because Antigravity hooks cannot rewrite tool output. The hook covers PreToolUse only: it does not clean what a tool returns and does not block a secret pasted into the prompt. zn-gate check reports whether the hook works on your machine.

If Node.js is missing or the hook cannot start, the hook answers in Antigravity's deny format with the steps to repair it: install zn-gate and run zn hooks install antigravity again. A hook that starts and then fails is answered the same way.

On macOS and Linux, zn hooks install antigravity writes a launcher script (~/.zn/hooks/zn-hook-antigravity.sh) that runs the Node.js and zn-gate runner it was installed with, but only while the runner still has the SHA-256 recorded at install time, and never a zn found on your PATH. npm update -g zn-gate refreshes it by itself; with --ignore-scripts, run zn hooks install antigravity again.

Antigravity does not document what happens when a hook fails. In our tests (Antigravity IDE and CLI on a real Windows machine, October 2026), a hook that failed to start, printed nothing, printed text that is not JSON, or printed {} made Antigravity block every tool call, with an empty reason. That is the safe direction, but it stops the agent until the hook is repaired (zn-gate check shows how). Because Antigravity does not document this and there is no automated end-to-end run yet, Antigravity can change this behavior in a new version without us noticing.

Limits to know:

  • Not tested: a hook that runs past its time limit, and whether an organization can turn hooks off. We do not know what Antigravity does in those cases, so do not rely on a blocked call there.
  • Other hooks: a hook can be turned off with "enabled": false (zn-gate check reports zn's own as not protected when it is). Antigravity does not document in which order hooks run or which answer wins, and a CLI plugin can carry hooks of its own, so another hook that runs for the same tool call may change what zn's deny means. zn-gate check lists the other enabled PreToolUse hooks it finds in your hooks file and the project's; it cannot see plugin hooks.
  • MCP tool calls: zn-gate checks their arguments before they run (a secret value or __ZN_ marker is blocked, personal data asks you first). Antigravity does not document MCP tool names, so zn-gate recognizes them by a tool name that starts with mcp.
  • Search runs through the shell: the agent's file search runs as a shell command, including over files that .gitignore excludes, so zn-gate checks it as a command and covers it only as far as the command checks go.
  • Which files the agent cannot edit: the hook files and Antigravity's CLI settings file (.agents/hooks.json, ~/.gemini/config/hooks.json and ~/.gemini/antigravity-cli/settings.json), and from zn-gate 1.14.0 the plugin folders and plugin state (~/.gemini/config/plugins/, ~/.gemini/antigravity-cli/plugins/, ~/.gemini/config/config.json and .agents/plugins/ at the root of a project). Antigravity's MCP configuration files are not protected.
  • Windows: checked by hand on a real Windows machine; there is no automated end-to-end run.

If you need secrets removed from shell output and file contents, use zn-gate with Claude Code, Codex CLI, Cursor or OpenCode: see compat.md.

Technical reference

Where the configuration lives

All projects: ~/.gemini/config/mcp_config.json. One project: .agents/mcp_config.json. zn-gate init --wrap-mcp wraps the servers in the all-projects file; wrap the servers of a project file by hand as below.

Check the output of your other MCP servers

To check the output of the other MCP servers you use in Antigravity, start each local server through zn-gate: replace its command with npx and put -y zn-gate shield -- in front of its original command and arguments. For example, a server started with uvx mcp-server-fetch becomes:

{
  "mcpServers": {
    "fetch": {
      "command": "npx",
      "args": [
        "-y",
        "zn-gate",
        "shield",
        "--",
        "uvx",
        "mcp-server-fetch"
      ]
    }
  }
}

Every result of that server is then checked for prompt injection, and secrets zn-gate recognizes are removed, before the agent sees it. zn-gate init --wrap-mcp does this automatically for Claude Desktop, Claude Code, Cursor, Codex, OpenCode and Antigravity's all-projects file, but not for a project's .agents/mcp_config.json.

Antigravity documentation