@etheaven/codex-mcp-server 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/.claude-plugin/marketplace.json +26 -0
  2. package/.claude-plugin/plugin.json +13 -0
  3. package/.mcp.json +8 -0
  4. package/LICENSE +21 -0
  5. package/README.md +450 -0
  6. package/dist/constants.d.ts +165 -0
  7. package/dist/constants.d.ts.map +1 -0
  8. package/dist/constants.js +154 -0
  9. package/dist/constants.js.map +1 -0
  10. package/dist/index.d.ts +3 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +195 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/tools/ask-codex.tool.d.ts +3 -0
  15. package/dist/tools/ask-codex.tool.d.ts.map +1 -0
  16. package/dist/tools/ask-codex.tool.js +263 -0
  17. package/dist/tools/ask-codex.tool.js.map +1 -0
  18. package/dist/tools/batch-codex.tool.d.ts +3 -0
  19. package/dist/tools/batch-codex.tool.d.ts.map +1 -0
  20. package/dist/tools/batch-codex.tool.js +140 -0
  21. package/dist/tools/batch-codex.tool.js.map +1 -0
  22. package/dist/tools/brainstorm.tool.d.ts +3 -0
  23. package/dist/tools/brainstorm.tool.d.ts.map +1 -0
  24. package/dist/tools/brainstorm.tool.js +171 -0
  25. package/dist/tools/brainstorm.tool.js.map +1 -0
  26. package/dist/tools/fetch-chunk.tool.d.ts +3 -0
  27. package/dist/tools/fetch-chunk.tool.d.ts.map +1 -0
  28. package/dist/tools/fetch-chunk.tool.js +66 -0
  29. package/dist/tools/fetch-chunk.tool.js.map +1 -0
  30. package/dist/tools/index.d.ts +2 -0
  31. package/dist/tools/index.d.ts.map +1 -0
  32. package/dist/tools/index.js +14 -0
  33. package/dist/tools/index.js.map +1 -0
  34. package/dist/tools/registry.d.ts +25 -0
  35. package/dist/tools/registry.d.ts.map +1 -0
  36. package/dist/tools/registry.js +84 -0
  37. package/dist/tools/registry.js.map +1 -0
  38. package/dist/tools/simple-tools.d.ts +5 -0
  39. package/dist/tools/simple-tools.d.ts.map +1 -0
  40. package/dist/tools/simple-tools.js +64 -0
  41. package/dist/tools/simple-tools.js.map +1 -0
  42. package/dist/tools/test-tool.example.d.ts +13 -0
  43. package/dist/tools/test-tool.example.d.ts.map +1 -0
  44. package/dist/tools/test-tool.example.js +34 -0
  45. package/dist/tools/test-tool.example.js.map +1 -0
  46. package/dist/tools/timeout-test.tool.d.ts +3 -0
  47. package/dist/tools/timeout-test.tool.d.ts.map +1 -0
  48. package/dist/tools/timeout-test.tool.js +32 -0
  49. package/dist/tools/timeout-test.tool.js.map +1 -0
  50. package/dist/utils/changeModeChunker.d.ts +11 -0
  51. package/dist/utils/changeModeChunker.d.ts.map +1 -0
  52. package/dist/utils/changeModeChunker.js +93 -0
  53. package/dist/utils/changeModeChunker.js.map +1 -0
  54. package/dist/utils/changeModeParser.d.ts +15 -0
  55. package/dist/utils/changeModeParser.d.ts.map +1 -0
  56. package/dist/utils/changeModeParser.js +67 -0
  57. package/dist/utils/changeModeParser.js.map +1 -0
  58. package/dist/utils/changeModeRunner.d.ts +11 -0
  59. package/dist/utils/changeModeRunner.d.ts.map +1 -0
  60. package/dist/utils/changeModeRunner.js +133 -0
  61. package/dist/utils/changeModeRunner.js.map +1 -0
  62. package/dist/utils/changeModeTranslator.d.ts +8 -0
  63. package/dist/utils/changeModeTranslator.d.ts.map +1 -0
  64. package/dist/utils/changeModeTranslator.js +69 -0
  65. package/dist/utils/changeModeTranslator.js.map +1 -0
  66. package/dist/utils/chunkCache.d.ts +22 -0
  67. package/dist/utils/chunkCache.d.ts.map +1 -0
  68. package/dist/utils/chunkCache.js +163 -0
  69. package/dist/utils/chunkCache.js.map +1 -0
  70. package/dist/utils/codexExecutor.d.ts +47 -0
  71. package/dist/utils/codexExecutor.d.ts.map +1 -0
  72. package/dist/utils/codexExecutor.js +296 -0
  73. package/dist/utils/codexExecutor.js.map +1 -0
  74. package/dist/utils/commandExecutor.d.ts +29 -0
  75. package/dist/utils/commandExecutor.d.ts.map +1 -0
  76. package/dist/utils/commandExecutor.js +158 -0
  77. package/dist/utils/commandExecutor.js.map +1 -0
  78. package/dist/utils/logger.d.ts +20 -0
  79. package/dist/utils/logger.d.ts.map +1 -0
  80. package/dist/utils/logger.js +83 -0
  81. package/dist/utils/logger.js.map +1 -0
  82. package/dist/utils/outputParser.d.ts +26 -0
  83. package/dist/utils/outputParser.d.ts.map +1 -0
  84. package/dist/utils/outputParser.js +174 -0
  85. package/dist/utils/outputParser.js.map +1 -0
  86. package/dist/utils/reviewParser.d.ts +28 -0
  87. package/dist/utils/reviewParser.d.ts.map +1 -0
  88. package/dist/utils/reviewParser.js +87 -0
  89. package/dist/utils/reviewParser.js.map +1 -0
  90. package/dist/utils/workingDirResolver.d.ts +47 -0
  91. package/dist/utils/workingDirResolver.d.ts.map +1 -0
  92. package/dist/utils/workingDirResolver.js +199 -0
  93. package/dist/utils/workingDirResolver.js.map +1 -0
  94. package/package.json +79 -0
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "codex-mcp-server",
3
+ "owner": {
4
+ "name": "Taras Trishchuk"
5
+ },
6
+ "metadata": {
7
+ "description": "Codex CLI MCP server for Claude Code"
8
+ },
9
+ "plugins": [
10
+ {
11
+ "name": "codex-mcp-server",
12
+ "source": {
13
+ "source": "github",
14
+ "repo": "etheaven/codex-mcp-server"
15
+ },
16
+ "description": "MCP server for Codex CLI — use OpenAI Codex (gpt-5.4, gpt-5.3-codex, o3, etc.) directly from Claude Code with model selection, reasoning effort control, and file analysis",
17
+ "version": "1.3.0",
18
+ "author": {
19
+ "name": "Taras Trishchuk"
20
+ },
21
+ "homepage": "https://github.com/etheaven/codex-mcp-server",
22
+ "license": "MIT",
23
+ "keywords": ["mcp", "codex", "openai", "cli", "gpt-5"]
24
+ }
25
+ ]
26
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "codex-mcp-server",
3
+ "version": "1.3.0",
4
+ "description": "MCP server for Codex CLI — use OpenAI Codex (gpt-5.4, gpt-5.3-codex, o3, etc.) directly from Claude Code with model selection, reasoning effort control, and file analysis",
5
+ "author": {
6
+ "name": "Taras Trishchuk"
7
+ },
8
+ "homepage": "https://github.com/etheaven/codex-mcp-server",
9
+ "repository": "https://github.com/etheaven/codex-mcp-server",
10
+ "license": "MIT",
11
+ "keywords": ["mcp", "codex", "openai", "cli", "code-generation", "ai", "gpt-5"],
12
+ "mcpServers": "../.mcp.json"
13
+ }
package/.mcp.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "codex": {
4
+ "command": "npx",
5
+ "args": ["-y", "@etheaven/codex-mcp-server"]
6
+ }
7
+ }
8
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Taras Trishchuk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,450 @@
1
+ # Codex MCP Tool
2
+
3
+ <div align="center">
4
+
5
+ [![GitHub Release](https://img.shields.io/github/v/release/etheaven/codex-mcp-server?logo=github&label=GitHub)](https://github.com/etheaven/codex-mcp-server/releases)
6
+ [![npm version](https://img.shields.io/npm/v/@etheaven/codex-mcp-server)](https://www.npmjs.com/package/@etheaven/codex-mcp-server)
7
+ [![npm downloads](https://img.shields.io/npm/dt/@etheaven/codex-mcp-server)](https://www.npmjs.com/package/@etheaven/codex-mcp-server)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
9
+ [![Open Source](https://img.shields.io/badge/Open%20Source-❤️-red.svg)](https://github.com/etheaven/codex-mcp-server)
10
+
11
+ </div>
12
+
13
+ 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.
14
+
15
+ > **Latest Release (v1.3.0)**: Updated model support — all GPT-5.x series (gpt-5.4, gpt-5.3-codex, etc.), reasoning effort control, and accurate model descriptions for AI clients. [See changelog](#recent-updates)
16
+
17
+ - Ask Codex questions from your MCP client, or brainstorm ideas programmatically.
18
+
19
+ <a href="https://glama.ai/mcp/servers/@etheaven/codex-mcp-server">
20
+ <img width="380" height="200" src="https://glama.ai/mcp/servers/@etheaven/codex-mcp-server/badge" alt="Codex Tool MCP server" />
21
+ </a>
22
+
23
+ ## TLDR: [![Claude](https://img.shields.io/badge/Claude-D97757?logo=claude&logoColor=fff)](#) + Codex CLI
24
+
25
+ Goal: Use Codex directly from your MCP-enabled editor to analyze and edit code efficiently.
26
+
27
+ ## Prerequisites
28
+
29
+ Before using this tool, ensure you have:
30
+
31
+ 1. **[Node.js](https://nodejs.org/)** (v18.0.0 or higher)
32
+ 2. **[Codex CLI](https://github.com/openai/codex)** installed and authenticated
33
+
34
+ > **✅ Cross-Platform Support**: Fully tested and working on Windows, macOS, and Linux (v1.2.4+)
35
+
36
+ ### Install via Claude Code Marketplace (Recommended)
37
+
38
+ In Claude Code, run:
39
+
40
+ ```
41
+ /plugin marketplace add etheaven/codex-mcp-server
42
+ /plugin install codex-mcp-server@codex-mcp-server
43
+ ```
44
+
45
+ ### Alternative: CLI Setup
46
+
47
+ ```bash
48
+ claude mcp add codex-cli -- npx -y @etheaven/codex-mcp-server
49
+ ```
50
+
51
+ ### Verify Installation
52
+
53
+ Type `/mcp` inside Claude Code to verify the Codex MCP is active.
54
+
55
+ ---
56
+
57
+ ## Configuration
58
+
59
+ ### Claude Desktop
60
+
61
+ Add to your Claude Desktop config file:
62
+
63
+ ```json
64
+ {
65
+ "mcpServers": {
66
+ "codex-cli": {
67
+ "command": "npx",
68
+ "args": ["-y", "@etheaven/codex-mcp-server"]
69
+ }
70
+ }
71
+ }
72
+ ```
73
+
74
+ **Config file locations:**
75
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
76
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
77
+ - **Linux**: `~/.config/claude/claude_desktop_config.json`
78
+
79
+ ### Global Installation
80
+
81
+ ```bash
82
+ npm install -g @etheaven/codex-mcp-server
83
+ ```
84
+
85
+ Then use `"command": "codex-mcp"` instead of the npx approach.
86
+
87
+ After updating configuration, restart your terminal session.
88
+
89
+ ## Example Workflow
90
+
91
+ - Natural language: "use codex to explain index.html", "understand this repo with @src", "look for vulnerabilities and suggest fixes"
92
+ - Claude Code: Type `/codex-cli` to access the MCP server tools.
93
+
94
+ ## Usage Examples
95
+
96
+ ### Model Selection
97
+
98
+ ```javascript
99
+ // Use the default model (gpt-5.4)
100
+ 'explain the architecture of @src/';
101
+
102
+ // Use gpt-5.3-codex for complex coding tasks
103
+ 'use codex with model gpt-5.3-codex to refactor @legacy-code.js';
104
+
105
+ // Use gpt-5.4 with high reasoning for deep analysis
106
+ 'use codex with model gpt-5.4 and reasoning high to analyze complex algorithm in @algorithm.py';
107
+
108
+ // Use o4-mini for quick tasks
109
+ 'use codex with model o4-mini to add comments to @utils.js';
110
+
111
+ // Use o3 for deep reasoning
112
+ 'use codex with model o3 to design microservices architecture for @requirements.md';
113
+
114
+ // Use gpt-5-mini for cost-effective tasks
115
+ 'use codex with model gpt-5-mini to summarize @README.md';
116
+ ```
117
+
118
+ ### With File References (using @ syntax)
119
+
120
+ - `ask codex to analyze @src/main.ts and explain what it does`
121
+ - `use codex to summarize @. the current directory`
122
+ - `analyze @package.json and list dependencies`
123
+
124
+ ### General Questions (without files)
125
+
126
+ - `ask codex to explain div centering`
127
+ - `ask codex about best practices for React development related to @src/components/Button.tsx`
128
+
129
+ ### Brainstorming & Ideation
130
+
131
+ - `brainstorm ways to optimize our CI/CD pipeline using SCAMPER method`
132
+ - `use codex to brainstorm 10 innovative features for our app with feasibility analysis`
133
+ - `ask codex to generate product ideas for the healthcare domain with design-thinking approach`
134
+
135
+ ### Codex Approvals & Sandbox
136
+
137
+ Codex CLI supports fine-grained control over permissions and approvals through sandbox modes and approval policies.
138
+
139
+ #### Understanding Parameters
140
+
141
+ **The `sandbox` Parameter (Convenience Flag):**
142
+
143
+ - `sandbox: true` → Enables **fullAuto** mode (equivalent to `fullAuto: true`)
144
+ - `sandbox: false` (default) → Does **NOT** disable sandboxing, just doesn't enable auto mode
145
+ - **Important:** The `sandbox` parameter is a convenience flag, not a security control
146
+
147
+ **Granular Control Parameters:**
148
+
149
+ - `sandboxMode`: Controls file system access level
150
+ - `approvalPolicy`: Controls when user approval is required
151
+ - `fullAuto`: Shorthand for `sandboxMode: "workspace-write"` + `approvalPolicy: "on-failure"`
152
+ - `yolo`: ⚠️ Bypasses all safety checks (dangerous, not recommended)
153
+
154
+ #### Sandbox Modes
155
+
156
+ | Mode | Description | Use Case |
157
+ | --------------------- | ------------------------------------ | ------------------------------------------------- |
158
+ | `read-only` | Analysis only, no file modifications | Code review, exploration, documentation reading |
159
+ | `workspace-write` | Can modify files in workspace | Most development tasks, refactoring, bug fixes |
160
+ | `danger-full-access` | Full system access including network | Advanced automation, CI/CD pipelines |
161
+
162
+ #### Approval Policies
163
+
164
+ | Policy | Description | When to Use |
165
+ | ------------- | -------------------------------- | ----------------------------------- |
166
+ | `never` | No approvals required | Fully trusted automation |
167
+ | `on-request` | Ask before every action | Maximum control, manual review |
168
+ | `on-failure` | Only ask when operations fail | Balanced automation (recommended) |
169
+ | `untrusted` | Maximum paranoia mode | Untrusted code or high-risk changes |
170
+
171
+ #### Configuration Examples
172
+
173
+ **Example 1: Balanced Automation (Recommended)**
174
+
175
+ ```javascript
176
+ {
177
+ "approvalPolicy": "on-failure",
178
+ "sandboxMode": "workspace-write", // Auto-set if omitted in v1.2+
179
+ "model": "gpt-5.4",
180
+ "prompt": "refactor @src/utils for better performance"
181
+ }
182
+ ```
183
+
184
+ **Example 2: Quick Automation (Convenience Mode)**
185
+
186
+ ```javascript
187
+ {
188
+ "sandbox": true, // Equivalent to fullAuto: true
189
+ "model": "gpt-5.4",
190
+ "prompt": "fix type errors in @src/"
191
+ }
192
+ ```
193
+
194
+ **Example 3: Read-Only Analysis**
195
+
196
+ ```javascript
197
+ {
198
+ "sandboxMode": "read-only",
199
+ "model": "gpt-5.4",
200
+ "prompt": "analyze @src/ and explain the architecture"
201
+ }
202
+ ```
203
+
204
+ #### Smart Defaults (v1.2+)
205
+
206
+ Starting from version 1.2.0, the server automatically applies intelligent defaults to prevent permission errors:
207
+
208
+ - ✅ If `approvalPolicy` is set but `sandboxMode` is not → auto-sets `sandboxMode: "workspace-write"`
209
+ - ✅ If `search: true` or `oss: true` → auto-sets `sandboxMode: "workspace-write"` (for network access)
210
+ - ✅ All commands include `--skip-git-repo-check` to prevent errors in non-git environments
211
+
212
+ #### Troubleshooting Permission Errors
213
+
214
+ If you encounter `❌ Permission Error: Operation blocked by sandbox policy`:
215
+
216
+ **Check 1: Verify sandboxMode**
217
+
218
+ ```bash
219
+ # Ensure you're not using read-only mode for write operations
220
+ {
221
+ "sandboxMode": "workspace-write", // Not "read-only"
222
+ "approvalPolicy": "on-failure"
223
+ }
224
+ ```
225
+
226
+ **Check 2: Use convenience flags**
227
+
228
+ ```bash
229
+ # Let the server handle defaults
230
+ {
231
+ "sandbox": true, // Simple automation
232
+ "prompt": "your task"
233
+ }
234
+ ```
235
+
236
+ **Check 3: Update to latest version**
237
+
238
+ ```bash
239
+ # v1.2+ includes smart defaults to prevent permission errors
240
+ npm install -g @etheaven/codex-mcp-server@latest
241
+ ```
242
+
243
+ #### Common Issues
244
+
245
+ **Issue 1: MCP Tool Timeout Error**
246
+
247
+ If you encounter timeout errors when using Codex MCP tools:
248
+
249
+ ```bash
250
+ # Set the MCP tool timeout environment variable (in milliseconds)
251
+ export MCP_TOOL_TIMEOUT=36000000 # 10 hours
252
+
253
+ # For Windows (PowerShell):
254
+ $env:MCP_TOOL_TIMEOUT=36000000
255
+
256
+ # For Windows (CMD):
257
+ set MCP_TOOL_TIMEOUT=36000000
258
+ ```
259
+
260
+ Add this to your shell profile (`~/.bashrc`, `~/.zshrc`, or PowerShell profile) to make it permanent.
261
+
262
+ **Issue 2: Codex Cannot Write Files**
263
+
264
+ If Codex responds with permission errors like "Operation blocked by sandbox policy" or "rejected by user approval settings", configure your Codex CLI settings:
265
+
266
+ Create or edit `~/.codex/config.toml`:
267
+
268
+ ```toml
269
+ # Dynamically generated Codex configuration
270
+ model = "gpt-5.4"
271
+ model_reasoning_effort = "high"
272
+ model_reasoning_summary = "detailed"
273
+ approval_policy = "never"
274
+ sandbox_mode = "danger-full-access"
275
+ disable_response_storage = true
276
+ network_access = true
277
+ ```
278
+
279
+ **⚠️ 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.
280
+
281
+ **Configuration File Locations:**
282
+ - **macOS/Linux**: `~/.codex/config.toml`
283
+ - **Windows**: `%USERPROFILE%\.codex\config.toml`
284
+
285
+ After updating the configuration, restart your MCP client (Claude Desktop, Claude Code, etc.).
286
+
287
+ #### Basic Examples
288
+
289
+ - `use codex to create and run a Python script that processes data`
290
+ - `ask codex to safely test @script.py and explain what it does`
291
+
292
+ **Default Behavior:**
293
+
294
+ - All `codex exec` commands automatically include `--skip-git-repo-check` to avoid unnecessary git repository checks, as not all execution environments are git repositories.
295
+ - This prevents permission errors when running Codex in non-git directories or when git checks would interfere with automation.
296
+
297
+ ### Advanced Examples
298
+
299
+ ```javascript
300
+ // Using ask-codex with specific model and reasoning effort
301
+ 'ask codex using gpt-5.3-codex with reasoning high to refactor @utils/database.js for better performance';
302
+
303
+ // Brainstorming with constraints
304
+ "brainstorm solutions for reducing API latency with constraints: 'must use existing infrastructure, budget under $5k'";
305
+
306
+ // Change mode for structured edits
307
+ 'use codex in change mode to update all console.log to use winston logger in @src/';
308
+ ```
309
+
310
+ ### Tools (for the AI)
311
+
312
+ These tools are designed to be used by the AI assistant.
313
+
314
+ #### Core Tools
315
+
316
+ - **`ask-codex`**: Sends a prompt to Codex via `codex exec`.
317
+ - Supports `@` file references for including file content
318
+ - Optional `model` parameter — recommended models:
319
+ - `gpt-5.4` (default, latest flagship)
320
+ - `gpt-5.3-codex` (best for complex coding)
321
+ - `gpt-5.3-codex-spark` (instant coding, Pro only)
322
+ - `o3` (deep reasoning)
323
+ - `o4-mini` (fast & efficient)
324
+ - `gpt-5-mini` (cost-effective)
325
+ - `gpt-4.1` (1M context, no reasoning)
326
+ - See [full model list](docs/concepts/models.md)
327
+ - Optional `reasoningEffort` parameter: `none`, `minimal`, `low`, `medium`, `high`, `xhigh`
328
+ - `sandbox=true` enables `--full-auto` mode
329
+ - `changeMode=true` returns structured OLD/NEW edits
330
+ - Supports approval policies and sandbox modes
331
+ - **Automatically includes `--skip-git-repo-check`** to prevent permission errors in non-git environments
332
+
333
+ - **`brainstorm`**: Generate novel ideas with structured methodologies.
334
+ - Multiple frameworks: divergent, convergent, SCAMPER, design-thinking, lateral
335
+ - Domain-specific context (software, business, creative, research, product, marketing)
336
+ - Supports same models and `reasoningEffort` as `ask-codex`
337
+ - Configurable idea count and analysis depth
338
+ - Includes feasibility, impact, and innovation scoring
339
+ - Example: `brainstorm prompt:"ways to improve code review process" domain:"software" methodology:"scamper"`
340
+
341
+ - **`ping`**: A simple test tool that echoes back a message.
342
+ - Use to verify MCP connection is working
343
+ - Example: `/codex-cli:ping (MCP) "Hello from Codex MCP!"`
344
+
345
+ - **`help`**: Shows the Codex CLI help text and available commands.
346
+
347
+ #### Advanced Tools
348
+
349
+ - **`fetch-chunk`**: Retrieves cached chunks from changeMode responses.
350
+ - Used for paginating large structured edit responses
351
+ - Requires `cacheKey` and `chunkIndex` parameters
352
+
353
+ - **`timeout-test`**: Test tool for timeout prevention.
354
+ - Runs for a specified duration in milliseconds
355
+ - Useful for testing long-running operations
356
+
357
+ ### Slash Commands (for the User)
358
+
359
+ You can use these commands directly in Claude Code's interface (compatibility with other clients has not been tested).
360
+
361
+ - **/analyze**: Analyzes files or directories using Codex, or asks general questions.
362
+ - **`prompt`** (required): The analysis prompt. Use `@` syntax to include files (e.g., `/analyze prompt:@src/ summarize this directory`) or ask general questions (e.g., `/analyze prompt:Please use a web search to find the latest news stories`).
363
+ - **/sandbox**: Safely tests code or scripts with Codex approval modes.
364
+ - **`prompt`** (required): Code testing request (e.g., `/sandbox prompt:Create and run a Python script that processes CSV data` or `/sandbox prompt:@script.py Test this script safely`).
365
+ - **/help**: Displays the Codex CLI help information.
366
+ - **/ping**: Tests the connection to the server.
367
+ - **`message`** (optional): A message to echo back.
368
+
369
+ ## Recent Updates
370
+
371
+ ### v1.3.0 (2026-03-15)
372
+
373
+ **Model Support Overhaul:**
374
+ - **Updated model list** to March 2026: added gpt-5.4, gpt-5.4-pro, gpt-5.3-codex, gpt-5.3-codex-spark, gpt-5.2-codex, gpt-5.2, gpt-5.1-codex-max, gpt-5.1-codex, gpt-5.1, gpt-5-pro, gpt-5-mini, gpt-5-nano, o3-pro, gpt-4.1-mini, gpt-4.1-nano
375
+ - **Removed deprecated models**: `codex-1` and `codex-mini-latest` (never existed in OpenAI API)
376
+ - **New `reasoningEffort` parameter** for ask-codex, brainstorm, and batch-codex tools — supports `none`, `minimal`, `low`, `medium`, `high`, `xhigh`
377
+ - **Improved tool schema descriptions** with exact valid model IDs to prevent AI clients from inventing model names
378
+ - **Updated default model** recommendation from `gpt-5-codex` to `gpt-5.4`
379
+ - **Comprehensive model documentation** rewrite with per-model reasoning effort support tables
380
+
381
+ ### v1.2.4 (2025-10-27)
382
+
383
+ **🔧 Major Improvement:**
384
+ - **Windows Compatibility Enhancement**: Replaced Node.js native `spawn()` with industry-standard `cross-spawn` package
385
+ - Root cause: Previous `shell: true` fix still failed on some Windows configurations
386
+ - Solution: Use `cross-spawn` (50M+ weekly downloads, used by Webpack/Jest) for automatic Windows `.cmd` handling
387
+ - Benefits:
388
+ - Zero configuration required for Windows users
389
+ - Automatic handling of `.cmd`, `.ps1`, and `.exe` extensions
390
+ - Compatible with both CMD and PowerShell environments
391
+ - <5ms performance overhead
392
+ - Dependencies: Added `cross-spawn@^7.0.6` and `@types/cross-spawn`
393
+
394
+ **🐛 Bug Fixes:**
395
+ - Enhanced ENOENT error diagnostics with Windows-specific 4-step troubleshooting guide
396
+ - Added optional chaining for `stdout`/`stderr` to handle null values in TypeScript strict mode
397
+
398
+ **📝 Documentation:**
399
+ - Added comprehensive Windows troubleshooting section in docs
400
+ - Documented `spawn codex ENOENT` error resolution steps
401
+
402
+ ### v1.2.3 (2025-10-27)
403
+
404
+ **🐛 Bug Fixes:**
405
+ - **Windows Compatibility**: Fixed Codex CLI detection failing on Windows despite proper installation
406
+ - Root cause: `spawn()` with `shell: false` couldn't resolve `.cmd` extensions on Windows
407
+ - Solution: Enabled shell mode for cross-platform command execution
408
+ - Impact: Zero performance impact (~10ms overhead), maintains security with array-form arguments
409
+ - Platforms verified: Windows, macOS, Linux via GitHub Actions CI
410
+
411
+ **📝 Documentation:**
412
+ - Updated all package references from `@trishchuk/codex-mcp-tool` to `@etheaven/codex-mcp-server` (now hosted at etheaven/codex-mcp-server)
413
+ - Enhanced cross-platform setup instructions
414
+
415
+ **🔍 Testing:**
416
+ - CI/CD now validates on Ubuntu, macOS, and Windows across Node.js 18.x, 20.x, and 22.x
417
+
418
+ ### v1.2.2 & Earlier
419
+
420
+ - Smart sandbox mode defaults to prevent permission errors
421
+ - Enhanced debug information for troubleshooting
422
+ - Automatic `--skip-git-repo-check` flag for non-git environments
423
+ - Web search integration with feature flags
424
+ - Structured change mode with pagination support
425
+
426
+ ## Platform Support
427
+
428
+ | Platform | Status | Notes |
429
+ |----------|--------|-------|
430
+ | **Windows** | ✅ Fully Supported | Enhanced in v1.2.4 with cross-spawn |
431
+ | **macOS** | ✅ Fully Supported | Tested on Darwin 23.5.0+ |
432
+ | **Linux** | ✅ Fully Supported | Tested on Ubuntu Latest |
433
+
434
+ **Minimum Requirements:**
435
+ - Node.js v18.0.0 or higher
436
+ - Codex CLI installed and authenticated (`npm install -g @openai/codex`)
437
+
438
+ ## Acknowledgments
439
+
440
+ This project was inspired by the excellent work from [jamubc/gemini-mcp-tool](https://github.com/jamubc/gemini-mcp-tool). Special thanks to [@jamubc](https://github.com/jamubc) for the original MCP server architecture and implementation patterns.
441
+
442
+ ## Contributing
443
+
444
+ Contributions are welcome! Please submit pull requests or report issues through GitHub.
445
+
446
+ ## License
447
+
448
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
449
+
450
+ **Disclaimer:** This is an unofficial, third-party tool and is not affiliated with, endorsed, or sponsored by OpenAI.
@@ -0,0 +1,165 @@
1
+ export declare const LOG_PREFIX = "[CODEX-MCP]";
2
+ export declare const ERROR_MESSAGES: {
3
+ readonly TOOL_NOT_FOUND: "not found in registry";
4
+ readonly NO_PROMPT_PROVIDED: "Please provide a prompt for analysis. Use @ syntax to include files (e.g., '@largefile.js explain what this does') or ask general questions";
5
+ readonly QUOTA_EXCEEDED: "Rate limit exceeded";
6
+ readonly AUTHENTICATION_FAILED: "Authentication failed - please check your OpenAI API key or login status";
7
+ readonly CODEX_NOT_FOUND: "Codex CLI not found - please install with 'npm install -g @openai/codex'";
8
+ readonly SANDBOX_VIOLATION: "Operation blocked by sandbox policy";
9
+ readonly UNSAFE_COMMAND: "Command requires approval or elevated permissions";
10
+ };
11
+ export declare const STATUS_MESSAGES: {
12
+ readonly SANDBOX_EXECUTING: "🔒 Executing CLI command in sandbox/auto mode...";
13
+ readonly CODEX_RESPONSE: "Codex response:";
14
+ readonly AUTHENTICATION_SUCCESS: "✅ Authentication successful";
15
+ readonly PROCESSING_START: "🔍 Starting analysis (may take 5-15 minutes for large codebases)";
16
+ readonly PROCESSING_CONTINUE: "⏳ Still processing...";
17
+ readonly PROCESSING_COMPLETE: "✅ Analysis completed successfully";
18
+ };
19
+ export declare const MODELS: {
20
+ readonly GPT_5_4: "gpt-5.4";
21
+ readonly GPT_5_4_PRO: "gpt-5.4-pro";
22
+ readonly GPT_5_3_CODEX: "gpt-5.3-codex";
23
+ readonly GPT_5_3_CODEX_SPARK: "gpt-5.3-codex-spark";
24
+ readonly GPT_5_2_CODEX: "gpt-5.2-codex";
25
+ readonly GPT_5_2: "gpt-5.2";
26
+ readonly GPT_5_1_CODEX_MAX: "gpt-5.1-codex-max";
27
+ readonly GPT_5_1_CODEX: "gpt-5.1-codex";
28
+ readonly GPT_5_1: "gpt-5.1";
29
+ readonly GPT_5: "gpt-5";
30
+ readonly GPT_5_PRO: "gpt-5-pro";
31
+ readonly GPT_5_CODEX: "gpt-5-codex";
32
+ readonly GPT_5_CODEX_MINI: "gpt-5-codex-mini";
33
+ readonly GPT_5_MINI: "gpt-5-mini";
34
+ readonly GPT_5_NANO: "gpt-5-nano";
35
+ readonly O3: "o3";
36
+ readonly O3_PRO: "o3-pro";
37
+ readonly O4_MINI: "o4-mini";
38
+ readonly GPT_4_1: "gpt-4.1";
39
+ readonly GPT_4_1_MINI: "gpt-4.1-mini";
40
+ readonly GPT_4_1_NANO: "gpt-4.1-nano";
41
+ readonly GPT_4O: "gpt-4o";
42
+ readonly GPT_4O_MINI: "gpt-4o-mini";
43
+ };
44
+ export declare const MODEL_RECOMMENDATIONS: {
45
+ readonly DEFAULT: "gpt-5.4";
46
+ readonly CODING: "gpt-5.3-codex";
47
+ readonly FAST_CODING: "gpt-5.3-codex-spark";
48
+ readonly DEEP_REASONING: "o3";
49
+ readonly FAST_REASONING: "o4-mini";
50
+ readonly COST_EFFECTIVE: "gpt-5-mini";
51
+ readonly LARGE_CONTEXT: "gpt-4.1";
52
+ };
53
+ export declare const REASONING_EFFORTS: {
54
+ readonly NONE: "none";
55
+ readonly MINIMAL: "minimal";
56
+ readonly LOW: "low";
57
+ readonly MEDIUM: "medium";
58
+ readonly HIGH: "high";
59
+ readonly XHIGH: "xhigh";
60
+ };
61
+ export type ReasoningEffort = (typeof REASONING_EFFORTS)[keyof typeof REASONING_EFFORTS];
62
+ export declare const SANDBOX_MODES: {
63
+ readonly READ_ONLY: "read-only";
64
+ readonly WORKSPACE_WRITE: "workspace-write";
65
+ readonly DANGER_FULL_ACCESS: "danger-full-access";
66
+ };
67
+ export declare const APPROVAL_POLICIES: {
68
+ readonly UNTRUSTED: "untrusted";
69
+ readonly ON_FAILURE: "on-failure";
70
+ readonly ON_REQUEST: "on-request";
71
+ readonly NEVER: "never";
72
+ };
73
+ export declare const PROTOCOL: {
74
+ readonly ROLES: {
75
+ readonly USER: "user";
76
+ readonly ASSISTANT: "assistant";
77
+ };
78
+ readonly CONTENT_TYPES: {
79
+ readonly TEXT: "text";
80
+ };
81
+ readonly STATUS: {
82
+ readonly SUCCESS: "success";
83
+ readonly ERROR: "error";
84
+ readonly FAILED: "failed";
85
+ readonly REPORT: "report";
86
+ };
87
+ readonly NOTIFICATIONS: {
88
+ readonly PROGRESS: "notifications/progress";
89
+ };
90
+ readonly KEEPALIVE_INTERVAL: 25000;
91
+ };
92
+ export declare const CLI: {
93
+ readonly COMMANDS: {
94
+ readonly CODEX: "codex";
95
+ readonly CODEX_EXEC: "codex exec";
96
+ readonly ECHO: "echo";
97
+ };
98
+ readonly FLAGS: {
99
+ readonly MODEL: "-m";
100
+ readonly SANDBOX: "-s";
101
+ readonly FULL_AUTO: "--full-auto";
102
+ readonly ASK_FOR_APPROVAL: "--ask-for-approval";
103
+ readonly SANDBOX_MODE: "--sandbox";
104
+ readonly APPROVAL: "-a";
105
+ readonly YOLO: "--dangerously-bypass-approvals-and-sandbox";
106
+ readonly SKIP_GIT_REPO_CHECK: "--skip-git-repo-check";
107
+ readonly CD: "--cd";
108
+ readonly PROMPT: "-p";
109
+ readonly HELP: "-help";
110
+ readonly IMAGE: "-i";
111
+ readonly PROFILE: "--profile";
112
+ readonly CONFIG: "-c";
113
+ readonly VERSION: "--version";
114
+ readonly WORKING_DIR: "-C";
115
+ readonly OSS: "--oss";
116
+ readonly ENABLE: "--enable";
117
+ readonly DISABLE: "--disable";
118
+ };
119
+ readonly DEFAULTS: {
120
+ readonly MODEL: "default";
121
+ readonly BOOLEAN_TRUE: "true";
122
+ readonly BOOLEAN_FALSE: "false";
123
+ };
124
+ readonly ENV_VARS: {
125
+ readonly CODEX_MCP_CWD: "CODEX_MCP_CWD";
126
+ readonly PWD: "PWD";
127
+ readonly INIT_CWD: "INIT_CWD";
128
+ };
129
+ };
130
+ export interface ToolArguments {
131
+ prompt?: string;
132
+ model?: string;
133
+ sandbox?: boolean | string;
134
+ approvalPolicy?: 'never' | 'on-request' | 'on-failure' | 'untrusted';
135
+ approval?: string;
136
+ sandboxMode?: 'read-only' | 'workspace-write' | 'danger-full-access';
137
+ fullAuto?: boolean | string;
138
+ yolo?: boolean | string;
139
+ cd?: string;
140
+ workingDir?: string;
141
+ changeMode?: boolean | string;
142
+ chunkIndex?: number | string;
143
+ chunkCacheKey?: string;
144
+ message?: string;
145
+ reasoningEffort?: string;
146
+ image?: string | string[];
147
+ config?: string | Record<string, any>;
148
+ profile?: string;
149
+ timeout?: number;
150
+ useExec?: boolean;
151
+ includeThinking?: boolean;
152
+ includeMetadata?: boolean;
153
+ search?: boolean;
154
+ oss?: boolean;
155
+ enableFeatures?: string[];
156
+ disableFeatures?: string[];
157
+ methodology?: string;
158
+ domain?: string;
159
+ constraints?: string;
160
+ existingContext?: string;
161
+ ideaCount?: number;
162
+ includeAnalysis?: boolean;
163
+ [key: string]: string | boolean | number | string[] | Record<string, any> | undefined;
164
+ }
165
+ //# sourceMappingURL=constants.d.ts.map