Meet Unleash at one of the events we're attending this year➩ See where we'll be

Watch "Implementing a Kill Switch for AI"

Events

Join the Unleash team to learn how to integrate runtime control in your AI strategy.

Automate feature glags in Google Antigravity: MCP, Plugins, and Hooks

Alex Casalboni

Alex Casalboni

Developer Advocate

August 5, 2026

Google Antigravity is built to run agents, not just answer questions. In the desktop app you launch several agents at once and watch them work, and in the CLI you drive the same engine from your terminal. Either way, the agents write real code, and a lot of it.

The question is how do you make those agents put risky changes behind feature flags automatically, the way your team already does by hand?

The answer is the Unleash MCP server. Connect it once and your agent can evaluate a change, create a properly named flag, wrap the code, and later clean it up, all through the same MCP tools. We will wire it up, watch it wrap a change, then package the whole setup so your team shares it, teach the agent to reach for flags on its own, and add a hook that makes flag writes impossible to skip. Five steps, each building on the last.

Everything here works the same in the Antigravity desktop app and the agy CLI, since they share one engine and configuration. If you are still on Gemini CLI under a paid license, the same MCP tools work there too; the integration docs cover the small config differences.

Step 1: Connect the Unleash MCP server

Antigravity reads MCP servers from ~/.gemini/config/mcp_config.json. Add Unleash there:


{
  "mcpServers": {
    "unleash": {
      "command": "npx",
      "args": ["-y", "@unleash/mcp@latest", "--log-level", "error"],
      "env": {
        "UNLEASH_BASE_URL": "${UNLEASH_BASE_URL}",
        "UNLEASH_PAT": "${UNLEASH_PAT}",
        "UNLEASH_DEFAULT_PROJECT": "${UNLEASH_DEFAULT_PROJECT}"
      }
    }
  }
}

Export UNLEASH_BASE_URL, UNLEASH_PAT, and UNLEASH_DEFAULT_PROJECT in your shell first. Prefer the desktop app? It has an MCP Store UI that writes the same file.

Now start a session and run /mcp. You should see the unleash server and its tools listed. That is the whole setup. From here on, you talk to your agent in plain language and it calls the tools for you.

Step 2: Let the agent wrap your first risky change

Here is where automation shines. Say you are adding a Stripe payment path to a checkout service. That is exactly the kind of change you want behind a flag. Instead of creating the flag in the Unleash UI and hand-writing the guard, ask the agent:

Evaluate whether the Stripe payment integration should be behind a feature flag.
It modifies the checkout service and handles credit card processing.

The agent calls evaluate_change, decides a flag is warranted, and suggests a name. Before it creates anything, it calls detect_flag to check whether a similar flag already exists, so you do not end up with stripe-checkout and checkout-stripe-v2 competing in the same codebase.

If nothing matches, it calls create_flag and the flag lands in Unleash, disabled by default and named to your convention.

Then ask it to wrap the code:

Wrap the Stripe checkout handler with the new flag. This is a Node.js Express app.

The agent calls wrap_change and edits the file for you:


const { isEnabled } = require('unleash-client');

app.post('/checkout', async (req, res) => {
  const context = { userId: req.user.id };

  if (isEnabled('stripe-payment-integration', context)) {
    const result = await stripeService.processPayment(req.body);
    return res.json(result);
  } else {
    const result = await legacyPaymentService.process(req.body);
    return res.json(result);
  }
});

You merge the change, disabled. You turn it on for internal users, watch the numbers, and roll it out from there. If it misbehaves, you flip the flag off and it is gone from production instantly, no redeploy.

The same agent can manage that rollout: ask it to enable the flag in staging, check its current strategies, or clean it up once the feature is fully shipped, and it calls toggle_flag_environment, get_flag_state, or cleanup_flag in turn.

One habit worth keeping: leave a prompting approval mode on for the write tools. When the agent calls create_flag or toggle_flag_environment, Antigravity shows you the flag name and environment before it runs.

