Skip to main content
Glama
Antigravity MCP Bridge

Antigravity MCP Bridge

by connormxy

Antigravity 子代理桥接(FastMCP)

一个容器化的 FastMCP 服务器,将 Google Antigravity CLI(agy --headless) 作为远程模型上下文协议(MCP)工具通过 SSE 暴露出来。

该桥接允许对话式 AI 客户端(如 Google Spark、Claude、Cursor 或 ChatGPT)在沙盒化、容器化的工作区中调度完整的编码和自动化子代理。


🚀 主要特性

  • **同步子代理执行(execute_antigravity_sync)**: 将编码/自动化任务直接分派给 agy --headless`,并在代理完成后返回输出日志(适用于 1-3 分钟的短任务)。

  • 异步后台执行(start_antigravity_async): 在后台生成一个长时间运行的 Antigravity 代理,并返回一个 task_id 以实现解耦执行。

  • 任务轮询与管理(get_antigravity_task_status、list_antigravity_tasks): 轮询进度、检查日志并列出所有后台子代理。

  • 工作区隔离与沙盒化: 在 Docker 容器中运行,仅挂载 ./workspaces,保护主机系统文件,同时允许代理在其沙盒内完全自主地进行构建、测试和执行。

  • 与 mcp-server-oauth-proxy 无缝集成: 在 8080/sse 端口暴露标准 SSE 端点,可直接插入 Home Assistant 的 OAuth 代理,以便从 Google Spark 安全访问。


Related MCP server: Antigravity Worker MCP

🛠️ 仓库结构

antigravity-mcp-bridge/
├── Dockerfile              # Container image with Python 3.12, Node.js, git, & agy CLI
├── docker-compose.yml      # Service definitions with volume mounts & port bindings
├── requirements.txt        # fastmcp, mcp[cli], pydantic
├── server.py               # FastMCP Server exposing Antigravity agent tools
├── .env.example            # Environment variable template
├── .gitignore              # Ignored artifacts & workspace directories
└── README.md               # Documentation

📦 快速开始与部署

1. 配置环境变量

复制 .env.example 模板:

cp .env.example .env

(可选:如果您的 agy 环境需要,请添加 GEMINI_API_KEY 或 ANTIGRAVITY_API_KEY。)

2. 使用 Docker Compose 启动

docker compose up -d --build

FastMCP 服务器将开始监听: 👉 http://localhost:8080/sse(或您的主机局域网 IP)。

3. 验证容器健康状态

docker compose logs -f

🔗 连接到 mcp-server-oauth-proxy

要通过您的 Home Assistant OAuth 代理将此 Antigravity 子代理桥接安全地暴露给 Google Spark:

  1. 在 Home Assistant 中,打开 设置 > 加载项 > MCP Server OAuth Proxy > 配置。

  2. 在 servers 下添加一个新的服务器条目:

    - client_name: "Google Spark"
      server_name: "Antigravity Bridge"
      server_url: "http://<YOUR_DOCKER_HOST_IP>:8080/sse"
      bearer_token: ""
      client_id: "spark-antigravity"
      client_secret: "secret-antigravity"
      allowed_redirect_uris: "https://oauth-redirect.googleusercontent.com"
      host: "antigravity-oauth.yourdomain.com"
      path_prefix: ""
  1. 保存并重启加载项。

  2. 在 Google Spark 中,添加自定义工具,指向 https://antigravity-oauth.yourdomain.com/sse,客户端 ID 为 spark-antigravity。


🧰 可用的 MCP 工具

1. execute_antigravity_sync

  • 描述:通过 agy --headless 同步执行任务并等待输出。

  • 参数:

    • prompt (字符串,必填):目标或编码指令。

    • sub_path (字符串,可选):在 /workspace 中执行的子目录。

    • timeout_seconds (整数,默认值:300):中止前等待的最大秒数。

2. start_antigravity_async

  • 描述:在后台启动一个 Antigravity 任务并返回 task_id。

  • 参数:

    • prompt (字符串,必填):目标或编码指令。

    • sub_path (字符串,可选):在 /workspace 中执行的子目录。

3. get_antigravity_task_status

  • 描述:检查后台任务的进度和完整日志。

  • 参数:

    • task_id (字符串,必填):由 start_antigravity_async 返回的 8 字符 ID。

4. list_antigravity_tasks

  • 描述:列出所有活动及已完成的后台任务。

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Enables delegating coding tasks to the official Antigravity CLI from any MCP client, with task listing, model selection, streamed event tracking, cancellation, and resumable sessions. Runs each task against an isolated copy of the repository so results can be previewed, tested, and only integrated into the original after explicit user confirmation.
      23
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables STDIO-compatible AI assistants to queue coding work onto the official Google Antigravity CLI and track status, read reports or patches, query capabilities, or cancel running tasks without blocking. Supports trusted direct execution plus optional isolated or read-only modes depending on the platform.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Codex or Claude Code to orchestrate persistent Antigravity CLI workers as independent implementers and testers within restricted workspace roots. It supports asynchronous task dispatch, progress polling, result inspection, follow-up messages, and cancellation with bounded, audited local event logging.
      5
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP clients to launch, supervise, inspect, cancel, and clean up autonomous coding jobs executed by the Google Antigravity CLI in isolated git worktrees and branches, with optional verification, review, and security auditing.
      Apache 2.0