@leo000001/claude-code-mcp 2.8.1 → 2.8.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 +6 -0
- package/README.md +113 -86
- package/dist/index.js +344 -101
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,12 +8,18 @@
|
|
|
8
8
|
- Expand SDK stream/event mapping for `rate_limit_event`, `system/api_retry`, `system/local_command_output`, `system/elicitation_complete`, `system/compact_boundary`, and partial `stream_event` output.
|
|
9
9
|
- Preserve newer SDK metadata in session/results, including `fastModeState` and richer permission prompt labels (`title`, `displayName`).
|
|
10
10
|
- Prefer SDK permission `suggestions` for `allow_for_session` responses and sync session metadata from `system/init` (for example actual model / permission mode).
|
|
11
|
+
- Add default Claude executable resolution with explicit env overrides (`CLAUDE_CODE_MCP_PATH` / `CLAUDE_CODE_MCP_COMMAND`) and auto-detection order `claude` -> `claude-internal` -> SDK-bundled.
|
|
11
12
|
|
|
12
13
|
### Documentation
|
|
13
14
|
|
|
14
15
|
- Add OpenCode-specific setup and usage guidance, including local MCP config examples and async polling recommendations.
|
|
15
16
|
- Sync README and DESIGN option/message matrices with the current SDK 0.2.81 surface.
|
|
16
17
|
- Add usage reminders in model-visible guidance: long Claude Code runs are normal, and follow-up questions should use `claude_code_reply` with the existing session.
|
|
18
|
+
- Separate agent-visible MCP guidance from repo-only documentation, and move more protocol-critical rules into tool descriptions and resources.
|
|
19
|
+
|
|
20
|
+
### Tests
|
|
21
|
+
|
|
22
|
+
- Add a reusable stdio metadata smoke script to verify agent-visible tool/resource guidance through a real MCP client transport.
|
|
17
23
|
|
|
18
24
|
## 2.5.0 (2026-02-27)
|
|
19
25
|
|
package/README.md
CHANGED
|
@@ -10,6 +10,16 @@ Inspired by the [Codex MCP](https://developers.openai.com/codex/guides/agents-sd
|
|
|
10
10
|
|
|
11
11
|
This package is **CLI-first**: it is intended to run as an MCP server process (`npx @leo000001/claude-code-mcp`), not as a stable programmatic library API.
|
|
12
12
|
|
|
13
|
+
## Visibility Boundary
|
|
14
|
+
|
|
15
|
+
Not every piece of documentation below is visible to an MCP-connected coding agent.
|
|
16
|
+
|
|
17
|
+
- **Usually visible to the agent:** MCP tool names, tool descriptions, input field descriptions, and MCP resources that the client explicitly reads.
|
|
18
|
+
- **Not safe to assume visible:** this `README.md`, `docs/DESIGN.md`, `AGENTS.md`, and other repository files unless the client or orchestrator copies that content into the model context.
|
|
19
|
+
- **Authoring rule:** keep protocol-critical calling rules in tool descriptions and MCP resources first; mirror them in README for humans, but do not rely on README alone.
|
|
20
|
+
|
|
21
|
+
In practice, the most important runtime rules are duplicated in the `claude_code*` tool descriptions and the `quickstart` / `gotchas` / `compat-report` resources so async polling clients can succeed even when they never read this file.
|
|
22
|
+
|
|
13
23
|
## Features
|
|
14
24
|
|
|
15
25
|
- **4 tools** covering the full agent lifecycle: start, continue, check/poll, manage
|
|
@@ -30,9 +40,10 @@ See `CHANGELOG.md` for release history.
|
|
|
30
40
|
- **Node.js >= 18** is required.
|
|
31
41
|
- **Same-platform deployment** — this MCP server is designed to run on the same machine as the MCP client. It communicates via stdio (child process), reads local Claude configuration files from `~/.claude/`, and accesses the local file system directly. Remote deployment is not supported.
|
|
32
42
|
|
|
33
|
-
This MCP server uses the [`@anthropic-ai/claude-agent-sdk`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk) package, which **bundles its own Claude Code CLI** (`cli.js`).
|
|
43
|
+
This MCP server uses the [`@anthropic-ai/claude-agent-sdk`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk) package, which **bundles its own Claude Code CLI** (`cli.js`). When no explicit `pathToClaudeCodeExecutable` is provided, this server now prefers a detected local `claude` command, then `claude-internal`, and falls back to the SDK-bundled CLI if neither is found.
|
|
34
44
|
|
|
35
45
|
- The SDK bundles a Claude Code CLI; its version generally tracks the SDK package version, but the exact scheme is not guaranteed
|
|
46
|
+
- Default executable resolution order is: request-level `pathToClaudeCodeExecutable` -> `CLAUDE_CODE_MCP_PATH` -> `CLAUDE_CODE_MCP_COMMAND` -> auto-detected `claude` -> auto-detected `claude-internal` -> SDK-bundled CLI
|
|
36
47
|
- **Configuration is shared** — the bundled CLI reads API keys and settings from `~/.claude/`, same as the system-installed `claude`
|
|
37
48
|
- **All local settings are loaded by default** — unlike the raw SDK (which defaults to isolation mode), this MCP server loads `user`, `project`, and `local` settings automatically, including `CLAUDE.md` project context. Pass `advanced.settingSources: []` to opt out
|
|
38
49
|
- You must have Claude Code configured (API key set up) before using this MCP server: see [Claude Code documentation](https://docs.anthropic.com/en/docs/claude-code/overview)
|
|
@@ -122,16 +133,19 @@ npm start
|
|
|
122
133
|
|
|
123
134
|
Start a new Claude Code session. The agent autonomously performs coding tasks: reading/writing files, running shell commands, searching code, managing git, and interacting with APIs.
|
|
124
135
|
|
|
136
|
+
Important protocol note: this call starts background work and returns quickly with `sessionId`; it does not return the final result. Callers must poll `claude_code_check(action="poll")`, persist `nextCursor`, and use `claude_code_reply` to continue the same session later.
|
|
137
|
+
|
|
125
138
|
| Parameter | Type | Required | Description |
|
|
126
139
|
| ---------------------------- | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
127
140
|
| `prompt` | string | Yes | Task or question for Claude Code |
|
|
128
141
|
| `cwd` | string | No | Working directory (defaults to server cwd) |
|
|
129
|
-
| `allowedTools` | string[] | No | Auto-approved tool names. Default: `[]` (none).
|
|
142
|
+
| `allowedTools` | string[] | No | Auto-approved tool names. Default: `[]` (none). This is not a strict allowlist unless `strictAllowedTools=true`. Example: `["Bash", "Read", "Write", "Edit"]` |
|
|
143
|
+
| `strictAllowedTools` | boolean | No | Server-side strict allowlist toggle. When `true`, tools outside `allowedTools` are denied. Default: `false` |
|
|
130
144
|
| `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 |
|
|
131
145
|
| `maxTurns` | number | No | Maximum number of agent reasoning steps. Each step may involve one or more tool calls. Default: SDK/Claude Code default |
|
|
132
146
|
| `model` | string | No | Model to use (e.g. `"claude-sonnet-4-5-20250929"`). Default: SDK/Claude Code default |
|
|
133
|
-
| `effort` | string | No | Effort
|
|
134
|
-
| `thinking` | object | No | Thinking
|
|
147
|
+
| `effort` | string | No | Effort string: `"low"`, `"medium"`, `"high"`, `"max"`. Default: SDK/Claude Code default |
|
|
148
|
+
| `thinking` | object | No | Thinking config object, not a string: `{ type: "adaptive" }`, `{ type: "enabled", budgetTokens?: N }`, or `{ type: "disabled" }`. Do not pass `"low"`/`"high"` here. Default: SDK/Claude Code default |
|
|
135
149
|
| `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 |
|
|
136
150
|
| `permissionRequestTimeoutMs` | number | No | Timeout in milliseconds waiting for permission decisions, auto-deny on expiry. Default: `60000` (server-clamped to 5min) |
|
|
137
151
|
| `advanced` | object | No | Advanced/low-frequency parameters (see below) |
|
|
@@ -139,32 +153,32 @@ Start a new Claude Code session. The agent autonomously performs coding tasks: r
|
|
|
139
153
|
<details>
|
|
140
154
|
<summary><code>advanced</code> object parameters (24 low-frequency parameters)</summary>
|
|
141
155
|
|
|
142
|
-
| Parameter | Type | Description
|
|
143
|
-
| ------------------------------------- | ------------------ |
|
|
144
|
-
| `advanced.tools` | string[] \| object |
|
|
145
|
-
| `advanced.persistSession` | boolean | Persist session history to disk (`~/.claude/projects/`). Default: `true`. Set `false` to disable.
|
|
146
|
-
| `advanced.sessionInitTimeoutMs` | number | Session init timeout in milliseconds waiting for `system/init`. Default: `10000`.
|
|
147
|
-
| `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.
|
|
148
|
-
| `advanced.agent` | string | Name of a custom agent (defined in `agents`) to use as the primary agent. Default: omitted
|
|
149
|
-
| `advanced.maxBudgetUsd` | number | Maximum budget in USD. Default: SDK/Claude Code default
|
|
150
|
-
| `advanced.betas` | string[] | Beta features (e.g. `["context-1m-2025-08-07"]`). Default: none
|
|
151
|
-
| `advanced.additionalDirectories` | string[] | Additional directories the agent can access beyond cwd. Default: none
|
|
152
|
-
| `advanced.outputFormat` | object | Structured output: `{ type: "json_schema", schema: {...} }`. Default: omitted (plain text)
|
|
153
|
-
| `advanced.pathToClaudeCodeExecutable` | string | Path to the Claude Code executable. Default: SDK-bundled Claude Code (cli.js)
|
|
154
|
-
| `advanced.mcpServers` | object | MCP server configurations
|
|
155
|
-
| `advanced.sandbox` | object | Sandbox
|
|
156
|
-
| `advanced.fallbackModel` | string | Fallback model if the primary model fails or is unavailable. Default: none
|
|
157
|
-
| `advanced.enableFileCheckpointing` | boolean | Enable file checkpointing to track file changes during the session. Default: `false`
|
|
158
|
-
| `advanced.toolConfig` | object | Per-tool built-in configuration. Example: `{ askUserQuestion: { previewFormat: "html" } }`. Default: none
|
|
159
|
-
| `advanced.includePartialMessages` | boolean | When true, includes intermediate streaming messages in the response. Useful for real-time progress monitoring. Default: false
|
|
160
|
-
| `advanced.promptSuggestions` | boolean | When true, emits post-turn prompt suggestion events (`prompt_suggestion`). Default: `false`
|
|
161
|
-
| `advanced.agentProgressSummaries` | boolean | When true, emits AI-generated summaries on `system/task_progress` events for running subagents. Default: `false`
|
|
162
|
-
| `advanced.strictMcpConfig` | boolean | Enforce strict validation of MCP server configurations. Default: `false`
|
|
163
|
-
| `advanced.settings` | string \| object | Extra Claude Code flag settings. Pass either a path to a settings JSON file or an inline settings object. Default: none
|
|
164
|
-
| `advanced.settingSources` | string[] | Which filesystem settings to load. Defaults to `["user", "project", "local"]` (loads all settings and CLAUDE.md). Pass `[]` for SDK isolation mode
|
|
165
|
-
| `advanced.debug` | boolean | Enable debug mode for verbose logging. Default: `false`
|
|
166
|
-
| `advanced.debugFile` | string | Write debug logs to a specific file path (implicitly enables debug mode). Default: omitted
|
|
167
|
-
| `advanced.env` | object | Environment variables
|
|
156
|
+
| Parameter | Type | Description |
|
|
157
|
+
| ------------------------------------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
158
|
+
| `advanced.tools` | string[] \| object | Visible built-in tool set. Array of exact tool names, `[]` to disable built-ins, or `{ type: "preset", preset: "claude_code" }` for the default set. This controls what Claude can see/call; `allowedTools` only controls pre-approval. |
|
|
159
|
+
| `advanced.persistSession` | boolean | Persist session history to disk (`~/.claude/projects/`). Default: `true`. Set `false` to disable. |
|
|
160
|
+
| `advanced.sessionInitTimeoutMs` | number | Session init timeout in milliseconds waiting for `system/init`. Default: `10000`. |
|
|
161
|
+
| `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. |
|
|
162
|
+
| `advanced.agent` | string | Name of a custom agent (defined in `agents`) to use as the primary agent. Default: omitted |
|
|
163
|
+
| `advanced.maxBudgetUsd` | number | Maximum budget in USD. Default: SDK/Claude Code default |
|
|
164
|
+
| `advanced.betas` | string[] | Beta features (e.g. `["context-1m-2025-08-07"]`). Default: none |
|
|
165
|
+
| `advanced.additionalDirectories` | string[] | Additional directories the agent can access beyond cwd. Default: none |
|
|
166
|
+
| `advanced.outputFormat` | object | Structured output config: `{ type: "json_schema", schema: {...} }`. Default: omitted (plain text) |
|
|
167
|
+
| `advanced.pathToClaudeCodeExecutable` | string | Path to the Claude Code executable. Default: auto-detect `claude`, then `claude-internal`, else SDK-bundled Claude Code (cli.js). |
|
|
168
|
+
| `advanced.mcpServers` | object | MCP server configurations keyed by server name. Default: none |
|
|
169
|
+
| `advanced.sandbox` | object | Sandbox behavior config object. This controls sandbox behavior, not the actual Read/Edit/WebFetch permission rules. Default: SDK/Claude Code default |
|
|
170
|
+
| `advanced.fallbackModel` | string | Fallback model if the primary model fails or is unavailable. Default: none |
|
|
171
|
+
| `advanced.enableFileCheckpointing` | boolean | Enable file checkpointing to track file changes during the session. Default: `false` |
|
|
172
|
+
| `advanced.toolConfig` | object | Per-tool built-in configuration. Example: `{ askUserQuestion: { previewFormat: "html" } }`. Default: none |
|
|
173
|
+
| `advanced.includePartialMessages` | boolean | When true, includes intermediate streaming messages in the response. Useful for real-time progress monitoring. Default: false |
|
|
174
|
+
| `advanced.promptSuggestions` | boolean | When true, emits post-turn prompt suggestion events (`prompt_suggestion`). Default: `false` |
|
|
175
|
+
| `advanced.agentProgressSummaries` | boolean | When true, emits AI-generated summaries on `system/task_progress` events for running subagents. Default: `false` |
|
|
176
|
+
| `advanced.strictMcpConfig` | boolean | Enforce strict validation of MCP server configurations. Default: `false` |
|
|
177
|
+
| `advanced.settings` | string \| object | Extra Claude Code flag settings. Pass either a path to a settings JSON file or an inline settings object. These load at the highest-priority flag-settings layer. Default: none |
|
|
178
|
+
| `advanced.settingSources` | string[] | Which filesystem settings to load. Defaults to `["user", "project", "local"]` (loads all settings and CLAUDE.md). Pass `[]` for SDK isolation mode |
|
|
179
|
+
| `advanced.debug` | boolean | Enable debug mode for verbose logging. Default: `false` |
|
|
180
|
+
| `advanced.debugFile` | string | Write debug logs to a specific file path (implicitly enables debug mode). Default: omitted |
|
|
181
|
+
| `advanced.env` | object | Environment variables merged over `process.env` before launching Claude Code (user values take precedence). Default: inherit `process.env` |
|
|
168
182
|
|
|
169
183
|
</details>
|
|
170
184
|
|
|
@@ -191,56 +205,58 @@ Use `claude_code_check` to poll events and obtain the final `result`.
|
|
|
191
205
|
|
|
192
206
|
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.
|
|
193
207
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
|
197
|
-
|
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
200
|
-
| `
|
|
201
|
-
| `
|
|
202
|
-
| `
|
|
203
|
-
| `
|
|
208
|
+
Important protocol note: prefer `claude_code_reply` over starting a fresh `claude_code` session when you want to continue the same work. This requires a persistent in-memory session, or `diskResumeConfig` when disk resume fallback is enabled.
|
|
209
|
+
|
|
210
|
+
| Parameter | Type | Required | Description |
|
|
211
|
+
| ---------------------------- | ------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
212
|
+
| `sessionId` | string | Yes | Session ID from a previous `claude_code` call |
|
|
213
|
+
| `prompt` | string | Yes | Follow-up prompt |
|
|
214
|
+
| `forkSession` | boolean | No | Create a branched copy of this session. Default: `false` |
|
|
215
|
+
| `effort` | string | No | Effort string override for this run (and for future replies when not forking): `"low"`, `"medium"`, `"high"`, `"max"`. Default: SDK/Claude Code default |
|
|
216
|
+
| `thinking` | object | No | Thinking config object override for this run (and for future replies when not forking): `{ type: "adaptive" }`, `{ type: "enabled", budgetTokens?: N }`, or `{ type: "disabled" }`. Default: SDK/Claude Code default |
|
|
217
|
+
| `permissionRequestTimeoutMs` | number | No | Timeout in milliseconds waiting for permission decisions, auto-deny on expiry. Default: `60000` (server-clamped to 5min) |
|
|
218
|
+
| `sessionInitTimeoutMs` | number | No | Fork init timeout in milliseconds (only when `forkSession=true`). Default: `10000` |
|
|
219
|
+
| `diskResumeConfig` | object | No | Disk resume parameters (see below). Used when `CLAUDE_CODE_MCP_ALLOW_DISK_RESUME=1` and in-memory session is missing |
|
|
204
220
|
|
|
205
221
|
<details>
|
|
206
222
|
<summary><code>diskResumeConfig</code> object parameters (34 disk-resume-only parameters)</summary>
|
|
207
223
|
|
|
208
|
-
| Parameter | Type | Description
|
|
209
|
-
| --------------------------------------------- | ------------------ |
|
|
210
|
-
| `diskResumeConfig.resumeToken` | string | Resume token returned by `claude_code` / `claude_code_reply`. Required for disk resume fallback
|
|
211
|
-
| `diskResumeConfig.cwd` | string | Working directory. Required for disk resume.
|
|
212
|
-
| `diskResumeConfig.allowedTools` | string[] | Auto-approved tool names (see `claude_code`). Default: `[]`
|
|
213
|
-
| `diskResumeConfig.disallowedTools` | string[] | Forbidden tool names (see `claude_code`). Default: `[]`
|
|
214
|
-
| `diskResumeConfig.strictAllowedTools` | boolean |
|
|
215
|
-
| `diskResumeConfig.tools` | string[] \| object | Base tool set (see `claude_code`). Default: SDK/Claude Code default
|
|
216
|
-
| `diskResumeConfig.persistSession` | boolean | Persist session history to disk. Default: `true`
|
|
217
|
-
| `diskResumeConfig.maxTurns` | number | Maximum number of agent reasoning steps. Default: SDK/Claude Code default
|
|
218
|
-
| `diskResumeConfig.model` | string | Model to use. Default: SDK/Claude Code default
|
|
219
|
-
| `diskResumeConfig.systemPrompt` | string \| object | Override the agent's system prompt. Default: SDK/Claude Code default
|
|
220
|
-
| `diskResumeConfig.agents` | object | Custom sub-agent definitions (see `claude_code`). Default: none
|
|
221
|
-
| `diskResumeConfig.agent` | string | Primary agent name (see `claude_code` tool). Default: omitted
|
|
222
|
-
| `diskResumeConfig.maxBudgetUsd` | number | Maximum budget in USD. Default: SDK/Claude Code default
|
|
223
|
-
| `diskResumeConfig.effort` | string | Effort level. Default: SDK/Claude Code default
|
|
224
|
-
| `diskResumeConfig.betas` | string[] | Beta features. Default: none
|
|
225
|
-
| `diskResumeConfig.additionalDirectories` | string[] | Additional directories. Default: none
|
|
226
|
-
| `diskResumeConfig.outputFormat` | object | Structured output
|
|
227
|
-
| `diskResumeConfig.thinking` | object | Thinking
|
|
228
|
-
| `diskResumeConfig.resumeSessionAt` | string | Resume only up to and including a specific message UUID. Default: omitted
|
|
229
|
-
| `diskResumeConfig.pathToClaudeCodeExecutable` | string | Path to Claude Code executable. Default: SDK-bundled Claude Code (cli.js)
|
|
230
|
-
| `diskResumeConfig.mcpServers` | object | MCP server configurations. Default: none
|
|
231
|
-
| `diskResumeConfig.sandbox` | object | Sandbox config
|
|
232
|
-
| `diskResumeConfig.fallbackModel` | string | Fallback model. Default: none
|
|
233
|
-
| `diskResumeConfig.enableFileCheckpointing` | boolean | Enable file checkpointing. Default: `false`
|
|
234
|
-
| `diskResumeConfig.toolConfig` | object | Per-tool built-in configuration. Default: none
|
|
235
|
-
| `diskResumeConfig.includePartialMessages` | boolean | Include intermediate streaming messages. Default: `false`
|
|
236
|
-
| `diskResumeConfig.promptSuggestions` | boolean | Emit post-turn prompt suggestion events (`prompt_suggestion`). Default: `false`
|
|
237
|
-
| `diskResumeConfig.agentProgressSummaries` | boolean | Emit AI-generated subagent progress summaries. Default: `false`
|
|
238
|
-
| `diskResumeConfig.strictMcpConfig` | boolean | Strict MCP config validation. Default: `false`
|
|
239
|
-
| `diskResumeConfig.settings` | string \| object | Extra Claude Code flag settings (path or inline object). Default: none
|
|
240
|
-
| `diskResumeConfig.settingSources` | string[] | Which filesystem settings to load. Default: `["user", "project", "local"]`
|
|
241
|
-
| `diskResumeConfig.debug` | boolean | Debug mode. Default: `false`
|
|
242
|
-
| `diskResumeConfig.debugFile` | string | Debug log file path. Default: omitted
|
|
243
|
-
| `diskResumeConfig.env` | object | Environment variables
|
|
224
|
+
| Parameter | Type | Description |
|
|
225
|
+
| --------------------------------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
226
|
+
| `diskResumeConfig.resumeToken` | string | Resume token returned by `claude_code` / `claude_code_reply`. Required for disk resume fallback |
|
|
227
|
+
| `diskResumeConfig.cwd` | string | Working directory. Required for disk resume. |
|
|
228
|
+
| `diskResumeConfig.allowedTools` | string[] | Auto-approved tool names (see `claude_code`). Default: `[]` |
|
|
229
|
+
| `diskResumeConfig.disallowedTools` | string[] | Forbidden tool names (see `claude_code`). Default: `[]` |
|
|
230
|
+
| `diskResumeConfig.strictAllowedTools` | boolean | Server-side strict allow-list behavior for `allowedTools`. Default: `false` |
|
|
231
|
+
| `diskResumeConfig.tools` | string[] \| object | Base tool set (see `claude_code`). Default: SDK/Claude Code default |
|
|
232
|
+
| `diskResumeConfig.persistSession` | boolean | Persist session history to disk. Default: `true` |
|
|
233
|
+
| `diskResumeConfig.maxTurns` | number | Maximum number of agent reasoning steps. Default: SDK/Claude Code default |
|
|
234
|
+
| `diskResumeConfig.model` | string | Model to use. Default: SDK/Claude Code default |
|
|
235
|
+
| `diskResumeConfig.systemPrompt` | string \| object | Override the agent's system prompt. Default: SDK/Claude Code default |
|
|
236
|
+
| `diskResumeConfig.agents` | object | Custom sub-agent definitions (see `claude_code`). Default: none |
|
|
237
|
+
| `diskResumeConfig.agent` | string | Primary agent name (see `claude_code` tool). Default: omitted |
|
|
238
|
+
| `diskResumeConfig.maxBudgetUsd` | number | Maximum budget in USD. Default: SDK/Claude Code default |
|
|
239
|
+
| `diskResumeConfig.effort` | string | Effort level. Default: SDK/Claude Code default |
|
|
240
|
+
| `diskResumeConfig.betas` | string[] | Beta features. Default: none |
|
|
241
|
+
| `diskResumeConfig.additionalDirectories` | string[] | Additional directories. Default: none |
|
|
242
|
+
| `diskResumeConfig.outputFormat` | object | Structured output config. Default: omitted (plain text) |
|
|
243
|
+
| `diskResumeConfig.thinking` | object | Thinking config object: `{ type: "adaptive" }`, `{ type: "enabled", budgetTokens?: N }`, or `{ type: "disabled" }`. Default: SDK/Claude Code default |
|
|
244
|
+
| `diskResumeConfig.resumeSessionAt` | string | Resume only up to and including a specific message UUID. Default: omitted |
|
|
245
|
+
| `diskResumeConfig.pathToClaudeCodeExecutable` | string | Path to Claude Code executable. Default: auto-detect `claude`, then `claude-internal`, else SDK-bundled Claude Code (cli.js) |
|
|
246
|
+
| `diskResumeConfig.mcpServers` | object | MCP server configurations keyed by server name. Default: none |
|
|
247
|
+
| `diskResumeConfig.sandbox` | object | Sandbox behavior config object. Default: SDK/Claude Code default |
|
|
248
|
+
| `diskResumeConfig.fallbackModel` | string | Fallback model. Default: none |
|
|
249
|
+
| `diskResumeConfig.enableFileCheckpointing` | boolean | Enable file checkpointing. Default: `false` |
|
|
250
|
+
| `diskResumeConfig.toolConfig` | object | Per-tool built-in configuration. Default: none |
|
|
251
|
+
| `diskResumeConfig.includePartialMessages` | boolean | Include intermediate streaming messages. Default: `false` |
|
|
252
|
+
| `diskResumeConfig.promptSuggestions` | boolean | Emit post-turn prompt suggestion events (`prompt_suggestion`). Default: `false` |
|
|
253
|
+
| `diskResumeConfig.agentProgressSummaries` | boolean | Emit AI-generated subagent progress summaries. Default: `false` |
|
|
254
|
+
| `diskResumeConfig.strictMcpConfig` | boolean | Strict MCP config validation. Default: `false` |
|
|
255
|
+
| `diskResumeConfig.settings` | string \| object | Extra Claude Code flag settings (path or inline object), loaded at the highest-priority flag-settings layer. Default: none |
|
|
256
|
+
| `diskResumeConfig.settingSources` | string[] | Which filesystem settings to load. Default: `["user", "project", "local"]` |
|
|
257
|
+
| `diskResumeConfig.debug` | boolean | Debug mode. Default: `false` |
|
|
258
|
+
| `diskResumeConfig.debugFile` | string | Debug log file path (implicitly enables debug). Default: omitted |
|
|
259
|
+
| `diskResumeConfig.env` | object | Environment variables merged over `process.env` (user values override). Default: inherit process.env |
|
|
244
260
|
|
|
245
261
|
</details>
|
|
246
262
|
|
|
@@ -304,6 +320,8 @@ List, inspect, cancel, or interrupt sessions.
|
|
|
304
320
|
|
|
305
321
|
Poll session events/results and approve/deny pending permission requests.
|
|
306
322
|
|
|
323
|
+
Important protocol note: `action="poll"` is the main loop, and `action="respond_permission"` is the only interactive approval flow on this backend. `respond_user_input` is not supported.
|
|
324
|
+
|
|
307
325
|
| Parameter | Type | Required | Description |
|
|
308
326
|
| ------------------- | ------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
309
327
|
| `action` | string | Yes | `"poll"` or `"respond_permission"` |
|
|
@@ -365,7 +383,7 @@ Notes:
|
|
|
365
383
|
- `permission_result` event data is `{ requestId, toolName, behavior, source, message?, interrupt? }` (denial details only present for `deny`).
|
|
366
384
|
- `result.fastModeState` may be present when the SDK reports fast-mode state, and `claude_code_session` surfaces the latest known `fastModeState` for each session.
|
|
367
385
|
- In `"minimal"` mode (default): assistant message events are slimmed (strips `usage`, `model`, `id`, `cache_control` from content blocks); noisy SDK progress subtypes (`tool_progress`, `auth_status`, `system/api_retry`, `system/task_progress`, `system/hook_progress`) are filtered out; `lastEventId`/`lastToolUseId` are omitted; `AgentResult` omits `durationApiMs`/`sessionTotalTurns`/`sessionTotalCostUsd`. Use `responseMode: "full"` or individual `include*` flags to restore any of these.
|
|
368
|
-
- In `"delta_compact"` mode: defaults
|
|
386
|
+
- In `"delta_compact"` mode: defaults minimize per-poll payload size (`events` and top-level `result` omitted unless explicitly enabled via `pollOptions`), while still returning session status/actions/cursors. Note: this does not change the recommended poll interval — `running` sessions should still be polled at >=2 minute intervals.
|
|
369
387
|
|
|
370
388
|
## Usage Example
|
|
371
389
|
|
|
@@ -502,15 +520,24 @@ setx CLAUDE_CODE_GIT_BASH_PATH "C:\Program Files\Git\bin\bash.exe"
|
|
|
502
520
|
|
|
503
521
|
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).
|
|
504
522
|
|
|
505
|
-
| Variable | Description
|
|
506
|
-
| -------------------------------------------- |
|
|
507
|
-
| `CLAUDE_CODE_GIT_BASH_PATH` | Path to `bash.exe` on Windows (see [Windows Support](#windows-support))
|
|
508
|
-
| `
|
|
509
|
-
| `
|
|
510
|
-
| `
|
|
511
|
-
| `
|
|
512
|
-
| `
|
|
513
|
-
| `
|
|
523
|
+
| Variable | Description | Default |
|
|
524
|
+
| -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- |
|
|
525
|
+
| `CLAUDE_CODE_GIT_BASH_PATH` | Path to `bash.exe` on Windows (see [Windows Support](#windows-support)) | Auto-detected |
|
|
526
|
+
| `CLAUDE_CODE_MCP_COMMAND` | Exact command name to resolve from `PATH` as the default Claude executable (for example `claude` or `claude-internal`). Mutually exclusive with `CLAUDE_CODE_MCP_PATH` | _(unset)_ |
|
|
527
|
+
| `CLAUDE_CODE_MCP_PATH` | Explicit filesystem path to use as the default Claude executable. Mutually exclusive with `CLAUDE_CODE_MCP_COMMAND` | _(unset)_ |
|
|
528
|
+
| `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) |
|
|
529
|
+
| `CLAUDE_CODE_MCP_RESUME_SECRET` | HMAC secret used to validate `resumeToken` for disk resume fallback (recommended if disk resume is enabled) | _(unset)_ |
|
|
530
|
+
| `CLAUDE_CODE_MCP_MAX_SESSIONS` | Maximum number of in-memory sessions (set `0` to disable the limit) | `128` |
|
|
531
|
+
| `CLAUDE_CODE_MCP_MAX_PENDING_PERMISSIONS` | Maximum number of outstanding permission requests per session (set `0` to disable the limit) | `64` |
|
|
532
|
+
| `CLAUDE_CODE_MCP_EVENT_BUFFER_MAX_SIZE` | Soft limit for in-memory event buffer per session (`0` is not supported) | `1000` |
|
|
533
|
+
| `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` |
|
|
534
|
+
|
|
535
|
+
### Choosing the default Claude executable
|
|
536
|
+
|
|
537
|
+
- `CLAUDE_CODE_MCP_PATH` and `CLAUDE_CODE_MCP_COMMAND` are mutually exclusive.
|
|
538
|
+
- If neither is set, the server auto-detects `claude`, then `claude-internal`, then falls back to the SDK-bundled CLI.
|
|
539
|
+
- Request-level `pathToClaudeCodeExecutable` still overrides these server defaults.
|
|
540
|
+
- Invalid values for these env vars are treated as startup misconfiguration and will fail the server fast.
|
|
514
541
|
|
|
515
542
|
### How to configure
|
|
516
543
|
|