Skip to main content
Glama
README.md
# agy-mcp

MCP server that lets Claude Code hand coding tasks to the Antigravity CLI (`agy`), then review what it did before anything lands. Each task runs in its own git worktree, inside a bubblewrap sandbox, without the permission bypass ("turbo mode").

```
Claude Code ──agy_task──▶ agy-mcp ──▶ git worktree add -b agy/<id>
                                 └──▶ bwrap … agy -p … --mode accept-edits   (no --dangerously-skip-permissions)
            ◀── response, denied actions, diff ──┘
Claude reviews the diff, runs the checks, asks for fixes (agy_follow_up), commits and merges agy/<id>, then agy_cleanup.
```

agy-mcp is an independent project. It is not affiliated with or endorsed by Google, and Antigravity is a Google product. It runs only on Linux.

## Tools

| Tool | What it does |
| --- | --- |
| `agy_task` | Creates a worktree on `agy/<task_id>` from `base` (default `HEAD`), runs agy there and returns its response, `denied_actions`, usage and the diff against the base. |
| `agy_follow_up` | Continues the same agy conversation in the same worktree and returns the cumulative diff. |
| `agy_cleanup` | Removes the worktree, the task's agy home and the task record. Keeps the branch unless `delete_branch` is true. |

`agy_task` and `agy_follow_up` accept an optional `model` (any id from `agy models`) and `effort` (`low`, `medium`, `high`, `xhigh`, `max`).

## What agy can and cannot do

agy runs with `--mode accept-edits` and **without** `--dangerously-skip-permissions`. In headless mode agy cannot ask for approval, so it denies anything that needs it:

- **Allowed:** reading and editing files inside the task worktree.
- **Denied by agy:** terminal commands (tests, builds, installs, git) and writes outside the workspace. They are reported as `denied_actions`. A denial ends agy's turn, often with an empty response, so the server always returns the diff.
- **Not committed:** agy never commits. The reviewer commits after checking the diff.

The bubblewrap sandbox is a second layer that holds even if agy's own permission check fails:

