codex-agy-bridge
An MCP bridge that lets Codex delegate long-running agent work to the Antigravity CLI, providing observable and resumable tool-based execution with project scoping.
README
codex-agy-bridge
An observable and resumable MCP bridge that lets Codex delegate work to the
official Antigravity CLI (agy) using the user's existing Antigravity login.
Why
agy --print is designed as a blocking one-shot command. Long-running agent
work can exceed the caller's timeout, while useful progress remains available
only in Antigravity's local trajectory files.
This bridge starts each job in a detached runner and exposes six MCP tools:
agy_startagy_continueagy_statusagy_transcriptagy_resultagy_cancel
It also exposes lightweight orchestration tools:
agy_goal_createagy_goal_target_startagy_goal_statusagy_target_open_terminal
New and continued runs may select an installed Antigravity model explicitly
with the optional model argument instead of changing global CLI settings.
The default is Gemini 3.5 Flash (Medium).
Runs open in a persistent tmux session by default. Terminal.app attaches to
that session for user visibility; closing the terminal only detaches the view
and does not stop the target. Set visible_terminal=false for headless runs.
Goals group named targets and permit bounded parallel work. Parallelism is capped at three globally and may be lowered per goal.
Project Scoping
Every start and continuation requires an absolute workspace directory.
Starting with the same workspace creates a project-scoped Antigravity
conversation; continuing also requires its exact conversation_id, preventing
follow-up work from drifting into another project's conversation.
For example, all work for a repository can consistently use:
/Users/you/repositories/your-project
The bridge appends a unique internal completion marker to each prompt. When the marker remains the latest response through a stability window, the detached runner records the result and terminates the CLI process instead of waiting indefinitely for process exit. This avoids treating an intermediate response followed by a scheduled wait as completion. The marker is removed from public tool results.
Architecture
serverowns only the MCP tool interface and translates calls toorchestration.orchestrationowns run and goal lifecycle behavior independently of MCP.statedefines and validates persisted run and goal contracts while allowing older state files to omit fields added by newer versions.terminalowns tmux execution and Terminal.app attachment.runnerowns completion monitoring for one detached Antigravity process.coreowns JSON persistence and Antigravity transcript reading.
Run state and logs survive MCP server restarts under:
~/.local/state/codex-agy-bridge/runs/
agy_transcript defaults to bounded progress metadata: step identifiers,
statuses, event types, tool names, and short error summaries. Raw event content
is available only when include_content=true and remains length-capped. Private
model reasoning fields are never exposed.
agy_status returns a small status envelope by default. Set compact=false
only when process identifiers and artifact paths are needed for diagnosis.
Compact status also reports the latest semantic event and provider-health
classification when Antigravity logs expose authentication, rate-limit, or
quota signals.
Safety
Antigravity is an agentic CLI. It can read and write files, run commands, and access the network with the current user's privileges. The bridge does not provide a security boundary.
dangerously_skip_permissions defaults to true, so Antigravity may execute
commands and modify files without interactive approval. Set it to false for a
restricted run. The workspace is context, not a filesystem or network
boundary. Use only trusted prompts and trusted local content; use an OS-level
container or VM for actual isolation.
The bridge never reads or copies Antigravity OAuth credentials. It invokes the
installed agy binary and reads ordinary conversation metadata and trajectory
files from ~/.gemini/antigravity-cli.
Development
uv sync --extra dev
uv run pytest
uv run ruff check .
Run the MCP server:
uv run codex-agy-bridge
Codex Configuration
Add this to ~/.codex/config.toml:
[mcp_servers.codex-agy-bridge]
command = "/Users/you/.local/bin/uv"
args = [
"--directory",
"/absolute/path/to/codex-agy-bridge",
"run",
"codex-agy-bridge",
]
startup_timeout_sec = 30
tool_timeout_sec = 30
[mcp_servers.codex-agy-bridge.env]
AGY_CMD = "/absolute/path/to/agy"
Restart Codex after changing MCP configuration.
Compatibility
The initial implementation targets Antigravity CLI 1.0.7. It reads the JSONL trajectory currently written under:
~/.gemini/antigravity-cli/brain/<conversation-id>/
.system_generated/logs/transcript.jsonl
Antigravity is also migrating conversations to SQLite. The bridge keeps this reader isolated so a future SQLite or local-daemon adapter can be added without changing the MCP tool contract.
MCP Tasks were considered but remain experimental in the 2025-11-25 protocol
and are moving to an extension. This bridge uses the stable explicit-handle
pattern instead: agy_start returns a durable run_id that is passed to
status, transcript, result, and cancellation tools.
Design References
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。