claude-antigravity-mcp
<p align="center">
<img src="assets/banner.svg" alt="antigravity-mcp: MCP server for the Google Antigravity CLI (agy)" width="100%">
</p>
<p align="center">
<a href="https://github.com/aristidew1/antigravity-mcp/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/aristidew1/antigravity-mcp/actions/workflows/ci.yml/badge.svg"></a>
<a href="LICENSE"><img alt="MIT license" src="https://img.shields.io/badge/license-MIT-blue"></a>
<a href="https://modelcontextprotocol.io"><img alt="MCP 2025-11-25 with Tasks" src="https://img.shields.io/badge/MCP-2025--11--25%20%2B%20Tasks-00ADD8"></a>
<img alt="Node.js 20+" src="https://img.shields.io/badge/node-%E2%89%A520-339933">
<img alt="Zero dependencies" src="https://img.shields.io/badge/dependencies-0-brightgreen">
<img alt="Tested with agy 1.5.22" src="https://img.shields.io/badge/agy-1.5.x-4c8bf5">
<img alt="Windows, macOS, Linux" src="https://img.shields.io/badge/os-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey">
</p>
# Antigravity MCP server (agy MCP) for Claude Code, Codex and Cursor
**antigravity-mcp** is an MCP server for the **Google Antigravity CLI (`agy`)**. It lets Claude Code, Claude Desktop, OpenAI Codex, Cursor, Windsurf, Gemini CLI or any other MCP client hand tasks to Antigravity: Gemini 4, Claude or GPT models, through your own Antigravity account. You don't need an API key.
## Features
- **Three access levels enforced by agy itself**: `read-only` (plan mode), `edit` (file edits, no shell), `full` (everything, sandboxed by default). You can cap the highest level allowed.
- **Allowed folders**: agy only runs in folders you allow. Symlinks and junctions are resolved before the check.
- **Jobs that survive crashes**: every job is saved to disk, and agy runs detached with its output in files. If the server crashes or restarts, or the client disconnects, the next server picks the job up and returns its result. Any session can read any job.
- **Native MCP Tasks** (spec 2025-11-25): clients that support tasks run long calls in the background, with `tasks/get`, `tasks/result`, `tasks/list` and `tasks/cancel`. Other clients get a `job_id` and wait with `antigravity_job`.
- **Multi-model council**: `antigravity_council` asks 2 to 5 models the same question in parallel, for example Gemini 4 and Claude, which come from different providers and quota pools. A judge model then checks their answers against the files and writes one consolidated answer.
- **Reliable resume**: each `conversation_id` keeps its model, effort and folders, because agy forgets the model when you resume.
- **Results you can check**: `changed_files`, `denied_actions`, token `usage`, and `served_by`, the backend model agy's own log says answered. Misrouting is flagged.
- **Quota-aware routing**: `model: "auto"` (the default) picks the strongest model, or the fastest with `prefer: "fast"`, from the pool with the most quota left. If that pool runs out mid-run, the task is re-run once on the other pool automatically (`fallback`). The council skips pools with no quota left.
- **Git worktree isolation**: `isolation: "worktree"` runs agy in its own worktree on a new `agy/<id>` branch, so parallel runs and your uncommitted work never collide. Review the result, then commit it on the branch or discard it with one call.
- **No polling**: the Claude Code plugin ships an `asyncRewake` hook that wakes Claude when a background run finishes. The server also pushes a `job_finished` notification, and MCP Tasks clients get status notifications.
- **Local dashboard**: a page that shows jobs from every session, live agy logs and the quota. It is read-only, local only, protected by a token, and served with a strict CSP.
- **One-command install**: a Claude Code plugin marketplace, plus `install`, which registers the server with every MCP client it finds on the machine.
- **Zero dependencies**: plain Node.js 20+, no SDK, no build step. CI runs the tests and the [benchmarks](#benchmarks) on Windows, macOS and Linux with Node 20, 22 and 24. The 94 tests run offline against a fake agy.
## Quick start
1. Install the official Antigravity CLI, then run `agy` once and sign in:
```powershell
irm https://antigravity.google/cli/install.ps1 | iex # Windows PowerShell
```
```bash
curl -fsSL https://antigravity.google/cli/install.sh | bash # macOS / Linux
```
2. Install the server. Pick one option:
**Claude Code plugin** (adds the server and a delegation skill):
```text
/plugin marketplace add aristidew1/antigravity-mcp
/plugin install antigravity-mcp@antigravity
```
Recent Claude Code versions can do both steps at once: `/plugin install antigravity-mcp --marketplace aristidew1/antigravity-mcp`.
**Any MCP client**: clone the repo, check the setup, and register the server with every client found on the machine (Claude Code, Claude Desktop, Cursor, Windsurf, Gemini CLI, Codex):
```bash
git clone https://github.com/aristidew1/antigravity-mcp
node antigravity-mcp/src/cli.mjs --check
node antigravity-mcp/src/cli.mjs install # --dry-run to preview, --client cursor,codex to choose
```
3. Restart your client and ask something like: *"Ask Antigravity with gemini-4-neon-high to review src/ in read-only mode."*, or *"Hold an Antigravity council on whether this migration is safe."*
### Let your agent install it
Paste this into Claude Code, Codex or any coding agent:
```text
Install the MCP server from https://github.com/aristidew1/antigravity-mcp.
1. Check that `agy --version` works. If it doesn't, tell me to install the Antigravity CLI and sign in.
2. Clone the repo into a tools folder and run `node src/cli.mjs --check`. Show me the output.
3. Run `node src/cli.mjs install --dry-run`, show me the plan, and run it without --dry-run once I agree.
4. Tell me to restart the session, then call `antigravity_models` to confirm it works.
Do not run paid agy tasks without asking me first.
```
<details>
<summary><b>Manual configuration</b> (Claude Desktop, Cursor, Windsurf, Gemini CLI, Codex)</summary>
JSON clients (`claude_desktop_config.json`, `~/.cursor/mcp.json`, `~/.codeium/windsurf/mcp_config.json`, `~/.gemini/settings.json`):
```json
{
"mcpServers": {
"antigravity": {
"command": "node",
"args": ["C:\\path\\to\\antigravity-mcp\\src\\cli.mjs"]
}
}
}
```
Codex (`~/.codex/config.toml`):
```toml
[mcp_servers.antigravity]
command = "node"
args = ["/absolute/path/to/antigravity-mcp/src/cli.mjs"]
```
Claude Code: `claude mcp add -s user antigravity -- node /absolute/path/to/antigravity-mcp/src/cli.mjs`
</details>
## Tools
| Tool | What it does |
|---|---|
| `antigravity_task` | Runs `agy --print` in `cwd`. Arguments: `prompt`, `cwd`, `model` (a slug or `"auto"`), `prefer` (`strong`/`fast`), `fallback`, `isolation` (`none`/`worktree`), `effort` (low…max), `access`, `sandbox`, `conversation_id`, `add_dirs`, `timeout_seconds`, `wait_seconds`. It returns `response`, `conversation_id`, `routing`, `served_by`, `changed_files` (git repos only), `denied_actions`, `usage`, `worktree` and `fallback_from`, or a `job_id` while the run continues. Supports MCP Tasks. |
| `antigravity_council` | The same read-only question to 2-5 `models` in parallel, then a `judge_model` consolidates the answers (`"none"` skips it). Without `models`, it picks the strongest available model from each quota pool. Supports MCP Tasks. |
| `antigravity_job` | Waits for a job or a council, or cancels it with `cancel: true`. Cancelling kills the whole agy process tree. `worktree: "commit"` commits a worktree run on its branch, and `"discard"` removes it. Works across restarts and sessions, and follows a quota fallback to the run that replaced it. |
| `antigravity_jobs` | Lists recent jobs from every session. |
| `antigravity_models` | Lists the live models (`agy models`), the remaining quota per pool (Gemini vs Claude/GPT, 5-hour and weekly limits) and the default council. |
| `antigravity_dashboard` | Starts the local dashboard and returns its URL. You can also run it standalone with `node src/cli.mjs dashboard`. |
### Access levels
| `access` | agy flags | Effect |
|---|---|---|
| `read-only` (default) | `--mode plan` | No changes. agy only writes a plan in its own state folder. |
| `edit` | `--mode accept-edits` | Edits files. Shell commands are auto-denied in headless mode and listed in `denied_actions`. |
| `full` | `--dangerously-skip-permissions` (+ `--sandbox` unless `sandbox: false`) | Everything is auto-approved, including shell commands. Use it only when you mean it, or forbid it with `max_access`. |
## Configuration
Settings come from the MCP server's `env` block first, then from `config.json` in the state folder (`%LOCALAPPDATA%\antigravity-mcp\` on Windows, `~/.antigravity-mcp/` elsewhere):
```json
{
"allowed_roots": ["C:\\Users\\you\\Dev", "D:\\work"],
"max_access": "edit",
"max_concurrent": 3,
"on_exit": "keep"
}
```
| Variable | `config.json` | Default | Purpose |
|---|---|---|---|
| `AGY_MCP_ALLOWED_ROOTS` | `allowed_roots` | home folder + temp folder | Folders agy may run in (`cwd` and `add_dirs`). Separate entries with `;` on Windows and `:` elsewhere. `*` allows any folder. |
| `AGY_MCP_MAX_ACCESS` | `max_access` | `full` | Highest `access` a caller may request. |
| `AGY_MCP_MAX_CONCURRENT` | `max_concurrent` | `3` | agy runs at once. Further runs wait in a queue. |
| `AGY_MCP_ON_EXIT` | `on_exit` | `keep` | When the client disconnects: `keep` lets running jobs finish so the next session can read them; `cancel` kills them. |
| `AGY_MCP_DASHBOARD` | `dashboard` | `1` | `0` disables the dashboard tool. |
| `AGY_MCP_STATE_DIR` | | see above | Where jobs, conversations and `config.json` live. |
| `AGY_BIN` | | auto | Path to `agy`. Otherwise the server looks in `%LOCALAPPDATA%\agy\bin\agy.exe`, then `~/.local/bin/agy`, then `PATH`. |
`node src/cli.mjs --check` shows the settings in effect.
## How it works
- **Prompt passing**: the prompt goes in as `--print=<prompt>` in an argv array, with no shell and stdin closed. A prompt starting with `-` is never taken for a flag, and cmd.exe never expands anything.
- **Long prompts**: prompts over 20,000 characters are written to a private temp file that agy is asked to read, because Windows caps a command line at 32,767 characters.
- **Persistence**: each job is saved to `jobs/<id>.json` in the state folder. agy is started detached, and its stdout, stderr and log go to files in a private run folder. A server that starts later adopts the unfinished jobs whose server is gone: it waits for agy to exit, then reads the result from those files. Ownership is an exclusive lock file per job, so two sessions never finish the same job. Another session can follow a job through its file, cancel it through a request file, and take it over if its owner dies.
- **Resume**: `agy --conversation <id>` silently falls back to the default model unless `--model` is passed again. The server stores cwd, model, effort and extra dirs for each `conversation_id` and passes them again.
- **Changed files**: `git status` runs before and after each run, with the repo's fsmonitor hook disabled and git taken from `PATH`, never from the workspace. Files that were already dirty are fingerprinted, so editing them again still shows up.
- **Paths**: `cwd` and `add_dirs` are resolved to their real path, checked against the allowed folders, passed to agy in that resolved form, and checked again when a queued job starts. Network (UNC) and drive-relative paths are refused unless a UNC root is allowed.
- **Backend check**: each run writes an agy log (`--log-file`). The server reads the backend label from that log and flags `misrouted` when it differs from the requested model.
- **MCP Tasks**: the server declares `tasks.requests.tools.call`, and the long tools declare `execution.taskSupport: "optional"`. A task-augmented `tools/call` returns a `CreateTaskResult` right away. `tasks/result` blocks until the run ends, and `tasks/cancel` kills agy.
- **Timeouts**: the server passes `--print-timeout` to agy and kills the process tree 90 s after that if agy has not stopped.
## FAQ
**How do I use Google Antigravity from Claude Code?**
Install the `agy` CLI, sign in once, then install the plugin or run `node src/cli.mjs install` (see [Quick start](#quick-start)). Claude can then call `antigravity_task` or `antigravity_council`.
**Can Claude Code or Codex use Gemini 4 through Antigravity?**
Yes. Pass any model that `agy models` lists, for example `gemini-4-neon-high`, as `model`. `antigravity_models` shows the live list.
**Can I get several models to answer and compare them?**
Yes. `antigravity_council` runs Gemini and Claude (or any 2-5 models) on the same question, then a judge model reconciles their answers against the code.
**What happens when my Gemini (or Claude) quota runs out?**
With `model: "auto"`, new runs go to the pool with the most quota left. If a pool runs out mid-run, the task is re-run once on the other pool, and the result says so in `fallback_from`. With an explicit model, pass `fallback: true` for the same behaviour.
**Can several agents edit the same repo at once?**
Yes, with `isolation: "worktree"`: each run gets its own git worktree and `agy/<id>` branch. Commit or discard each one when you have reviewed it.
**Does it need an API key? What does it cost?**
No API key. It uses the account you signed in to with `agy`, and each run counts against that account's Antigravity quota. Gemini models and Claude/GPT models draw on separate pools.
**Can Antigravity break my repo?**
Not by default. The default access level is `read-only` (agy plan mode), agy only runs inside the allowed folders, and you can forbid `full` with `max_access`.
**What happens to a long job if Claude Code crashes?**
agy keeps running. The next session's server picks the job up, and `antigravity_job` returns the result.
**Does it work on Windows?**
Yes. Windows is the main target: no cmd.exe, a process-tree kill with `taskkill /T`, long prompts passed through a file, junctions resolved before the folder check, and tolerance for the UTF-8 BOM that PowerShell 5.1 adds.
**Is this the Gemini CLI?**
No. This wraps the Antigravity CLI (`agy`), not `gemini`. It can still register itself in Gemini CLI as an MCP server.
## Test
```bash
node test/smoke.mjs # 94 offline end-to-end tests against test/fake-agy.mjs (what CI runs)
node test/smoke.mjs --real # protocol and models against your real agy, spends no quota
node test/smoke.mjs --task claude-sonnet-5-5-low # adds real runs: edit, resume, MCP task, jobs
```
## Benchmarks
`node bench/bench.mjs` measures what the server itself adds, against the instant fake agy, so the numbers are reproducible and spend no quota. CI runs it on every push for each OS and Node version, and writes the table to the job summary. The raw numbers are uploaded as artifacts. Result on a Windows 11 laptop (Node 26, 20 CPUs):
| Measure | Result |
|---|---|
| Cold start (spawn → initialize) | 44 ms median, 61 ms p95 |
| Idle memory (RSS) | 51 MB |
| Tool surface sent to the model | 6 tools, ~1,500 tokens |
| Server overhead per call | 64 ms median, on top of agy's own runtime |
| Parallel reliability | 40/40 runs completed, 8 at once |
| Misroutes flagged | 10/10, with 0/10 false alarms |
| Quota exhaustion | 5/5 tasks completed on the other pool |
| Crash recovery | result recovered by the next server, about 0.6 s after the run ended |
To compare another MCP server on the same machine, `--server` measures its cold start, memory, tool surface and capabilities the same way:
```bash
node bench/bench.mjs --server "node /path/to/other-server/index.js" --json other.json
```
`--real <model>` adds real agy runs, timed direct and through the server (this spends quota).
## Wake-up hook without the plugin
The plugin installs this hook automatically. If you registered the server by hand, add it to `~/.claude/settings.json` so Claude is woken when a background run ends:
```json
{
"hooks": {
"PostToolUse": [
{
"matcher": "^mcp__antigravity__antigravity_(task|council)$",
"hooks": [
{
"type": "command",
"command": "node \"/absolute/path/to/antigravity-mcp/src/cli.mjs\" await-job",
"asyncRewake": true,
"timeout": 3600
}
]
}
]
}
}
```
## Similar projects
Other agy MCP servers, each with different trade-offs: [tphakala/agy-mcp](https://github.com/tphakala/agy-mcp) (Go, HTTP transport), [Daniiislo/antigravity-mcp-bridge](https://github.com/Daniiislo/antigravity-mcp-bridge) (persistent workers), [adeelali4/antigravity-mcp](https://github.com/adeelali4/antigravity-mcp) (shared task board for several agent CLIs), [Boulea7/agy-mcp](https://github.com/Boulea7/agy-mcp) (Python), [PyModel/antigravity-mcp](https://github.com/PyModel/antigravity-mcp) (TypeScript), [bangya96/agycli-mcp](https://github.com/bangya96/agycli-mcp), [x51xxx/antigravity-mcp-server](https://github.com/x51xxx/antigravity-mcp-server), [Sh3rm/agy-mcp](https://github.com/Sh3rm/agy-mcp).
## Credits
The stdio MCP layer is adapted from [claude-codex-mcp](https://github.com/aikazu/claude-codex-mcp) (MIT). Backend verification comes from [Sh3rm/agy-mcp](https://github.com/Sh3rm/agy-mcp), and quota-aware errors from [agent-intern](https://github.com/SinanTufekci/agent-intern).
This is an unofficial community project, not affiliated with Google or Anthropic. If it saves you time, a ⭐ helps other people find it.
## License
MIT
TDQS
Scored across 6 tools
Each tool targets a distinct action: delegating (task), polling/cancelling (job), listing (jobs), multi-model consensus (council), model/quota discovery (models), and a local UI (dashboard). The only real overlap is antigravity_job vs antigravity_jobs, which differ solely by plurality, though the descriptions make the single-versus-list distinction clear.
All six tools use the same antigravity_ prefix with snake_case noun-based names, so the convention is predictable throughout. Minor deviation: there is no verb_noun pattern, and job/jobs differ only by an 's', which is the one naming pair that could be misread.
Six tools is well within the ideal range and each one earns its place: the core delegation/council flow plus three supporting tools (job, jobs, models) and an optional dashboard. Nothing looks padded or redundant.
The lifecycle is largely covered: start a task or council, continue via conversation_id, poll/wait/cancel jobs, list jobs across sessions, discover models/quota, and open a dashboard. Minor gap: no way to prune or delete old job records or arbitrary stale conversations.