codex-mcp-tool — Claude Code MCP server: what it does, how to install
Bridges AI editors to OpenAI's Codex CLI for automated code reviews, file analysis, and sandboxed edits. Ideal when delegating repository tasks to local or hosted models.
claude mcp add --env CODEX_MCP_CWD=<CODEX_MCP_CWD> --env CODEX_SESSION_TTL_MS=<CODEX_SESSION_TTL_MS> --env CODEX_MAX_SESSIONS=<CODEX_MAX_SESSIONS> --transport stdio codex-mcp-tool -- npx -y @trishchuk/codex-mcp-toolWhat codex-mcp-tool does
This server routes editor requests straight into the Codex terminal utility. Assistants gain access to tools like ask-codex, do-act, and review-changes. You can inspect repositories using @ file selectors, request structured old-and-new patches, or trigger web lookups. Local engines such as Ollama and LM Studio work through the localProvider flag.
Task continuity relies on isolated workspaces and the native session recovery mechanism built into modern CLI releases. The do-act routine executes actions, evaluates them against terminal commands, and tries fresh corrections if tests fail. Built-in image creation runs directly on your existing ChatGPT session without extra credential setup.
Execution fails unless Node.js 18 and an authenticated Codex CLI exist in your path. Defaults flow straight from your ~/.codex/config.toml file unless overridden explicitly per call.
What it helps with
- route repository and directory inspection into Codex CLI
- conduct non-interactive code reviews on pending git diffs
- run automated code edits with shell verification loops
- query local open models via Ollama or LM Studio
Example prompts for the agent
- explain the project layout in
@src/using codex - run codex with sandbox:true to generate a data migration script
- review current changes in the repository with review-changes
How to install codex-mcp-tool
Platform CLI
claude mcp add --env CODEX_MCP_CWD=<CODEX_MCP_CWD> --env CODEX_SESSION_TTL_MS=<CODEX_SESSION_TTL_MS> --env CODEX_MAX_SESSIONS=<CODEX_MAX_SESSIONS> --transport stdio codex-mcp-tool -- npx -y @trishchuk/codex-mcp-toolReplace <…> with your own values
Platform CLI
codex mcp add codex-mcp-tool --env CODEX_MCP_CWD=<CODEX_MCP_CWD> --env CODEX_SESSION_TTL_MS=<CODEX_SESSION_TTL_MS> --env CODEX_MAX_SESSIONS=<CODEX_MAX_SESSIONS> -- npx -y @trishchuk/codex-mcp-toolReplace <…> with your own values
Config file
{
"mcpServers": {
"codex-mcp-tool": {
"command": "npx",
"args": [
"-y",
"@trishchuk/codex-mcp-tool"
],
"env": {
"CODEX_MCP_CWD": "<CODEX_MCP_CWD>",
"CODEX_SESSION_TTL_MS": "<CODEX_SESSION_TTL_MS>",
"CODEX_MAX_SESSIONS": "<CODEX_MAX_SESSIONS>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"codex-mcp-tool": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@trishchuk/codex-mcp-tool"
],
"env": {
"CODEX_MCP_CWD": "<CODEX_MCP_CWD>",
"CODEX_SESSION_TTL_MS": "<CODEX_SESSION_TTL_MS>",
"CODEX_MAX_SESSIONS": "<CODEX_MAX_SESSIONS>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e CODEX_MCP_CWD=<CODEX_MCP_CWD> -e CODEX_SESSION_TTL_MS=<CODEX_SESSION_TTL_MS> -e CODEX_MAX_SESSIONS=<CODEX_MAX_SESSIONS> codex-mcp-tool npx -y @trishchuk/codex-mcp-toolReplace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about codex-mcp-tool
How to install codex-mcp-tool in Claude Code?
Run claude mcp add codex-mcp-tool -- npx -y @trishchuk/codex-mcp-tool in your terminal. You must have Node.js 18 or newer alongside an authenticated Codex CLI installation.
What does codex-mcp-tool do?
It exposes Codex CLI utilities to MCP clients, adding tools for file examination, sandboxed execution, and multi-turn refactoring sessions.
Is an OPENAI_API_KEY required for image generation?
No, the image-gen tool uses Codex's native mechanism tied to your active ChatGPT login, omitting the need for a separate API token.