codex-cli-mcp-tool
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@codex-cli-mcp-toolreview auth.py for security issues"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Codex CLI MCP Server
An MCP server that allows Claude Code to interact with the OpenAI Codex CLI. If you have a ChatGPT subscription and a claude code subscription, you can use this tool to get the benefits of both, as a $20 ChatGPT subscription gives you access to GPT-5 for free in Codex CLI.
Features
Complete Codex Integration: Access all Codex CLI capabilities through MCP
GPT-5 Model: Powered by OpenAI's most capable model
Sandbox Safety: Configurable execution modes (read-only, workspace-write, full-access)
Progress Tracking: Real-time updates for long-running operations
Git Integration: Apply Codex-generated diffs directly to repositories
Flexible Configuration: Environment variables and config file support
Related MCP server: MCP Ask-to-Code
Installation
Install Codex CLI (required):
npm install -g @openai/codexAdd to Claude Code using npx:
claude mcp add codex-cli-mcp-tool -- npx -y codex-cli-mcp-toolOr install globally first:
npm install -g codex-cli-mcp-toolConfigure Authentication:
# Option 1: Use API key export OPENAI_API_KEY=your-api-key # Option 2: Login with ChatGPT account codex login
Available Tools
ask-codex
Execute Codex with comprehensive parameter support for code analysis, generation, and assistance.
Parameters:
prompt(required): Your query or instructionmodel(optional): gpt-5 (default and only supported model)sandbox(optional): read-only, workspace-write, danger-full-accessapproval(optional): untrusted, on-failure, on-request, neverimage(optional): Image file path(s) to includeconfig(optional): Configuration overridestimeout(optional): Maximum execution time
Example:
ask-codex "Explain this code: @main.py" sandbox="read-only"exec-codex
Non-interactive Codex execution for automation workflows.
Parameters:
prompt(required): Command or instructionmodel(optional): Always gpt-5sandbox(optional): Sandbox modetimeout(optional): Execution timeout
apply-diff
Apply the latest Codex-generated diff to your git repository.
Parameters:
dryRun(optional): Preview changes without applyingvalidate(optional): Validate before applying
Utility Tools
ping: Test MCP connectionhelp: Show detailed help informationversion: Display version information
Configuration
Environment Variables
OPENAI_API_KEY=sk-... # OpenAI API key
CODEX_MODEL=gpt-5 # Default model
CODEX_SANDBOX_MODE=read-only # Default sandbox modeConfig File (~/.codex/config.toml)
[model]
provider = "openai"
default = "gpt-5"
reasoning_effort = "medium"
[sandbox]
default_mode = "read-only"
permissions = ["disk-read-access"]
[approval]
policy = "untrusted"
trusted_commands = ["ls", "cat", "grep"]Sandbox Modes
read-only: Safe exploration, no file modifications
workspace-write: Limited modifications within project
danger-full-access: Full system access (requires confirmation)
Examples
Code Analysis
ask-codex "Review this function for security issues: @auth.py"Code Generation
ask-codex "Generate unit tests for the User class" sandbox="workspace-write"Debugging
ask-codex "Fix the bug in login function" approval="on-request"File Operations
ask-codex "Create a new React component for user profile" sandbox="workspace-write"Apply Changes
ask-codex "Refactor this code to use async/await"
apply-diff validate=trueTroubleshooting
Common Issues
Codex CLI not found:
npm install -g @openai/codexAuthentication failed:
# Set API key export OPENAI_API_KEY=your-key # Or login codex loginPermission denied:
Use appropriate sandbox mode
Check approval policy settings
Verify file permissions
Rate limits:
Wait before retrying
Check OpenAI account quota
Debug Mode
Enable debug logging:
DEBUG=true codex-cli-mcp-toolDevelopment
Setup
git clone <repository>
cd codex-cli-tool
npm install
npm run build
npm run devTesting
npm test
npm run lintAcknowledgments
This project is based on the excellent Gemini MCP Tool by jamubc. We adapted their architecture and patterns to create this Codex CLI integration.
License
MIT License - see LICENSE file for details.
Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests
Submit a pull request
Support
GitHub Issues: Report bugs and feature requests
OpenAI Codex: https://github.com/openai/codex
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseBquality-maintenanceAn MCP server for the OpenAI Codex CLI that provides coding assistance with multi-turn session management and reasoning depth control. It enables users to perform code analysis, generation, and refactoring through Claude with native resume support for conversational context.Last updated48571
- AlicenseAqualityDmaintenanceAn autonomous MCP server that uses the Claude Code CLI to solve coding problems without permission prompts.Last updated1MIT
- Alicense-qualityDmaintenanceMCP server that enables Claude Code to delegate code generation and debugging to OpenAI Codex, with stall detection and auto-recovery.Last updated8MIT
- Alicense-qualityCmaintenanceA local MCP server that enables Claude to generate images using the OpenAI API.Last updated13MIT
Related MCP Connectors
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
MCP server for OpenAI Sora AI video generation
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Mr-Tomahawk/codex-cli-mcp-tool'
If you have feedback or need assistance with the MCP directory API, please join our Discord server