@leo000001/claude-code-mcp 2.4.0 → 2.4.6

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.
package/CHANGELOG.md CHANGED
@@ -8,12 +8,17 @@
8
8
 
9
9
  ### Improvements
10
10
 
11
+ - Upgrade `@anthropic-ai/claude-agent-sdk` to `^0.2.49` and align MCP-facing schemas with the current SDK surface.
12
+ - Permission mode enum now follows SDK 0.2.49 (`default`, `acceptEdits`, `bypassPermissions`, `plan`, `dontAsk`; `delegate` removed).
11
13
  - Session cleanup now marks timed-out running/waiting sessions as `cancelled` for consistent status semantics.
12
14
  - `SessionManager.destroy()` now clears in-memory session/runtime maps after aborting active runs, so post-destroy reads are no longer stale.
13
15
  - Event buffer eviction now uses batch compaction (instead of repeated `findIndex` + `splice`) and `readEvents` now uses binary search for cursor start.
14
16
  - Add configurable event-buffer limits via `CLAUDE_CODE_MCP_EVENT_BUFFER_MAX_SIZE` and `CLAUDE_CODE_MCP_EVENT_BUFFER_HARD_MAX_SIZE`.
15
17
  - Runtime tool-discovery updates now notify both tools and resources (internal-tools resource change notification).
16
18
  - Enrich compatibility resources with package version, disk-resume diagnostics, and runtime limits.
19
+ - Remove deprecated `claude_code` parameter aliases: top-level `sessionInitTimeoutMs` and `advanced.effort` / `advanced.thinking`.
20
+ - Add support for SDK `promptSuggestions` option passthrough and expose `promptSuggestions` in `advanced`/`diskResumeConfig`.
21
+ - Query consumer now maps additional SDK stream messages (`system/task_started`, `rate_limit`, `prompt_suggestion`) to progress events.
17
22
 
18
23
  ### Documentation
19
24
 
@@ -88,7 +93,7 @@
88
93
  - New tool: `claude_code_check` (poll + respond_permission)
89
94
  - Legacy `bypassPermissions` mode is no longer exposed in MCP schemas for 2.x.
90
95
  - **Parameter nesting refactor**: low-frequency parameters have been folded into nested objects to reduce top-level clutter. This is a breaking change for callers that pass these parameters at the top level:
91
- - `claude_code`: 22 low-frequency params moved into `advanced` object in 2.0.0 (current versions expose 20 low-frequency params + 2 compatibility aliases: `advanced.effort`, `advanced.thinking`)
96
+ - `claude_code`: 22 low-frequency params moved into `advanced` object in 2.0.0 (including `advanced.effort` / `advanced.thinking`, later removed)
92
97
  - `claude_code_reply`: 28 disk-resume params moved into `diskResumeConfig` object (e.g. `resumeToken` → `diskResumeConfig.resumeToken`, `cwd` → `diskResumeConfig.cwd`)
93
98
  - `claude_code_check`: 9 poll control params moved into `pollOptions` object (e.g. `includeTools` → `pollOptions.includeTools`); 2 permission response params moved into `permissionOptions` object (e.g. `updatedInput` → `permissionOptions.updatedInput`)
94
99
 
package/README.md CHANGED
@@ -79,7 +79,7 @@ codex mcp add claude-code -- npx -y @leo000001/claude-code-mcp
79
79
  Or manually add to `~/.codex/config.toml`:
80
80
 
81
81
  ```toml
82
- [mcp_servers.claude-code]
82
+ [mcp_servers.claude-code-mcp]
83
83
  command = "npx"
84
84
  args = ["-y", "@leo000001/claude-code-mcp"]
85
85
  ```
@@ -110,21 +110,20 @@ Start a new Claude Code session. The agent autonomously performs coding tasks: r
110
110
  | `disallowedTools` | string[] | No | Forbidden tool names. Default: `[]` (none). SDK behavior: disallowed tools are removed from the model's context. Takes precedence over `allowedTools` and will be denied even if later approved interactively |
111
111
  | `maxTurns` | number | No | Maximum number of agent reasoning steps. Each step may involve one or more tool calls. Default: SDK/Claude Code default |
112
112
  | `model` | string | No | Model to use (e.g. `"claude-sonnet-4-5-20250929"`). Default: SDK/Claude Code default |
