Codex CLI▌

by cexll
Codex CLI is a code analysis tool for structured command execution, brainstorming, and workflow automation with static c
Bridges OpenAI's Codex CLI with structured command execution, brainstorming sessions, and chunked response delivery for code analysis, automated refactoring, and development workflow automation.
best for
- / Developers automating code reviews and refactoring
- / Teams processing large codebases with AI analysis
- / CI/CD pipelines requiring automated code transformations
capabilities
- / Execute Codex CLI with file analysis using @ syntax
- / Run batch operations for mass code refactoring
- / Generate structured brainstorming sessions for development ideas
- / Retrieve chunked responses for large code transformations
- / Process multiple atomic tasks in parallel
what it does
Connects Claude/MCP clients to OpenAI's Codex CLI for direct code analysis and automated refactoring. Handles large-scale file processing with chunked responses and safety controls.
about
Codex CLI is a community-built MCP server published by cexll that provides AI assistants with tools and capabilities via the Model Context Protocol. Codex CLI is a code analysis tool for structured command execution, brainstorming, and workflow automation with static c It is categorized under developer tools. This server exposes 8 tools that AI clients can invoke during conversations and coding sessions.
how to install
You can install Codex CLI in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
license
MIT
Codex CLI is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
readme
Codex MCP Tool
<div align="center"> </div>Codex MCP Tool is an open‑source Model Context Protocol (MCP) server that connects your IDE or AI assistant (Claude, Cursor, etc.) to the Codex CLI. It enables non‑interactive automation with codex exec, safe sandboxed edits with approvals, and large‑scale code analysis via @ file references. Built for reliability and speed, it streams progress updates, supports structured change mode (OLD/NEW patch output), and integrates cleanly with standard MCP clients for code review, refactoring, documentation, and CI automation.
Latest Release (v1.2.4): Enhanced Windows compatibility - Now using cross-spawn for reliable npm global command execution across all platforms (Windows, macOS, Linux). See changelog
- Ask Codex questions from your MCP client, or brainstorm ideas programmatically.
TLDR:
+ Codex CLI
Goal: Use Codex directly from your MCP-enabled editor to analyze and edit code efficiently.
Prerequisites
Before using this tool, ensure you have:
✅ Cross-Platform Support: Fully tested and working on Windows, macOS, and Linux (v1.2.4+)
One-Line Setup
claude mcp add codex-cli -- npx -y @cexll/codex-mcp-server
Verify Installation
Type /mcp inside Claude Code to verify the Codex MCP is active.
Alternative: Import from Claude Desktop
If you already have it configured in Claude Desktop:
- Add to your Claude Desktop config:
"codex-cli": {
"command": "npx",
"args": ["-y", "@cexll/codex-mcp-server"]
}
- Import to Claude Code:
claude mcp add-from-claude-desktop
Configuration
Register the MCP server with your MCP client:
For NPX Usage (Recommended)
Add this configuration to your Claude Desktop config file:
{
"mcpServers": {
"codex-cli": {
"command": "npx",
"args": ["-y", "@cexll/codex-mcp-server"]
}
}
}
For Global Installation
If you installed globally, use this configuration instead:
{
"mcpServers": {
"codex-cli": {
"command": "codex-mcp"
}
}
}
Configuration File Locations:
- Claude Desktop:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/claude/claude_desktop_config.json
- macOS:
After updating the configuration, restart your terminal session.
Example Workflow
- Natural language: "use codex to explain index.html", "understand this repo with @src", "look for vulnerabilities and suggest fixes"
- Claude Code: Type
/codex-clito access the MCP server tools.
Usage Examples
Model Selection
// Use the default gpt-5-codex model
'explain the architecture of @src/';
// Use gpt-5 for fast general purpose reasoning
'use codex with model gpt-5 to analyze @config.json';
// Use o3 for deep reasoning tasks
'use codex with model o3 to analyze complex algorithm in @algorithm.py';
// Use o4-mini for quick tasks
'use codex with model o4-mini to add comments to @utils.js';
// Use codex-1 for software engineering
'use codex with model codex-1 to refactor @legacy-code.js';
With File References (using @ syntax)
ask codex to analyze @src/main.ts and explain what it doesuse codex to summarize @. the current directoryanalyze @package.json and list dependencies
General Questions (without files)
ask codex to explain div centeringask codex about best practices for React development related to @src/components/Button.tsx
Brainstorming & Ideation
brainstorm ways to optimize our CI/CD pipeline using SCAMPER methoduse codex to brainstorm 10 innovative features for our app with feasibility analysisask codex to generate product ideas for the healthcare domain with design-thinking approach
Codex Approvals & Sandbox
Codex CLI supports fine-grained control over permissions and approvals through sandbox modes and approval policies.
Understanding Parameters
The sandbox Parameter (Convenience Flag):
sandbox: true→ Enables fullAuto mode (equivalent tofullAuto: true)sandbox: false(default) → Does NOT disable sandboxing, just doesn't enable auto mode- Important: The
sandboxparameter is a convenience flag, not a security control
Granular Control Parameters:
sandboxMode: Controls file system access levelapprovalPolicy: Controls when user approval is requiredfullAuto: Shorthand forsandboxMode: "workspace-write"+approvalPolicy: "on-failure"yolo: ⚠️ Bypasses all safety checks (dangerous, not recommended)
Sandbox Modes
| Mode | Description | Use Case |
|---|---|---|
read-only | Analysis only, no file modifications | Code review, exploration, documentation reading |
workspace-write | Can modify files in workspace | Most development tasks, refactoring, bug fixes |
danger-full-access | Full system access including network | Advanced automation, CI/CD pipelines |
Approval Policies
| Policy | Description | When to Use |
|---|---|---|
never | No approvals required | Fully trusted automation |
on-request | Ask before every action | Maximum control, manual review |
on-failure | Only ask when operations fail | Balanced automation (recommended) |
untrusted | Maximum paranoia mode | Untrusted code or high-risk changes |
Configuration Examples
Example 1: Balanced Automation (Recommended)
{
"approvalPolicy": "on-failure",
"sandboxMode": "workspace-write", // Auto-set if omitted in v1.2+
"model": "gpt-5-codex",
"prompt": "refactor @src/utils for better performance"
}
Example 2: Quick Automation (Convenience Mode)
{
"sandbox": true, // Equivalent to fullAuto: true
"model": "gpt-5-codex",
"prompt": "fix type errors in @src/"
}
Example 3: Read-Only Analysis
{
"sandboxMode": "read-only",
"model": "gpt-5-codex",
"prompt": "analyze @src/ and explain the architecture"
}
Smart Defaults (v1.2+)
Starting from version 1.2.0, the server automatically applies intelligent defaults to prevent permission errors:
- ✅ If
approvalPolicyis set butsandboxModeis not → auto-setssandboxMode: "workspace-write" - ✅ If
search: trueoross: true→ auto-setssandboxMode: "workspace-write"(for network access) - ✅ All commands include
--skip-git-repo-checkto prevent errors in non-git environments
Troubleshooting Permission Errors
If you encounter ❌ Permission Error: Operation blocked by sandbox policy:
Check 1: Verify sandboxMode
# Ensure you're not using read-only mode for write operations
{
"sandboxMode": "workspace-write", // Not "read-only"
"approvalPolicy": "on-failure"
}
Check 2: Use convenience flags
# Let the server handle defaults
{
"sandbox": true, // Simple automation
"prompt": "your task"
}
Check 3: Update to latest version
# v1.2+ includes smart defaults to prevent permission errors
npm install -g @cexll/codex-mcp-server@latest
Common Issues
Issue 1: MCP Tool Timeout Error
If you encounter timeout errors when using Codex MCP tools:
# Set the MCP tool timeout environment variable (in milliseconds)
export MCP_TOOL_TIMEOUT=36000000 # 10 hours
# For Windows (PowerShell):
$env:MCP_TOOL_TIMEOUT=36000000
# For Windows (CMD):
set MCP_TOOL_TIMEOUT=36000000
Add this to your shell profile (~/.bashrc, ~/.zshrc, or PowerShell profile) to make it permanent.
Issue 2: Codex Cannot Write Files
If Codex responds with permission errors like "Operation blocked by sandbox policy" or "rejected by user approval settings", configure your Codex CLI settings:
Create or edit ~/.codex/config.toml:
# Dynamically generated Codex configuration
model = "gpt-5-codex"
model_reasoning_effort = "high"
model_reasoning_summary = "detailed"
approval_policy = "never"
sandbox_mode = "danger-full-access"
disable_response_storage = true
network_access = true
⚠️ Security Warning: The danger-full-access mode grants Codex full file system access. Only use this configuration in trusted environments and for tasks you fully understand.
Configuration File Locations:
- macOS/Linux:
~/.codex/config.toml - Windows:
%USERPROFILE%\.codex\config.toml
After updating the configuration, restart your MCP client (Claude Desktop, Claude Code, etc.).
Basic Ex
FAQ
- What is the Codex CLI MCP server?
- Codex CLI is a Model Context Protocol (MCP) server profile on explainx.ai. MCP lets AI hosts (e.g. Claude Desktop, Cursor) call tools and resources through a standard interface; this page summarizes categories, install hints, and community ratings.
- How do MCP servers relate to agent skills?
- Skills are reusable instruction packages (often SKILL.md); MCP servers expose live capabilities. Teams frequently combine both—skills for workflows, MCP for APIs and data. See explainx.ai/skills and explainx.ai/mcp-servers for parallel directories.
- How are reviews shown for Codex CLI?
- This profile displays 10 aggregated ratings (sample rows for discoverability plus signed-in user reviews). Average score is about 4.5 out of 5—verify behavior in your own environment before production use.
Ratings
4.5★★★★★10 reviews- ★★★★★Shikha Mishra· Oct 10, 2024
Codex CLI is among the better-indexed MCP projects we tried; the explainx.ai summary tracks the official description.
- ★★★★★Piyush G· Sep 9, 2024
We evaluated Codex CLI against two servers with overlapping tools; this profile had the clearer scope statement.
- ★★★★★Chaitanya Patil· Aug 8, 2024
Useful MCP listing: Codex CLI is the kind of server we cite when onboarding engineers to host + tool permissions.
- ★★★★★Sakshi Patil· Jul 7, 2024
Codex CLI reduced integration guesswork — categories and install configs on the listing matched the upstream repo.
- ★★★★★Ganesh Mohane· Jun 6, 2024
I recommend Codex CLI for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
- ★★★★★Oshnikdeep· May 5, 2024
Strong directory entry: Codex CLI surfaces stars and publisher context so we could sanity-check maintenance before adopting.
- ★★★★★Dhruvi Jain· Apr 4, 2024
Codex CLI has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.
- ★★★★★Rahul Santra· Mar 3, 2024
According to our notes, Codex CLI benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.
- ★★★★★Pratham Ware· Feb 2, 2024
We wired Codex CLI into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.
- ★★★★★Yash Thakker· Jan 1, 2024
Codex CLI is a well-scoped MCP server in the explainx.ai directory — install snippets and categories matched our Claude Code setup.