@leo000001/claude-code-mcp 2.0.1 → 2.2.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.
- package/CHANGELOG.md +146 -83
- package/CONTRIBUTING.md +10 -1
- package/NOTICE.md +27 -0
- package/README.md +563 -486
- package/SECURITY.md +4 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1398 -379
- package/dist/index.js.map +1 -1
- package/package.json +14 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,83 +1,146 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## Unreleased
|
|
4
|
-
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
###
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
- `
|
|
25
|
-
- `
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
###
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
### Improvements
|
|
6
|
+
|
|
7
|
+
- Add `CLAUDE_CODE_MCP_MAX_SESSIONS` (default: `128`) to cap in-memory session count and reduce risk of memory exhaustion.
|
|
8
|
+
- Add `CLAUDE_CODE_MCP_MAX_PENDING_PERMISSIONS` (default: `64`) to cap outstanding permission requests per session.
|
|
9
|
+
- Promote `effort` and `thinking` to top-level parameters on `claude_code` and `claude_code_reply` (deprecated aliases: `advanced.effort`, `advanced.thinking`).
|
|
10
|
+
- Tool responses now include `structuredContent` (in addition to JSON text) for easier MCP client consumption.
|
|
11
|
+
- Emit `tools/list_changed` and `resources/list_changed` once after connect; update `claude_code` tool description dynamically when runtime tool discovery changes.
|
|
12
|
+
- Align declared MCP capabilities with implemented primitives (`logging`, `tools`, `resources`) and remove prompt primitive exposure.
|
|
13
|
+
- Add unit tests for `build-options.ts` and `race-with-abort.ts`.
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- Fork resume: restore original session state before creating the forked session record to avoid a brief `AbortController` sharing window.
|
|
18
|
+
- Session totals: prevent `totalTurns`/`totalCostUsd` from being overwritten when SDK-provided session totals look incremental.
|
|
19
|
+
- Permission audit: include allow-side `updatedInput`/`updatedPermissions` in `permission_result` events.
|
|
20
|
+
|
|
21
|
+
### Refactors
|
|
22
|
+
|
|
23
|
+
- Extract shared Zod schema fields for `advanced` and `diskResumeConfig` in `src/server.ts`.
|
|
24
|
+
- Deduplicate `SessionManager.create()` call payloads via a shared helper.
|
|
25
|
+
- Remove `server.close` monkey-patch; perform `sessionManager.destroy()` in the shutdown flow.
|
|
26
|
+
|
|
27
|
+
### Documentation
|
|
28
|
+
|
|
29
|
+
- Changelog: move released 2.x items out of `Unreleased` and add missing 2.0.0–2.0.3 entries.
|
|
30
|
+
- SECURITY: update supported versions table for 2.x.
|
|
31
|
+
- Docs: clarify same-platform assumption (MCP server and client run on the same machine) across README, AGENTS, SECURITY, and mcp_demo.
|
|
32
|
+
|
|
33
|
+
## 2.0.3 (2026-02-15)
|
|
34
|
+
|
|
35
|
+
### Improvements
|
|
36
|
+
|
|
37
|
+
- Version bump only.
|
|
38
|
+
|
|
39
|
+
## 2.0.2 (2026-02-15)
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
- MCP resources: `server-info`, `internal-tools`, and `gotchas`
|
|
44
|
+
- Permission workflow: include timeout/expiration metadata in permission actions; support `updatedInput` normalization
|
|
45
|
+
|
|
46
|
+
### Bug Fixes
|
|
47
|
+
|
|
48
|
+
- Windows: normalize MSYS-style paths for `NotebookEdit` where possible
|
|
49
|
+
|
|
50
|
+
## 2.0.1 (2026-02-15)
|
|
51
|
+
|
|
52
|
+
### Improvements
|
|
53
|
+
|
|
54
|
+
- Refined server schema descriptions/default annotations to reduce token overhead for calling models
|
|
55
|
+
|
|
56
|
+
## 2.0.0 (2026-02-15)
|
|
57
|
+
|
|
58
|
+
### Breaking Changes
|
|
59
|
+
|
|
60
|
+
- `claude_code` and `claude_code_reply` now start asynchronously and return `{ sessionId, status: "running", pollInterval }`. Use `claude_code_check` to poll events and fetch the final `result`.
|
|
61
|
+
- Removed tool: `claude_code_configure`
|
|
62
|
+
- New tool: `claude_code_check` (poll + respond_permission)
|
|
63
|
+
- **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:
|
|
64
|
+
- `claude_code`: 22 low-frequency params moved into `advanced` object (e.g. `effort` → `advanced.effort`, `tools` → `advanced.tools`, `agents` → `advanced.agents`, `env` → `advanced.env`)
|
|
65
|
+
- `claude_code_reply`: 28 disk-resume params moved into `diskResumeConfig` object (e.g. `resumeToken` → `diskResumeConfig.resumeToken`, `cwd` → `diskResumeConfig.cwd`)
|
|
66
|
+
- `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`)
|
|
67
|
+
|
|
68
|
+
### Features
|
|
69
|
+
|
|
70
|
+
- New module: `src/tools/query-consumer.ts` — shared background query consumer (`consumeQuery`) for start, resume, and disk-resume code paths
|
|
71
|
+
- New module: `src/tools/tool-discovery.ts` — runtime tool discovery with `TOOL_CATALOG`, `ToolDiscoveryCache`, and dynamic `claude_code` description generation
|
|
72
|
+
- New module: `src/utils/build-options.ts` — centralized SDK `Partial<Options>` construction from flat input objects
|
|
73
|
+
- New module: `src/utils/race-with-abort.ts` — race a promise against an AbortSignal with cleanup
|
|
74
|
+
- New module: `src/utils/resume-token.ts` — HMAC-SHA256 resume token generation/validation for secure disk resume
|
|
75
|
+
|
|
76
|
+
### Improvements
|
|
77
|
+
|
|
78
|
+
- `claude_code_check`: default `responseMode="minimal"` to reduce payload size; supports `maxEvents` pagination with `truncated`/`truncatedFields`
|
|
79
|
+
- `claude_code_check`: minimal mode now slims assistant message events (strips `usage`, `model`, `id`, `cache_control` from content blocks)
|
|
80
|
+
- `claude_code_check`: minimal mode filters out noisy progress events (`tool_progress`, `auth_status`); use `includeProgressEvents: true` to restore
|
|
81
|
+
- `claude_code_check`: minimal mode omits `lastEventId`/`lastToolUseId` from top-level response and `durationApiMs`/`sessionTotalTurns`/`sessionTotalCostUsd` from AgentResult
|
|
82
|
+
- `claude_code_check`: includes lightweight session diagnostics (`cancelledAt`/`cancelledReason`/`cancelledSource`, `lastEventId`, `lastToolUseId`)
|
|
83
|
+
- Permission result events now include `toolName`, and denial details (`message`, `interrupt`) when applicable
|
|
84
|
+
- Disk resume security: disk resume fallback requires `CLAUDE_CODE_MCP_RESUME_SECRET` + `resumeToken`
|
|
85
|
+
|
|
86
|
+
## 1.6.0 (2026-02-12)
|
|
87
|
+
|
|
88
|
+
### Bug Fixes
|
|
89
|
+
|
|
90
|
+
- Windows: fixed Git Bash auto-detection path derivation and improved candidate search
|
|
91
|
+
|
|
92
|
+
### Security
|
|
93
|
+
|
|
94
|
+
- `claude_code_session includeSensitive=true` no longer leaks extra fields (e.g. `env`, `debugFile`, `mcpServers`, `sandbox`) beyond the documented sensitive set
|
|
95
|
+
|
|
96
|
+
### Documentation
|
|
97
|
+
|
|
98
|
+
- README: clarify `Task` is required for subagent invocation and how `allowedTools` interacts with `mcpServers`
|
|
99
|
+
- README: clarify `includePartialMessages` is not streamed over MCP responses
|
|
100
|
+
|
|
101
|
+
## 1.4.0 (2026-02-11)
|
|
102
|
+
|
|
103
|
+
### Features
|
|
104
|
+
|
|
105
|
+
- New tool: `claude_code_configure` for runtime bypass mode management (enable/disable without restart)
|
|
106
|
+
- New parameters for `claude_code`: `additionalDirectories`, `outputFormat`, `thinking`, `tools`, `timeout`
|
|
107
|
+
- New parameters for `claude_code` and `claude_code_reply`: `pathToClaudeCodeExecutable`, `agent`, `mcpServers`, `sandbox`, `fallbackModel`, `enableFileCheckpointing`, `includePartialMessages`, `strictMcpConfig`, `settingSources`, `debug`, `debugFile`, `env`
|
|
108
|
+
- Effort level now supports `"max"` in addition to low/medium/high
|
|
109
|
+
- `AgentResult` now includes `structuredOutput`, `stopReason`, `errorSubtype`, `usage`, `modelUsage`, `permissionDenials`
|
|
110
|
+
|
|
111
|
+
### Improvements
|
|
112
|
+
|
|
113
|
+
- README: Added Prerequisites section clarifying Claude Code CLI dependency
|
|
114
|
+
- README/DESIGN.md: Updated parameter tables to include all supported parameters
|
|
115
|
+
- DESIGN.md: Updated to reflect 4-tool architecture and current security model
|
|
116
|
+
- SECURITY.md: Fixed inaccurate references to system CLI and env vars
|
|
117
|
+
- Moved `clearTimeout` into `finally` blocks for safer resource cleanup
|
|
118
|
+
- Added `break` after result processing in `claude_code_reply` for consistency
|
|
119
|
+
|
|
120
|
+
### Bug Fixes
|
|
121
|
+
|
|
122
|
+
- Fixed `claude_code_reply` not passing `cwd`/`permissionMode`/`allowDangerouslySkipPermissions` to SDK
|
|
123
|
+
- Fixed falsy filtering dropping valid values like empty arrays and zero
|
|
124
|
+
- Removed unsafe `as any` type assertions where possible
|
|
125
|
+
- Fixed fork overwriting original session status (now restores pre-fork status)
|
|
126
|
+
- Fixed `cancel()` allowing cancellation of non-running sessions
|
|
127
|
+
- Fixed `destroy()` clearing session map while in-flight operations still reference sessions
|
|
128
|
+
- Improved abort detection using SDK's `AbortError` class
|
|
129
|
+
- Added session overwrite guard in `create()`
|
|
130
|
+
- Added `lastActiveAt` update when aborting stuck sessions in cleanup
|
|
131
|
+
|
|
132
|
+
## 1.0.0 (2026-02-11)
|
|
133
|
+
|
|
134
|
+
### Features
|
|
135
|
+
|
|
136
|
+
- Initial release
|
|
137
|
+
- 3 MCP tools: `claude_code`, `claude_code_reply`, `claude_code_session`
|
|
138
|
+
- Session management with resume and fork support
|
|
139
|
+
- Fine-grained permission control (default, acceptEdits, bypassPermissions, plan, delegate, dontAsk)
|
|
140
|
+
- Custom subagent definitions
|
|
141
|
+
- Effort level control (low, medium, high)
|
|
142
|
+
- Beta features support (e.g., 1M context window)
|
|
143
|
+
- Cost and turn tracking per session
|
|
144
|
+
- Session cancellation via AbortController
|
|
145
|
+
- Auto-cleanup for idle (30min) and stuck running (4h) sessions
|
|
146
|
+
- Security: bypassPermissions disabled by default
|
package/CONTRIBUTING.md
CHANGED
|
@@ -35,7 +35,7 @@ npm install
|
|
|
35
35
|
|
|
36
36
|
- Keep PRs focused on a single change
|
|
37
37
|
- Include tests for new functionality
|
|
38
|
-
- Update documentation (README, DESIGN.md) if the public API changes
|
|
38
|
+
- Update documentation (README, docs/DESIGN.md) if the public API changes
|
|
39
39
|
- Ensure CI passes before requesting review
|
|
40
40
|
|
|
41
41
|
## Reporting Issues
|
|
@@ -43,3 +43,12 @@ npm install
|
|
|
43
43
|
- Use GitHub Issues for bug reports and feature requests
|
|
44
44
|
- Include reproduction steps for bugs
|
|
45
45
|
- For security vulnerabilities, see [SECURITY.md](SECURITY.md)
|
|
46
|
+
|
|
47
|
+
## Release Checklist
|
|
48
|
+
|
|
49
|
+
1. Update `CHANGELOG.md` with the upcoming version and confirm `package.json` reflects that version.
|
|
50
|
+
2. Run `npm run format:check`, `npm run lint`, `npm run typecheck` (now covers `src` + `tests`), and `npm test` to prove the working tree is clean.
|
|
51
|
+
3. Build the bundle (`npm run build`) and verify `dist/` contains the expected entry points.
|
|
52
|
+
4. Refresh any documentation (README/CONTRIBUTING/docs) that describe public behavior or APIs touched by the release.
|
|
53
|
+
5. Ensure `NOTICE.md` lists the third-party components bundled in the release and contains links or pointers to their licenses.
|
|
54
|
+
6. Double-check `files`, `bin`, and other package metadata so the published package only ships the intended assets.
|
package/NOTICE.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# NOTICE
|
|
2
|
+
|
|
3
|
+
This project (`@leo000001/claude-code-mcp`) is licensed under the MIT License (see `LICENSE`).
|
|
4
|
+
|
|
5
|
+
## Third-party components
|
|
6
|
+
|
|
7
|
+
This project depends on third-party packages. Their licenses and terms may impose additional
|
|
8
|
+
requirements on redistribution and use.
|
|
9
|
+
|
|
10
|
+
### Direct dependencies (from `package.json`)
|
|
11
|
+
|
|
12
|
+
- `@anthropic-ai/claude-agent-sdk@0.2.38` — license is declared as “SEE LICENSE IN README.md” in the package metadata. This package bundles a Claude Code CLI; please review Anthropic's documentation and legal terms referenced by that project before redistributing or deploying.
|
|
13
|
+
- `@modelcontextprotocol/sdk@1.26.0` — MIT License
|
|
14
|
+
- `zod@4.3.6` — MIT License
|
|
15
|
+
|
|
16
|
+
For a complete dependency graph, see `package-lock.json`. When installed, each dependency’s
|
|
17
|
+
license information is included with the package itself (typically under its `LICENSE` file or
|
|
18
|
+
`package.json` fields).
|
|
19
|
+
|
|
20
|
+
### Optional native dependencies
|
|
21
|
+
|
|
22
|
+
Some optional dependencies pulled in by the Claude Agent SDK (or its transitive dependencies)
|
|
23
|
+
may include prebuilt native binaries with licenses such as LGPL. These packages are platform-
|
|
24
|
+
specific (e.g., `@img/sharp-*` and related `libvips` packages).
|
|
25
|
+
|
|
26
|
+
If you redistribute this project (or produce bundled artifacts), you are responsible for ensuring
|
|
27
|
+
you comply with any applicable third-party license obligations and include required notices.
|