ANTIGRAVITY LABJP
Articles/Integrations
Integrations/2026-06-22Advanced

Scope the MCP Tools You Hand an Agent: A Least-Privilege Allowlist Design

As you add MCP servers to Antigravity 2.0, the set of tools every agent can reach quietly grows into an all-you-can-eat buffet. An agent that only needs to read files seeing delete and deploy tools is an accident waiting to happen. This walks through a least-privilege design that scopes tools per agent role, denies at call time, and gates destructive operations behind a second step, with working Python and field notes.

Antigravity258MCP16Least PrivilegeSecurity DesignProduction10

Premium Article

A background agent I had assigned read-only work turned out, one day, to be holding a file-delete tool. Nothing was actually deleted. But the simple fact that a permission it never needed had drifted within reach stayed with me for a while.

With Antigravity 2.0, this state arrives on its own as you connect MCP servers. Every server you wire in piles its exposed tools onto the heap of "available tools." The heap looks identical to every agent, and the line between who may use what is written down nowhere.

What this article works through is putting that line into code. The guiding idea is least privilege: show each agent only the tools its job requires, and nothing else.

Why an all-in tool set breeds accidents

Let me make the danger concrete first.

MCP's convenience is that connecting a server makes its tools immediately usable: file operations, shell execution, external APIs, databases, billing. The more you connect, the more tools appear. The trouble is that these new tools become visible to every agent without being sorted by role.

A nightly aggregation agent needs reading and summarizing, nothing more. But if deploy and delete tools live in the same environment, the moment the model misreads context there is room for it to reach for a tool it should never touch. In unattended background runs with no review, that room is the entrance to an incident.

A design without scoping fails two ways. Show destructive tools to a read-only agent and the odds of a misfire rise above zero. Narrow every agent uniformly and the agents that genuinely need power can no longer do their work. Drawing the line per role is the only path that satisfies both.

Hold the allowlist per agent role

The center of the design is an allowlist that enumerates, per agent role, the tools it may see. The key move is to attach permission to the agent, not to the tool.

Agent roleAllowed toolsDenied tools
Reporting (read-only)read_file, list_dir, query_db_readonlywrite_file, run_shell, deploy, delete_*
Article build (writes)read_file, write_file, run_buildrun_shell, deploy, charge_*, delete_*
Deploy (destructive, gated)read_file, deploy (two-step)delete_db, charge_*

The rows are roles; the columns are allowed and denied. The same tool set exposes a different surface depending on role — that is the point of the design. Default to "denied" and let through only what you explicitly list. Holding that deny-by-default line means a newly connected server never leaks to every agent the instant you wire it in.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
A registry design that scopes MCP tools per agent role with deny-by-default allowlists, shown as Python you can drop in, so adding a new server never silently leaks tools to every agent
A guard that checks permission right before each tool call, plus a two-step approval gate that applies only to destructive tools like delete, charge, and deploy, with the exact ordering of checks
A minimal audit log that lets you reconstruct who was allowed what, and a safe way to grow allowlists over time, drawn from running automation across four indie sites
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

Integrations2026-06-01
Fixing spawn npx ENOENT When an Antigravity MCP Server Won't Start
Your MCP server config JSON looks correct, but Antigravity logs spawn npx ENOENT and the server stays gray. This is almost always a PATH inheritance problem, not a broken server. Here is how to diagnose and fix it.
Integrations2026-03-28
Building Custom AI Agents with Antigravity and MCP — External API Integration
Learn how to build custom AI agents using Antigravity's MCP (Model Context Protocol) to integrate external REST APIs and Webhooks. This guide covers design, implementation, debugging, and production-ready patterns.
Integrations2026-03-22
Building a Store Asset Production Environment in Antigravity — Stitch × Figma × MCP Workspace
Learn how to integrate Stitch, Figma, and MCP into Antigravity for a unified App Store and Google Play asset production workspace
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →