Skip to main content

antigravity-mcp-swarm

An MCP server that wraps Google's Antigravity CLI (agy) with true parallel execution, live task monitoring, git worktree isolation, and MCP Tasks support. Powered by stdlib-only mcp-swarm-core (zero third-party runtime dependencies).

Why?

Run multiple Antigravity (agy) agents concurrently from Claude Code or any MCP client without serial queueing, with live visibility into tool calls, cumulative token usage, structured output, tool errors / CLI warnings, and isolated HEAD-based git worktrees.

Key features:

  • True parallel fan-out -- each task runs as an independent agy --input-format stream-json --output-format stream-json subprocess
  • Worktree isolation -- worktree: true creates an isolated HEAD-based git worktree (antigravity-swarm/<id>) per task so parallel runs never edit past each other
  • Batch wait & MCP Tasks -- supports both explicit fan-out (antigravity_async + antigravity_wait) and the official MCP 2026-07-28 Tasks extension (io.modelcontextprotocol/tasks)
  • Live JSONL streaming status -- parses init, step_update, and result NDJSON events incrementally for live tool counts, last tool call, cumulative token usage, tool errors, and CLI warnings
  • Non-interactive agy flag support -- --model, --effort, --mode, --dangerously-skip-permissions, --sandbox, --agent, --add-dir, --json-schema, --settings, --disable-slash-commands, --print-timeout, --project, --remote-agent, and --conversation resume (interactive-only flags like --continue, --remote-control, --new-project, and --log-file are omitted)
  • Safe NDJSON stdin transport -- prompts are sent as pure-ASCII single-line NDJSON {"event":"user","message":{"content":...}} over stdin, avoiding OS argv length limits, leading-- option injection, and Windows shell quoting issues

MCP Protocol Support

  • Stateless MCP 2026-07-28 -- supports server/discover, per-request _meta["io.modelcontextprotocol/protocolVersion"] and _meta["io.modelcontextprotocol/clientCapabilities"], resultType discriminators, and unsupported-version rejection (-32022).
  • Official Tasks extension (io.modelcontextprotocol/tasks) -- when a client advertises io.modelcontextprotocol/tasks, antigravity and antigravity_reply immediately return a CreateTaskResult (resultType: "task") with a 128-bit taskId. Clients poll tasks/get and cancel via tasks/cancel per SEP-2663.
  • Backward-compatible stateful MCP (2024-11-05--2025-11-25) -- supports initialize negotiation, top-level server instructions, ping, tool annotations, outputSchema + structuredContent, accurate isError flags, enriched notifications/progress, and JSON-RPC 2.0 §4.1 silent handling of unknown notifications.

Tools

Tool Description
antigravity Synchronous execution (or native MCP Task when client supports io.modelcontextprotocol/tasks); returns text, conversation_id, token usage, optional structured_output, tool_errors, warnings, and structured failure details
antigravity_async Launch a task, get a task_id immediately (fan-out). Not fire-and-forget: results come back only via antigravity_wait. Pass conversation_id (UUID) to resume a conversation
antigravity_reply Continue a previous conversation via agy --conversation <uuid>. Automatically reuses the original conversation's working directory (including its worktree path) when cwd is omitted, and fails explicitly with conversation_not_found if agy cannot locate the requested conversation
antigravity_status Live read-only peek: tools called, last tool call, permission mode, tool errors, cumulative token usage, warnings, and failure cause
antigravity_wait Block until multiple tasks complete and return results or structured failure details
antigravity_cancel Kill a running async task and its child process tree (preserves worktree for inspection); if already completed or failed, preserves and reports that outcome

Installation

Claude Code

claude mcp add antigravity-swarm -- uvx --upgrade antigravity-mcp-swarm \
  --model gemini-4-neon-high

Note: Requires uv (curl -LsSf https://astral.sh/uv/install.sh | sh) and agy CLI installed and authenticated.

Manual (~/.claude.json)

{
  "mcpServers": {
    "antigravity-swarm": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "--upgrade",
        "antigravity-mcp-swarm",
        "--model", "gemini-4-neon-high"
      ]
    }
  }
}

