@unitsvc/cc-helper 1.0.15 → 1.0.16

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 (3) hide show
  1. package/README-zh.md +78 -20
  2. package/README.md +78 -8
  3. package/package.json +2 -4
package/README-zh.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  [**English**](./README.md) | **简体中文**
8
8
 
9
- > ⚡ 一键启用 Claude Code CLI 的隐藏功能:`/loop` 和 `/btw`
9
+ > ⚡ 一键启用 Claude Code CLI 的隐藏功能:`/loop`、`/btw` 和 `MCPSearch`
10
10
 
11
11
  ## 环境要求
12
12
 
@@ -20,9 +20,14 @@ npm install -g @anthropic-ai/claude-code@v2.1.71
20
20
  ## 使用方法
21
21
 
22
22
  ```bash
23
- # 启用所有功能(默认)
23
+ # 启用默认功能(/loop, /btw)
24
24
  npx @unitsvc/cc-helper enable
25
25
 
26
+ # 启用特定功能
27
+ npx @unitsvc/cc-helper enable loop
28
+ npx @unitsvc/cc-helper enable btw
29
+ npx @unitsvc/cc-helper enable toolsearch
30
+
26
31
  # 查看状态
27
32
  npx @unitsvc/cc-helper status
28
33
 
@@ -30,25 +35,16 @@ npx @unitsvc/cc-helper status
30
35
  npx @unitsvc/cc-helper disable
31
36
  ```
32
37
 
33
- ### 代理支持
34
-
35
- 如果下载失败,使用 `--proxy` 参数:
36
-
37
- ```bash
38
- # 使用默认代理 (https://edgeone.gh-proxy.org)
39
- npx @unitsvc/cc-helper --proxy enable
40
-
41
- # 使用自定义代理
42
- npx @unitsvc/cc-helper --proxy https://your-proxy.com enable
43
- ```
44
-
45
38
  ### 命令说明
46
39
 
47
- | 命令 | 说明 |
48
- | --------- | ----------------------- |
49
- | `enable` | 启用 `/loop` 和 `/btw` 功能 |
50
- | `disable` | 恢复原始状态 |
51
- | `status` | 查看当前状态 |
40
+ | 命令 | 说明 |
41
+ |---------|-------------|
42
+ | `enable` | 启用 `/loop` 和 `/btw` 功能(默认,不包含 toolsearch) |
43
+ | `enable loop` | 仅启用 `/loop` 功能 |
44
+ | `enable btw` | 仅启用 `/btw` 功能 |
45
+ | `enable toolsearch` | 启用 toolsearch 功能(需要显式激活) |
46
+ | `disable` | 恢复原始状态 |
47
+ | `status` | 查看当前状态及版本要求 |
52
48
 
53
49
  ## 赞助
54
50
 
@@ -132,13 +128,75 @@ cancel the deploy check job # 按描述或 ID 取消
132
128
  /btw 为什么这里要用 async/await?