| Path | Inside the sandbox |
| --- | --- |
| `/usr`, `/etc`, root symlinks | read-only |
| `/proc`, `/dev`, `/tmp`, `/run` | a new `/proc` for the sandbox's own processes, a minimal `/dev`, empty tmpfs for `/tmp` and `/run`; `/run/systemd/resolve` is mounted read-only when present so DNS works |
| `$HOME` | empty tmpfs, nothing from your home is visible except the entries below |
| task worktree | read-write, except its `.git` file (read-only, so agy cannot repoint git at a config it controls) |
| `~/.gemini` | a fresh directory per task (`$AGY_MCP_STATE_DIR/homes/<task_id>/gemini`), read-write for agy's conversations and logs; deleted by `agy_cleanup` |
| `~/.gemini/config/{config.json,mcp_config.json,hooks.json,plugins,sidecars}` and `~/.gemini/antigravity-cli/settings.json` | read-only seeds kept outside that directory, so no run can enable auto-approval, hooks, plugins or MCP servers for a later run. The seeded `config.json` is the one agy writes on a fresh install, which enables its built-in `swarm` plugin |
| agy binary | read-only (agy's self-update cannot replace it from inside) |
| your real `~/.gemini` (Antigravity IDE and CLI state, `mcp_config.json`, hooks, skills), main repository, `~/.ssh`, other tasks, everything else | not mounted |
| session D-Bus | only through `xdg-dbus-proxy --filter --talk=org.freedesktop.secrets` |
| network | shared with the host |

agy reads its sign-in from the Secret Service keyring, which is why the filtered D-Bus proxy exists. If `bwrap` or the proxy cannot start, the call fails; there is no unsandboxed fallback.

### Remaining risks

- **Network is shared.** agy can reach the internet, services listening on `localhost`, and the host's abstract unix sockets (for example X11 or remote-desktop agents). With commands denied it has no tool to use them beyond its own API calls.
- **Keyring.** The proxy lets the agy process call any Secret Service method, so it can read, create, change and delete secrets in every unlocked keyring collection. That is the agy binary itself, not something the model can drive while commands are denied.
- **xdg-dbus-proxy version.** The D-Bus filter is only as strong as the proxy. Before 0.1.9, upstream lists filter bypasses (CVE-2026-93676 in 0.1.8, CVE-2026-94422 in 0.1.9) that would let code running inside the sandbox reach services other than `org.freedesktop.secrets`. agy's terminal commands are denied, so this needs another way to run code inside the sandbox first, but keep the proxy patched. agy-mcp still runs with an older proxy, and every result starts with a warning naming its version; set `AGY_MCP_DBUS_PROXY_PATCHED=1` if your distribution backported both fixes without raising the version.
- **Session bus address.** Because the network namespace is shared, a session bus on an abstract socket (`unix:abstract=…`) or on TCP would be reachable without the proxy, so agy-mcp only runs when every entry of the address is `unix:path=…`, the usual systemd setup.
- **Other agy files.** Files agy may read as global instructions, such as `~/.gemini/GEMINI.md` or skills and workflows under `~/.gemini/config`, stay writable inside a task and persist into its follow-ups. Writing them needs code execution inside the sandbox, and they never leave the task's own home.
- **Code in the worktree is untrusted.** Read the diff before running tests or builds from the worktree: they run with your permissions, outside the sandbox. Embedded git repositories that agy creates are excluded from the diff and listed separately; git is never run inside them.
- **Per-task agy state.** A task's conversations stay writable for its follow-ups and are removed with `agy_cleanup`. Your interactive agy and the Antigravity IDE never see them.

## Requirements

- Linux with unprivileged user namespaces for `bwrap` (`/usr/bin/bwrap`). On Ubuntu 23.10 and later, AppArmor blocks them unless an AppArmor profile allows `bwrap` (recent Ubuntu releases ship `bwrap-userns-restrict`) or `kernel.apparmor_restrict_unprivileged_userns` is set to 0.
- `xdg-dbus-proxy` (`/usr/bin/xdg-dbus-proxy`) and a session D-Bus on a `unix:path` socket with the Secret Service keyring. Use xdg-dbus-proxy 0.1.9 or a distribution build that includes the fixes for CVE-2026-93676 and CVE-2026-94422 (see "Remaining risks")
- `agy` installed and signed in (run `agy` once interactively)
- git 2.40 or newer, Node.js 22.13 or newer, pnpm

## Install

```bash
git clone https://github.com/jestays/agy-mcp.git
```

```bash
cd agy-mcp
```

```bash
pnpm install
```

```bash
pnpm build
```

Register it in Claude Code for your user. `AGY_MCP_ALLOWED_ROOTS` is required; tasks are refused for repositories outside it.

```bash
claude mcp add agy -s user -e AGY_MCP_ALLOWED_ROOTS=/home/you/workspace:/home/you/personal -- node /path/to/agy-mcp/dist/index.js
```

Long tasks can take several minutes. If your MCP client cuts tool calls short, raise its tool timeout (for Claude Code, the `MCP_TOOL_TIMEOUT` environment variable, in milliseconds).

## Configuration

| Variable | Default | Meaning |
| --- | --- | --- |
| `AGY_MCP_ALLOWED_ROOTS` | none (required) | Directories, separated by `:` or `,`, that may contain the repositories you delegate. |
| `AGY_MCP_AGY_PATH` | `~/.local/bin/agy` | agy binary (symlinks are resolved). |
| `AGY_MCP_STATE_DIR` | `$XDG_STATE_HOME/agy-mcp` or `~/.local/state/agy-mcp` | Worktrees, per-task agy homes and task records. |
| `AGY_MCP_TIMEOUT_SEC` | `1800` | agy `--print-timeout` per run. |
| `AGY_MCP_MAX_DIFF_CHARS` | `60000` | Diff size returned before it is truncated. |
| `AGY_MCP_MODEL` | agy default | Default model for new tasks. |
| `AGY_MCP_EFFORT` | agy default | Default effort. |
| `AGY_MCP_BWRAP_PATH` | `/usr/bin/bwrap` | bubblewrap binary. |
| `AGY_MCP_DBUS_PROXY_PATH` | `/usr/bin/xdg-dbus-proxy` | D-Bus proxy binary. |
| `AGY_MCP_DBUS_PROXY_PATCHED` | `0` | Set to `1` to silence the warning for an xdg-dbus-proxy older than 0.1.9 that your distribution patched for CVE-2026-93676 and CVE-2026-94422. |
| `DBUS_SESSION_BUS_ADDRESS` | `/run/user/<uid>/bus` if it exists | Session bus the proxy connects to. |

## Review workflow

1. `agy_task` with a self-contained brief: goal, files, constraints, acceptance criteria.
2. Read the returned diff. If agy stopped early (empty response, `denied_actions`), say what to do next with `agy_follow_up`.
3. Run the checks yourself in the worktree once the diff looks safe.
4. `agy_follow_up` with failing output or review findings until it is right.
5. Commit in the worktree, merge or cherry-pick `agy/<task_id>` into your branch, then `agy_cleanup`.

## Development

```bash
pnpm test
```

```bash
pnpm typecheck
```

`pnpm test` runs unit and integration tests, including real `bwrap` and `xdg-dbus-proxy` runs with a fake agy. Those sandbox tests are skipped on machines without `bwrap`, `xdg-dbus-proxy` or a `unix:path` session bus; set `AGY_MCP_REQUIRE_SANDBOX=1` to make that a failure instead, as CI does. `pnpm test:live` builds the server and runs one end-to-end task with the real agy through MCP over stdio. It uses your Antigravity quota (`AGY_MCP_LIVE_MODEL`, default `gemini-4-hydrogen-low`).

## Security

agy-mcp is a sandbox, so escapes and ways to run code outside it are security bugs. Please report them privately as described in [SECURITY.md](SECURITY.md), not in public issues.

## License

[ISC](LICENSE)

TDQS

A4.1/5.0

Scored across 3 tools

Disambiguation5/5

Each tool maps to a distinct phase of the task lifecycle: agy_task starts a task, agy_follow_up continues an existing one, and agy_cleanup tears it down. The descriptions make the boundaries explicit (new worktree vs. same worktree/conversation vs. removal), so misselection is unlikely.

Naming Consistency5/5

All three tools use the same agy_ prefix with snake_case verb/noun semantics (agy_task, agy_follow_up, agy_cleanup). The convention is uniform and predictable for a small surface.

Tool Count4/5

Three tools cover the create/continue/destroy lifecycle with no redundancy, which fits a focused delegation server. It sits at the low end of the scale and feels slightly minimal, but no tool is superfluous.

Completeness4/5

The core workflow (delegate, iterate, clean up) is fully covered, and the description explains the manual review/commit step. The main gap is the absence of a list/status tool to rediscover existing tasks and their worktrees after a context loss.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues