Skip to main content
ClaudeWave
hampsterx avatar
hampsterx

codex-mcp-bridge

Ver en GitHub

MCP server bridging Codex CLI to Claude Code, Cursor - (native) review, queries, and search with hardened subprocess management

MCP ServersRegistry oficial3 estrellas0 forksTypeScriptMITActualizado today
ClaudeWave Trust Score
74/100
· OK
Passed
  • Open-source license (MIT)
  • Recently active
  • Clear description
Last scanned: 6/11/2026
Install in Claude Code / Claude Desktop
Method: NPX · codex-mcp-bridge
Claude Code CLI
claude mcp add codex-mcp-bridge -- npx -y codex-mcp-bridge
claude_desktop_config.json (Claude Desktop)
{
  "mcpServers": {
    "codex-mcp-bridge": {
      "command": "npx",
      "args": ["-y", "codex-mcp-bridge"]
    }
  }
}
1. Run the command above in your terminal (Claude Code), or paste the JSON config into claude_desktop_config.json (Claude Desktop).
2. Replace any <placeholder> values with your API keys or paths.
3. Restart Claude. The MCP server and its tools appear automatically.
Casos de uso

Resumen de MCP Servers

# codex-mcp-bridge

[![npm version](https://img.shields.io/npm/v/codex-mcp-bridge)](https://www.npmjs.com/package/codex-mcp-bridge)
[![npm downloads](https://img.shields.io/npm/dm/codex-mcp-bridge)](https://www.npmjs.com/package/codex-mcp-bridge)
[![CI](https://github.com/hampsterx/codex-mcp-bridge/actions/workflows/ci.yml/badge.svg)](https://github.com/hampsterx/codex-mcp-bridge/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Node.js](https://img.shields.io/node/v/codex-mcp-bridge)](https://nodejs.org/)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
[![MCP](https://img.shields.io/badge/MCP-compatible-8A2BE2)](https://modelcontextprotocol.io/)

MCP server that wraps [Codex CLI](https://github.com/openai/codex) as a subprocess, exposing code execution, web search, and structured output as [Model Context Protocol](https://modelcontextprotocol.io/) tools.

Works with any MCP client: Claude Code, Gemini CLI, Cursor, Windsurf, VS Code, or any tool that speaks MCP.

## Do you need this?

If you're in a terminal agent (Claude Code, Codex CLI, Gemini CLI) with shell access, call Codex CLI directly. It's faster, cheaper, and zero overhead:

```bash
# Review current branch vs main
codex review --base main

# Review uncommitted changes
codex review --uncommitted

# Review with custom focus
codex review --base main "Focus on security and error handling"

# From a worktree (run inside the worktree; `-C` is broken for `review`)
cd /path/to/worktree && codex review --base main

# General analysis
codex exec "Analyze src/utils/parse.ts for edge cases"
```

**Use this MCP bridge instead when:**
- Your client has no shell access (Cursor, Windsurf, Claude Desktop, VS Code)
- You need structured output with JSON Schema validation (Codex CLI's `--json` has [known bugs](https://github.com/openai/codex/issues/16552))
- You need partial response capture on timeout and automatic model fallback on
  quota exhaustion
- You want subprocess isolation: explicit env allowlist, no shell escape,
  secret redaction on output, FIFO-queued concurrency (max 3 parallel spawns,
  configurable via `CODEX_MAX_CONCURRENT`)
- You need multi-turn conversations via session resume (`sessionId` /
  `resetSession`, inspected via `listSessions`)

Worktree note: Codex CLI issue [#9084](https://github.com/openai/codex/issues/9084)
breaks `codex -C /path review ...`. Run `codex review` from inside the worktree to avoid it.

## Quick Start

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

### Prerequisites

- [Codex CLI](https://github.com/openai/codex) installed (`npm i -g @openai/codex`)
- `OPENAI_API_KEY` environment variable set, or `codex auth login` completed

### Claude Code

```bash
claude mcp add codex-bridge -- npx -y codex-mcp-bridge
```

### Gemini CLI

Add to `~/.gemini/settings.json`:
```json
{
  "mcpServers": {
    "codex-bridge": {
      "command": "npx",
      "args": ["-y", "codex-mcp-bridge"]
    }
  }
}
```

### Cursor / Windsurf / VS Code

Add to your MCP settings:
```json
{
  "codex-bridge": {
    "command": "npx",
    "args": ["-y", "codex-mcp-bridge"],
    "env": {
      "OPENAI_API_KEY": "sk-..."
    }
  }
}
```

## Tools

| Tool | Description |
|------|-------------|
| **codex** | Execute prompts with file context, session resume, and sandbox control. Multi-turn conversations via session IDs. Use for free-form review prompts; see [Code review with this CLI](#code-review-with-this-cli). |
| **review** | Native diff-aware Codex review via `codex exec review --json`. No caller prompt; supports uncommitted, base branch, and commit review modes. |
| **search** | Web search via `codex --search`. Returns synthesized answers with source URLs. |
| **query** | Lightweight text analysis. No repo context, no sessions. Runs in an isolated temp directory. |
| **structured** | JSON Schema validated output via [Ajv](https://ajv.js.org/). Data extraction, classification, or any task needing machine-parseable output. |
| **ping** | Health check with CLI version, capabilities, and concurrency diagnostics (`activeCount`, `queueDepth`). |
| **mcpStatus** | Report what Codex says about each MCP server it knows about: auth type, tool inventory, and whether it initialized. Optional diagnostic mode adds explicit failure states and error text. |
| **listSessions** | List active conversation sessions with metadata (turn count, model, timestamps). |

### codex

General-purpose execution. Supports multi-turn conversations via `sessionId`, sandbox levels (`read-only`, `workspace-write`, `full-auto`), and reasoning effort control. Pass `resetSession: true` to discard and start fresh. Use `listSessions` to inspect active sessions before resuming.

Key parameters: `prompt` (required), `files`, `model`, `sessionId`, `sandbox`, `reasoningEffort`, `workingDirectory`, `timeout` (default 60s).

### search

Web search powered by OpenAI's native search infrastructure via Codex CLI's `--search` flag. Returns synthesized answers with source URLs.

Key parameters: `query` (required), `model`, `workingDirectory`, `timeout` (default 120s).

### query

Lightweight, non-agentic text analysis. Spawns in an isolated temp directory so the bridge's repo context doesn't leak. Pass text to analyze in the `context` parameter. Supports `reasoningEffort` and `maxResponseLength`.

Key parameters: `prompt` (required), `context`, `model`, `reasoningEffort`, `timeout` (default 60s).

### review

Thin wrapper around Codex CLI's native diff-aware review. The bridge passes the diff selector to `codex exec review --json`; upstream Codex owns the review prompt. Requires a real git repository via `workingDirectory`.

Key parameters: `mode` (required: `uncommitted`, `base`, or `commit`), `workingDirectory` (required), `base` (required for `base` mode), `commit` (required for `commit` mode), `title`, `model`, `timeout` (default 180s).

### structured

Embeds a JSON Schema in the prompt and validates the response with Ajv. Returns clean JSON on success, validation errors on failure.

Key parameters: `prompt` (required), `schema` (required, JSON string), `files`, `model`, `workingDirectory`, `timeout` (default 60s).

### ping

No parameters. Returns CLI version, auth status, model configuration, and concurrency diagnostics (`activeCount`, `queueDepth`).

### mcpStatus

Reports per-server MCP state as Codex's own `app-server` protocol sees it. Unlike every other tool, it deliberately does **not** suppress Codex's MCP servers or harden the subprocess environment, because both would disable the thing being measured. It therefore boots the servers in `~/.codex/config.toml` and is slower than a normal call.

Key parameters: `diagnostics` (default `false`), `workingDirectory`, `timeout` (per-request, default 90s).

| Mode | Cost | What you get |
|------|------|--------------|
| default | ~6-9s | Inventory: auth type, tool names and counts, and `initialized` / `unknown` per server. Creates no thread and writes no session record. |
| `diagnostics: true` | ~10-20s | Adds an explicit `failed` state and the error text naming the cause (expired OAuth grant, missing binary, remote refusal). Starts an ephemeral thread, which is never materialised on disk. |

Reading the output:

- **`unknown` is not a failure.** It means the inventory carried no server info and no explicit verdict was available. Only `diagnostics: true` can report `failed`.
- **A `degraded` warning means don't trust `unknown`.** Slow calls have been observed reporting healthy servers as uninitialized, so the tool reports how long the underlying call took and flags the result when it was slow enough to be suspect.
- **`builtIn`** marks a server Codex injects that is not in your config; **`configuredButUnreported`** marks one in your config that Codex never mentioned.

Example:

```text
atlassian            failed       auth=oAuth  tools=0
    error: MCP client for `atlassian` failed to start: MCP startup failed: failed to
    refresh OAuth tokens for server atlassian: ... invalid_grant: Grant not found
codex_apps           initialized  auth=bearerToken  tools=117  (builtIn)
linear               initialized  auth=oAuth  tools=57
serena               initialized  auth=unsupported  tools=22
```

All tools attach execution metadata (`_meta`) with `durationMs`, `model`, `fallbackUsed`, and session info where applicable. See [DESIGN.md](DESIGN.md) for details.

## Code review with this CLI

This bridge does not bundle reviewer prompts. There are three paths for code review:

### Native upstream `codex review`

```bash
codex review --base main
codex review --uncommitted
codex review --base main "Focus on security and error handling"
```

Diff-aware review built into Codex CLI. No bridge involvement. Use this when your client has shell access.

### Bridge `review` tool for native diff-aware review

```jsonc
{
  "tool": "review",
  "arguments": {
    "mode": "base",
    "base": "main",
    "workingDirectory": "/path/to/worktree"
  }
}
```

The bridge runs `codex exec review --json` from `workingDirectory`, captures the final review text, and returns review metadata such as `threadId`, event counts, and redacted command output. It does not accept a prompt.

### Bridge `codex` tool with caller-supplied prompt

```jsonc
{
  "tool": "codex",
  "arguments": {
    "prompt": "<your review prompt + diff or file references>",
    "sandbox": "read-only"
  }
}
```

The bridge runs `codex exec --sandbox read-only` with the supplied prompt and returns stdout. Use this for free-form review prompts or review inputs that are not expressible as `uncommitted`, `base`, or `commit` diff selectors.

### Representative review prompt

A starting point; adapt freely:

```text
Review the following diff:

<diff content>

Look for:
- Bugs that would surface in production
- Missing error handling on user-supplied input
- Tests modifi

Lo que la gente pregunta sobre codex-mcp-bridge

¿Qué es hampsterx/codex-mcp-bridge?

+

hampsterx/codex-mcp-bridge es mcp servers para el ecosistema de Claude AI. MCP server bridging Codex CLI to Claude Code, Cursor - (native) review, queries, and search with hardened subprocess management Tiene 3 estrellas en GitHub y se actualizó por última vez today.

¿Cómo se instala codex-mcp-bridge?

+

Puedes instalar codex-mcp-bridge clonando el repositorio (https://github.com/hampsterx/codex-mcp-bridge) o siguiendo las instrucciones del README en GitHub. ClaudeWave también te ofrece bloques de instalación rápida en esta misma página.

¿Es seguro usar hampsterx/codex-mcp-bridge?

+

Nuestro agente de seguridad ha analizado hampsterx/codex-mcp-bridge y le ha asignado un Trust Score de 74/100 (tier: OK). Revisa el desglose completo de comprobaciones superadas y flags en esta página.

¿Quién mantiene hampsterx/codex-mcp-bridge?

+

hampsterx/codex-mcp-bridge es mantenido por hampsterx. La última actividad registrada en GitHub es de today, con 0 issues abiertos.

¿Hay alternativas a codex-mcp-bridge?

+

Sí. En ClaudeWave puedes explorar mcp servers similares en /categories/mcp, ordenados por popularidad o actividad reciente.

Despliega codex-mcp-bridge en tu cloud

Lleva este repo a producción en minutos. Cada plataforma genera su propio entorno con variables de entorno editables.

¿Mantienes este repo? Añade un badge a tu README

Pega el badge en tu README de GitHub para mostrar que está auditado por ClaudeWave. Cada badge enlaza de vuelta a esta página y muestra el Trust Score actual.

Featured on ClaudeWave: hampsterx/codex-mcp-bridge
[![Featured on ClaudeWave](https://claudewave.com/api/badge/hampsterx-codex-mcp-bridge)](https://claudewave.com/repo/hampsterx-codex-mcp-bridge)
<a href="https://claudewave.com/repo/hampsterx-codex-mcp-bridge"><img src="https://claudewave.com/api/badge/hampsterx-codex-mcp-bridge" alt="Featured on ClaudeWave: hampsterx/codex-mcp-bridge" width="320" height="64" /></a>

Más MCP Servers

Alternativas a codex-mcp-bridge