113
- | `effort` | string | No | Effort level: `"low"`, `"medium"`, `"high"`, `"max"`. Default: SDK/Claude Code default |
114
- | `thinking` | object | No | Thinking mode: `{ type: "adaptive" }`, `{ type: "enabled", budgetTokens: N }`, or `{ type: "disabled" }`. Default: SDK/Claude Code default |
113
+ | `effort` | string | No | Effort level: `"low"`, `"medium"`, `"high"`, `"max"`. Default: SDK/Claude Code default |
114
+ | `thinking` | object | No | Thinking mode: `{ type: "adaptive" }`, `{ type: "enabled", budgetTokens: N }`, or `{ type: "disabled" }`. Default: SDK/Claude Code default |
115
115
  | `systemPrompt` | string \| object | No | Override the agent's system prompt. Default: SDK/Claude Code default. Pass a string for full replacement, or `{ type: "preset", preset: "claude_code", append?: "..." }` to extend the default prompt |
116
- | `permissionRequestTimeoutMs` | number | No | Timeout in milliseconds waiting for permission decisions, auto-deny on expiry. Default: `60000` (server-clamped to 5min) |
117
- | `sessionInitTimeoutMs` | number | No | **Compatibility alias** for `advanced.sessionInitTimeoutMs` (deprecated for `claude_code`). Default: `10000`. If both are provided, `advanced.sessionInitTimeoutMs` wins |
116
+ | `permissionRequestTimeoutMs` | number | No | Timeout in milliseconds waiting for permission decisions, auto-deny on expiry. Default: `60000` (server-clamped to 5min) |
118
117
  | `advanced` | object | No | Advanced/low-frequency parameters (see below) |
119
118
 
120
119
  <details>
121
- <summary><code>advanced</code> object parameters (20 low-frequency parameters)</summary>
120
+ <summary><code>advanced</code> object parameters (21 low-frequency parameters)</summary>
122
121
 
123
122
  | Parameter | Type | Description |
124
123
  | ------------------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
125
124
  | `advanced.tools` | string[] \| object | Define the base tool set. Default: SDK/Claude Code default toolset. Array of tool name strings, or `{ type: "preset", preset: "claude_code" }` for the default toolset. `allowedTools`/`disallowedTools` further filter on top of this |
126
125
  | `advanced.persistSession` | boolean | Persist session history to disk (`~/.claude/projects/`). Default: `true`. Set `false` to disable. |
127
- | `advanced.sessionInitTimeoutMs` | number | Session init timeout in milliseconds waiting for `system/init`. Default: `10000`. **Recommended location for `claude_code` callers.** |
126
+ | `advanced.sessionInitTimeoutMs` | number | Session init timeout in milliseconds waiting for `system/init`. Default: `10000`. |
128
127
  | `advanced.agents` | object | Define custom sub-agents the main agent can delegate tasks to. Default: none. SDK default: if a sub-agent omits `tools`, it inherits all tools from the parent. |
129
128
  | `advanced.agent` | string | Name of a custom agent (defined in `agents`) to use as the primary agent. Default: omitted |
130
129
  | `advanced.maxBudgetUsd` | number | Maximum budget in USD. Default: SDK/Claude Code default |
@@ -137,14 +136,13 @@ Start a new Claude Code session. The agent autonomously performs coding tasks: r
137
136
  | `advanced.fallbackModel` | string | Fallback model if the primary model fails or is unavailable. Default: none |
138
137
  | `advanced.enableFileCheckpointing` | boolean | Enable file checkpointing to track file changes during the session. Default: `false` |
139
138
  | `advanced.includePartialMessages` | boolean | When true, includes intermediate streaming messages in the response. Useful for real-time progress monitoring. Default: false |
139
+ | `advanced.promptSuggestions` | boolean | When true, emits post-turn prompt suggestion events (`prompt_suggestion`). Default: `false` |
140
140
  | `advanced.strictMcpConfig` | boolean | Enforce strict validation of MCP server configurations. Default: `false` |
141
141
  | `advanced.settingSources` | string[] | Which filesystem settings to load. Defaults to `["user", "project", "local"]` (loads all settings and CLAUDE.md). Pass `[]` for SDK isolation mode |
142
142
  | `advanced.debug` | boolean | Enable debug mode for verbose logging. Default: `false` |
143
143
  | `advanced.debugFile` | string | Write debug logs to a specific file path (implicitly enables debug mode). Default: omitted |
144
144
  | `advanced.env` | object | Environment variables to merge with process.env and pass to the Claude Code process (user values take precedence). Default: inherit process.env |
145
145
 
146
- Deprecated aliases: `advanced.effort` and `advanced.thinking` are still accepted for compatibility, but prefer top-level `effort` / `thinking` (top-level wins if both are set).
147
-
148
146
  </details>
149
147
 
150
148
  **Returns:** `{ sessionId, status: "running", pollInterval, resumeToken? }`
@@ -153,7 +151,6 @@ Notes:
153
151
 
154
152
  - `resumeToken` is omitted by default, and is only returned when `CLAUDE_CODE_MCP_RESUME_SECRET` is set on the server.