133
129
  ```
134
130
 
131
+ ## 什么是工具搜索?
132
+
133
+ 工具搜索(Tool Search)是一项允许 Claude 在运行时动态搜索和加载工具的功能,而不是一次性发送所有工具定义。这可以节省 token 并提高性能。
134
+
135
+ ### 为什么为第三方 API 启用?
136
+
137
+ 默认情况下,Claude Code 在使用第三方 API 代理(如 Kimi、自定义端点)时会禁用工具搜索。此功能修改该行为,为这些代理启用工具搜索。
138
+
139
+ ### 优势
140
+
141
+ - **Token 效率**:减少大型 MCP 工具目录的上下文窗口占用
142
+ - **性能提升**:延迟加载工具,响应更快
143
+ - **代理兼容**:支持 Kimi 和其他第三方 Claude API 提供商
144
+
145
+ ### 要求
146
+
147
+ - 您的代理必须支持 API 响应中的 `tool_reference` 块
148
+ - 仅支持 Claude Sonnet 4+ 和 Opus 4+ 模型(不支持 Haiku)
149
+
150
+ ### 配置说明
151
+
152
+ 使用官方 Anthropic API 时,工具搜索默认启用。但当 `ANTHROPIC_BASE_URL` 指向非第一方主机时,工具搜索默认禁用(大多数代理不转发 `tool_reference` 块)。
153
+
154
+ 通过 `ENABLE_TOOL_SEARCH` 环境变量控制工具搜索行为:
155
+
156
+ | 值 | 行为 |
157
+ | ---------- | ------------------------------------------------------ |
158
+ | (未设置) | 默认启用。当 `ANTHROPIC_BASE_URL` 为非第一方主机时禁用 |
159
+ | `true` | 始终启用,包括非第一方 `ANTHROPIC_BASE_URL` |
160
+ | `auto` | 当 MCP 工具超过上下文 10% 时激活 |
161
+ | `auto:<N>` | 自定义阈值激活(如 `auto:5` 表示 5%) |
162
+ | `false` | 禁用,所有 MCP 工具预先加载 |
163
+
164
+ **示例:**
165
+
166
+ ```bash
167
+ # 使用 5% 自定义阈值
168
+ ENABLE_TOOL_SEARCH=auto:5 claude
169
+
170
+ # 完全禁用工具搜索
171
+ ENABLE_TOOL_SEARCH=false claude
172
+
173
+ # 始终启用(适用于支持 tool_reference 的代理)
174
+ ENABLE_TOOL_SEARCH=true claude
175
+ ```
176
+
177
+ 或在 `settings.json` 的 env 字段中设置。
178
+
179
+ #### 禁用 MCPSearch 工具
180
+
181
+ 您还可以使用 `disallowedTools` 设置专门禁用 `MCPSearch` 工具:
182
+
183
+ ```json
184
+ {
185
+ "permissions": {
186
+ "deny": ["MCPSearch"]
187
+ }
188
+ }
189
+ ```
190
+
135
191
  ## 功能特点
136
192
 
137
- - 一键启用 `/loop` `/btw` 功能
193
+ - 一键启用 `/loop`、`/btw` 功能(toolsearch 需要显式激活)
194
+ - 可单独启用特定功能
138
195
  - 轻松恢复原始状态
139
196
  - 自动备份原文件
140
197
  - 零运行时依赖
141
198
  - 跨平台支持
199
+ - 支持版本:2.1.71、2.1.72、2.1.73、2.1.74
142
200
 
143
201
  ### 示例
144
202
 
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  **English** | [**简体中文**](./README-zh.md)
8
8
 
9
- > ⚡ Enable hidden features in Claude Code CLI with one command: `/loop` and `/btw`
9
+ > ⚡ Enable hidden features in Claude Code CLI with one command: `/loop`, `/btw`, and `MCPSearch`
10
10
 
11
11
  ## Requirements
12
12
 
@@ -20,9 +20,14 @@ npm install -g @anthropic-ai/claude-code@v2.1.71
20
20
  ## Usage
21
21
 
22
22
  ```bash
23
- # Enable all features (default)
23
+ # Enable default features (/loop, /btw)
24
24
  npx @unitsvc/cc-helper enable
25
25
 
26
+ # Enable specific features
27
+ npx @unitsvc/cc-helper enable loop
28
+ npx @unitsvc/cc-helper enable btw
29
+ npx @unitsvc/cc-helper enable toolsearch
30
+
26
31
  # Check status
27
32
  npx @unitsvc/cc-helper status
28
33
 
@@ -32,11 +37,14 @@ npx @unitsvc/cc-helper disable
32
37
 
33
38
  ### Commands
34
39
 
35
- | Command | Description |
36
- | --------- | ------------------------ |
37
- | `enable` | Enable `/loop` and `/btw` features |
38
- | `disable` | Restore original |
39
- | `status` | Check current status |
40
+ | Command | Description |
41
+ | ------------------- | ----------------------------------------------------------------- |
42
+ | `enable` | Enable `/loop` and `/btw` features (default, excludes toolsearch) |
43
+ | `enable loop` | Enable only `/loop` feature |
44
+ | `enable btw` | Enable only `/btw` feature |
45
+ | `enable toolsearch` | Enable toolsearch feature (requires explicit activation) |
46
+ | `disable` | Restore original |
47
+ | `status` | Check current status with version requirements |
40
48
 
