Antigravity ↔ Codex Bridge
Delegates research, planning, editing, and structured-output tasks to a local Google Antigravity CLI (agy) using stream-json input/output and local authentication.
Delegates scoped implementation, code review, and parallel tasks to the local OpenAI Codex CLI, including exec, resume, fork, and review workflows.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Antigravity ↔ Codex Bridge
A zero-dependency, bidirectional Model Context Protocol (MCP) plugin that lets Google Antigravity and OpenAI Codex CLI delegate work to each other—either in a strict master/worker hierarchy or freely back and forth as peers with built-in workspace, concurrency, recursion, and agent-level cycle protection.
Antigravity → Codex (
codex-local): Antigravity delegates scoped implementation, code review, or parallel tasks in operator-approved workspaces to your local@openai/codexCLI (codex exec --json,resume,fork,review).Codex → Antigravity (
antigravity-local): Codex delegates research, planning, editing, or structured-output tasks to your local Google Antigravity CLI (agy --input-format stream-json --output-format stream-json).Independent direction controls: Enable or disable either direction independently with a single shared policy file (
bridge.config.json), CLI configurator (scripts/configure.mjs), or environment variables—no restart required.Explicit agent-to-agent attribution: Both directions prepend an
AGENT-TO-AGENT DELEGATIONheader identifying the sending and receiving agents so delegated models never confuse agent instructions with direct human prompts.
Why a bundled MCP bridge? Newer releases of
@openai/codexremoved the legacycodex mcp-serversubcommand, andagyruns headless via NDJSON streams. Both servers here are pure Node.js ESM (>= 18), require zeronpm install, reuse your existing local logins/configs, and share a unified loop-guard policy layer.
Delegation Topologies
Configure the exact hierarchy you want via node scripts/configure.mjs:
Topology | Preset Command |
|
|
|
| Behavior |
Antigravity Master (default) |
|
|
|
|
| Antigravity delegates to Codex; Codex cannot call back to Antigravity. |
Codex Master |
|
|
|
|
| Codex delegates to Antigravity; Antigravity cannot call back to Codex. |
Bidirectional Peers |
|
|
|
|
| Either tool can initiate one-hop delegation (no ping-pong callbacks by default). |
Bidirectional Callbacks |
|
|
|
|
| Either model can initiate and delegate back ( |
Both Disabled |
|
|
|
|
| Both servers stay healthy ( |
You can also toggle each direction, max_depth, and allow_cycles independently (see Configuring Directions & Loop Protection).
Related MCP server: agv-codex-bridge
Prerequisites
Install whichever CLIs correspond to the direction(s) you plan to enable:
Node.js 18+ (
node --version)For Antigravity → Codex (
codex-local):npm install -g @openai/codex codex --version codex loginFor Codex → Antigravity (
antigravity-local):macOS / Linux:
curl -fsSL https://antigravity.google/cli/install.sh | bash agy --versionWindows (PowerShell):
irm https://antigravity.google/cli/install.ps1 | iex agy --versionAuthenticate once via an interactive
agysession (or Antigravity App—credentials are shared locally).
Installation
1. Clone the plugin into Antigravity's global plugins folder
macOS / Linux:
mkdir -p ~/.gemini/config/plugins
git clone https://github.com/zbush/antigravity-codex-plugin.git ~/.gemini/config/plugins/codexWindows (PowerShell):
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.gemini\config\plugins" | Out-Null
git clone https://github.com/zbush/antigravity-codex-plugin.git "$env:USERPROFILE\.gemini\config\plugins\codex"This immediately enables Direction A (Antigravity → Codex) in Antigravity (Customizations → Plugins → Antigravity <-> Codex Bridge).
2. Wire Direction B (Codex → Antigravity) (optional)
Run the built-in configurator from the installed plugin checkout to register antigravity-local in Codex (~/.codex/config.toml), configure env_vars forwarding for the loop guard, and choose your starting mode. If you wired Codex on an older version, rerun node scripts/configure.mjs --wire-codex from that checkout and restart the host to pick up AGENT_BRIDGE_MAX_CONCURRENT and AGENT_BRIDGE_INHERITED_POLICY forwarding.
cd ~/.gemini/config/plugins/codex
# Example 1: Bidirectional peer mode (1 hop from either side)
node scripts/configure.mjs --mode bidirectional --wire-codex --status
# Example 2: Bidirectional with back-and-forth callbacks (A -> B -> A)
node scripts/configure.mjs --mode bidirectional --max-depth 2 --allow-cycles on --wire-codex --status
# Example 3: Strict Codex-master hierarchy (Codex -> Antigravity only)
node scripts/configure.mjs --mode codex-master --wire-codex --statusRegister the server with codex mcp add:
codex mcp add antigravity-local -- node /absolute/path/to/.gemini/config/plugins/codex/server/antigravity-mcp.mjsThen add env_vars under [mcp_servers.antigravity-local] in ~/.codex/config.toml so delegation depth and policy overrides cross Codex's MCP boundary:
[mcp_servers.antigravity-local]
command = "node"
args = ["/absolute/path/to/.gemini/config/plugins/codex/server/antigravity-mcp.mjs"]
env_vars = [
"AGENT_BRIDGE_CONTEXT",
"AGENT_BRIDGE_WORKSPACE_ROOTS",
"AGENT_BRIDGE_ALLOW_EDITS",
"AGENT_BRIDGE_CODEX_WINDOWS_SANDBOX",
"AGENT_BRIDGE_DEPTH",
"AGENT_BRIDGE_MAX_DEPTH",
"AGENT_BRIDGE_MAX_CONCURRENT",
"AGENT_BRIDGE_CHAIN",
"AGENT_BRIDGE_CONFIG",
"AGENT_BRIDGE_INHERITED_POLICY",
"AGENT_BRIDGE_ANTIGRAVITY_TO_CODEX",
"AGENT_BRIDGE_CODEX_TO_ANTIGRAVITY",
"AGENT_BRIDGE_ALLOW_CYCLES",
"AGY_BIN",
"CODEX_BIN",
"CODEX_CLI_JS",
]To remove antigravity-local from Codex later:
node scripts/configure.mjs --unwire-codexConfiguring Directions & Loop Protection
Config file & precedence
User policy is stored outside the plugin install folder so git pull or plugin updates never overwrite your preferences:
Default user policy file:
~/.gemini/config/antigravity-codex-bridge/bridge.config.jsonShipped defaults:
./bridge.config.json(antigravity_to_codex: true,codex_to_antigravity: false,max_depth: 1,max_concurrent: 4,allow_cycles: false)
When you supply a config path via AGENT_BRIDGE_CONFIG or --config, that path must be absolute and nonblank. Passing --config to scripts/configure.mjs selects its target file ahead of AGENT_BRIDGE_CONFIG. At runtime, an explicit config path pointing to a missing file fails closed.
Both servers reload the operator config live on every tools/list and tools/call in the precedence order below. On delegated hops, the child intersects that operator config with AGENT_BRIDGE_INHERITED_POLICY before admitting a handoff.
Environment variables > User bridge.config.json (or AGENT_BRIDGE_CONFIG) > Shipped bridge.config.json > Built-in defaultsCLI configurator (scripts/configure.mjs)
Unspecified flags preserve your existing settings:
# Inspect effective policy and Codex MCP registration
node scripts/configure.mjs --status
# Switch presets
node scripts/configure.mjs --mode agy-master
node scripts/configure.mjs --mode codex-master
node scripts/configure.mjs --mode bidirectional
node scripts/configure.mjs --mode off
# Toggle directions independently
node scripts/configure.mjs --antigravity-to-codex on --codex-to-antigravity off
node scripts/configure.mjs --codex-to-antigravity on --max-depth 2
# Allow multi-hop back-and-forth (e.g., A -> B -> A -> B up to 4 hops)
node scripts/configure.mjs --mode bidirectional --max-depth 4 --allow-cycles onPolicy schema (bridge.config.json)
{
"version": 1,
"directions": {
"antigravity_to_codex": true,
"codex_to_antigravity": true
},
"max_depth": 1,
"max_concurrent": 4,
"allow_cycles": false
}How live policy & loop guards work
Disabled direction: The server still responds to
initializeandping, returns an emptytools: []list (emittingnotifications/tools/list_changedif disabled live), cancels owned jobs, and rejects any cachedtools/callwith JSON-RPC error-32602(data.reason: "direction_disabled").Depth, agent-level cycles, concurrency, and inherited limits. Each parent forwards
AGENT_BRIDGE_CONTEXT, the incrementedAGENT_BRIDGE_DEPTH, the updatedAGENT_BRIDGE_CHAIN, and its effective policy inAGENT_BRIDGE_INHERITED_POLICY. A child can use a direction only when both inherited and current operator settings enable it. The lowermax_depthandmax_concurrentapply, and both policies must permit cycles.depth = 0is a top-level user session.When
depth >= max_depthorremaining_hops === 0, launch tools (*_run,*_spawn,*_resume,*_fork,*_review) are hidden and rejected (data.reason: "max_depth_reached"), while*_status,*_job_status, and*_job_cancelremain available.When
allow_cyclesisfalse(default), delegating back to an agent that already sent an earlier hop in the chain is blocked (data.reason: "cycle_blocked"). That permits 3-agent non-cyclic chains (such asAntigravity → Codex → Claudewhenmax_depth >= 2) while blockingA → B → Acallbacks unless you explicitly enableallow_cycles: truewithmax_depth >= 2.When active child jobs reach
max_concurrent(default4), new launches are refused (data.reason: "max_concurrent_reached") until a running job completes or is cancelled.
Request cancellation (
notifications/cancelled): Cancelling a synchronous*_run,*_resume,*_fork, or*_reviewMCP call immediately terminates the spawned CLI process tree.Fail-closed validation. A nonzero
AGENT_BRIDGE_DEPTHwithoutAGENT_BRIDGE_INHERITED_POLICY(unless entering fresh from a foreign bridge viaAGENT_BRIDGE_CONTEXT) refuses the launch. The bridge also fails closed on malformed JSON, invalid policy values, blank or relativeAGENT_BRIDGE_CONFIGpaths, missing explicitAGENT_BRIDGE_CONFIGfiles at runtime, and inconsistentAGENT_BRIDGE_DEPTHandAGENT_BRIDGE_CHAINvalues.
Environment variable overrides
All three bridges pass AGENT_BRIDGE_CONTEXT through the host environment as a version 1 JSON object containing ordered hops (from, to, and a unique id) and remaining_hops. Each handoff spends one hop and applies the smaller of the incoming budget and the local limit. A handoff entering from the Claude bridge can start this pair's local policy history; a returning handoff that previously used this pair must carry its inherited policy. Run node scripts/configure.mjs --wire-codex to refresh existing Codex forwarding.
Variable | Values | Purpose |
| Nonblank absolute file path | Shared override path for runtime and |
|
| Override Antigravity → Codex direction. |
|
| Override Codex → Antigravity direction. |
| Integer | Maximum delegated hop depth. |
| Integer | Maximum concurrent active child CLI jobs per server. |
|
| Allow delegating back to an agent already in the chain up to |
| Absolute file path | Explicit |
| Absolute file path | Explicit |
|
| Select the Windows sandbox backend provisioned on this machine when delegated Codex sessions need it for shell commands. |
| Absolute file path | Explicit |
Workspace and edit permissions
Set AGENT_BRIDGE_WORKSPACE_ROOTS in each host's MCP registration to a JSON array of absolute directories, for example ["/home/me/projects"]. The bridge resolves symlinks and checks cwd and every add_dirs entry against those roots before launch. If the setting is absent, the server uses its startup directory. A server started at a volume root requires explicit roots.
Codex starts read-only (sandbox: "read-only"). To request workspace-write, the operator must set AGENT_BRIDGE_ALLOW_EDITS to the string true. The isolated CLI loads the paired antigravity-local server only when a return hop is permitted (allow_cycles: true, reverse direction enabled, depth remaining) and the standard registration from --wire-codex is enabled; it skips customized registrations with additional tool, approval, or environment settings. Its callback inherits the narrowed workspace directories and edit setting. For parallel edits, prepare separate worktrees inside approved roots and pass each as cwd.
Antigravity CLI tasks require AGENT_BRIDGE_ALLOW_EDITS=true on the host because the CLI can edit files even when asked to plan. Each task starts a fresh sandboxed session with slash commands disabled, in plan mode unless the caller selects accept-edits. When mode is plan, the bridge narrows AGENT_BRIDGE_ALLOW_EDITS to false in the child's environment so a plan-mode turn cannot delegate writes back to Codex.
MCP Tool Reference
Antigravity → Codex (codex-local)
Tool | Description |
| Read-only diagnostic reporting resolved Codex binary & source (or |
| Run a scoped local Codex task synchronously ( |
| Continue a completed session started by this bridge in the same workspace ( |
| Fork a completed session started by this bridge in the same workspace ( |
| Run a non-interactive code review against uncommitted changes, a |
| Start a Codex task ( |
| Inspect a background |
| Terminate a running background Codex job and its process tree. |
Codex → Antigravity (antigravity-local)
Tool | Description |
| Read-only diagnostic reporting resolved |
| Run a local Antigravity CLI turn synchronously ( |
| Start a background Antigravity turn and return a |
| Inspect a background |
| Terminate a running background Antigravity job and its process tree. |
Non-PATH / Version Manager Setup (nvm, fnm, volta, Homebrew)
By default, mcp_config.json uses portable defaults (command: "node", args: ["server/index.mjs"]) because Antigravity runs plugin MCP servers with cwd set to the plugin root.
On Windows, automatic discovery checks %LOCALAPPDATA%\agy\bin\agy.exe, ~/.local/bin/agy.exe, and PATH for agy.exe, and discovers @openai/codex/bin/codex.js (relative to Node, NPM_CONFIG_PREFIX, %APPDATA%\npm, or PATH) or codex.exe without ever invoking cmd.exe batch shims. When a desktop or GUI host omits your shell PATH, pin explicit paths in your local ~/.gemini/config/plugins/codex/mcp_config.json:
{
"mcpServers": {
"codex-local": {
"command": "C:\\nvm4w\\nodejs\\node.exe",
"args": [
"C:\\Users\\<YOUR_USER>\\.gemini\\config\\plugins\\codex\\server\\index.mjs"
],
"env": {
"CODEX_CLI_JS": "C:\\nvm4w\\nodejs\\node_modules\\@openai\\codex\\bin\\codex.js"
}
}
}
}{
"mcpServers": {
"codex-local": {
"command": "/Users/<YOUR_USER>/.nvm/versions/node/v22.x.x/bin/node",
"args": [
"/Users/<YOUR_USER>/.gemini/config/plugins/codex/server/index.mjs"
],
"env": {
"CODEX_BIN": "/opt/homebrew/bin/codex"
}
}
}
}Testing & Verification
Run the built-in zero-dependency test suite (covers config precedence, live toggling, depth/agent-cycle/concurrency guards, both MCP servers over stdio, status diagnostics, request cancellation, timeouts, output caps, and Codex wiring):
npm test
# or directly:
node --test tests/bridge.test.mjsTroubleshooting
Synchronous MCP call times out after ~3 minutes: Some MCP hosts enforce a ~3-minute per-call timeout. Use
codex_spawn/antigravity_spawn+*_job_statusfor multi-file tasks or deep research.codexoragynot found from a GUI app: Runcodex_status/antigravity_statusto inspect discovery errors, and setCODEX_BIN/CODEX_CLI_JS/AGY_BINin your MCP registration or pin the absolutenodepath.Windows Codex sandbox directory errors: On Windows, Codex's restricted-token sandbox may deny shell access inside dot-folders under your user profile (such as
~/.gemini). Pointcwdat normal project directories.
Repository Layout
├── package.json # Root test runner manifest (zero dependencies)
├── plugin.json # Antigravity plugin manifest
├── mcp_config.json # Antigravity -> Codex MCP registration
├── bridge.config.json # Shipped default direction, depth, and concurrency policy
├── assets/
│ ├── logo.png # Plugin icon
│ └── icon-64.png # MCP server icon
├── server/
│ ├── index.mjs # Backward-compatible entry point (-> codex-mcp.mjs)
│ ├── codex-mcp.mjs # Antigravity -> Codex MCP server (codex-local)
│ ├── antigravity-mcp.mjs # Codex -> Antigravity MCP server (antigravity-local)
│ └── lib/
│ ├── bridge.mjs # Config loading, precedence, direction/depth/cycle/concurrency guard
│ ├── codex-cli.mjs # Codex binary discovery and TOML registration inspection
│ ├── context.mjs # Shared v1 AGENT_BRIDGE_CONTEXT wire format
│ ├── mcp.mjs # Shared JSON-RPC 2.0 stdio transport with cancellation & validation
│ ├── process.mjs # Command resolution, job registry (with pruning), tree kill
│ ├── status.mjs # Shared diagnostic status helper for codex_status / antigravity_status
│ └── workspace-policy.mjs # Shared workspace/edit ceiling
├── scripts/
│ └── configure.mjs # CLI for toggling directions & wiring Codex MCP
├── skills/
│ └── codex-orchestration/
│ └── SKILL.md # Antigravity orchestration skill
└── tests/
└── bridge.test.mjs # node:test end-to-end & policy test suiteLicense
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Coordination hub for AI coding agents: message teammates, ask humans, audit every event.
Shared long-term memory & Stop-hook task handoff across Claude Code, Codex, Cursor, and mobile.
Multiplayer for the coding agents your team already uses: shared tasks, decisions, skills and tools.
Shared control plane for AI coding agents — tasks, memory, decisions, file locks. 12 tools.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables Claude Code to delegate implementation tasks to Antigravity CLI and OpenCode, run them fully autonomously, and then review and gate the results.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables an automated development loop where Google Antigravity IDE performs code generation and fixes while OpenAI Codex CLI acts as an independent QA auditor, with live dashboards, slash commands, and closed-loop remediation.MIT
- AlicenseNot gradedqualityBmaintenanceEnables Codex users to delegate engineering, refactoring, auditing, and test execution tasks to Google Antigravity CLI as a persistent autonomous subagent, with tools for managing sessions and running prompts.1MIT
- AlicenseAqualityBmaintenanceEnables AI agents to delegate complex coding tasks, refactorings, and automated code reviews to OpenAI Codex and Google Antigravity CLIs, running them autonomously in YOLO mode with process supervision.6MIT