155
153
  - On error: `{ sessionId: "", status: "error", error }`
156
- - If `sessionInitTimeoutMs` (top-level alias) is used, `claude_code` may return `compatWarnings` to guide migration to `advanced.sessionInitTimeoutMs`.
157
154
 
158
155
  Use `claude_code_check` to poll events and obtain the final `result`.
159
156
 
@@ -169,19 +166,19 @@ Use `claude_code_check` to poll events and obtain the final `result`.
169
166
 
170
167
  Continue an existing session by sending a follow-up message. The agent retains full context from previous turns including files read, code analysis, and conversation history.
171
168
 
172
- | Parameter | Type | Required | Description |
173
- | ---------------------------- | ------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
174
- | `sessionId` | string | Yes | Session ID from a previous `claude_code` call |
175
- | `prompt` | string | Yes | Follow-up prompt |
176
- | `forkSession` | boolean | No | Create a branched copy of this session. Default: `false` |
177
- | `effort` | string | No | Effort level override for this run (and for future replies when not forking). Default: SDK/Claude Code default |
178
- | `thinking` | object | No | Thinking mode override for this run (and for future replies when not forking). Default: SDK/Claude Code default |
169
+ | Parameter | Type | Required | Description |
170
+ | ---------------------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------ |
171
+ | `sessionId` | string | Yes | Session ID from a previous `claude_code` call |
172
+ | `prompt` | string | Yes | Follow-up prompt |
173
+ | `forkSession` | boolean | No | Create a branched copy of this session. Default: `false` |
174
+ | `effort` | string | No | Effort level override for this run (and for future replies when not forking). Default: SDK/Claude Code default |
175
+ | `thinking` | object | No | Thinking mode override for this run (and for future replies when not forking). Default: SDK/Claude Code default |
179
176
  | `permissionRequestTimeoutMs` | number | No | Timeout in milliseconds waiting for permission decisions, auto-deny on expiry. Default: `60000` (server-clamped to 5min) |
180
- | `sessionInitTimeoutMs` | number | No | Fork init timeout in milliseconds (only when `forkSession=true`). Default: `10000` |
181
- | `diskResumeConfig` | object | No | Disk resume parameters (see below). Used when `CLAUDE_CODE_MCP_ALLOW_DISK_RESUME=1` and in-memory session is missing |
177
+ | `sessionInitTimeoutMs` | number | No | Fork init timeout in milliseconds (only when `forkSession=true`). Default: `10000` |
178
+ | `diskResumeConfig` | object | No | Disk resume parameters (see below). Used when `CLAUDE_CODE_MCP_ALLOW_DISK_RESUME=1` and in-memory session is missing |
182
179
 
183
180
  <details>
184
- <summary><code>diskResumeConfig</code> object parameters (28 disk-resume-only parameters)</summary>
181
+ <summary><code>diskResumeConfig</code> object parameters (31 disk-resume-only parameters)</summary>
185
182
 
186
183
  | Parameter | Type | Description |
187
184
  | --------------------------------------------- | ------------------ | ----------------------------------------------------------------------------------------------- |
@@ -189,6 +186,7 @@ Continue an existing session by sending a follow-up message. The agent retains f
189
186
  | `diskResumeConfig.cwd` | string | Working directory. Required for disk resume. |
190
187
  | `diskResumeConfig.allowedTools` | string[] | Auto-approved tool names (see `claude_code`). Default: `[]` |
191
188
  | `diskResumeConfig.disallowedTools` | string[] | Forbidden tool names (see `claude_code`). Default: `[]` |
189
+ | `diskResumeConfig.strictAllowedTools` | boolean | Enforce strict allow-list behavior for `allowedTools`. Default: `false` |
192
190
  | `diskResumeConfig.tools` | string[] \| object | Base tool set (see `claude_code`). Default: SDK/Claude Code default |
193
191
  | `diskResumeConfig.persistSession` | boolean | Persist session history to disk. Default: `true` |
194
192
  | `diskResumeConfig.maxTurns` | number | Maximum number of agent reasoning steps. Default: SDK/Claude Code default |
@@ -209,6 +207,7 @@ Continue an existing session by sending a follow-up message. The agent retains f
209
207
  | `diskResumeConfig.fallbackModel` | string | Fallback model. Default: none |
210
208
  | `diskResumeConfig.enableFileCheckpointing` | boolean | Enable file checkpointing. Default: `false` |
211
209
  | `diskResumeConfig.includePartialMessages` | boolean | Include intermediate streaming messages. Default: `false` |
