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.
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
# Install from PyPI
pip install codex-bridge
# Add to Claude Code with uvx (recommended)
claude mcp add codex-bridge -s user -- uvx codex-bridge
# 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
Codex Bridge works with any MCP-compatible AI coding assistant through different configuration methods. Here are examples for popular clients:
# Recommended installation
claude mcp add codex-bridge -s user -- uvx codex-bridge
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: Settings
→ Cursor Settings
→ MCP
→ Add new global MCP server
Create a file at .vscode/mcp.json
in your workspace:
{
"servers": {
"codex-bridge": {
"type": "stdio",
"command": "uvx",
"args": ["codex-bridge"]
}
}
}
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
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
Codex Bridge provides two main tools:
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
)
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
)
# Simple research query
consult_codex(
query="What authentication patterns are used in this project?",
directory="/Users/dev/my-project"
)
# 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
)
# 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
)
If you encounter issues with the CLI:
# Install Codex CLI
npm install -g @openai/codex-cli
# Authenticate
codex auth login
# Test
codex --version
codex auth login
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.
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.
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": []
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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