Skip to main content
Glama
Antigravity Sub-Agent MCP Server

Antigravity Sub-Agent MCP Server

by khanhbkqt

Antigravity Sub-Agent MCP Server

License: MIT Node.js MCP

An MCP server that lets a main AI agent spawn sub-agents on Antigravity IDE. Delegates tasks with full lifecycle management: creating cascades, auto-accepting tool actions, and extracting results.

Runs via stdio transport — configure as a command in mcp_config.json, no manual server start needed.


Table of Contents

Related MCP server: Antigravity Execution Fabric

How It Works

Main Agent (Claude/Gemini/etc)
  ↓ MCP tool call
  ↓
index.js (stdio MCP server)
  ↓ autoDetect(workspace) → finds correct LS instance
  ↓ startCascade() → sendMessage(SYSTEM_PROMPT + task)
  ↓
completion-loop.js (polls until done)
  ├─ RUNNING → keep polling (auto-accept if steps stall)
  ├─ WAITING_FOR_USER → auto-accept.js handles it
  ├─ IDLE → treat as completed
  ├─ Question detected → auto-reply "proceed" (max 3)
  └─ COMPLETED → extract final text
  ↓
Returns result to Main Agent

Project Structure

antigravity-sub-agent-mcp/
├── package.json
├── index.js                  # stdio MCP server (2 tools)
├── lib/
│   ├── ls-detector.js        # LS auto-detection (PPID + process scan + workspace matching)
│   ├── cascade-client.js     # HTTP client for LS API (JSON + binary + streaming)
│   ├── completion-loop.js    # Smart polling with auto-accept integration
│   ├── auto-accept.js        # Interaction payload builder for WAITING steps
│   └── protobuf.js           # Binary protobuf encoder/decoder
├── docs/                     # Internal architecture documentation
├── LICENSE                   # MIT License
├── CONTRIBUTING.md           # Contribution guide
├── CODE_OF_CONDUCT.md        # Contributor Covenant
└── CHANGELOG.md              # Release history

Setup

Prerequisites

  • Node.js 18+

  • Antigravity IDE running with at least one workspace open

Install

cd antigravity-sub-agent-mcp
npm install

Configure Antigravity

Add to your mcp_config.json:

{
  "mcpServers": {
    "antigravity-sub-agent": {
      "command": "node",
      "args": ["/absolute/path/to/antigravity-sub-agent-mcp/index.js"]
    }
  }
}

Environment Variables

Variable

Default

Description

ANTIGRAVITY_PORT

auto-detect

Language Server port

ANTIGRAVITY_CSRF

auto-detect

CSRF token

ANTIGRAVITY_TLS

true

Use TLS

When not set, the server auto-detects the correct LS instance (see Workspace Detection below).

MCP Tools

submit_agent — Non-blocking

Submit a task and get a taskId back immediately (~1s). The sub-agent runs in the background.

Same params as start_agent. Returns taskId for use with get_agent_results.


get_agent_results — Batch Wait

Wait for multiple submitted tasks and return all results at once.

Param

Type

Required

Description

taskIds

string[]

✅

Array of taskIds from submit_agent calls

Parallel workflow:

submit_agent(task1) → taskId: "abc"     ← instant
submit_agent(task2) → taskId: "def"     ← instant
submit_agent(task3) → taskId: "ghi"     ← instant
get_agent_results(["abc", "def", "ghi"]) → all 3 results (ran in parallel!)

Model Aliases

Alias

Model

gemini-high (default)

Gemini 3.1 Pro (High)

gemini-low

Gemini 3.1 Pro (Low)

gemini-flash

Gemini 3 Flash

claude-sonnet

Claude Sonnet 4.6 (Thinking)

claude-opus

Claude Opus 4.6 (Thinking)

gpt-120b

GPT-OSS 120B (Medium)

Raw MODEL_* IDs also accepted.

Key Features

Workspace Detection

Auto-finds the correct LS instance:

  1. PPID detection (primary): Parent process IS the LS — reads --csrf_token and --workspace_id from its command line

  2. Workspace path matching (fallback): Matches workspace param against running LS instances

  3. First valid instance (last resort): Uses whatever is available

Auto-Accept

Handles all WAITING steps automatically:

  • Commands: Approves with the exact proposed command line

  • File writes: Grants file permission with the target path

  • File reads: Always allows (read-only)

  • Browser actions: Approves browser automation

  • Terminal input: Confirms with proposed input

Stalled-Running Detection

LS sometimes reports RUNNING status even when steps are waiting for user accept. The server detects stalled polls (steps not increasing) and proactively checks for WAITING steps to auto-accept.

Binary Protobuf Fallback

When LS JSON API returns capped results, falls back to binary protobuf which correctly respects pagination.