210
+ | `diskResumeConfig.promptSuggestions` | boolean | Emit post-turn prompt suggestion events (`prompt_suggestion`). Default: `false` |
212
211
  | `diskResumeConfig.strictMcpConfig` | boolean | Strict MCP config validation. Default: `false` |
213
212
  | `diskResumeConfig.settingSources` | string[] | Which filesystem settings to load. Default: `["user", "project", "local"]` |
214
213
  | `diskResumeConfig.debug` | boolean | Debug mode. Default: `false` |
@@ -261,11 +260,11 @@ Resource templates:
261
260
 
262
261
  List, inspect, cancel, or interrupt sessions.
263
262
 
264
- | Parameter | Type | Required | Description |
265
- | ------------------ | ------- | ------------------------- | ------------------------------------------------------------------------------ |
266
- | `action` | string | Yes | `"list"`, `"get"`, `"cancel"`, or `"interrupt"` |
267
- | `sessionId` | string | For get/cancel/interrupt | Target session ID |
268
- | `includeSensitive` | boolean | No | Include `cwd`/`systemPrompt`/`agents`/`additionalDirectories` (default: false) |
263
+ | Parameter | Type | Required | Description |
264
+ | ------------------ | ------- | ------------------------ | ------------------------------------------------------------------------------ |
265
+ | `action` | string | Yes | `"list"`, `"get"`, `"cancel"`, or `"interrupt"` |
266
+ | `sessionId` | string | For get/cancel/interrupt | Target session ID |
267
+ | `includeSensitive` | boolean | No | Include `cwd`/`systemPrompt`/`agents`/`additionalDirectories` (default: false) |
269
268
 
270
269
  **Returns:** `{ sessions, message?, isError? }`
271
270
 
@@ -275,19 +274,19 @@ List, inspect, cancel, or interrupt sessions.
275
274
 
276
275
  Poll session events/results and approve/deny pending permission requests.
277
276
 
278
- | Parameter | Type | Required | Description |
279
- | ------------------- | ------- | ---------------------- | -------------------------------------------------------------------------------------------------------------- |
280
- | `action` | string | Yes | `"poll"` or `"respond_permission"` |
281
- | `sessionId` | string | Yes | Target session ID |
282
- | `cursor` | number | No | Event cursor for incremental polling (`poll` only). Default: omitted (starts from the beginning of the buffer) |
283
- | `responseMode` | string | No | `"minimal"` (default), `"delta_compact"` (lightweight polling), or `"full"` (verbose diagnostics) |
277
+ | Parameter | Type | Required | Description |
278
+ | ------------------- | ------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------- |
279
+ | `action` | string | Yes | `"poll"` or `"respond_permission"` |
280
+ | `sessionId` | string | Yes | Target session ID |
281
+ | `cursor` | number | No | Event cursor for incremental polling (`poll` only). Default: omitted (starts from the beginning of the buffer) |
282
+ | `responseMode` | string | No | `"minimal"` (default), `"delta_compact"` (lightweight polling), or `"full"` (verbose diagnostics) |
284
283
  | `maxEvents` | number | No | Max events per poll (pagination via `nextCursor`). Default: `200` in `"minimal"`; unlimited in `"full"`/`"delta_compact"` |
285
- | `requestId` | string | For respond_permission | Permission request ID |
286
- | `decision` | string | For respond_permission | `"allow"`, `"deny"`, or `"allow_for_session"` |
287
- | `denyMessage` | string | No | Deny reason shown to Claude (`deny` only). Default: `"Permission denied by caller"` |
288
- | `interrupt` | boolean | No | When true, denying also interrupts the whole agent (`deny` only). Default: `false` |
289
- | `pollOptions` | object | No | Fine-grained poll control options (see below) |
290
- | `permissionOptions` | object | No | Advanced permission response options (see below) |
284
+ | `requestId` | string | For respond_permission | Permission request ID |
285
+ | `decision` | string | For respond_permission | `"allow"`, `"deny"`, or `"allow_for_session"` |
286
+ | `denyMessage` | string | No | Deny reason shown to Claude (`deny` only). Default: `"Permission denied by caller"` |
287
+ | `interrupt` | boolean | No | When true, denying also interrupts the whole agent (`deny` only). Default: `false` |
288
+ | `pollOptions` | object | No | Fine-grained poll control options (see below) |
289
+ | `permissionOptions` | object | No | Advanced permission response options (see below) |
291
290
 
292
291
  <details>
293
292
  <summary><code>pollOptions</code> object parameters (10 fine-grained poll controls)</summary>
@@ -298,20 +297,20 @@ Poll session events/results and approve/deny pending permission requests.
298
297
  | `pollOptions.includeEvents` | boolean | When false, omits `events` (but `nextCursor` still advances). Default: `true` |