41
49
  ### Proxy Support
42
50
 
@@ -132,13 +140,75 @@ cancel the deploy check job # Cancel by description or ID
132
140
  /btw why use async/await in this case?
133
141
  ```
134
142
 
143
+ ## What is Tool Search?
144
+
145
+ Tool Search is a feature that allows Claude to dynamically search and load tools at runtime instead of sending all tool definitions upfront. This saves tokens and improves performance.
146
+
147
+ ### Why Enable for Third-Party APIs?
148
+
149
+ By default, Claude Code disables Tool Search when using third-party API proxies (like Kimi, custom endpoints). This feature patches that behavior to enable Tool Search for these proxies.
150
+
151
+ ### Benefits
152
+
153
+ - **Token efficiency**: Reduces context window usage for large MCP tool catalogs
154
+ - **Better performance**: Faster response times with deferred tool loading
155
+ - **Proxy compatibility**: Works with Kimi and other third-party Claude API providers
156
+
157
+ ### Requirements
158
+
159
+ - Your proxy must support `tool_reference` blocks in API responses
160
+ - Works with Claude Sonnet 4+ and Opus 4+ models (not Haiku)
161
+
162
+ ### Configuration
163
+
164
+ Tool Search is enabled by default when using official Anthropic APIs. However, when `ANTHROPIC_BASE_URL` points to a non-first-party host, Tool Search is disabled by default (most proxies do not forward `tool_reference` blocks).
165
+
166
+ Control Tool Search behavior using the `ENABLE_TOOL_SEARCH` environment variable:
167
+
168
+ | Value | Behavior |
169
+ | ---------- | -------------------------------------------------------------------------------- |
170
+ | (unset) | Enabled by default. Disabled when `ANTHROPIC_BASE_URL` is a non-first-party host |
171
+ | `true` | Always enabled, including for non-first-party `ANTHROPIC_BASE_URL` |
172
+ | `auto` | Activates when MCP tools exceed 10% of context |
173
+ | `auto:<N>` | Activates at custom threshold (e.g., `auto:5` for 5%) |
174
+ | `false` | Disabled, all MCP tools loaded upfront |
175
+
176
+ **Examples:**
177
+
178
+ ```bash
179
+ # Use custom 5% threshold
180
+ ENABLE_TOOL_SEARCH=auto:5 claude
181
+
182
+ # Disable tool search entirely
183
+ ENABLE_TOOL_SEARCH=false claude
184
+
185
+ # Always enable (useful for proxies that support tool_reference)
186
+ ENABLE_TOOL_SEARCH=true claude
187
+ ```
188
+
189
+ Or set the value in your `settings.json` env field.
190
+
191
+ #### Disabling MCPSearch Tool
192
+
193
+ You can also disable the `MCPSearch` tool specifically using the `disallowedTools` setting:
194
+
195
+ ```json
196
+ {
197
+ "permissions": {
198
+ "deny": ["MCPSearch"]
199
+ }
200
+ }
201
+ ```
202
+
135
203
  ## Features
136
204
 
137
- - Enable `/loop` and `/btw` with one command
205
+ - Enable `/loop`, `/btw`, and toolsearch with one command
206
+ - Enable specific features individually
138
207
  - Easy restore functionality
139
208
  - Automatic backup
140
209
  - Zero runtime dependencies
141
210
  - Cross-platform support
211
+ - Version support: 2.1.71, 2.1.72, 2.1.73, 2.1.74
142
212
 
143
213
  ### Examples
144
214
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unitsvc/cc-helper",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Claude Code /loop feature bypass tool",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -14,10 +14,8 @@
14
14
  },
15
15
  "keywords": [
16
16
  "claude code",
17
- "claude",
18
17
  "loop",
19
- "cli",
20
- "zai"
18
+ "cli"
21
19
  ],
22
20
  "author": "next-bin",
23
21
  "license": "AGPL-3.0",