Enables AI coding assistants to interact with OpenAI's Codex AI through the official CLI, providing tools for code analysis, file review, and general coding queries without direct API costs
Codex Bridge
A lightweight MCP (Model Context Protocol) server that enables AI coding assistants to interact with OpenAI's Codex AI through the official CLI. Works with Claude Code, Cursor, VS Code, and other MCP-compatible clients. Designed for simplicity, reliability, and seamless integration.
✨ Features
- Direct Codex CLI Integration: Zero API costs using official Codex CLI
- Simple MCP Tools: Two core functions for basic queries and file analysis
- Stateless Operation: No sessions, caching, or complex state management
- Production Ready: Robust error handling with configurable timeouts (default: 90 seconds)
- Minimal Dependencies: Only requires
mcp>=1.0.0
and Codex CLI - Easy Deployment: Support for both uvx and traditional pip installation
- Universal MCP Compatibility: Works with any MCP-compatible AI coding assistant
🚀 Quick Start
Prerequisites
- Install Codex CLI:
- Authenticate with Codex:
- Verify installation:
Installation
🎯 Recommended: PyPI Installation
Alternative: From Source
Development Installation
🌐 Multi-Client Support
Codex Bridge works with any MCP-compatible AI coding assistant - the same server supports multiple clients through different configuration methods.
Supported MCP Clients
- Claude Code ✅ (Default)
- Cursor ✅
- VS Code ✅
- Windsurf ✅
- Cline ✅
- Void ✅
- Cherry Studio ✅
- Augment ✅
- Roo Code ✅
- Zencoder ✅
- Any MCP-compatible client ✅
Configuration Examples
Global Configuration (~/.cursor/mcp.json
):
Project-Specific (.cursor/mcp.json
in your project):
Go to: Settings
→ Cursor Settings
→ MCP
→ Add new global MCP server
Configuration (.vscode/mcp.json
in your workspace):
Alternative: Through Extensions
- Open Extensions view (Ctrl+Shift+X)
- Search for MCP extensions
- Add custom server with command:
uvx codex-bridge
Add to your Windsurf MCP configuration:
- Open Cline and click MCP Servers in the top navigation
- Select Installed tab → Advanced MCP Settings
- Add to
cline_mcp_settings.json
:
Go to: Settings
→ MCP
→ Add MCP Server
- Navigate to Settings → MCP Servers → Add Server
- Fill in the server details:
- Name:
codex-bridge
- Type:
STDIO
- Command:
uvx
- Arguments:
["codex-bridge"]
- Name:
- Save the configuration
Using the UI:
- Click hamburger menu → Settings → Tools
- Click + Add MCP button
- Enter command:
uvx codex-bridge
- Name: Codex Bridge
Manual Configuration:
- Go to Settings → MCP Servers → Edit Global Config
- Add to
mcp_settings.json
:
- Go to Zencoder menu (...) → Tools → Add Custom MCP
- Add configuration:
- Hit the Install button
For pip-based installations:
For development/local testing:
For npm-style installation (if needed):
Universal Usage
Once configured with any client, use the same two tools:
- Ask general questions: "What authentication patterns are used in this codebase?"
- Analyze specific files: "Review these auth files for security issues"
The server implementation is identical - only the client configuration differs!
⚙️ Configuration
Timeout Configuration
By default, Codex Bridge uses a 90-second timeout for all CLI operations. For longer queries (large files, complex analysis), you can configure a custom timeout using the CODEX_TIMEOUT
environment variable.
Example configurations:
Timeout Options:
- Default: 90 seconds (if not configured)
- Range: Any positive integer (seconds)
- Recommended: 60-120 seconds for most queries, 120-300 for large file analysis
- Invalid values: Fall back to 90 seconds with warning
🛠️ Available Tools
consult_codex
Direct CLI bridge for simple queries with structured JSON output by default.
Parameters:
query
(string): The question or prompt to send to Codexdirectory
(string): Working directory for the query (default: current directory)format
(string): Output format - "text", "json", or "code" (default: "json")timeout
(int, optional): Timeout in seconds (recommended: 60-120, default: 90)
Example:
consult_codex_with_stdin
CLI bridge with stdin content for pipeline-friendly execution.
Parameters:
stdin_content
(string): Content to pipe as stdin (file contents, diffs, logs)prompt
(string): The prompt to process the stdin contentdirectory
(string): Working directory for the queryformat
(string): Output format - "text", "json", or "code" (default: "json")timeout
(int, optional): Timeout in seconds (recommended: 60-120, default: 90)
consult_codex_batch
Batch processing for multiple queries - perfect for CI/CD automation.
Parameters:
queries
(list): List of query dictionaries with 'query' and optional 'timeout'directory
(string): Working directory for all queriesformat
(string): Output format - currently only "json" supported for batch
Example:
📋 Usage Examples
Basic Code Analysis
Detailed File Review
Batch Processing
🏗️ Architecture
Core Design
- CLI-First: Direct subprocess calls to
codex
command - Stateless: Each tool call is independent with no session state
- Configurable Timeout: 90-second default execution time (configurable)
- Structured Output: JSON format by default for better integration
- Simple Error Handling: Clear error messages with fail-fast approach
Project Structure
🔧 Development
Local Testing
Integration with Claude Code
The server automatically integrates with Claude Code when properly configured through the MCP protocol.
🔍 Troubleshooting
CLI Not Available
Connection Issues
- Verify Codex CLI is properly authenticated
- Check network connectivity
- Ensure Claude Code MCP configuration is correct
- Check that the
codex
command is in your PATH
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
🤝 Contributing
We welcome contributions from the community! Please read our Contributing Guidelines for details on how to get started.
Quick Contributing Guide
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🔄 Version History
See CHANGELOG.md for detailed version history.
🆘 Support
- Issues: Report bugs or request features via GitHub Issues
- Discussions: Join the community discussion
- Documentation: Additional docs can be created in the
docs/
directory
Focus: A simple, reliable bridge between Claude Code and Codex AI through the official CLI.
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
Enables AI coding assistants to interact with OpenAI's Codex AI through the official CLI. Provides direct integration for code analysis, file review, and batch processing with zero API costs.
Related MCP Servers
- -securityAlicense-qualityProvides code manipulation, execution, and version control capabilities. It allows AI assistants to read, write, and execute code while maintaining a history of changes.Last updated -9MIT License
- -securityAlicense-qualityProvides AI-enhanced code search capabilities by integrating with Sourcegraph, allowing AI assistants to search across multiple repositories and codebases with advanced query syntax.Last updated -11MIT License
- -securityAlicense-qualityProvides AI coding assistants with context optimization tools including targeted file analysis, intelligent terminal command execution with LLM-powered output extraction, and web research capabilities. Helps reduce token usage by extracting only relevant information instead of processing entire files and command outputs.Last updated -6137TypeScriptMIT License
- -securityAlicense-qualityProvides real-time access to up-to-date library documentation and code examples for any programming library. Helps AI coding assistants deliver accurate, current information instead of relying on outdated training data.Last updated -279MIT License