299
298
  | `pollOptions.includeActions` | boolean | When false, omits `actions[]` even if `waiting_permission`. Default: `true` |
300
299
  | `pollOptions.includeResult` | boolean | When false, omits top-level `result` even when `idle`/`error`. Default: `true` |
301
- | `pollOptions.includeUsage` | boolean | Include `result.usage` (default: `true` in `"full"`, `false` in `"minimal"`/`"delta_compact"`) |
302
- | `pollOptions.includeModelUsage` | boolean | Include `result.modelUsage` (default: `true` in `"full"`, `false` in `"minimal"`/`"delta_compact"`) |
303
- | `pollOptions.includeStructuredOutput` | boolean | Include `result.structuredOutput` (default: `true` in `"full"`, `false` in `"minimal"`/`"delta_compact"`) |
304
- | `pollOptions.includeTerminalEvents` | boolean | When true, keeps terminal `result`/`error` events in `events` even if top-level `result` is included. Default: `false` in `"minimal"`/`"delta_compact"`, `true` in `"full"` |
305
- | `pollOptions.includeProgressEvents` | boolean | When true, includes progress events (`tool_progress`, `auth_status`) in the events stream. Default: `false` in `"minimal"`/`"delta_compact"`, `true` in `"full"` |
306
- | `pollOptions.maxBytes` | number | Approximate max JSON bytes for `events` in this response. When exceeded, events are truncated and `truncatedFields` includes `"events_bytes"`. Default: unlimited |
300
+ | `pollOptions.includeUsage` | boolean | Include `result.usage` (default: `true` in `"full"`, `false` in `"minimal"`/`"delta_compact"`) |
301
+ | `pollOptions.includeModelUsage` | boolean | Include `result.modelUsage` (default: `true` in `"full"`, `false` in `"minimal"`/`"delta_compact"`) |
302
+ | `pollOptions.includeStructuredOutput` | boolean | Include `result.structuredOutput` (default: `true` in `"full"`, `false` in `"minimal"`/`"delta_compact"`) |
303
+ | `pollOptions.includeTerminalEvents` | boolean | When true, keeps terminal `result`/`error` events in `events` even if top-level `result` is included. Default: `false` in `"minimal"`/`"delta_compact"`, `true` in `"full"` |
304
+ | `pollOptions.includeProgressEvents` | boolean | When true, includes progress events (`tool_progress`, `auth_status`) in the events stream. Default: `false` in `"minimal"`/`"delta_compact"`, `true` in `"full"` |
305
+ | `pollOptions.maxBytes` | number | Approximate max JSON bytes for `events` in this response. When exceeded, events are truncated and `truncatedFields` includes `"events_bytes"`. Default: unlimited |
307
306
 
308
307
  </details>
309
308
 
310
309
  <details>
311
310
  <summary><code>permissionOptions</code> object parameters (2 advanced permission response options)</summary>
312
311
 
313
- | Parameter | Type | Description |
314
- | -------------------------------------- | ------ | ----------------------------------------------------------------------- |
312
+ | Parameter | Type | Description |
313
+ | -------------------------------------- | ------ | ------------------------------------------------------------------------------------------- |
315
314
  | `permissionOptions.updatedInput` | object | Modified tool input to run (`allow`/`allow_for_session` only). Default: none |
316
315
  | `permissionOptions.updatedPermissions` | array | Permission rule updates suggested/applied (`allow`/`allow_for_session` only). Default: none |
317
316
 
@@ -414,11 +413,11 @@ For JSON-based MCP clients (Claude Desktop, Cursor, etc.):
414
413
  For OpenAI Codex CLI (`~/.codex/config.toml`):
415
414
 
416
415
  ```toml
417
- [mcp_servers.claude-code]
416
+ [mcp_servers.claude-code-mcp]
418
417
  command = "npx"
419
418
  args = ["-y", "@leo000001/claude-code-mcp"]
420
419
 
421
- [mcp_servers.claude-code.env]
420
+ [mcp_servers.claude-code-mcp.env]
422
421
  CLAUDE_CODE_GIT_BASH_PATH = "C:\\Program Files\\Git\\bin\\bash.exe"
423
422
  ```
424
423
 
@@ -453,15 +452,15 @@ setx CLAUDE_CODE_GIT_BASH_PATH "C:\Program Files\Git\bin\bash.exe"
453
452
 
454
453
  All environment variables are optional. They are set on the MCP server process (not on the Claude Code child process — for that, use the `env` tool parameter).
455
454
 
