dsh-mcp 1.15.0 → 1.15.1
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.en.md +16 -1
- package/CHANGELOG.md +16 -1
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/lib/index.js +68 -12
- package/lib/tool-admission.js +111 -0
- package/package.json +2 -2
package/CHANGELOG.en.md
CHANGED
|
@@ -9,9 +9,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
## Compatibility
|
|
11
11
|
|
|
12
|
-
- **Supported DSH version**: **dsh `0.2.
|
|
12
|
+
- **Supported DSH version**: **dsh `0.2.2-rc.1`** — the latest release is developed and verified on `0.2.2-rc.1` (declared in `package.json` → `dsh.supported`); older entries state the version verified at their time. When the DSH and plugin versions do not match, the Settings page reports a diagnosis (check whether the bundle is selected → restart `dsh web` → hard-refresh → upgrade both sides).
|
|
13
13
|
- **Release convention**: every version entry states `- **Supported DSH version**: dsh <version>`, mirrored in the GitHub Release notes. The release body is written in **Chinese** (matching [CHANGELOG.md](CHANGELOG.md)), with heading levels mirroring the entry.
|
|
14
14
|
|
|
15
|
+
## [1.15.1] - 2026-11-10
|
|
16
|
+
|
|
17
|
+
- **Supported DSH version**: **dsh `0.2.2-rc.1`**
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- **Search mode and per-tool switches were complete no-ops on DSH 0.2.2, which kept injecting every MCP tool (issue #23)**: 0.2.2 no longer hands the tool list to `system-prompt/assemble` — the model-facing set is built by `systemPrompt.tools()` from a **per-step admission set** (`tools.resolve()` → `registration.when(context)`), so "filter an already-built list" is not a thing that can work: a tool outside the set never arrives no matter how it is filtered, and one inside cannot be removed. The result was 314 tools ≈ 305.6 KB ≈ 82k tokens on every request, with `mcp_tool_search` and the checkboxes both inert. The plugin now declares `when` **at registration time**: `installToolControl()` wraps `ctx.tools.register` synchronously before any mount registers a tool, attaching "switched off → refuse; `search` mode → admit only the hot set; `full` mode → admit everything" to every `mcp__*` registration for the core to resolve each step. `mcp_tool_search` sits outside the `mcp__` namespace, so it stays visible and callable — it records the matched tools as hot, which admits them on the next step, which is what finally makes `search` mode save tokens. A caller-supplied `when` is preserved and ANDed after the plugin's admission; cores ≤ 0.2.1 take a single-argument `register`, so the extra `when` is ignored and the existing waterfall filter still applies. Unload/reload restores the original `register` and never overwrites a wrapper added later
|
|
22
|
+
- **The degraded-path log no longer misleads**: when the "no tool list" seam of 0.2.2 is hit but the admission gate is live, the message drops to `info` and states that switches and search mode are enforced at registration time; only a core with neither seam nor admission capability gets a `warn` that the configuration is inert
|
|
23
|
+
- **`toolsList()` now reports `enforcement`**: `admission` (per-step, 0.2.2) / `waterfall` (hook filtering, ≤ 0.2.1) / `unavailable` (neither), so the settings page and diagnostics can tell whether the injection mode and switches actually take effect
|
|
24
|
+
|
|
25
|
+
### Notes
|
|
26
|
+
|
|
27
|
+
- New `test/tool-admission.test.mjs` (no DSH module closure — runs anywhere): covers ① the admission matrix (`search`/`full` × switches × hot set); ② only the `mcp__` namespace is wrapped, `mcp_tool_search` and ordinary tools are untouched; ③ a caller-supplied `when` is preserved and can still veto; ④ the ≤ 0.2.1 single-argument registration shape is unchanged; ⑤ idempotent install and disposer restoration
|
|
28
|
+
- No client source changes: `lib/client.js` rebuilds byte-for-byte identically
|
|
29
|
+
|
|
15
30
|
## [1.15.0] - 2026-11-06
|
|
16
31
|
|
|
17
32
|
- **Supported DSH version**: **dsh `0.2.0-rc.2`** (this release also lets the plugin load on `0.2.2-rc.1`, see below)
|
package/CHANGELOG.md
CHANGED
|
@@ -9,9 +9,24 @@
|
|
|
9
9
|
|
|
10
10
|
## 兼容性
|
|
11
11
|
|
|
12
|
-
- **支持版本**:**dsh `0.2.
|
|
12
|
+
- **支持版本**:**dsh `0.2.2-rc.1`** —— 最新版本在 `0.2.2-rc.1` 上开发与验证(`package.json` → `dsh.supported` 同步声明);历史版本条目各自声明当时验证的版本。DSH 与插件版本不匹配时,设置页会给出排查诊断(核对 bundle 是否已选中 → 重启 `dsh web` → 硬刷新 → 同步升级)。
|
|
13
13
|
- **发版约定**:每个版本条目都要声明 `- **支持版本**:dsh <版本>`,并在 GitHub Release notes 中同步。Release 正文用**中文**(与本文档一致),标题层级与条目一致。
|
|
14
14
|
|
|
15
|
+
## [1.15.1] - 2026-11-10
|
|
16
|
+
|
|
17
|
+
- **支持版本**:**dsh `0.2.2-rc.1`**
|
|
18
|
+
|
|
19
|
+
### 修复
|
|
20
|
+
|
|
21
|
+
- **DSH 0.2.2 上「按需检索」与单工具开关完全失效,每轮仍注入全部 MCP 工具(issue #23)**:0.2.2 不再把工具列表交给 `system-prompt/assemble`——模型可见的工具集由 `systemPrompt.tools()` 按**每步准入集合**(`tools.resolve()` → `registration.when(context)`)构建,因此「过滤一份已经建好的列表」这条路不复存在:集合外的工具再怎么过滤也进不来,集合内的也删不掉。结果是 314 个工具 ≈ 305.6 KB ≈ 82k tokens 每轮全量注入,`mcp_tool_search` 与勾选开关都成了空操作。现在改为在**注册时**声明 `when`:`installToolControl()` 在任何挂载注册工具之前同步包装 `ctx.tools.register`,为 `mcp__*` 注册挂上「被开关禁用 → 拒绝;`search` 模式 → 仅热集合准入;`full` 模式 → 全部准入」的条件,由核心逐步求值。`mcp_tool_search` 不在 `mcp__` 命名空间内,始终可见可调用——它把命中工具写入热集合,下一步即被准入,`search` 模式这才真正省下 token。调用方自带的 `when` 会保留并与插件准入相与;≤ 0.2.1 的核心 `register` 只接受一个参数,多余的 `when` 被忽略,原有 waterfall 过滤路径照旧生效。插件卸载/重载时还原原始 `register`,且不会覆盖后续插件加的包装
|
|
22
|
+
- **降级日志不再误导**:命中 0.2.2 的「无工具列表」接缝时,若准入门已生效则降为 `info`,说明「开关与 search 模式已在注册期由准入 `when` 执行」;只有核心既无该接缝又无准入能力时才 `warn`「配置不生效」
|
|
23
|
+
- **`toolsList()` 新增 `enforcement`**:取值 `admission`(0.2.2 按步准入)/ `waterfall`(≤ 0.2.1 钩子过滤)/ `unavailable`(两者皆无),设置页与诊断可据此判断注入模式与工具开关是否真的生效
|
|
24
|
+
|
|
25
|
+
### 说明
|
|
26
|
+
|
|
27
|
+
- 新增 `test/tool-admission.test.mjs`(不依赖 DSH 模块闭包,任何环境都会执行):覆盖 ① 准入判定矩阵(`search`/`full` × 开关 × 热集合);② 只包装 `mcp__` 命名空间、`mcp_tool_search` 与普通工具不受影响;③ 调用方 `when` 保留且仍可否决;④ ≤ 0.2.1 单参数注册形态不变;⑤ 幂等安装与卸载还原
|
|
28
|
+
- 未改客户端源码:`lib/client.js` 重建后字节零变化
|
|
29
|
+
|
|
15
30
|
## [1.15.0] - 2026-11-06
|
|
16
31
|
|
|
17
32
|
- **支持版本**:**dsh `0.2.0-rc.2`**(本版本同时让插件可在 `0.2.2-rc.1` 上加载,见下)
|
package/README.en.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://dshfind.com/en/plugins/ArvinQi/dsh-mcp?ref=badge)
|
|
4
4
|
|
|
5
|
-
> **Supported DSH version**: `dsh 0.2.
|
|
5
|
+
> **Supported DSH version**: `dsh 0.2.2-rc.1` — the latest release is developed and verified on `0.2.2-rc.1`, declared in `package.json` → `dsh.supported`. When the DSH and plugin versions do not match, the Settings page shows a diagnosis (check whether the bundle is selected → restart `dsh web` → hard-refresh → upgrade both sides).
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://dshfind.com/zh/plugins/ArvinQi/dsh-mcp?ref=badge)
|
|
6
6
|
|
|
7
|
-
> **支持版本**:`dsh 0.2.
|
|
7
|
+
> **支持版本**:`dsh 0.2.2-rc.1` —— 最新版本在 `0.2.2-rc.1` 上开发与验证,`package.json` → `dsh.supported` 同步声明。DSH 与插件两侧版本不匹配时,设置页会给出排查诊断(检查 bundle 是否已选中 → 重启 `dsh web` → 硬刷新 → 同步升级)。
|
|
8
8
|
|
|
9
9
|

|
|
10
10
|
|
package/lib/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { probeConnection } from "./probe.js";
|
|
|
8
8
|
import { Remote, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
9
9
|
import { hostText } from "./host-locales.js";
|
|
10
10
|
import { applyToolControl } from "./tool-assembly.js";
|
|
11
|
+
import { installAdmissionGate, shouldAdmitTool } from "./tool-admission.js";
|
|
11
12
|
import { readDeclaredServers, toMirrorRecord } from "./cordis-servers.js";
|
|
12
13
|
import { managedIds, writeManagedIds } from "./patch-writer.js";
|
|
13
14
|
import z from "@deepseek-ai/schemastery";
|
|
@@ -624,6 +625,19 @@ let McpManagerService = (() => {
|
|
|
624
625
|
/** LRU bound for {@link hotTools}. */
|
|
625
626
|
static HOT_LIMIT = 60;
|
|
626
627
|
/**
|
|
628
|
+
* Restores the patched `ctx.tools.register`; set only on cores that expose
|
|
629
|
+
* the per-step admission seam (DSH ≥ 0.2.2, see lib/tool-admission.js).
|
|
630
|
+
*/
|
|
631
|
+
disposeAdmissionGate;
|
|
632
|
+
/** Whether the adapter's registration gate is enforcing switches and `search` mode. */
|
|
633
|
+
admissionGateInstalled = false;
|
|
634
|
+
/**
|
|
635
|
+
* Set once a `system-prompt/assemble` payload arrives without a tool list,
|
|
636
|
+
* i.e. the core moved admission outside the waterfall. Distinguishes "the
|
|
637
|
+
* gate carries this core" from "nothing filters here".
|
|
638
|
+
*/
|
|
639
|
+
assembleSeamBlocked = false;
|
|
640
|
+
/**
|
|
627
641
|
* @param ctx - Host context carrying storage, credentials, and the tool registry.
|
|
628
642
|
* @param config - Resolved manager configuration.
|
|
629
643
|
*/
|
|
@@ -1893,12 +1907,41 @@ let McpManagerService = (() => {
|
|
|
1893
1907
|
return s;
|
|
1894
1908
|
}
|
|
1895
1909
|
/**
|
|
1896
|
-
* Register the `mcp_tool_search` model tool and the
|
|
1897
|
-
*
|
|
1898
|
-
*
|
|
1899
|
-
*
|
|
1910
|
+
* Register the `mcp_tool_search` model tool and the two seams that decide
|
|
1911
|
+
* which MCP tools the model sees: a registration-time admission gate for
|
|
1912
|
+
* cores that resolve tools per step (DSH ≥ 0.2.2) and the
|
|
1913
|
+
* `system-prompt/assemble` transform for cores that still hand the tool
|
|
1914
|
+
* list to the waterfall (≤ 0.2.1). Also tracks the hot set on real calls.
|
|
1915
|
+
*
|
|
1916
|
+
* The gate is installed first, and synchronously: `reconcileDeclared()`
|
|
1917
|
+
* mounts servers asynchronously, so wrapping before this point catches
|
|
1918
|
+
* every registration a mount will make.
|
|
1900
1919
|
*/
|
|
1901
1920
|
installToolControl() {
|
|
1921
|
+
// DSH ≥ 0.2.2 builds the model-facing list from a per-step admission
|
|
1922
|
+
// set, so filtering inside `system-prompt/assemble` has nothing to
|
|
1923
|
+
// filter (the hook never receives `tools`). Declaring `when` at
|
|
1924
|
+
// registration time is the seam that still works, and it is what makes
|
|
1925
|
+
// `search` mode save tokens again instead of injecting all 300+ tools.
|
|
1926
|
+
this.disposeAdmissionGate = installAdmissionGate(this.ctx.tools, (name) => shouldAdmitTool(name, {
|
|
1927
|
+
toolMode: this.toolMode,
|
|
1928
|
+
toolSwitches: this.toolSwitches,
|
|
1929
|
+
hotTools: this.hotTools
|
|
1930
|
+
}));
|
|
1931
|
+
this.admissionGateInstalled = typeof this.disposeAdmissionGate === "function";
|
|
1932
|
+
if (this.admissionGateInstalled) {
|
|
1933
|
+
const disposeGate = this.disposeAdmissionGate;
|
|
1934
|
+
this.ctx.effect(() => () => {
|
|
1935
|
+
this.admissionGateInstalled = false;
|
|
1936
|
+
this.disposeAdmissionGate = undefined;
|
|
1937
|
+
disposeGate();
|
|
1938
|
+
}, "mcp-manager.admissionGate");
|
|
1939
|
+
// A tool registered before this point keeps the old (unconditional)
|
|
1940
|
+
// registration; surface it rather than silently mixing behaviours.
|
|
1941
|
+
// At boot the count is zero because mounts have not resolved yet.
|
|
1942
|
+
const preRegistered = this.toolSnapshot().length;
|
|
1943
|
+
if (preRegistered > 0) this.ctx.logger?.warn?.(`mcp-manager: ${preRegistered} MCP tool(s) registered before the admission gate; they stay unconditionally visible until their server remounts`);
|
|
1944
|
+
}
|
|
1902
1945
|
this.ctx.tools.register({
|
|
1903
1946
|
name: "mcp_tool_search",
|
|
1904
1947
|
description: hostText(this.ctx, "toolSearchDesc"),
|
|
@@ -1953,10 +1996,12 @@ let McpManagerService = (() => {
|
|
|
1953
1996
|
}
|
|
1954
1997
|
});
|
|
1955
1998
|
this.ctx.on("system-prompt/assemble", (assembly, _context, next) => {
|
|
1956
|
-
//
|
|
1957
|
-
//
|
|
1958
|
-
//
|
|
1959
|
-
//
|
|
1999
|
+
// Cores ≤ 0.2.1 hand the tool list to this waterfall; filter it here.
|
|
2000
|
+
// Cores ≥ 0.2.2 attach the list after the waterfall, so `assembly`
|
|
2001
|
+
// carries none — the admission gate above is what filters there. Never
|
|
2002
|
+
// read `assembly.tools` unconditionally: doing that threw
|
|
2003
|
+
// `assembly.tools is not iterable` on every turn and killed the whole
|
|
2004
|
+
// pre-step assembly (issue #22).
|
|
1960
2005
|
const applied = applyToolControl(assembly, {
|
|
1961
2006
|
toolSwitches: this.toolSwitches,
|
|
1962
2007
|
toolMode: this.toolMode,
|
|
@@ -1964,9 +2009,13 @@ let McpManagerService = (() => {
|
|
|
1964
2009
|
serverOf: (name) => this.serverOf(name),
|
|
1965
2010
|
promptText: (key, vars) => hostText(this.ctx, key, vars)
|
|
1966
2011
|
});
|
|
1967
|
-
if (!applied
|
|
1968
|
-
this.
|
|
1969
|
-
|
|
2012
|
+
if (!applied) {
|
|
2013
|
+
this.assembleSeamBlocked = true;
|
|
2014
|
+
if (!this.assembleToolsUnavailableLogged) {
|
|
2015
|
+
this.assembleToolsUnavailableLogged = true;
|
|
2016
|
+
if (this.admissionGateInstalled) this.ctx.logger?.info?.("mcp-manager: system-prompt/assemble carries no tool list (DSH >= 0.2.2) — per-tool switches and search mode are enforced at registration time through the admission `when` hook");
|
|
2017
|
+
else this.ctx.logger?.warn?.("mcp-manager: system-prompt/assemble carries no tool list and this core exposes no admission hook — per-tool switches and search mode are inactive on this core");
|
|
2018
|
+
}
|
|
1970
2019
|
}
|
|
1971
2020
|
return next();
|
|
1972
2021
|
});
|
|
@@ -1990,7 +2039,14 @@ let McpManagerService = (() => {
|
|
|
1990
2039
|
ok: true,
|
|
1991
2040
|
tools,
|
|
1992
2041
|
mode: this.toolMode,
|
|
1993
|
-
hotSize: this.hotTools.size
|
|
2042
|
+
hotSize: this.hotTools.size,
|
|
2043
|
+
/**
|
|
2044
|
+
* How this core enforces `mode` and the per-tool switches: `admission`
|
|
2045
|
+
* (declared at registration, resolved per step — DSH ≥ 0.2.2),
|
|
2046
|
+
* `waterfall` (filtered inside `system-prompt/assemble` — ≤ 0.2.1), or
|
|
2047
|
+
* `unavailable` (neither seam exists, so the stored config is inert).
|
|
2048
|
+
*/
|
|
2049
|
+
enforcement: this.admissionGateInstalled ? "admission" : this.assembleSeamBlocked ? "unavailable" : "waterfall"
|
|
1994
2050
|
};
|
|
1995
2051
|
}
|
|
1996
2052
|
/**
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registration-time admission gate: search mode and per-tool switches on the
|
|
3
|
+
* DSH cores that filter tools *before* the system prompt is built.
|
|
4
|
+
*
|
|
5
|
+
* Why this exists
|
|
6
|
+
* ---------------
|
|
7
|
+
* DSH ≤ 0.2.1 handed `system-prompt/assemble` an assembly with `tools` already
|
|
8
|
+
* attached, so `lib/tool-assembly.js` could filter that list in the waterfall.
|
|
9
|
+
*
|
|
10
|
+
* DSH ≥ 0.2.2 does not: `@deepseek-ai/dsh-tools` publishes the model-facing
|
|
11
|
+
* tool list through a `systemPrompt.tools()` contributor built from a
|
|
12
|
+
* **per-step admission set** (`tools.resolve()` → `registration.when(context)`),
|
|
13
|
+
* and the waterfall runs without a tool list. Filtering an already-built list
|
|
14
|
+
* therefore cannot work — a tool outside the admission set never reaches the
|
|
15
|
+
* prompt, and a tool inside it cannot be removed afterwards.
|
|
16
|
+
*
|
|
17
|
+
* The only seam that still carries a decision is the registration itself:
|
|
18
|
+
* `register(definition, { when })` stores a condition that `resolve()` evaluates
|
|
19
|
+
* once per step. So the plugin declares `when` at registration time and lets the
|
|
20
|
+
* core do the admission — which is also cheaper, because the model never sees
|
|
21
|
+
* the tool it was not admitted for.
|
|
22
|
+
*
|
|
23
|
+
* Bare core compatibility: `register` on ≤ 0.2.1 takes a single argument and
|
|
24
|
+
* ignores the extra one, so the waterfall transform in `tool-assembly.js` keeps
|
|
25
|
+
* working there untouched. This gate is installed only when the core actually
|
|
26
|
+
* exposes the admission seam (`tools.resolve`).
|
|
27
|
+
* @module dsh-mcp/tool-admission
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/** Marks one wrapper as this plugin's gate, so a reload cannot stack a second. */
|
|
31
|
+
const GATE_MARK = Symbol.for("dsh-mcp.admission-gate");
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Whether one MCP tool may enter a step's model-facing tool set.
|
|
35
|
+
*
|
|
36
|
+
* - a switched-off tool is never admitted;
|
|
37
|
+
* - `search` mode admits only the hot set (recently searched or called) plus
|
|
38
|
+
* whatever `mcp_tool_search` injected for the next step;
|
|
39
|
+
* - `full` mode admits every tool that is not switched off.
|
|
40
|
+
*
|
|
41
|
+
* The hot set is read live: `when` is evaluated per step, so a tool that
|
|
42
|
+
* `mcp_tool_search` just recorded becomes admissible on the very next step.
|
|
43
|
+
* @param {string} name - public tool name (`mcp__<server>__<tool>`).
|
|
44
|
+
* @param {object} state - live plugin state.
|
|
45
|
+
* @param {string} state.toolMode - `search` or `full`.
|
|
46
|
+
* @param {Map<string, boolean>} state.toolSwitches - public name → enabled.
|
|
47
|
+
* @param {Map<string, number>} state.hotTools - the resident/hot tool names.
|
|
48
|
+
* @returns {boolean} whether the tool may be shown to the model this step.
|
|
49
|
+
*/
|
|
50
|
+
export function shouldAdmitTool(name, state) {
|
|
51
|
+
const { toolMode, toolSwitches, hotTools } = state;
|
|
52
|
+
if (toolSwitches.get(name) === false) return false;
|
|
53
|
+
if (toolMode === "search") return hotTools.has(name);
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Install the admission gate on a tool registry, or report that this core does
|
|
59
|
+
* not need it.
|
|
60
|
+
*
|
|
61
|
+
* Every `mcp__*` registration is wrapped so the core receives a `when`
|
|
62
|
+
* condition built from `isAdmitted`. A caller-supplied `when` is preserved and
|
|
63
|
+
* still wins: the plugin's admission is ANDed after it, never in front of it.
|
|
64
|
+
* Registrations outside the `mcp__` namespace — notably `mcp_tool_search`
|
|
65
|
+
* itself, which must stay callable to admit anything at all — pass through
|
|
66
|
+
* untouched.
|
|
67
|
+
*
|
|
68
|
+
* @param {object} tools - the core's `tools` service (`ctx.tools`).
|
|
69
|
+
* @param {(name: string) => boolean} isAdmitted - live admission decision.
|
|
70
|
+
* @returns {(() => void) | undefined} a disposer restoring the original
|
|
71
|
+
* `register`, or `undefined` when this core has no admission seam (in which
|
|
72
|
+
* case the waterfall transform remains the only filter and nothing is
|
|
73
|
+
* monkey-patched).
|
|
74
|
+
*/
|
|
75
|
+
export function installAdmissionGate(tools, isAdmitted) {
|
|
76
|
+
if (tools === null || typeof tools !== "object") return undefined;
|
|
77
|
+
if (typeof tools.register !== "function") return undefined;
|
|
78
|
+
// `tools.resolve()` is the per-step admission pass introduced with the
|
|
79
|
+
// `when` option; without it the extra argument would be dead weight and the
|
|
80
|
+
// waterfall transform is still the working path.
|
|
81
|
+
if (typeof tools.resolve !== "function") return undefined;
|
|
82
|
+
if (tools.register[GATE_MARK] === true) return () => {};
|
|
83
|
+
|
|
84
|
+
const original = tools.register;
|
|
85
|
+
const hadOwnRegister = Object.prototype.hasOwnProperty.call(tools, "register");
|
|
86
|
+
|
|
87
|
+
const gate = function registerWithAdmission(definition, options) {
|
|
88
|
+
const name = definition !== null && typeof definition === "object" && typeof definition.name === "string"
|
|
89
|
+
? definition.name
|
|
90
|
+
: undefined;
|
|
91
|
+
if (name === undefined || !name.startsWith("mcp__")) {
|
|
92
|
+
return original.call(this, definition, options);
|
|
93
|
+
}
|
|
94
|
+
const base = options !== null && typeof options === "object" ? options : {};
|
|
95
|
+
const callerWhen = base.when;
|
|
96
|
+
const when = typeof callerWhen === "function"
|
|
97
|
+
? async (context) => (await callerWhen(context)) && isAdmitted(name)
|
|
98
|
+
: () => isAdmitted(name);
|
|
99
|
+
return original.call(this, definition, { ...base, when });
|
|
100
|
+
};
|
|
101
|
+
gate[GATE_MARK] = true;
|
|
102
|
+
tools.register = gate;
|
|
103
|
+
|
|
104
|
+
return () => {
|
|
105
|
+
// Only undo our own patch: a later plugin may have wrapped register in
|
|
106
|
+
// turn, and deleting their wrapper would re-open the admission hole.
|
|
107
|
+
if (tools.register !== gate) return;
|
|
108
|
+
if (hadOwnRegister) tools.register = original;
|
|
109
|
+
else delete tools.register;
|
|
110
|
+
};
|
|
111
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mcp",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.1",
|
|
4
4
|
"description": "MCP 管理界面 + tool search:可视化配置/启停/刷新 MCP 服务器与工具勾选,按需检索(tool search)热注入;工具列表稳定命中缓存、不撑爆上下文。DeepSeek Harness plugin: MCP management UI + tool search — stable tool list, cache-friendly, no context bloat.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"url": "https://github.com/ArvinQi/dsh-mcp/issues"
|
|
42
42
|
},
|
|
43
43
|
"dsh": {
|
|
44
|
-
"supported": "0.2.
|
|
44
|
+
"supported": "0.2.2-rc.1",
|
|
45
45
|
"bundle": {
|
|
46
46
|
"patch": "./cordis.patch.yml"
|
|
47
47
|
},
|