codex-antigravity-bridge
Enables AI agents to interact with Google's Antigravity CLI, allowing delegation of prompts and tasks to the Antigravity model, with support for synchronous and asynchronous execution, model selection, and file output.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@codex-antigravity-bridgeWrite a Python function to reverse a string."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Codex-Antigravity Bridge
This bridge allows Google Codex (or other MCP-compatible clients) to delegate tasks to the Google Antigravity CLI and receive responses back.
On Windows, agy --print may exit successfully but return empty stdout when executed from a non-interactive subprocess. agy_pty.py bypasses this limitation using ConPTY (pywinpty). It spawns agy inside a pseudo-terminal (PTY), captures the terminal output, and returns the cleaned text to the caller.
Workflow
Codex -> MCP server -> agy_pty.py -> ConPTY -> agy.exe -> AntigravityThe bridge detects the capabilities of the installed agy CLI using a capability probe. On Windows, the PTY backend is used by default because direct stdout capture for agy -p can return empty output even if the model responds successfully.
Related MCP server: claude-to-agy
Installation
python -m pip install --user -r requirements.txtAdditionally, ensure you have the Antigravity CLI installed:
where.exe agy
agy --version
agy updateQuick Verification
To verify the low-level wrapper:
python agy_pty.py "What is 2+2? Answer with one digit only." --timeout=60s --jsonExpected output:
"4"To verify the MCP server via stdio:
python mcp_server.pyWhen run in a standard console, this command will wait for an MCP client. For actual validation, register it in your Codex MCP config or run a test MCP client.
Model Selection
Antigravity CLI 1.0.5+ supports the official --model flag:
agy --model "Gemini 3.5 Flash (High)" -p "Reply with exactly: OK"The bridge uses this flag automatically if the capability probe detects support for --model (default for agy 1.0.6+).
For older CLI versions, the bridge falls back to temporarily modifying:
%USERPROFILE%\.gemini\antigravity-cli\settings.jsonThe fallback sequence is:
The bridge acquires a lock file near
settings.json.It backs up original settings.
Temporarily sets
"model": "<label>".Runs
agy.Restores original configuration (reverting only the
modelfield without overwriting other settings).
If the process is hard-killed during fallback model override, the next bridge invocation will detect the crash marker near settings.json and restore the original model value (if the current setting still matches the left override).
On agy 1.0.6+, settings.json is not modified for model selection.
Diagnostic example:
python agy_pty.py "Reply with exactly: OK" --model "Gemini 3.5 Flash (High)"The bridge fetches the list of models by running agy models via PTY. If the CLI is unavailable, it falls back to:
models.jsonMCP Server
Codex config:
[mcp_servers.antigravity]
command = "python"
args = ["C:\\path\\to\\codex-antigravity-bridge\\mcp_server.py"]
enabled = true
required = false
startup_timeout_sec = 60
tool_timeout_sec = 600Tools:
antigravity_delegate: Sends a prompt to Antigravity and returns the response.antigravity_delegate_async: Starts delegation in the background and returns ajob_id.antigravity_run_status: Checks the status of an async job.antigravity_get_summary: Gets the summary of an async job.antigravity_get_result_path: Gets the file path to the full result of an async job.antigravity_smoke_test: Verifies the installation path, expectsMCP_OK.antigravity_capabilities: Displaysagyversion, flags/subcommands, and recommended backend.antigravity_current_settings: Displays non-sensitive bridge settings and trusted roots.antigravity_list_models: Lists model labels retrieved fromagy modelswith fallback tomodels.json.
antigravity_delegate supports return_mode:
Value | Returned to Codex |
| Complete response inline + writes |
| Brief summary, metadata, and path to |
To save Codex tokens, use file_summary:
{
"return_mode": "file_summary",
"summary_max_bullets": 5
}Run artifacts are written to:
<cwd>/.agentboard/antigravity/runs/This directory should not be committed. The bridge automatically retains only the last 50 runs in each workspace.
Capability probe:
{
"include_live_probe": false
}include_live_probe: false does not consume LLM quota (the bridge only reads agy --version and agy --help). include_live_probe: true sends a small smoke prompt and verifies direct stdout against the PTY backend.
Prompt guardrails:
Hard limit: 12,000 characters (after adding
mode: "advise"wrapper text).Warning: triggered after 8,000 characters.
If the hard limit is exceeded, the request is not sent to Antigravity, and only a truncated preview is written to the run directory.
Migration to Another Project
There are two migration modes: project-local and global.
Project-Local
In this mode, the bridge resides within each project.
Copy the repository files into your project folder, e.g.:
tools/antigravity-bridge/Install dependencies in the new project:
python -m pip install --user -r tools\antigravity-bridge\requirements.txtVerify Antigravity CLI:
where.exe agy
agy --versionAdd local run folders to
.gitignoreof the new project:
.antigravitycli/
.agentboard/
__pycache__/Run a smoke-test once from the root of the new project:
python tools\antigravity-bridge\agy_pty.py "Reply with exactly: OK" --add-dir "<ABSOLUTE_PROJECT_PATH>" --timeout=60sAdd the MCP server to
%USERPROFILE%\.codex\config.toml, substituting the project path:
[mcp_servers.antigravity]
command = "python"
args = ["<ABSOLUTE_PROJECT_PATH>\\tools\\antigravity-bridge\\mcp_server.py"]
enabled = true
required = false
startup_timeout_sec = 60
tool_timeout_sec = 600Restart Codex to reload the MCP config.
Call
antigravity_smoke_testin the new project.
Global MCP
In this mode, the bridge is placed in a single global location, e.g.:
C:\Users\username\.codex\tools\codex-antigravity-bridge\The active project path is passed via cwd/add_dirs in each MCP tool call. To let the bridge know which workspaces are trusted, add environment variables to the MCP config:
[mcp_servers.antigravity]
command = "python"
args = ["C:\\Users\\username\\.codex\\tools\\codex-antigravity-bridge\\mcp_server.py"]
enabled = true
required = false
startup_timeout_sec = 60
tool_timeout_sec = 600
[mcp_servers.antigravity.env]
ANTIGRAVITY_BRIDGE_WORKSPACE_ROOT = "C:\\path\\to\\your\\project"
ANTIGRAVITY_BRIDGE_TRUSTED_ROOTS = "C:\\path\\to\\your\\project"ANTIGRAVITY_BRIDGE_WORKSPACE_ROOT defines the default cwd if the tool call doesn't specify one. ANTIGRAVITY_BRIDGE_TRUSTED_ROOTS defines additional allowed roots; multiple paths are separated by the OS path separator (; on Windows).
If environment variables are not set, the fallback remains project-local:
BRIDGE_DIR.parent.parentRun artifacts are always written to the active workspace (i.e. <resolved_cwd>/.agentboard/), not next to the global bridge scripts.
Troubleshooting
If agy throws a symlink error:
A required privilege is not held by the clientEnable Windows Developer Mode and restart your terminal/Codex. Antigravity uses .antigravitycli/ as a local project link to its settings in %USERPROFILE%\.gemini\config\projects.
If antigravity_delegate returns an empty response:
Do not call
agy --printdirectly;Run
agy_pty.pysmoke-test;Verify
pywinptyis installed;Verify the Antigravity CLI is authenticated.
If
pywinptyis broken or missing, the bridge returns a diagnostic warning and falls back to standard subprocess execution (which may not capture stdout on Windows).
If the prompt is rejected due to size:
Do not paste entire files;
Pass file paths;
Instruct Antigravity to read only specific files or sections.
If you need a different model:
Call
antigravity_list_models;Pass the exact label in
model;If
agy modelsfails, update the fallbackmodels.json.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Common-ka/codex-antigravity-bridge'
If you have feedback or need assistance with the MCP directory API, please join our Discord server