An intelligent MCP server for orchestrating task delegation between Claude and OpenAI Codex CLI
Project description
Claude-Codex Bridge
An intelligent MCP (Model Context Protocol) server that leverages Codex's exceptional capabilities in code analysis, architectural planning, and complex problem-solving.
Screenshots
Philosophy: Think First, Execute Later
Claude-Codex Bridge embraces a planning-first approach to software development. Codex's true strength lies not in blindly executing changes, but in:
- 🧠 Deep Understanding: Comprehending complex code relationships and patterns
- 📊 Strategic Analysis: Identifying optimization opportunities and architectural insights
- 🎯 Thoughtful Planning: Designing robust, well-considered solutions
- ✅ Quality Assurance: Reviewing code for best practices, security, and performance
Why Read-Only by Default?
- Safety First: Prevent accidental modifications during code exploration
- Better Decisions: Encourage thorough analysis before making changes
- Learning Tool: Understand the "why" behind recommendations, not just the "what"
- Audit Trail: Clear separation between planning and execution phases
Recommended Development Flow
graph LR
A[🔍 Analyze] --> B[🧠 Understand]
B --> C[📋 Plan]
C --> D[👁️ Review]
D --> E[⚡ Execute With Claude Code]
E --> F[✅ Validate]
- Analyze: Use read-only mode to deeply understand your codebase
- Understand: Let Codex explain complex relationships and patterns
- Plan: Design comprehensive solutions and strategies
- Review: Examine Codex's recommendations carefully
- Execute: Enable write mode and apply changes thoughtfully using Claude Code
- Validate: Test and verify the implemented changes
Project Overview
Claude-Codex Bridge is an Intelligent Analysis Engine that orchestrates task delegation between Claude Code and locally running OpenAI Codex CLI. Rather than a simple code generator, it's a sophisticated planning and analysis system with intelligent caching, security validation, and read-only safety defaults.
Technical Architecture
graph TD
A[Claude Code] --> B[MCP Client]
B --> C{Claude-Codex Bridge}
C --> D[Delegation Decision Engine]
C --> E[Result Cache]
C --> G[Codex CLI]
G --> H[Local Sandbox]
C --> I[Output Parser]
I --> B
B --> A
Component Overview
- MCP Server: High-performance server based on FastMCP, providing standardized tool interfaces
- Delegation Decision Engine (DDE): Intelligently analyzes tasks and determines optimal execution strategies
- Result Cache: Intelligent caching system based on content hashes, avoiding duplicate executions
- Output Parser: Intelligently identifies and formats Codex output into structured data
Quick Start
Prerequisites
- Python 3.11+
- OpenAI Codex CLI:
npm install -g @openai/codex
Installation
From PyPI (Recommended)
pip install claude-codex-bridge
From Source
-
uv Package Manager (if building from source):
curl -LsSf https://astral.sh/uv/install.sh | sh -
Clone the project
git clone https://github.com/xiaocang/claude-codex-bridge.git cd claude-codex-bridge
-
Install dependencies
uv syncOr with pip:
pip install -e .
-
Configure environment variables (optional)
# Copy environment variable template cp .env.example .env # Edit .env file, add API keys vim .env
Starting the Server
The server supports two operational modes:
📋 Planning Mode (Default - Recommended)
Start in read-only mode for safe code analysis and planning:
If installed from PyPI:
claude-codex-bridge
Or using Python module:
python -m claude_codex_bridge
If running from source:
uv run python -m claude_codex_bridge
⚡ Execution Mode (When Ready to Apply Changes)
Enable write operations when you're ready to implement Codex's recommendations:
If installed from PyPI:
claude-codex-bridge --allow-write
Or using Python module:
python -m claude_codex_bridge --allow-write
If running from source:
uv run python -m claude_codex_bridge --allow-write
Command-Line Options
--allow-write: Enable file modification operations (default: read-only)--verbose: Enable verbose output for debugging
Claude Code Integration
1. Configure MCP Server
You can configure separate servers for planning and execution modes:
Planning Mode (Default):
# In your project directory - for safe analysis and planning
claude mcp add codex-planning --command "claude-codex-bridge" --scope project
Execution Mode:
# In your project directory - for applying changes
claude mcp add codex-execution --command "claude-codex-bridge --allow-write" --scope project
Or use the example configuration file:
# Copy the example configuration
cp .mcp.json.example .mcp.json
# Edit to match your setup
2. Usage Examples
Planning Phase (Read-Only):
/mcp__codex-planning__codex_delegate "Analyze the authentication system for security vulnerabilities" --working_directory "/path/to/your/project"
Execution Phase (Write-Enabled):
/mcp__codex-execution__codex_delegate "Implement the security fixes we planned earlier" --working_directory "/path/to/your/project"
Main Tools
codex_delegate
Leverage Codex's advanced analytical capabilities for code comprehension and strategic planning.
Codex Specializes In:
- 🔍 Analyzing complex codebases and identifying improvement opportunities
- 🏗️ Designing architectural solutions and refactoring strategies
- 📋 Planning implementation approaches for new features
- 🧪 Generating comprehensive test strategies
- ⚡ Reviewing code for quality, security, and performance issues
Parameters:
task_description(required): Describe what you want Codex to analyze or planworking_directory(required): Project directory to analyzeexecution_mode(optional): Approval strategy (default: on-failure)sandbox_mode(optional): File access mode (forced to read-only unless --allow-write)output_format(optional): How to format the analysis results (diff/full_file/explanation)
Planning Mode Example:
{
"task_description": "Analyze the user authentication system for security vulnerabilities and design improvement strategies",
"working_directory": "/Users/username/my-project",
"execution_mode": "on-failure",
"sandbox_mode": "read-only",
"output_format": "explanation"
}
Execution Mode Example:
{
"task_description": "Implement the security improvements we planned for the authentication system",
"working_directory": "/Users/username/my-project",
"execution_mode": "on-failure",
"sandbox_mode": "workspace-write",
"output_format": "diff"
}
cache_stats
Get cache statistics and clean up expired entries.
clear_cache
Clear all cache entries.
Configuration Options
Environment Variables
# Cache configuration
CACHE_TTL=3600 # Cache TTL in seconds
MAX_CACHE_SIZE=100 # Maximum cache entries
Execution Mode Explanation
- untrusted: Only runs trusted commands, most secure
- on-failure: Requests approval on failure, recommended for most tasks
- on-request: Model decides when to request approval, suitable for complex tasks
- never: Never requests approval, suitable for simple automation tasks
Sandbox Mode Explanation
- read-only: Read-only access, suitable for code analysis and explanation
- workspace-write: Writable workspace, suitable for most development tasks
- danger-full-access: Full access, use with caution
Version History
v0.1.1
- 🔄 Version update and maintenance release
v0.1.0
- ✅ Basic MCP server implementation
- ✅ Codex CLI integration
- ✅ Delegation Decision Engine
- ✅ Result caching system
- ✅ Security validation mechanism
License
MIT License - see LICENSE file for details
Support
For questions or suggestions, please create a GitHub Issue or contact the maintainers.
Claude-Codex Bridge - Making AI agent collaboration smarter 🚀
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file claude_codex_bridge-0.1.1.tar.gz.
File metadata
- Download URL: claude_codex_bridge-0.1.1.tar.gz
- Upload date:
- Size: 21.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2859fe9ef80688c2b51ae4a35fc8b575b195b3ea529c0f0a1dfd41a9b1638a5e
|
|
| MD5 |
8847cec6ab101dea24432dd77b24ec9f
|
|
| BLAKE2b-256 |
5f69f6ee06520599a4cbd016485ad6e6d971a892dddaf615744c0fdedb592629
|
Provenance
The following attestation bundles were made for claude_codex_bridge-0.1.1.tar.gz:
Publisher:
publish.yml on xiaocang/claude-codex-bridge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_codex_bridge-0.1.1.tar.gz -
Subject digest:
2859fe9ef80688c2b51ae4a35fc8b575b195b3ea529c0f0a1dfd41a9b1638a5e - Sigstore transparency entry: 409612630
- Sigstore integration time:
-
Permalink:
xiaocang/claude-codex-bridge@231acb1485b85931f2599d9f361e37002d0f9da1 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/xiaocang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@231acb1485b85931f2599d9f361e37002d0f9da1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file claude_codex_bridge-0.1.1-py3-none-any.whl.
File metadata
- Download URL: claude_codex_bridge-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd2b102fef44c849bdf5473c0214a85d8bc43c9e3a92b291ff8fd005d57ce000
|
|
| MD5 |
f008b805548fdddf9a9ef28272e2345e
|
|
| BLAKE2b-256 |
1a3680db09d1084615c0328bb5bfe5800b44383570d7e49e6b5d899a7bb2cb03
|
Provenance
The following attestation bundles were made for claude_codex_bridge-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on xiaocang/claude-codex-bridge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_codex_bridge-0.1.1-py3-none-any.whl -
Subject digest:
cd2b102fef44c849bdf5473c0214a85d8bc43c9e3a92b291ff8fd005d57ce000 - Sigstore transparency entry: 409612634
- Sigstore integration time:
-
Permalink:
xiaocang/claude-codex-bridge@231acb1485b85931f2599d9f361e37002d0f9da1 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/xiaocang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@231acb1485b85931f2599d9f361e37002d0f9da1 -
Trigger Event:
release
-
Statement type: