antigravity-mcp
Orchestrates Google Antigravity CLI (agy) coding agents, including agent lifecycle, sessions, model switching, MCP server mounts, and runtime management.
Antigravity Agent Hub (antigravity-mcp)
English | 简体中文
A persistent local Agent Hub, real-time Web Console, strictly project-isolated 4-tool stdio MCP bridge, shell CLI, and zero-dependency Python SDK for Google Antigravity CLI (agy).
Turn Google Antigravity CLI (agy) into a fleet of isolated, long-lived, multi-session coding agents that you can orchestrate from Claude Code, Claude Desktop, Cursor, Windsurf, Codex, Antigravity, your browser, or any Python application — with strict project boundaries, zero polling token waste, zero recursive MCP storms, and zero global config pollution.

One-Click AI Install Prompt (Claude Code / Cursor / Codex / Antigravity)
Copy and paste the prompt below directly into Claude Code (or any MCP-capable coding agent with shell access) inside the project where you want to install agy-hub:
Please install and configure Antigravity Agent Hub (https://github.com/jackche8/antigravity-mcp) as a strictly project-isolated MCP server for my current workspace:
1. Check prerequisites: verify `git`, `uv`, and `agy --version` are installed on PATH. If any is missing, tell me before proceeding.
2. Install the hub outside this repository at `~/.local/share/antigravity-mcp` (clone if absent, otherwise `git pull --ff-only`), then run `uv sync --python 3.12` inside `~/.local/share/antigravity-mcp`.
3. Check whether the local daemon is healthy at `http://127.0.0.1:4319/api/health`. If not running, start `~/.local/share/antigravity-mcp/.venv/bin/agy-agent daemon` detached in the background (logging to `~/.local/share/agy-hub/daemon.log`) and verify `agy-agent hub status` returns `status=ok`.
4. Register `agy-hub` as a PROJECT-SCOPED MCP server bound strictly to my current project directory (`$PWD`) so agents in this project are completely isolated from other projects:
- If you are Claude Code, run:
`claude mcp add --scope project agy-hub -- "$HOME/.local/share/antigravity-mcp/.venv/bin/agy-mcp" --cwd "$PWD" --hub-url http://127.0.0.1:4319`
- Otherwise, add `"agy-hub"` to this project's `.mcp.json` using `"command": "<HOME>/.local/share/antigravity-mcp/.venv/bin/agy-mcp"` and `"args": ["--cwd", "<CURRENT_PROJECT_ABS_PATH>", "--hub-url", "http://127.0.0.1:4319"]`.
- Do NOT commit personal absolute paths in `.mcp.json` if the repository is shared; add `.mcp.json` to `.git/info/exclude` if needed.
5. Verify the setup by calling `agent(op="list")` (after MCP reload if required) and confirm `project_cwd` matches my current project directory, then print the Web Console URL `http://127.0.0.1:4319/`.Quick Claude Code CLI Setup (1 Command)
Once cloned and synced to ~/.local/share/antigravity-mcp with the daemon running:
# Inside your target project directory — strictly scoped to this project only
claude mcp add --scope project agy-hub -- \
"$HOME/.local/share/antigravity-mcp/.venv/bin/agy-mcp" \
--cwd "$PWD" \
--hub-url http://127.0.0.1:4319Tip for multi-project Claude Code users: Always pass
--scope project+--cwd "$PWD"(or rely on MCProots/listwithout hardcoding another folder) so each repository gets its own isolated agent pool.
Related MCP server: agy-delegate
Strict Project Isolation
Multi-agent setups break fast when agents bleed across repositories, inherit your personal ~/.gemini/GEMINI.md, or spawn infinite recursive subagents. Antigravity Agent Hub enforces three hard isolation boundaries:
Isolation Layer | Enforcement Mechanism | What It Guarantees |
1. Strict Project | Every | Claude Code in Project A can only list, message, compact, cancel, or manage agents in Project A. Any cross-project |
2. Per-Agent | Each persistent agent runs inside its own isolated profile directory under | Global |
3. 3-Layer Hard Anti-Recursion |
| Subagents can never mount |
Why Antigravity Agent Hub?
Capability | What it gives you |
Zero-Dependency Python SDK ( | Pure Python |
Single-Source Local Daemon | FastAPI + SSE + SQLite WAL ( |
Compact 4-Tool MCP Bridge (27 Ops) | Exposes just 4 domain tools ( |
Async Dispatch + Shell |
|
Quota-Aware | A global switch ( |
5-File MCP Discovery & Live Hot-Reconnect | Auto-discovers MCP configs across 5 global/project files and supports per-agent or batch |
Real-Time Bilingual Web Console ( | Defaults to English with a 1-click |
Language support: Both the GitHub homepage (
README.md/README.zh-CN.md) and the local Web Console (http://127.0.0.1:4319/) support English (default) and Simplified Chinese via a 1-click toggle. The Python SDK, MCP tool schemas/instructions, CLI help, and REST API are English; the built-in/helppage and 3 starter presets currently remain in Chinese (contributions welcome!).
Architecture
flowchart LR
MCP["MCP Clients<br/>(Claude Code, Cursor, Codex, etc.)"] -->|stdio JSON-RPC · locked to project cwd| Bridge["agy-mcp / agy-agent mcp<br/>(4 Domain OP Tools)"]
CLI["Shell / Scripts"] --> CliBin["agy-agent CLI"]
Browser["Web Browser"] -->|REST + SSE| WebUI["Web Console<br/>(src/agy_hub/web/)"]
Bridge -->|HubClient HTTP| Daemon
CliBin -->|HubClient HTTP| Daemon
WebUI -->|REST + SSE| Daemon
subgraph Daemon["Persistent Local Daemon (FastAPI · 127.0.0.1:4319)"]
API["api/ (REST + SSE + /help)"] --> BIZ["biz/ (Agent, Session, MCP, Preset, Project, Runtime, Settings)"]
BIZ --> LOGIC["logic/ (SQLite WAL, EventBus, Uploads, Migrations)"]
end
Daemon --> SDK["libs/agy_sdk (Zero-Dep Pure Stdlib SDK)"]
SDK --> ACP1["Project A · Isolated agy acp<br/>(--gemini-dir profile_a)"]
SDK --> ACP2["Project B · Isolated agy acp<br/>(--gemini-dir profile_b)"]Manual Quick Start
Prerequisites
Python
>= 3.11(tested with Python 3.12 viauv)Google Antigravity CLI (
agy) installed and authenticated locally (agy --version)Node.js (only required for running the verification gate's JS syntax checks)
Install & Start the Daemon
# 1. Clone into a shared local directory (outside your individual project repos)
git clone https://github.com/jackche8/antigravity-mcp.git ~/.local/share/antigravity-mcp
cd ~/.local/share/antigravity-mcp
# 2. Install dependencies (automatically installs libs/agy_sdk in editable mode)
uv sync --python 3.12
# 3. Start the persistent local daemon (default: http://127.0.0.1:4319/)
uv run agy-agent daemon
# 4. In another terminal, verify daemon health or open http://127.0.0.1:4319/
uv run agy-agent hub statusOn Linux desktops, you can also start the daemon in the background and open the console in one command:
./scripts/desktop_launch.shMCP Client Configuration Examples
Project-Scoped .mcp.json (Claude Code / Cursor / Windsurf / Antigravity)
Place this in your project root (keeps every project isolated to its own --cwd):
{
"mcpServers": {
"agy-hub": {
"command": "/path/to/antigravity-mcp/.venv/bin/agy-mcp",
"args": [
"--cwd",
"/path/to/your/project",
"--hub-url",
"http://127.0.0.1:4319"
]
}
}
}Dynamic roots/list Config via uv (Auto-Binds to Client's Active Project)
For MCP clients that send MCP roots/list (such as Claude Code, Cursor, or Antigravity):
{
"mcpServers": {
"agy-hub": {
"command": "uv",
"args": [
"--directory",
"/path/to/antigravity-mcp",
"run",
"agy-agent",
"mcp"
]
}
}
}If the daemon is not running, the MCP bridge fails explicitly with
HUB_UNREACHABLEinstead of silently spawning competing background processes.
4 Domain OP MCP Tools (27 Operations)
Instead of flooding your LLM context with 20+ separate tool schemas, agy-mcp exposes 4 domain tools using a uniform tool(op="<action>", params={...}) contract. Every tool supports op="help" (with optional params={"op": "<action>"}) for exact parameter schemas and examples.
Recommended Zero-Guess AI Workflow
Discover once: Call
agent(op="list")to inspect active agents in the current project, defaults, compact presets, and mountableavailable_mcpsin a single round trip.Reuse or create: Send to an existing idle agent with
agent(op="send"), or spawn a specialized worker withagent(op="create", params={...}).Wait without burning tokens:
agent(op="send")returns immediately withturn_idandwait_command. Runagy-agent wait <agent_id> --turn <turn_id>in shell instead of pollingagent(op="messages").Compact or hot-reload MCPs: Use
session(op="compact")on long threads andmcp(op="start|stop|reconnect")to reload MCP servers on the fly while preserving conversation history.
Tool & Operation Matrix
Tool | Operations | Purpose |
|
| Full lifecycle and messaging for persistent project-scoped agents (async dispatch with |
|
| Manage multiple Hub-scoped conversation sessions per agent and run in-place context compaction checkpoints. |
|
| Inspect the 5-file MCP catalog, check live per-agent/project MCP status, toggle mounted MCPs without losing config, or hot-reconnect with immediate |
|
| Read the full usage guide, check live 5h/Weekly Antigravity quota, list available models, and list/create reusable role presets. |
Standalone Python SDK (libs/agy_sdk)
libs/agy_sdk is a zero-dependency Python >=3.11 package (dependencies = []) — no FastAPI, Pydantic, HTTPX, or MCP dependencies required. Install it directly or vendor libs/agy_sdk/src/agy_sdk into any Python project:
pip install -e ./libs/agy_sdkimport asyncio
from agy_sdk import (
AgyAgent,
AgyAgentConfig,
CallbackManager,
ModelCatalog,
TurnResult,
UsageClient,
)
callbacks = CallbackManager()
callbacks.subscribe("on_text_delta", lambda p: print(p["delta"], end="", flush=True))
class MyStateOwner:
def on_turn_finished(self, *, agent_id: str, result: TurnResult) -> None:
print(f"\n[{agent_id}] {result.status} in {result.duration_ms}ms")
async def run_async() -> None:
cfg = AgyAgentConfig(
cwd="/path/to/workspace",
model="gemini-4-neon-xhigh",
system_prompt="You are a concise engineering assistant.",
inherit_mcp=False,
)
async with AgyAgent(cfg, callbacks=callbacks, state_owner=MyStateOwner()) as agent:
result = await agent.send("Summarize README.md in 3 bullets.")
print(result.text, result.usage)
# Synchronous API backed by a lazy persistent background event loop
def run_sync() -> None:
with AgyAgent(AgyAgentConfig(cwd="/path/to/workspace")) as agent:
r1 = agent.send_sync("Remember token: ALPHA_42")
r2 = agent.send_sync("Repeat the token.")
assert r1.session_id == r2.session_id
print(r2.text)
# Zero-quota metadata probes
models, _err = ModelCatalog().get_models()
usage = UsageClient().get_usage()
print([m.id for m in models], [(b.group, b.window_5h) for b in usage.buckets])
asyncio.run(run_async())See libs/agy_sdk/README.md for the complete SDK reference (isolated profiles, SystemPromptMode, 5-file MCP discovery, AgyRuntimeClient, callbacks, and error hierarchy).
agy-agent CLI Reference
All client subcommands support --json and --hub-url <url> (or AGY_HUB_URL):
# Daemon, health check, and stdio MCP bridge
uv run agy-agent daemon [--host 127.0.0.1] [--port 4319] [--data-dir PATH] [--auto-update]
uv run agy-agent hub status [--json]
uv run agy-agent mcp [--cwd PATH] [--hub-url URL]
# Agents: list, send, and zero-token blocking wait
uv run agy-agent list [--cwd PATH] [--origin mcp|human|cli] [--status STATUS] [--json]
uv run agy-agent send <agent_id> "<prompt>" [--no-interrupt] [--wait] [--timeout 120] [--json]
uv run agy-agent wait <agent_id> [--turn <turn_id>] [--timeout 300] [--json]
# wait exit codes: 0=completed 2=cancelled 1=error/unreachable 124=timeout (turn keeps running)
# Quota & available models (zero model quota cost)
uv run agy-agent usage [--refresh] [--json]
uv run agy-agent models [--refresh] [--json]
# Workspace projects
uv run agy-agent projects list [--json]
uv run agy-agent projects add <cwd> [--name NAME] [--json]
uv run agy-agent projects rename <project_id> <name> [--json]
uv run agy-agent projects delete <project_id> [--json]
# Multi-session management & in-place context compaction
uv run agy-agent sessions list <agent_id> [-q KEYWORD] [--json]
uv run agy-agent sessions new <agent_id> [--title TITLE] [--json]
uv run agy-agent sessions switch <agent_id> <session_id> [--json]
uv run agy-agent sessions compact <agent_id> [--focus TEXT] [--wait] [--timeout 120] [--json]
uv run agy-agent sessions delete <agent_id> <session_id> [--json]
# Agent-mounted MCP lifecycle & batch hot-reconnect
uv run agy-agent mcps catalog [--cwd PATH] [--json]
uv run agy-agent mcps status [--agent ID | --project-id ID | --cwd PATH] [--name NAME] [--json]
uv run agy-agent mcps start <agent_id> <name> [--interrupt] [--json]
uv run agy-agent mcps stop <agent_id> <name> [--interrupt] [--json]
uv run agy-agent mcps reconnect [--agent ID] [--name NAME] [--interrupt] [--only-running] [--json]
# Antigravity CLI (agy) version & outdated ACP process management
uv run agy-agent runtime status [--json]
uv run agy-agent runtime update [--json]
uv run agy-agent runtime recycle [--all-idle | --interrupt-running] [--agent ID ...] [--json]Environment Variables
Only top-level entrypoints read environment variables (agy_sdk and agy_hub/logic never read os.environ implicitly):
Variable | Default | Description |
|
| Daemon bind host |
|
| Daemon bind port |
|
| SQLite WAL database, isolated profiles, and temporary upload directory |
|
| Target daemon URL for CLI and MCP bridge |
|
| Global Gemini/Antigravity config root (used for auth sharing & catalog discovery) |
|
| Path or executable name for the Google Antigravity CLI |
|
| Check/run |
|
| Timeout (seconds) for |
Key Engineering Details
Global
system_prompt_mode(appendvsreplace): Controlled viaGET/PUT /api/settingsor the Web Console sidebar switch and applied to newly created sessions (existing sessions keep their creation mode). Defaultappendruns viaagy's default agent at standard quota rate and layerssystem_prompton top of the native prompt;replacelaunches--agent <id>to replace the native prompt completely while preserving built-in tools (both enforce a 24 KB limit, failing with400 SYSTEM_PROMPT_TOO_LARGE).5-File MCP Auto-Discovery: Discovers MCP definitions in deterministic precedence across
<cwd>/.agents/mcp_config.json/.agent/mcp_config.json,<cwd>/.gemini/settings.json,<cwd>/.mcp.json,~/.gemini/config/mcp_config.json, and~/.gemini/settings.json, plus standard{"mcpServers": {...}}JSON imports.Web Console Slash Commands: Type
/in the console composer for keyboard-navigable/new [title],/compact [focus],/model [keyword],/history,/usage, and/help(strict first-token matching guarantees pasted file paths like/home/user/notes.txtnever trigger slash commands).Single-Source Help Endpoint: Open
http://127.0.0.1:4319/help(HTML),http://127.0.0.1:4319/help?format=md(raw Markdown), orGET /api/help(JSON) — all served from the same guide as MCPhub(op="guide").
Project Layout & Verification Gate
libs/agy_sdk/ # Zero-dependency pure-stdlib Python SDK
src/agy_hub/
├── logic/ # Pure logic: Pydantic models, SQLite WAL, migrations, EventBus, HubClient, MCP ops
├── biz/ # Business services: Agent, Session, Compact, MCP, Preset, Project, Runtime, Settings
├── api/ # FastAPI REST + SSE + /help routers
├── mcp_bridge/ # Project-scoped 4-tool stdio MCP server (talks only via HubClient)
├── cli.py # agy-agent CLI entrypoint (talks only via HubClient)
└── web/ # Real-time Web Console (pure UI components <- biz REST/SSE/Store wiring)
tests/ # SDK unit, AST architecture guards, logic, biz, API/SSE, MCP/CLI & Playwright E2E
scripts/gate.py # Unified single-entry verification gateRun the full offline verification gate (Ruff, mypy --strict, node --check, AST architectural guards, SDK/backend/API/MCP/CLI tests, and Playwright browser E2E):
uv run python scripts/gate.pyOptionally include live smoke tests against your local agy binary:
uv run python scripts/gate.py --live-agyContributing & License
Contributions, bug reports, and localization pull requests (additional languages or /help i18n) are welcome! See CONTRIBUTING.md for architecture rules and development setup.
Licensed under the MIT License.
Available Tools
4 toolsagentA
Manage persistent project-scoped Agents: inspect project overview, create/update configs, dispatch async prompts, inspect turns, and control Agent lifecycle. Call with op=, params={...} (use op='help' for full schema):
list(status?, created_by?, include_closed?): Return compact live snapshot of current project's active agents, defaults, presets, and selectable available_mcps.
create(name?, preset_id?, model?, system_prompt?, inherit_mcp?, catalog_refs?, mcp_servers?, mcp_server_names?): Create a persistent Agent strictly bound to the current project cwd.
update(agent_id, name?, model?, system_prompt?, inherit_mcp?, catalog_refs?, mcp_servers?, mcp_server_names?): Update an idle project Agent's model, prompt, or MCP config.
send(agent_id, prompt, interrupt?, wait?, timeout_sec?): Dispatch a prompt asynchronously (default interrupt=true, wait=false) and return turn_id + wait_command.
messages(agent_id, session_id?, turn_id?, limit?, include_trace?): Read turn history and optional trace records for a project Agent.
cancel(agent_id, reason?): Cancel a project Agent's currently running turn.
close(agent_id): Close a project Agent (stops agy process & profile, preserves history).
reopen(agent_id): Reopen a closed project Agent (rebuilds isolated profile & marks idle).
delete(agent_id): Permanently delete a project Agent, its isolated profile, and history.
help(op?): Return single-source parameter specs and examples for
agentops.
Inputs: op (required), params. Returns: object
hubA
Query Hub guide, real-time Antigravity quota usage, available models, and reusable Agent role presets. Call with op=, params={...} (use op='help' for full schema):
guide: Return the full AI & human usage guide Markdown and tool_count.
usage(refresh?): Query real-time Antigravity quota usage (5h & Weekly remaining %).
models(refresh?): List available Antigravity models and the configured default model.
preset_list(created_by?, include_prompt?): List reusable Agent role presets (compact summaries by default).
preset_create(name, description?, model?, system_prompt?, inherit_mcp?, catalog_refs?, mcp_servers?, mcp_server_names?): Create a reusable Agent role preset in the current project.
help(op?): Return single-source parameter specs and examples for
hubops.
Inputs: op (required), params. Returns: object
mcpA
Inspect and control external MCP servers mounted on current-project Agents: 5-file catalog discovery, per-MCP start/stop (config preserved), single-Agent or batch reconnect with immediate agy acp prewarm. Call with op=, params={...} (use op='help' for full schema):
catalog: Discover read-only MCP servers across 5 config files for the current project (marking self-referencing servers with blocked_reason).
status(agent_id?, name?): Inspect mounted MCP status: pass agent_id (optional name) for one Agent, or omit agent_id (optional name) for current-project runtime groups.
start(agent_id, name, interrupt?): Start a stopped mounted MCP on an Agent, rebuild profile from latest disk config, and immediately prewarm fresh agy acp.
stop(agent_id, name, interrupt?): Stop a mounted MCP on an Agent (preserving config), write disabled shadow, and immediately prewarm fresh agy acp.
reconnect(agent_id?, name?, interrupt?): Reconnect MCPs with latest disk config & immediate agy acp prewarm: (agent_id, name?) for one Agent, or (name) to batch-reconnect current project.
help(op?): Return single-source parameter specs and examples for
mcpops.
Inputs: op (required), params. Returns: object
sessionA
Manage multi-session conversation history and in-place context compaction for Agents in the current project. Call with op=, params={...} (use op='help' for full schema):
list(agent_id, q?): List an Agent's Hub-scoped conversation sessions (optional keyword q).
create(agent_id, title?): Create and activate a new blank conversation session for an idle Agent.
switch(agent_id, session_id): Switch an idle Agent's active conversation session.
compact(agent_id, focus?, wait?, timeout_sec?): Compact an idle Agent's active session context in-place into a durable checkpoint summary.
help(op?): Return single-source parameter specs and examples for
sessionops.
Inputs: op (required), params. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
The four top-level tools cover distinct domains: sessions, agents, MCP servers, and hub metadata/presets. Some overlap remains between session management and agent turn history (agent.messages accepts session_id), and MCP config appears both in agent updates and mcp operations, but the boundaries are mostly clear.
All four tool names are lowercase single-noun domain labels (session, agent, mcp, hub), giving a highly predictable top-level naming pattern. The sub-operations also mostly follow lowercase snake_case, with only minor noun/verb variation inside each dispatcher.
Four tools is a sensible top-level grouping for a meta-server, but each tool multiplexes 6-10 operations, so the effective surface is around 28 actions. This is appropriate but quite heavily bundled, making individual operations less discoverable than separate tools would be.
The set covers the core lifecycle well: session list/create/switch/compact, agent create/update/send/cancel/close/reopen/delete, MCP catalog/status/start/stop/reconnect, and hub guide/usage/models/presets. Minor gaps remain, such as session rename/delete and preset update/delete/get beyond preset_list and preset_create.
Maintenance
Related MCP Connectors
Private-by-default, local-first memory/context/task orchestrator for MCP apps and agents.
Agent-native notes, tasks, dev-docs, vaults, sync & handoffs. MCP + OpenAPI dual surface.
- aXDeprecatedio.github.ax-platform
Agent-native collaboration network: orchestrate a team of long-running agents from any MCP client.
Project management shared by people and AI agents, with persistent project state through MCP.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables a fleet of AI agents to connect over MCP to a local-first hub, where they can read time-ordered project feeds, keep session-scoped memory that survives compaction and resume, exchange artifacts, and send finished work or approval requests to a human inbox.MIT
- AlicenseNot gradedqualityCmaintenanceA local MCP server that lets an agent hand real coding tasks to the signed-in Google Antigravity CLI, with background runs, follow-ups, live status, cancellation, independently collected change evidence, execution traces, model listing, login, and quota-based account rotation. It requires no API key, relying instead on the existing Antigravity login and optionally exposing agy models through a bundled local model gateway.MIT
- AlicenseNot gradedqualityCmaintenanceEnables coordinating local coding agents across Antigravity, DeepSeek Harness, Claude Code, and OpenCode with persistent tasks, live public events, file-change artifacts, session follow-ups, process-tree cancellation, and configurable execution permissions.MIT
- AlicenseNot gradedqualityBmaintenanceEnables desktop AI sessions from Claude, Codex, Antigravity, and Grok Bot to join a shared local project hub, exchange direct and task-based messages, coordinate goals and task boards, share SHA-256 verified file artifacts, and receive peer messages through native client hooks. It also provides MCP stdio/HTTP gateways and a bilingual operator console for managing multi-agent conversations and access.1MIT