Step 3: Package it once for your whole team

Editing mcp_config.json by hand is fine for you. It does not scale to 100 developers, each doing it slightly differently. Antigravity’s answer is plugins, the successor to Gemini CLI extensions. A plugin bundles the MCP server, a context file, skills, and hooks into one installable unit, so a platform team publishes it once and everyone installs the same thing.

If you already maintain an Unleash setup for another assistant, you probably do not need to build the plugin from scratch. Antigravity imports from Gemini and Claude directly:


agy plugin import gemini     # bring across a Gemini CLI setup
agy plugin import claude     # bring across a Claude Code plugin
agy plugin list              # confirm what is installed

The import carries over the MCP server configuration and any skills, and drops them into a plugin under ~/.gemini/config/plugins/. After importing, open the generated mcp_config.json and swap any bash-style default like ${UNLEASH_DEFAULT_PROJECT:-default} for a plain ${UNLEASH_DEFAULT_PROJECT}, since Antigravity does not evaluate those inline defaults. Publish the result to a repo your team installs from, and setup drift stops being a problem you manage.

Step 4: Make it automatic with a context file

So far you have been asking the agent to consider flags. The next step is making it reach for them on its own. Antigravity reads GEMINI.md and AGENTS.md files for standing instructions, so drop your FeatureOps policy in one:


## Feature flags

Before implementing high-risk changes (payments, auth, data migrations, external
APIs), use the Unleash MCP server to evaluate whether a feature flag is needed.

- Name flags `{domain}-{feature}-{variant}`, e.g. `checkout-stripe-integration`.
- Run detect_flag before creating a new flag, to avoid duplicates.
- Clean up flags with cleanup_flag once a feature is fully rolled out.

Now when a developer says “add SSO login with Google” the agent recognizes an auth change, calls evaluate_change without being asked, and proposes a flag named auth-sso-google.

The policy lives in version control instead of in one senior engineer’s memory, and it ships inside the plugin from Step 3, so every agent on every machine follows it.

Step 5: Enforce it with a hook

A context file is guidance. Sometimes you want a rule that fires no matter what the agent decided. That is what hooks are for. A hook is a script Antigravity runs at a set point in the agent loop, and a PreToolUse hook runs right before a tool call, inspects it, and returns a decision of allow, deny, or ask.

Point one at the flag write tools and you have a deterministic gate:


{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "create_flag|toggle_flag_environment|set_flag_rollout|remove_flag_strategy",
        "command": "~/.unleash/confirm-flag-write.sh"
      }
    ]
  }
}

Your script reads the tool call as JSON on stdin and writes a decision on stdout. Use it to always require confirmation for flag mutations, block writes to production outright, or log every flag change for an audit trail.

Because it runs on every matching call regardless of the approval mode, nobody can prompt their way around it. Hook events and the exact schema are still settling as Antigravity evolves, so check the hooks docs for the current format before you rely on a specific field.

Scale it in the Agent Manager

Put the five steps together and the payoff shows up when you stop working one change at a time. In the desktop app’s Agent Manager you can hand off several tasks at once, each agent running in its own worktree, some scheduled to run while you are away. That is a lot of code landing fast, which is exactly the situation where undisciplined flagging turns into an incident.

With the setup above, it does not. Every agent shares the same MCP server, the same policy, and the same hook, so each risky change comes back already wrapped in a flag, disabled, named to convention. You review the Artifacts each agent produced, merge what looks good, and roll features out on your own schedule. The agents move fast, and the flag decides what actually reaches your users.

That is the whole point of wiring Unleash into Antigravity: the busywork of the flag lifecycle becomes the agent’s job, and the control over what ships stays yours. Start with Step 1, and by Step 5 your feature flags are running on autopilot with a hand on the switch. The integration docs have the full reference, including enterprise governance through the Gemini Enterprise Agent Platform and the remote MCP server for managed cloud agents.