# codex-mcp-bridge [Health: Active]

**Category:** 🤖 Coding Agents  
**Repository:** https://github.com/hampsterx/codex-mcp-bridge  
**GitHub Stars:** 3  
**npm Downloads (last month):** 356  
**Views:** 13  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/codex-mcp-bridge

## Description
Wraps Codex CLI as MCP tools: query, review, search, assess, structured, sessions.

## Tools
Capabilities this server exposes over MCP:

- **codex** — Execute a prompt via Codex CLI. Codex is an AI coding agent that can generate, analyze, refactor, and explain code with full project context (reads AGENTS.md/CODEX.md automatically).

Capabilities: code generation and refactoring, code analysis and explanation, file reading and modification (when sandbox allows), git operations and terminal commands, multi-turn conversations via sessionId.

When to use a different tool:
- For analysis of text you already have (plans, docs, opinions), inline it directly in the prompt rather than passing file paths. The files parameter triggers full file I/O and increases timeout pressure.

Tips:
- Set workingDirectory to the target repo for project-aware responses.
- Use sandbox "read-only" (default) for analysis, "full-auto" for code changes.
- Break complex tasks into focused prompts rather than one large request.
- Resume multi-turn conversations with sessionId (returned in previous response metadata).
- Include relevant files via the files parameter for targeted context (text and images supported).
- Set reasoningEffort to control depth: "none" for trivial, "minimal" for lightweight, "low"/"medium" for routine, "high"/"xhigh" for deep analysis.
- **search** — Web search via Codex CLI. Searches the web and synthesizes a comprehensive answer with source URLs. Use for current information, documentation lookups, API references, and research questions.

Tips:
- Ask specific, focused questions for best results.
- Results include source URLs for verification.
- Use maxResponseLength to control response verbosity.
- Default timeout is 2 minutes; increase for complex research queries that may require multiple web fetches.
- **query** — Lightweight query for analysis or opinions on text you already have. No file reading, no repo exploration, no session state. Pass text in the context parameter. For code execution or file operations, use the codex tool instead.

Use cases: reviewing a plan, critiquing a draft, comparing approaches, answering questions about provided text, generating summaries.

Tips:
- Pass the text to analyze in the context parameter, not as file paths.
- Set reasoningEffort to control depth: "none" for trivial, "minimal" for lightweight, "low"/"medium" for routine, "high"/"xhigh" for thorough analysis.
- Use maxResponseLength to control verbosity.
- **review** — Run Codex CLI's native diff-aware review via codex exec review --json. The bridge does not accept or bundle a review prompt; upstream Codex owns the reviewer instructions.

Use for MCP clients that cannot run shell commands but need native Codex review of uncommitted changes, a base branch diff, or a single commit.

Tips:
- Set workingDirectory to the target git repository.
- Choose mode "uncommitted", "base", or "commit".
- Use the codex tool with sandbox "read-only" for free-form review prompts.
- **structured** — Generate a JSON response conforming to a provided JSON Schema. Use for data extraction, classification, or any task needing machine-parseable output.
- **listSessions** — List active Codex conversation sessions. Returns session metadata for orchestration (no prompts or responses, just IDs and timing). Use to check available sessions before resuming with the codex tool's sessionId parameter.
- **ping** — Health check: verifies Codex CLI is installed and authenticated, reports versions and capabilities.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "codex-mcp-bridge": {
    "command": "npx",
    "args": ["-y","codex-mcp-bridge"],
    "env": {
      "OPENAI_API_KEY": "",
      "CODEX_MAX_CONCURRENT": ""
    }
  }
}
```

**Requires environment variables:** `OPENAI_API_KEY`, `CODEX_MAX_CONCURRENT` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What codex-mcp-bridge does

The codex-mcp-bridge MCP server exposes Codex CLI through the Model Context Protocol. Its main execution tool can generate, inspect, explain, and refactor code with project context, including files supplied to the request and repository guidance such as AGENTS.md or CODEX.md. Depending on the selected sandbox, Codex may also read or modify files and run Git or terminal operations.

Separate tools cover focused tasks. `query` analyzes text supplied directly in a request without repository exploration or session state. `search` uses Codex CLI web search and returns a synthesized response with source URLs. `review` invokes Codex’s native diff-aware review for uncommitted changes, a base branch, or a commit. `structured` embeds a supplied JSON Schema in the prompt and validates the result with Ajv.

The bridge also provides `ping` for installation and authentication checks, `listSessions` for inspecting active conversations, and `mcpStatus` for reporting the MCP servers known to Codex. Calls include execution metadata such as duration, model, fallback use, and applicable session information.

## How it works

The codex-mcp-bridge MCP server starts Codex CLI as a subprocess and exposes its operations over MCP. Set `workingDirectory` to the target repository when the response needs project context. The `codex` tool supports `read-only`, `workspace-write`, and `full-auto` sandbox levels, while `read-only` is the default for analysis-oriented work.

Use `sessionId` to continue a multi-turn conversation, or set `resetSession` to begin again. `listSessions` can show available session metadata before resuming one. Reasoning effort ranges from `none` through `xhigh`, allowing callers to trade depth against response time.

Pass text in `query`’s `context` parameter when analyzing plans, documents, or other content already available to the caller. Supplying file paths instead invokes file I/O through tools that support files and can increase timeout pressure. Complex work is better divided into focused prompts.

## Setup and configuration

Install Codex CLI first, then authenticate it with an `OPENAI_API_KEY` environment variable or by completing `codex auth login`. The bridge can be started with:

```bash
npx codex-mcp-bridge
```

MCP clients configure it as a command using `npx -y codex-mcp-bridge`. Claude Code, Gemini CLI, Cursor, Windsurf, and VS Code are documented configuration targets; the same stdio setup applies to other MCP clients.

The default timeout is 60 seconds for common execution tools, 120 seconds for web search, and 180 seconds for native review. These can be increased for slower operations. Concurrent subprocesses are queued, with a configurable maximum controlled by `CODEX_MAX_CONCURRENT`.

## Tools and capabilities

- `codex`: Run prompts with files, model selection, sandbox control, working-directory context, reasoning effort, and session resume.
- `review`: Review uncommitted changes, a base comparison, or a commit in a real Git repository.
- `search`: Research current information and documentation with source URLs.
- `structured`: Produce JSON validated against a caller-provided schema.
- `ping`, `listSessions`, and `mcpStatus`: Check health, inspect sessions, and diagnose Codex-managed MCP servers.

## Limitations and notes

Native review does not accept a bridge-supplied review prompt; Codex owns the reviewer instructions. Review also requires `workingDirectory` to identify a real Git repository. The `mcpStatus` diagnostic mode is slower because it starts Codex-managed MCP servers to inspect their state.

For worktrees, run review from inside the worktree because the documented Codex CLI `-C` behavior is broken for review. File inclusion supports text and images, but using files for material already held by the caller adds file-I/O overhead. Sandbox permissions determine whether requested modifications or commands can run.

_Full upstream README: https://allmcps.com/mcp/codex-mcp-bridge/readme_