Unattended permissions

If you want agy to auto-approve all tool permission prompts without confirmation in unattended runs, add --dangerously-skip-permissions to the server args (or pass dangerously_skip_permissions: true per call). Only enable this in trusted repositories or sandboxed environments (--sandbox), as it bypasses tool approval checks.

Usage

Parallel execution

1. Call antigravity_async(prompt="Audit module A", worktree=true)  -->  task_id: "a1b2c3d4"
2. Call antigravity_async(prompt="Audit module B", worktree=true)  -->  task_id: "e5f60718"
3. Call antigravity_wait(task_ids=["a1b2c3d4", "e5f60718"])
   --> blocks until all finish, returns all results

antigravity_async and antigravity_wait belong in the same turn: task_id is internal to this server and not tracked by legacy MCP clients. Short timeout values on antigravity_wait are raised to a floor (default 150s, configurable via ANTIGRAVITY_SWARM_MIN_WAIT) so long waits cross the client's 2-minute auto-backgrounding threshold; already-finished tasks return immediately.

Session continuity & worktree cwd preservation

  • antigravity_reply validates that conversation_id is a valid UUID (never a task_id). If agy cannot find the requested conversation and falls back to creating a new one, antigravity-mcp-swarm detects the mismatch and returns status: "failed" (category: "conversation_not_found", isError: true) instead of silently reporting success without prior context. Note that agy still ran the prompt in that fresh conversation before returning, so inspect the workspace if the prompt requested edits.
  • When cwd is omitted on antigravity_reply (or antigravity_async(conversation_id=...)), the server automatically reuses the original conversation's working directory (including its worktree path if it still exists; persisted on disk for async and worktree runs, and tracked in-process for non-worktree sync runs).
  • On resumed conversations, usage, num_turns, and duration_seconds returned by agy are cumulative across the entire conversation.

Structured output (json_schema)

Pass json_schema (JSON object or file path) to enforce structured output on the final result. When agy returns result.structured_output, it is exposed directly on structuredContent.structured_output.

Slash commands, tool errors, and diagnostics

  • Prompts starting with a built-in CLI slash command (such as /help) are rejected by agy under --input-format stream-json unless disable_slash_commands: true is set. Conversely, --mode plan relies on slash-command expansion and has no effect while disable_slash_commands: true is active.
  • Tool step errors (step_update with state: "ERROR") are surfaced in structuredContent.tool_errors and response notes without conflating OS errors with policy denials. CLI warning: lines written to stderr (such as unavailable modes) are surfaced in structuredContent.warnings.
  • When --print-timeout terminates an in-progress turn (finished_reason: "print_timeout", AGY_ERROR on stderr), the server classifies it cleanly as a print_timeout failure (preserving any partial output) rather than silently reporting an empty success.

Worktree isolation

Caveats:

  • Because worktrees branch from HEAD (git worktree add -b antigravity-swarm/<id> ... HEAD), uncommitted and untracked changes in your working tree are not included in the worktree. Commit prerequisite edits first if the task needs them.
  • Expired worktrees (older than ANTIGRAVITY_SWARM_TASK_MAX_AGE, default 24 hours) are lazily removed on a subsequent task launch via git worktree remove --force and git branch -D. Any uncommitted edits or unmerged commits remaining in an expired worktree are discarded -- merge or cherry-pick before expiry.

Server flags

Flag Description
--version Show version and exit
--model MODEL Default model (e.g. gemini-4-neon-high, gemini-3.8-flash-medium, claude-opus-5-5-high)
--effort LEVEL Default reasoning effort (low, medium, high, xhigh, max)
--mode MODE Default execution mode (accept-edits, auto, plan)
--dangerously-skip-permissions Auto-approve all tool permission requests by default
--sandbox Run in sandbox mode with terminal restrictions enabled by default
--agent NAME Default Antigravity agent name
--add-dir DIR Add workspace directory by default (repeatable)
--settings JSON_OR_PATH Default session-only settings JSON object or file path
--disable-slash-commands Disable slash command/skill expansion in print mode by default
--print-timeout DURATION Default print-mode time limit (e.g. 300s, 10m, 0s)
--project PROJECT Default project ID or name
--remote-agent Run conversations using remote agents by default