456
- | Variable | Description | Default |
457
- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -------------- |
458
- | `CLAUDE_CODE_GIT_BASH_PATH` | Path to `bash.exe` on Windows (see [Windows Support](#windows-support)) | Auto-detected |
459
- | `CLAUDE_CODE_MCP_ALLOW_DISK_RESUME` | Set to `1` to allow `claude_code_reply` to resume from on-disk transcripts when the in-memory session is missing | `0` (disabled) |
460
- | `CLAUDE_CODE_MCP_RESUME_SECRET` | HMAC secret used to validate `resumeToken` for disk resume fallback (recommended if disk resume is enabled) | _(unset)_ |
461
- | `CLAUDE_CODE_MCP_MAX_SESSIONS` | Maximum number of in-memory sessions (set `0` to disable the limit) | `128` |
462
- | `CLAUDE_CODE_MCP_MAX_PENDING_PERMISSIONS` | Maximum number of outstanding permission requests per session (set `0` to disable the limit) | `64` |
463
- | `CLAUDE_CODE_MCP_EVENT_BUFFER_MAX_SIZE` | Soft limit for in-memory event buffer per session (`0` is not supported) | `1000` |
464
- | `CLAUDE_CODE_MCP_EVENT_BUFFER_HARD_MAX_SIZE` | Hard limit for in-memory event buffer per session (clamped to be `>= max`; `0` is not supported) | `2000` |
455
+ | Variable | Description | Default |
456
+ | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | -------------- |
457
+ | `CLAUDE_CODE_GIT_BASH_PATH` | Path to `bash.exe` on Windows (see [Windows Support](#windows-support)) | Auto-detected |
458
+ | `CLAUDE_CODE_MCP_ALLOW_DISK_RESUME` | Set to `1` to allow `claude_code_reply` to resume from on-disk transcripts when the in-memory session is missing | `0` (disabled) |
459
+ | `CLAUDE_CODE_MCP_RESUME_SECRET` | HMAC secret used to validate `resumeToken` for disk resume fallback (recommended if disk resume is enabled) | _(unset)_ |
460
+ | `CLAUDE_CODE_MCP_MAX_SESSIONS` | Maximum number of in-memory sessions (set `0` to disable the limit) | `128` |
461
+ | `CLAUDE_CODE_MCP_MAX_PENDING_PERMISSIONS` | Maximum number of outstanding permission requests per session (set `0` to disable the limit) | `64` |
462
+ | `CLAUDE_CODE_MCP_EVENT_BUFFER_MAX_SIZE` | Soft limit for in-memory event buffer per session (`0` is not supported) | `1000` |
463
+ | `CLAUDE_CODE_MCP_EVENT_BUFFER_HARD_MAX_SIZE` | Hard limit for in-memory event buffer per session (clamped to be `>= max`; `0` is not supported) | `2000` |
465
464
 
466
465
  ### How to configure
467
466
 
@@ -482,14 +481,14 @@ All environment variables are optional. They are set on the MCP server process (
482
481
  }
483
482
  ```
484
483
 
485
- **OpenAI Codex CLI** — add an `[mcp_servers.claude-code.env]` section in `~/.codex/config.toml`:
484
+ **OpenAI Codex CLI** — add an `[mcp_servers.claude-code-mcp.env]` section in `~/.codex/config.toml`:
486
485
 
487
486
  ```toml
488
- [mcp_servers.claude-code]
487
+ [mcp_servers.claude-code-mcp]
489
488
  command = "npx"
490
489
  args = ["-y", "@leo000001/claude-code-mcp"]
491
490
 
492
- [mcp_servers.claude-code.env]
491
+ [mcp_servers.claude-code-mcp.env]
493
492
  CLAUDE_CODE_MCP_ALLOW_DISK_RESUME = "1"
494
493
  CLAUDE_CODE_MCP_RESUME_SECRET = "change-me"
495
494
  ```
package/dist/index.js CHANGED
@@ -232,6 +232,7 @@ var SessionManager = class _SessionManager {
232
232
  fallbackModel: params.fallbackModel,
233
233
  enableFileCheckpointing: params.enableFileCheckpointing,
234
234
  includePartialMessages: params.includePartialMessages,
235
+ promptSuggestions: params.promptSuggestions,
235
236
  strictMcpConfig: params.strictMcpConfig,
236
237
  settingSources: params.settingSources,
237
238
  debug: params.debug,
@@ -1236,6 +1237,26 @@ function messageToEvent(msg) {
1236
1237
  }
1237
1238
  };
1238
1239
  }
1240
+ if (msg.type === "system" && msg.subtype === "task_started") {
1241
+ return {
1242
+ type: "progress",
1243
+ data: {
1244
+ type: "task_started",
1245
+ task_id: msg.task_id,
1246
+ tool_use_id: msg.tool_use_id,
1247
+ description: msg.description,
1248
+ task_type: msg.task_type
1249
+ }
1250
+ };
1251
+ }
1252
+ if (msg.type === "rate_limit" || msg.type === "prompt_suggestion") {
1253
+ const rest = { ...msg };
1254
+ delete rest.type;
1255
+ return {
1256
+ type: "progress",
1257
+ data: { type: msg.type, ...rest }
1258
+ };
1259
+ }
1239
1260
  return null;
1240
1261
  }
1241
1262
  function consumeQuery(params) {
@@ -1401,6 +1422,7 @@ function consumeQuery(params) {
1401
1422
  let retryCount = 0;
1402
1423
  let currentStream = activeQuery;
1403
1424
  while (true) {
1425
+ let streamReceivedResult = false;
1404
1426
  try {
1405
1427
  for await (const message of currentStream) {
1406
1428
  if (isSystemInitMessage(message)) {
@@ -1441,6 +1463,7 @@ function consumeQuery(params) {
1441
1463
  continue;
1442
1464
  }
1443
1465
  if (message.type === "result") {
1466
+ streamReceivedResult = true;
1444
1467
  const sessionId2 = message.session_id ?? await getSessionId();
1445
1468
  const agentResult = sdkResultToAgentResult(message);
1446
1469
  const current = params.sessionManager.get(sessionId2);
@@ -1483,7 +1506,7 @@ function consumeQuery(params) {
1483
1506
  queryInterrupt: void 0
1484
1507
  });
1485
1508
  }
1486
- return;
1509
+ continue;
1487
1510
  }
1488
1511
  const sessionId = message.session_id ?? await getSessionId();
1489
1512
  const event = messageToEvent(message);
@@ -1501,7 +1524,7 @@ function consumeQuery(params) {
1501
1524
  `Error [${"INTERNAL" /* INTERNAL */}]: query stream ended before receiving session init.`
1502
1525
  )
1503
1526
  );
1504
- } else if (activeSessionId) {
1527
+ } else if (activeSessionId && !streamReceivedResult) {
1505
1528
  const sessionId = activeSessionId;
1506
1529
  const current = params.sessionManager.get(sessionId);
1507
1530
  if (current && current.status !== "cancelled") {
@@ -1548,6 +1571,9 @@ function consumeQuery(params) {
1548
1571
  );
1549
1572
  return;
1550
1573
  }
1574
+ if (streamReceivedResult) {
1575
+ return;
1576
+ }
1551
1577
  if (!activeSessionId) return;
1552
1578
  const sessionId = activeSessionId;
1553
1579
  if (errClass === "transient" && retryCount < MAX_TRANSIENT_RETRIES) {
@@ -1712,6 +1738,7 @@ function buildOptions(src) {
1712
1738
  opts.enableFileCheckpointing = src.enableFileCheckpointing;
1713
1739
  if (src.includePartialMessages !== void 0)
1714
1740
  opts.includePartialMessages = src.includePartialMessages;
1741
+ if (src.promptSuggestions !== void 0) opts.promptSuggestions = src.promptSuggestions;
1715
1742
  if (src.strictMcpConfig !== void 0) opts.strictMcpConfig = src.strictMcpConfig;
1716
1743
  if (src.settingSources !== void 0) opts.settingSources = src.settingSources;
1717
1744
  else opts.settingSources = DEFAULT_SETTING_SOURCES;
@@ -1750,6 +1777,7 @@ function toSessionCreateParams(input) {
1750
1777
  fallbackModel: src.fallbackModel,
1751
1778
  enableFileCheckpointing: src.enableFileCheckpointing,
1752
1779
  includePartialMessages: src.includePartialMessages,
1780
+ promptSuggestions: src.promptSuggestions,
1753
1781
  strictMcpConfig: src.strictMcpConfig,
1754
1782
  settingSources: src.settingSources ?? DEFAULT_SETTING_SOURCES,
1755
1783
  debug: src.debug,
@@ -1807,18 +1835,7 @@ async function executeClaudeCode(input, sessionManager, serverCwd, toolCache, re
1807
1835
  const abortController = new AbortController();
1808
1836
  const adv = input.advanced ?? {};
1809
1837
  const permissionRequestTimeoutMs = input.permissionRequestTimeoutMs ?? 6e4;
1810
- const sessionInitTimeoutMs = adv.sessionInitTimeoutMs ?? input.sessionInitTimeoutMs ?? 1e4;
1811
- const compatWarnings = [];
1812
- if (input.sessionInitTimeoutMs !== void 0) {
1813
- compatWarnings.push(
1814
- "Top-level sessionInitTimeoutMs for claude_code is a compatibility alias; prefer advanced.sessionInitTimeoutMs."
1815
- );
1816
- }
1817
- if (input.sessionInitTimeoutMs !== void 0 && adv.sessionInitTimeoutMs !== void 0 && input.sessionInitTimeoutMs !== adv.sessionInitTimeoutMs) {
1818
- compatWarnings.push(
1819
- `Both advanced.sessionInitTimeoutMs (${adv.sessionInitTimeoutMs}) and top-level sessionInitTimeoutMs (${input.sessionInitTimeoutMs}) were provided; using advanced.sessionInitTimeoutMs.`
1820
- );
1821
- }
1838
+ const sessionInitTimeoutMs = adv.sessionInitTimeoutMs ?? 1e4;
1822
1839
  const flat = {
1823
1840
  cwd: normalizedCwd,
1824
1841
  allowedTools: input.allowedTools,
@@ -1828,8 +1845,8 @@ async function executeClaudeCode(input, sessionManager, serverCwd, toolCache, re
1828
1845
  model: input.model,
1829
1846
  systemPrompt: input.systemPrompt,
1830
1847
  ...adv,
1831
- effort: input.effort ?? adv.effort,
1832
- thinking: input.thinking ?? adv.thinking
1848
+ effort: input.effort,
1849
+ thinking: input.thinking
1833
1850
  };
1834
1851
  const normalizedFlat = {
1835
1852
  ...flat,
@@ -1873,8 +1890,7 @@ async function executeClaudeCode(input, sessionManager, serverCwd, toolCache, re
1873
1890
  sessionId,
1874
1891
  status: "running",
1875
1892
  pollInterval: 3e3,
1876
- resumeToken: resumeSecret ? computeResumeToken(sessionId, resumeSecret) : void 0,
1877
- compatWarnings: compatWarnings.length > 0 ? compatWarnings : void 0
1893
+ resumeToken: resumeSecret ? computeResumeToken(sessionId, resumeSecret) : void 0
1878
1894
  };
1879
1895
  } catch (err) {
1880
1896
  const message = err instanceof Error ? err.message : String(err);
@@ -3574,7 +3590,7 @@ function registerResources(server, deps) {
3574
3590
  }
3575
3591
 
3576
3592
  // src/server.ts
3577
- var SERVER_VERSION = true ? "2.4.0" : "0.0.0-dev";
3593
+ var SERVER_VERSION = true ? "2.4.6" : "0.0.0-dev";
3578
3594
  function createServerContext(serverCwd) {
3579
3595
  const sessionManager = new SessionManager();
3580
3596
  const server = new McpServer(
@@ -3664,6 +3680,7 @@ function createServerContext(serverCwd) {
3664
3680
  fallbackModel: z.string().optional().describe("Default: none"),
3665
3681
  enableFileCheckpointing: z.boolean().optional().describe("Default: false"),
3666
3682
  includePartialMessages: z.boolean().optional().describe("Default: false"),
3683
+ promptSuggestions: z.boolean().optional().describe("Default: false"),
3667
3684
  strictMcpConfig: z.boolean().optional().describe("Default: false"),
3668
3685
  settingSources: z.array(z.enum(["user", "project", "local"])).optional().describe("Default: ['user','project','local']. []=isolation"),
3669
3686
  debug: z.boolean().optional().describe("Default: false"),
@@ -3671,9 +3688,7 @@ function createServerContext(serverCwd) {
3671
3688
  env: z.record(z.string(), z.string().optional()).optional().describe("Default: none")
3672
3689
  };
3673
3690
  const advancedOptionFieldsSchemaShape = {
3674
- ...sharedOptionFieldsSchemaShape,
3675
- effort: effortOptionSchema.describe("Deprecated, use top-level. Default: SDK"),
3676
- thinking: thinkingOptionSchema.describe("Deprecated, use top-level. Default: SDK")
3691
+ ...sharedOptionFieldsSchemaShape
3677
3692
  };
3678
3693
  const diskResumeOptionFieldsSchemaShape = {
3679
3694
  ...sharedOptionFieldsSchemaShape,
@@ -3764,7 +3779,6 @@ function createServerContext(serverCwd) {
3764
3779
  thinking: thinkingOptionSchema.describe("Default: SDK"),
3765
3780
  systemPrompt: systemPromptSchema.optional().describe("Default: SDK"),
3766
3781
  permissionRequestTimeoutMs: z.number().int().positive().optional().describe("Default: 60000, clamped to 300000"),
3767
- sessionInitTimeoutMs: z.number().int().positive().optional().describe("Deprecated, use advanced.sessionInitTimeoutMs. Default: 10000"),
3768
3782
  advanced: advancedOptionsSchema
3769
3783
  },
3770
3784
  outputSchema: startResultSchema,