# codex-mcp-tool

Bridges AI editors to OpenAI's Codex CLI for automated code reviews, file analysis, and sandboxed edits. Ideal when delegating repository tasks to local or hosted models.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 24
- Author: x51xxx
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/x51xxx/codex-mcp-tool
- Updated: 2026-09-30
- HTML: https://affpapa.org/en/nevibecode/mcp/codex-mcp-tool

## What it does

This server routes editor requests straight into the Codex terminal utility. Assistants gain access to tools like `ask-codex`, `do-act`, and `review-changes`. You can inspect repositories using `@` file selectors, request structured old-and-new patches, or trigger web lookups. Local engines such as Ollama and LM Studio work through the `localProvider` flag.

Task continuity relies on isolated workspaces and the native session recovery mechanism built into modern CLI releases. The `do-act` routine executes actions, evaluates them against terminal commands, and tries fresh corrections if tests fail. Built-in image creation runs directly on your existing ChatGPT session without extra credential setup.

Execution fails unless Node.js 18 and an authenticated Codex CLI exist in your path. Defaults flow straight from your `~/.codex/config.toml` file unless overridden explicitly per call.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `CODEX_MCP_CWD`, `CODEX_SESSION_TTL_MS`, `CODEX_MAX_SESSIONS` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env CODEX_MCP_CWD=<CODEX_MCP_CWD> --env CODEX_SESSION_TTL_MS=<CODEX_SESSION_TTL_MS> --env CODEX_MAX_SESSIONS=<CODEX_MAX_SESSIONS> --transport stdio codex-mcp-tool -- npx -y @trishchuk/codex-mcp-tool
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add codex-mcp-tool --env CODEX_MCP_CWD=<CODEX_MCP_CWD> --env CODEX_SESSION_TTL_MS=<CODEX_SESSION_TTL_MS> --env CODEX_MAX_SESSIONS=<CODEX_MAX_SESSIONS> -- npx -y @trishchuk/codex-mcp-tool
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "codex-mcp-tool": {
            "command": "npx",
            "args": [
                "-y",
                "@trishchuk/codex-mcp-tool"
            ],
            "env": {
                "CODEX_MCP_CWD": "<CODEX_MCP_CWD>",
                "CODEX_SESSION_TTL_MS": "<CODEX_SESSION_TTL_MS>",
                "CODEX_MAX_SESSIONS": "<CODEX_MAX_SESSIONS>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "codex-mcp-tool": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@trishchuk/codex-mcp-tool"
            ],
            "env": {
                "CODEX_MCP_CWD": "<CODEX_MCP_CWD>",
                "CODEX_SESSION_TTL_MS": "<CODEX_SESSION_TTL_MS>",
                "CODEX_MAX_SESSIONS": "<CODEX_MAX_SESSIONS>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e CODEX_MCP_CWD=<CODEX_MCP_CWD> -e CODEX_SESSION_TTL_MS=<CODEX_SESSION_TTL_MS> -e CODEX_MAX_SESSIONS=<CODEX_MAX_SESSIONS> codex-mcp-tool npx -y @trishchuk/codex-mcp-tool
```
Replace <…> with your own values

## When to use it
- route repository and directory inspection into Codex CLI
- conduct non-interactive code reviews on pending git diffs
- run automated code edits with shell verification loops
- query local open models via Ollama or LM Studio

## Example prompts
- explain the project layout in `@src/` using codex
- run codex with sandbox:true to generate a data migration script
- review current changes in the repository with review-changes

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 386989
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33918
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81115
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119160
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47392
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43872

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
