{
  "markdown": "# codex-agy-bridge\n\n[![CI](https://github.com/varadfromeast/codex-agy-bridge/actions/workflows/ci.yml/badge.svg)](https://github.com/varadfromeast/codex-agy-bridge/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\nRun Antigravity from an agent harness as durable, parallel, human-operable\n`agy` sessions over MCP.\n\n<!-- mcp-name: io.github.varadfromeast/codex-agy-bridge -->\n\n`codex-agy-bridge` wraps the official Antigravity CLI with a resumable MCP\ncontrol plane. Agent harnesses like Codex, Claude Desktop, or your own\nGPT/Claude-powered MCP client can start `agy` runs, wait on sparse events,\nattach a real terminal, send guarded input, cancel safely, continue exact\nconversations, and collect final results later by `run_id`.\n\n## Quick Install\n\nPrerequisites:\n\n- Codex CLI for the command below, or another local stdio MCP-capable harness\n- The official Antigravity CLI (`agy`), already authenticated locally\n- `uv` / `uvx`\n- `tmux` on macOS:\n\n```bash\nbrew install tmux\n```\n\nCheck the required commands:\n\n```bash\ncodex --version\nagy --version\nagy models\nuvx --version\ntmux -V\n```\n\n### Day 0 Authentication\n\n`agy --version` only proves the binary exists. Before adding the MCP server,\nrun `agy models`; if Antigravity asks you to sign in or reports that you are\nnot logged in, start a visible session and complete the browser/login flow:\n\n```bash\nagy --prompt-interactive \"Authenticate Antigravity and then exit.\"\nagy models\n```\n\nAfter `agy models` succeeds, install or restart the MCP server. If a bridge run\nstill hits auth, `agy_run_start` returns `status=\"auth_required\"` and opens a\nvisible `agy` authentication session by default. Complete sign-in there, then\nstart a fresh run. You can also use `agy_run_observe(view=\"terminal\")` or\n`agy_admin(action=\"doctor\")` to inspect the auth-required status.\n\nInstall from PyPI with the Codex CLI:\n\n```bash\ncodex mcp add codex-agy-bridge \\\n  --env AGY_CMD=\"$(command -v agy)\" \\\n  -- \"$(command -v uvx)\" codex-agy-bridge@latest\n```\n\nRestart the harness, then verify in Codex if you used the command above:\n\n```bash\ncodex mcp get codex-agy-bridge\ncodex mcp list\n```\n\nRemove it with:\n\n```bash\ncodex mcp remove codex-agy-bridge\n```\n\nFor Claude Desktop or a custom MCP client, use the same stdio command shape:\n`uvx codex-agy-bridge@latest` with `AGY_CMD` set to the authenticated `agy`\nexecutable.\n\n## What Makes It Different\n\n- **Parallel Antigravity sessions:** launch multiple independent `agy` runs,\n  each with its own durable state, logs, transcript projection, and result.\n- **Human-operable terminals:** foreground runs live in persistent `tmux`\n  sessions, so Terminal.app can attach without killing the agent.\n- **Resumable MCP control:** MCP calls can time out, the harness can restart,\n  and the run can still be observed later by `run_id`.\n- **Goal orchestration:** create a goal, start named targets with bounded\n  parallelism, and inspect the whole batch as one coordinated effort.\n- **Sparse wake events:** `agy_run_wait` short-polls lifecycle, attention,\n  progress, and terminal events without transcript-polling spam.\n- **Guarded input:** `agy_run_input` can reject stale writes when event or\n  transcript cursors changed after the caller observed the run.\n- **Trajectory-aware observability:** bounded transcript summaries and terminal\n  evidence are exposed without private model reasoning.\n- **Operational hygiene:** duplicate active starts are deduplicated, process\n  groups are cancelled safely, and completed result artifacts are preserved.\n\n## Install Details\n\n### If You Are An Agent Reading This\n\nHelp the user install it; do not silently mutate their machine.\n\n1. Verify prerequisites first:\n\n```bash\ncommand -v codex\ncommand -v agy\ncommand -v uvx\ncommand -v tmux\nagy --version\nagy models\n```\n\n2. If anything is missing, ask before installing it.\n3. If `agy models` reports an auth error, help the user complete the Day 0\n   authentication flow above before adding the MCP server.\n4. Then run:\n\n```bash\ncodex mcp add codex-agy-bridge \\\n  --env AGY_CMD=\"$(command -v agy)\" \\\n  -- \"$(command -v uvx)\" codex-agy-bridge@latest\n```\n\n5. Verify:\n\n```bash\ncodex mcp get codex-agy-bridge\ncodex mcp list\n```\n\n6. Tell the user to restart their agent harness so the new MCP tools load.\n\n### PyPI\n\nThe Quick Install command stores an stdio MCP server definition. When the agent\nharness starts the server, `uvx` resolves `codex-agy-bridge@latest` from PyPI,\ninstalls it into an isolated cached environment, and runs the\n`codex-agy-bridge` console script. `AGY_CMD` pins the bridge to the user's\nalready-installed and authenticated `agy` executable.\n\nDo not replace `$` or `$(...)` manually in the command. In POSIX shells,\n`$(command -v agy)` and `$(command -v uvx)` expand to absolute executable\npaths.\n\n### GitHub\n\nUse this when you want the repository version directly:\n\n```bash\ncodex mcp add codex-agy-bridge \\\n  --env AGY_CMD=\"$(command -v agy)\" \\\n  -- uvx --from git+https://github.com/varadfromeast/codex-agy-bridge \\\n  codex-agy-bridge\n```\n\n### Local Development\n\n```bash\ngit clone https://github.com/varadfromeast/codex-agy-bridge.git\ncd codex-agy-bridge\nuv sync --extra dev\n\ncodex mcp add codex-agy-bridge \\\n  --env AGY_CMD=\"$(command -v agy)\" \\\n  -- uv --directory \"$PWD\" run codex-agy-bridge\n```\n\n## How It Works\n\n```mermaid\nflowchart LR\n  H[\"Agent harness<br/>(Codex, Claude, custom MCP client)\"]\n  M[\"codex-agy-bridge<br/>MCP stdio server\"]\n  S[\"Durable control plane<br/>runs, goals, events, results\"]\n  W[\"Detached run supervisor\"]\n  A[\"Antigravity CLI<br/>agy\"]\n  T[\"Persistent tmux session<br/>human attach/input\"]\n  L[\"Local Antigravity<br/>trajectory files\"]\n\n  H <-->|\"MCP tools\"| M\n  M <--> S\n  S --> W\n  W --> A\n  W <--> T\n  A --> L\n  W -->|\"bounded transcript projection\"| S\n  T -->|\"terminal logs and attention prompts\"| S\n```\n\nThe bridge keeps the MCP server responsive while detached supervisors own the\nlong-running `agy` processes. State and events are persisted locally, so a run\ncan continue after the original MCP call returns. For the deeper process model,\nsee [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md). For the MCP control-loop\nvision, see [docs/MCP_VISION.md](docs/MCP_VISION.md).\n\n## MCP Tools\n\n| Tool | Purpose |\n| --- | --- |\n| `agy_run_start` | Start, continue, or open an interactive foreground run |\n| `agy_run_wait` | Short-poll until selected runs emit sparse wake events |\n| `agy_run_observe` | Read full, status, transcript, or raw terminal views |\n| `agy_run_input` | Send input with optional event/transcript preconditions |\n| `agy_run_cancel` | Cancel one active run |\n| `agy_run_result` | Read final result metadata or bounded result chunks |\n| `agy_goal` | Create goals, start targets, and read aggregate status |\n| `agy_admin` | Read diagnostics, models, plugins, validation, and changelog |\n\nTypical flow:\n\n```text\nagy_run_start -> agy_run_wait -> agy_run_observe -> agy_run_result\n```\n\nIn Codex MCP, tools may be exposed with the server prefix, for example\n`codex_agy_bridge_agy_run_wait`. Run responses include exact `wait_call`\narguments; note that `agy_run_wait` always takes `run_ids: [\"...\"]`, even for a\nsingle run. Supported wait conditions are `any_attention`, `any_terminal`,\n`all_terminal`, `any_event`, and aliases `attention`, `terminal`, `finished`,\n`finish`, `complete`, `completed`, `result`, `all_finished`, `all_complete`, and\n`all_completed`.\n\nUse `agy_goal` when the harness should split work into named targets with a\nshared objective and bounded parallelism.\n\n## Configuration\n\n| Variable | Default | Purpose |\n| --- | --- | --- |\n| `AGY_CMD` | `agy` on `PATH` | Exact Antigravity executable |\n| `AGY_BRIDGE_STATE_DIR` | `~/.local/state/codex-agy-bridge` | Durable run and goal state |\n| `AGY_BRIDGE_AGY_ROOT` | `~/.gemini/antigravity-cli` | Antigravity conversations and trajectories |\n| `AGY_BRIDGE_MAX_PARALLEL` | `50` | Global concurrent-run limit |\n| `AGY_BRIDGE_COMPLETION_STABILITY_SECONDS` | `150` | Time a final marker must remain stable |\n| `AGY_BRIDGE_MCP_WAIT_SLICE_SECONDS` | `120` | Max seconds a single `agy_run_wait` MCP call blocks before returning a snapshot so gateways do not time out |\n\nRun state survives MCP server restarts under\n`~/.local/state/codex-agy-bridge/`.\n\n## Status And Risk\n\nThis project is experimental. It currently targets Python 3.11+, macOS,\n`tmux`, and Antigravity CLI 1.0.8-compatible commands and trajectory files.\n\nAntigravity is an agentic CLI. It can read and write files, execute commands,\nand access the network with the current user's privileges. This bridge is not a\nsandbox or security boundary.\n\nThe bridge always enables Antigravity's dangerous permission-skip policy so\nunattended runs do not stall on CLI approval prompts. Any\n`dangerously_skip_permissions=false` input is rejected; the only allowed value\nis `true`. `sandbox=true` and `additional_directories` are CLI policy hints,\nnot filesystem containment.\n\nThe bridge does not read or copy Antigravity OAuth credentials. It invokes the\ninstalled `agy` binary and reads ordinary local conversation metadata and\ntrajectory files.\n\n## Development\n\n```bash\ngit clone https://github.com/varadfromeast/codex-agy-bridge.git\ncd codex-agy-bridge\nuv sync --extra dev\nuv run pytest\nuv run ruff check .\nuv build\n```\n\nRun the server directly:\n\n```bash\nuv run codex-agy-bridge\n```\n\nThe server uses stdio transport. Do not print diagnostic text to stdout; it\nwould corrupt MCP framing.\n\n## Publishing\n\nA pushed version tag runs `.github/workflows/publish.yml`, which verifies\nversions, runs checks, builds distributions, publishes to PyPI through GitHub\nOIDC, creates a GitHub release, and publishes `server.json` to the MCP\nRegistry.\n\n## Compatibility\n\nThe current reader expects Antigravity trajectory JSONL under:\n\n```text\n~/.gemini/antigravity-cli/brain/<conversation-id>/\n  .system_generated/logs/transcript.jsonl\n```\n\nIf Antigravity moves to SQLite or a local daemon API, a new adapter can replace\nthis reader without changing the MCP tool contract.\n\n## License\n\n[MIT](LICENSE)\n",
  "bytes": 10075,
  "sha": "b7f6d88b72faf4578ef811f4c74a78d54c21ff28c9f66d97033da129b0cbf9a3",
  "repo_slug": "varadfromeast/codex-agy-bridge",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_varadfromeast_codex_agy_bridge_9226ab51/readme"
}