Codex Bridge MCP server

Bridges Claude with OpenAI's Codex through the official CLI, enabling direct consultation, stdin-piped execution for CI/CD workflows, and batch processing for automated code analysis and reviews.
Back to servers
Setup instructions
Provider
Shelakh
Release date
Aug 28, 2025
Language
Go
Stats
21 stars

Codex Bridge is a lightweight MCP (Model Context Protocol) server that connects AI coding assistants with OpenAI's Codex AI through the official CLI. It works seamlessly with Claude Code, Cursor, VS Code, and other MCP-compatible clients, providing a simple interface without requiring API costs.

Prerequisites

Before installing Codex Bridge, you need to set up the Codex CLI:

# Install Codex CLI
npm install -g @openai/codex-cli

# Authenticate with Codex
codex

# Verify installation
codex --version

Installation

PyPI Installation (Recommended)

# Install from PyPI
pip install codex-bridge

# Add to Claude Code with uvx (recommended)
claude mcp add codex-bridge -s user -- uvx codex-bridge

Alternative: From Source

# Clone the repository
git clone https://github.com/shelakh/codex-bridge.git
cd codex-bridge

# Build and install locally
uvx --from build pyproject-build
pip install dist/*.whl

# Add to Claude Code
claude mcp add codex-bridge -s user -- uvx codex-bridge

Multi-Client Support

Codex Bridge works with any MCP-compatible AI coding assistant through different configuration methods. Here are examples for popular clients:

Claude Code Configuration

# Recommended installation
claude mcp add codex-bridge -s user -- uvx codex-bridge

Cursor Configuration

Create a file at ~/.cursor/mcp.json (for global) or .cursor/mcp.json (project-specific):

{
  "mcpServers": {
    "codex-bridge": {
      "command": "uvx",
      "args": ["codex-bridge"],
      "env": {}
    }
  }
}

Then go to: SettingsCursor SettingsMCPAdd new global MCP server

VS Code Configuration

Create a file at .vscode/mcp.json in your workspace:

{
  "servers": {
    "codex-bridge": {
      "type": "stdio",
      "command": "uvx",
      "args": ["codex-bridge"]
    }
  }
}

Configuration Options

Timeout Configuration

By default, Codex Bridge uses a 90-second timeout. You can customize this:

# Add with custom timeout (120 seconds)
claude mcp add codex-bridge -s user --env CODEX_TIMEOUT=120 -- uvx codex-bridge

Git Repository Check

By default, Codex CLI requires being inside a Git repository. To disable this check:

# Add with git repository check disabled
claude mcp add codex-bridge -s user --env CODEX_SKIP_GIT_CHECK=true -- uvx codex-bridge

Available Tools

Codex Bridge provides two main tools:

consult_codex

For direct queries to Codex:

consult_codex(
    query="Find authentication patterns in this codebase",
    directory="/path/to/project",
    format="json",  # Default format
    timeout=90      # Default timeout
)

consult_codex_with_stdin

For analyzing file contents:

consult_codex_with_stdin(
    stdin_content=open("src/auth.py").read(),
    prompt="Analyze this auth file and suggest improvements",
    directory="/path/to/project",
    format="json",  # Default format
    timeout=120     # Custom timeout for complex analysis
)

Usage Examples

Basic Code Analysis

# Simple research query
consult_codex(
    query="What authentication patterns are used in this project?",
    directory="/Users/dev/my-project"
)

Detailed File Review

# Analyze specific files
with open("/Users/dev/my-project/src/auth.py") as f:
    auth_content = f.read()
    
consult_codex_with_stdin(
    stdin_content=auth_content,
    prompt="Review this file and suggest security improvements",
    directory="/Users/dev/my-project",
    format="json",  # Structured output
    timeout=120     # Allow more time for detailed analysis
)

Batch Processing

# Process multiple queries at once
consult_codex_batch(
    queries=[
        {"query": "Analyze authentication patterns", "timeout": 60},
        {"query": "Review database implementations", "timeout": 90},
        {"query": "Check security vulnerabilities", "timeout": 120}
    ],
    directory="/Users/dev/my-project",
    format="json"  # Always JSON for batch processing
)

Troubleshooting

CLI Not Available

If you encounter issues with the CLI:

# Install Codex CLI
npm install -g @openai/codex-cli

# Authenticate
codex auth login

# Test
codex --version

Common Error Messages

  • "CLI not available": Codex CLI is not installed or not in PATH
  • "Authentication required": Run codex auth login
  • "Timeout after X seconds": Query took too long, try increasing timeout or breaking into smaller parts

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "codex-bridge" '{"command":"uvx","args":["codex-bridge"],"env":[]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "codex-bridge": {
            "command": "uvx",
            "args": [
                "codex-bridge"
            ],
            "env": []
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "codex-bridge": {
            "command": "uvx",
            "args": [
                "codex-bridge"
            ],
            "env": []
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later