Debugging

All logs go to stderr:

[ls-detector] ✓ Parent LS API on port 53525 (TLS: false)
[sub-agent:abc12345] RUNNING steps=5 replies=0 elapsed=12s
[auto-accept]   → Built interaction: {"runCommand":{"commandLine":"npm test"}}
[auto-accept]   → handleInteraction result: ok=true

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

This project follows the Contributor Covenant Code of Conduct.

Acknowledgments

This project was built on top of and heavily inspired by Antigravity Deck — the original toolkit for automating Antigravity IDE workflows.

Key components ported and simplified from Antigravity Deck:

  • Cascade Client (lib/cascade-client.js) — HTTP client for Language Server API

  • Auto-Accept (lib/auto-accept.js) — interaction payload builder for WAITING steps

  • LS Detector (lib/ls-detector.js) — Language Server process auto-detection

  • Protobuf (lib/protobuf.js) — binary protobuf encoder/decoder

Special thanks to the Antigravity IDE team for building the platform that makes this kind of agent orchestration possible.

License

This project is licensed under the MIT License.

Available Tools

2 tools
get_agent_resultsA

Collect results from submit_agent calls. Blocks until ALL tasks finish, then returns all results together.

Call this AFTER submitting all tasks via submit_agent. Pass the taskIds you received. Note: Sometimes agents may not finish within the timeout period. In such cases, the result will be returned as is, and you may need to manually check the status of the task in the Antigravity IDE.

Inputs: taskIds (required).

submit_agentA

Spawn an autonomous agent in Antigravity IDE. Returns a taskId INSTANTLY (does NOT wait for completion).

The agent runs as a new Cascade conversation with full codebase access — it can read files, grep, run terminal commands, and edit files. It operates fully autonomously without asking questions. Each agent consumes significant resources (new conversation + model tokens), so only delegate tasks that provide real value.

ALWAYS use this 2-step pattern: Step 1: Call submit_agent N times (each returns a taskId in ~1 second) Step 2: Call get_agent_results([taskId1, taskId2, ...]) to wait for ALL results at once

All N agents run in parallel. Write self-contained prompts — the agent has ZERO prior context.

WHEN TO USE (high-value tasks): ✅ Implement a scoped feature or bug fix (write code, run tests) ✅ Research/summarize a module, architecture, or large codebase area ✅ Run a build/test suite and report results ✅ Generate boilerplate, migrations, or repetitive code ✅ Perform multi-step analysis that requires reasoning

WHEN NOT TO USE (do it yourself — faster & cheaper): ❌ Read or view files ❌ Simple grep/search operations ❌ Single-file edits that take < 30 seconds ❌ Tasks that just collect information without transforming it

Models: gemini-high (default), gemini-low, gemini-flash, claude-opus, claude-sonnet, gpt-120b.

Inputs: task (required), model, timeout, taskName, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools have clearly orthogonal roles: submit_agent starts an asynchronous task and returns a taskId immediately, while get_agent_results blocks on the collected taskIds. The descriptions explicitly encode the two-step submit-then-collect workflow, leaving no realistic room for misselection.

    Naming Consistency5/5

    Both names follow the same snake_case verb_noun convention (submit_agent, get_agent_results) and the pairing is semantically symmetric within an async task lifecycle. No mixed casing or inconsistent verb styles.

    Tool Count4/5

    Two tools is on the thin side, but it maps exactly onto the intended submit/poll async pattern, so each tool clearly earns its place. A small set of lifecycle helpers would round it out but the current count is defensible for the scope.

    Completeness3/5

    The core submit-and-collect loop is covered, but the surface has no way to check a single task's status, list outstanding agents, or cancel a runaway agent. The description even admits that on timeout the user must 'manually check the status of the task in the Antigravity IDE', which is a genuine dead end for an agent-driven workflow.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      B
      maintenance
      Enables a primary agent in Antigravity IDE to delegate coding tasks to background subagents across multiple model backends, with crash recovery, process cleanup, and human-in-the-loop approval for destructive actions.
      20
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables a single Antigravity IDE to explicitly drive multiple isolated Antigravity CLI workers, choosing each worker's account, model, skills, task, and expected outputs while the bridge executes those decisions over STDIO with SQLite-backed task state. It returns bounded logs, cancellable task control, and immutable artifact exports whose chunks and whole files can be verified by SHA-256.
      1
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables an AI to delegate work to secondary Antigravity CLI accounts, running jobs in parallel with dependency (DAG) scheduling, file read/write declarations, warm multi-turn sessions, account quota tracking and compact result collection. Users simply describe their request in natural language while the AI plans and the server executes — no hand-written workflow JSON required.
      21
      MIT