antigravity-codex-mcp
# antigravity-codex-mcp
An async-first MCP server for the OpenAI Codex CLI. Each work tool returns a job ID and shell commands for retrieving the result. A detached worker records the job and its logs on disk, so stopping the client’s wait or restarting the MCP server leaves the job running.
## Install
Use Node.js 20.1+ and an authenticated Codex CLI. The server discovers the Codex app on Windows or the CLI on an absolute `PATH` entry. If you have the CLI, sign in with `codex login`.
The most reliable option across npm versions and operating systems is to clone and build locally.
```sh
git clone https://github.com/SlopSurfer4444/antigravity-codex-mcp.git
cd antigravity-codex-mcp
npm install
npm run build
```
To run from that checkout, set the MCP server's command to `node` and use the absolute path to the checkout's `dist/index.js` as its sole argument.
For a one-off run from GitHub with npm 12+, allow the direct Git dependency and this repository's `prepare` script. [npm configuration](https://docs.npmjs.com/cli/v12/using-npm/config/#allow-git)
```sh
npx --allow-git=root --allow-scripts=SlopSurfer4444/antigravity-codex-mcp github:SlopSurfer4444/antigravity-codex-mcp
```
### Antigravity
Add the entry to Antigravity’s `mcp_config.json`. [Antigravity MCP configuration](https://antigravity.google/docs/mcp)
```json
{
"mcpServers": {
"antigravity-codex-mcp": {
"command": "npx",
"args": [
"-y",
"--allow-git=root",
"--allow-scripts=SlopSurfer4444/antigravity-codex-mcp",
"github:SlopSurfer4444/antigravity-codex-mcp"
]
}
}
}
```
### Claude Code
Add the entry to the project’s `.mcp.json`. [Claude Code MCP configuration](https://code.claude.com/docs/en/mcp)
```json
{
"mcpServers": {
"antigravity-codex-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"--allow-git=root",
"--allow-scripts=SlopSurfer4444/antigravity-codex-mcp",
"github:SlopSurfer4444/antigravity-codex-mcp"
]
}
}
}
```
For either snippet on Windows, set `"command": "cmd.exe"` and prepend `"/d", "/c", "npx"` to the existing `args` to launch the npm command shim.
## Tools
| Tool | Purpose |
| --- | --- |
| `codex` | Run a prompt. Reuse a `sessionId` to resume, or pass `resetSession: true` to start a new thread with that ID. |
| `review` | Review uncommitted changes, a base branch, a commit, or a custom prompt. |
| `adversarial_review` | Run a skeptical, read-only review of a plan, design, or diff. |
| `websearch` | Run Codex’s web search. |
| `job_status` | Inspect a job, its live log tail, or its terminal result. |
| `list_jobs` | List recent jobs, optionally filtered by status. |
| `cancel_job` | Stop a job and its child processes. |
| `listModels` | Show cached models, aliases, and supported speed tiers. |
| `listSessions` | Show active persisted sessions. |
| `ping` | Check connectivity. |
| `help` | Show job and speed-tier usage. |
Use `waitCommand` in PowerShell on Windows or in the default shell on macOS and Linux. Use `waitCommandPosix` in Git Bash, Bash, or Zsh. Either waits for terminal JSON and exits with status `0` on success or `1` on failure or cancellation. Append `--timeout <seconds>` to bound the wait. Exit status `124` means the wait timed out and the job can still be retrieved by ID.
Jobs and sessions default to `~/.codex/mcp-jobs` and `~/.codex/mcp-sessions`. You can override them with `CODEX_MCP_JOBS_DIR` and `CODEX_MCP_SESSIONS_DIR`. When only the jobs directory is overridden, sessions live in its `sessions` subdirectory.
### Rules for `GEMINI.md` or `CLAUDE.md`
```md
When codex, review, adversarial_review, or websearch returns a jobId, save it.
Run its wait command once as a long-running terminal task. Use waitCommand
in PowerShell and waitCommandPosix in Git Bash, Bash, or Zsh. Read the
terminal JSON before acting on the result. Use job_status for troubleshooting
or recovery after an interrupted wait. Avoid polling or submitting the job
again. Use cancel_job when the user asks to stop the job itself.
```
## Fast and Ultrafast
- **Fast** uses `serviceTier: "fast"` or `"priority"`.
- **Ultrafast** uses `serviceTier: "ultrafast"`.
- **Default** uses `serviceTier: "default"` or `"standard"` to leave tier selection to Codex.
`service_tier` and `speed` are aliases for `serviceTier`. Set `CODEX_DEFAULT_SERVICE_TIER` in the MCP server’s environment for a default override. Existing threads keep their stored tier on resume, including when you switch models. Use `resetSession: true` or a new ID to change tiers.
Choose `sol`, `astra`, `terra`, or an exact model slug. Aliases and tier support come from `~/.codex/models_cache.json` (or the cache under `CODEX_HOME`). The canonical `service_tiers[].id` takes precedence over `additional_speed_tiers`.
## Development
```sh
npm run typecheck
npm run build
npm test
```
ISC. Based on [tuannvm/codex-mcp-server](https://github.com/tuannvm/codex-mcp-server).
TDQS
Scored across 11 tools
The start tools (codex, review, adversarial_review, websearch) are mostly separated by purpose, and job management tools are distinct. Some boundary ambiguity remains between codex's read-only consultation and review/adversarial_review, and between ping and help for MCP metadata.
Names mix snake_case (job_status, list_jobs), camelCase (listModels, listSessions), and bare nouns/verbs (codex, review, ping). Even the same list action is split between listModels/listSessions and list_jobs, so naming is not predictable.
The 11 tools fit the domain: job starters, job controls, session/model discovery, and connection/help utilities. The set is well within a reasonable range and each group maps to a clear need.
The background job lifecycle is covered with start, status, list, and cancel operations, plus model/session discovery and help/ping. Minor gaps include limited session management (list only) and no dedicated wait/poll abstraction beyond job_status.