使用说明
codex-mcp
MCP server wrapping the Codex CLI for code reviews and queries.
Prerequisites
Install the Codex CLI:
npm install -g @openai/codex
Installation
Option 1: Clone and build
git clone git@github.com:jnew00/my-codex-mcp.git
cd my-codex-mcp
npm install
npm run build
Then register it with Claude Code:
claude mcp add --scope user codex -- node /path/to/my-codex-mcp/dist/index.js
Option 2: npx (after publishing to npm)
{
"mcpServers": {
"codex": {
"command": "npx",
"args": ["codex-mcp"]
}
}
}
Tools
Codex runs with --ephemeral and a read-only sandbox, whatever ~/.codex/config.toml says. It can read the repo in its working directory, so it can open files itself; it can't run anything that writes, including most test runners. Calls time out after 20 minutes.
codex
Send a prompt to Codex CLI.
| Name | Type | Required | Description |
|---|---|---|---|
prompt |
string | Yes | Instructions for Codex |
code |
string | No | Code to analyze |
context |
string | No | Additional context |
model |
string | No | Model to use (defaults to config) |
reasoning_effort |
low | medium | high | xhigh |
No | Defaults to high |
cwd |
string | No | Directory Codex runs in |
{
"prompt": "Review src/auth.ts for security issues",
"context": "Node.js backend, security-critical"
}
codex_review
Runs Codex's built-in review mode (codex exec review).
| Name | Type | Required | Description |
|---|---|---|---|
target |
uncommitted | base | commit | custom |
Yes | What to review |
base |
string | For base |
Branch to diff against |
commit |
string | For commit |
Commit SHA |
instructions |
string | For custom |
Review prompt. Codex rejects it with the other targets |
model |
string | No | Model to use |
reasoning_effort |
low | medium | high | xhigh |
No | Defaults to high |
cwd |
string | No | Repo to review (defaults to the server's working directory) |
{ "target": "base", "base": "main" }
Development
npm test # Unit tests
npm run test:integration # Integration tests (calls Codex CLI)
npm run build # Build TypeScript