Boolean server flags can be explicitly overridden to false on any individual tool call.

MCP Resources

URI Description
antigravity-swarm:///server-info Version, capabilities, directories, CLI protocol contract
antigravity-swarm:///config Current server-level CLI defaults
antigravity-swarm:///tasks All known tasks and their state, usage, tool errors, and failure details

Environment variables

Variable Default Description
ANTIGRAVITY_SWARM_LOG <user-runtime>/antigravity-swarm/antigravity_mcp_swarm.log Log file path
ANTIGRAVITY_SWARM_LOG_LEVEL WARNING Log level (DEBUG, INFO, WARNING, ERROR)
ANTIGRAVITY_SWARM_TASK_DIR <user-runtime>/antigravity-swarm/tasks Task output storage directory (owner-only 0700 when using default)
ANTIGRAVITY_SWARM_WORKTREE_DIR <user-cache>/antigravity-swarm/worktrees Worktree storage directory (owner-only 0700 when using default)
ANTIGRAVITY_SWARM_TASK_MAX_AGE 86400 (24h) Seconds after completion / last reply activity before task artifacts and worktrees are cleaned up
ANTIGRAVITY_SWARM_MIN_WAIT 150 Floor in seconds for antigravity_wait
ANTIGRAVITY_SWARM_BIN (auto) Explicit path or command name for agy (auto-searches PATH and ~/.local/bin/agy)

<user-runtime> defaults to $XDG_RUNTIME_DIR when available, else /tmp/antigravity-swarm-<uid> on POSIX or %TEMP%\antigravity-swarm on Windows. <user-cache> defaults to ${XDG_CACHE_HOME:-~/.cache} on POSIX (so full worktree checkouts do not sit on a RAM-capped runtime tmpfs wiped at logout) or %TEMP% on Windows.

Requirements

  • Python 3.8+
  • Antigravity CLI (agy v1.5+) installed and authenticated
  • Only depends on stdlib-only mcp-swarm-core (no third-party packages)
  • Designed for Linux, macOS, and Windows (verified on Linux)

License

MIT

Metadata

Release files for antigravity-mcp-swarm 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for antigravity-mcp-swarm 0.1.0
File Size Uploaded Provenance Actions
antigravity_mcp_swarm-0.1.0.tar.gz 24.4 kB Without provenance Details for antigravity_mcp_swarm-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for antigravity-mcp-swarm 0.1.0
File Interpreter ABI Platform Actions
antigravity_mcp_swarm-0.1.0-py3-none-any.whl Python 3 none any Details for antigravity_mcp_swarm-0.1.0-py3-none-any.whl

Total release size: 49.4 kB

Release files / antigravity_mcp_swarm-0.1.0.tar.gz

Download URL antigravity_mcp_swarm-0.1.0.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
407f8b7d837d8e3ee28fe812619535eace5c10fc35f7f657a1f6fea0dfbc9c5f
BLAKE2b-256 checksum
How to use checksums
ccee6d8bbe31db9aa143aef2c1c03465b7a03cc9bccd6f599d1448a9082f27fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.11

Release files / antigravity_mcp_swarm-0.1.0-py3-none-any.whl

Download URL antigravity_mcp_swarm-0.1.0-py3-none-any.whl
Size 25.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f79d8e034c84aefe1dcb1fdb7ccb919976b6281033319aadef67827b16e0c45a
BLAKE2b-256 checksum
How to use checksums
2dd626f89f2f0d95b15d5450fc278aeb1b4b2ea60cb726da108c26771324bfa6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.11

Security for antigravity-mcp-swarm 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page