dsh-mcp-manager-plus 0.4.4 → 0.5.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 +92 -0
- package/README.en.md +130 -7
- package/README.md +104 -8
- package/lib/client.js +399 -58
- package/lib/index.js +504 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,98 @@
|
|
|
5
5
|
|
|
6
6
|
0.3.1 之前的开发发生在公开仓库建立之前,历史没有保留。
|
|
7
7
|
|
|
8
|
+
## [0.5.0] - 2026-11-11
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **项目绑定**:把某个 MCP 服务器限定在指定的项目目录里,其它项目看不到、也调不动
|
|
13
|
+
它的工具;清空路径即恢复全局可用。
|
|
14
|
+
- 页面每行新增「项目绑定」入口(bundle 提供的行也可以绑,因为绑定表是本插件
|
|
15
|
+
自己的数据);弹窗每行填一个绝对路径,列表上以标签显示当前状态
|
|
16
|
+
(「全局可用」/「仅限 N 个项目」),展开服务器时也有一条绑定摘要;
|
|
17
|
+
已有绑定再点一次会预填当前路径,改完即生效;
|
|
18
|
+
- 新增宿主路由 `POST /mcp-manager-plus/bind`;清单投影为每个服务器带上
|
|
19
|
+
`binding: { paths, restricted }`,并回传绑定文件路径 `bindingsPath`;
|
|
20
|
+
- 绑定数据写在
|
|
21
|
+
`$DSH_HOME/profiles/<profile>/plugin-data/dsh-mcp-manager-plus/bindings.json`
|
|
22
|
+
(可用环境变量 `DSH_MCP_MANAGER_BINDINGS` 指向别处)。**刻意不写补丁层**:
|
|
23
|
+
补丁层决定运行中的插件树,写进去意味着每改一次绑定都要重新编排整棵树、重挂
|
|
24
|
+
所有 MCP 连接;绑定只是本插件的数据,改完在运行中的进程里立刻生效;
|
|
25
|
+
- 执行分两层:**会话作用域**的 `ctx.tools.restrict()` 把工具从该会话的可见集合里
|
|
26
|
+
摘掉(所以工具列表里直接看不到),**根作用域**的 `ctx.tools.guard()` 再拦一次
|
|
27
|
+
调用 —— 守卫在可扩展的 `tools/pre-execute` 放行之后运行,且没有任何守卫能把
|
|
28
|
+
别人拒绝的调用改回允许,因此就算模型硬报一个工具名也执行不了;
|
|
29
|
+
- 在 `agent/created` 与 `agent/pre-step` 两处同步:新会话、已经开着的会话、
|
|
30
|
+
中途换了工作目录的会话都会被重新判定。目录取值顺序是
|
|
31
|
+
`workingDirectory.get(session)` → 会话头的 `cwd` → `workingDirectory.defaultDirectory`;
|
|
32
|
+
- 匹配规则:只认绝对路径,`~` 展开为主目录,Windows 下大小写不敏感、`/` 与 `\`
|
|
33
|
+
等价、结尾分隔符可有可无;判定「就是它或在它下面」,所以绑定 `E:\work\alpha`
|
|
34
|
+
不会放过名字只差前缀的兄弟目录 `E:\work\alphabeta`;
|
|
35
|
+
- 有意留的边界(都写进了 README):工作目录判断不出来时不拦截(宁可少拦一次,
|
|
36
|
+
也不误伤);`bindings.json` 缺失或损坏时按「没有绑定」处理,一次坏编辑不会让
|
|
37
|
+
服务器在所有项目里都用不了;绑定按 **serverName** 记录,与补丁层的行 `id` 无关。
|
|
38
|
+
- 回归用例 18 项(测试总数 131 → 149)。项目绑定 14 项:清单投影与绑定文件不因读取
|
|
39
|
+
而创建、绑定落盘与解除、路径归一化与去重、相对路径被拒、未知服务器被拒、守卫的
|
|
40
|
+
放行/拒绝(含大小写、子目录、前缀兄弟目录、无会话、非 MCP 工具名、带下划线的
|
|
41
|
+
serverName)、`agent/created` 与 `agent/pre-step` 的按会话限制与去重、改绑定后对
|
|
42
|
+
活动会话的回收、目录判断不出来时两侧一致地不拦截、绑定文件损坏时照常可用,以及
|
|
43
|
+
声明过的 effect 在 dispose 时全部撤销。图标按钮 4 项:四个动作共用同一个构造函数、
|
|
44
|
+
三处标签载体齐备、样式表真的把 `data-tip` 画成提示且不参与命中;用户行不再渲染
|
|
45
|
+
「配置文件」且该字典项已删除;绑定状态紧跟工具数量、来源标签只出现在非用户行;
|
|
46
|
+
卡片不裁切、底角仍圆、悬停抬起。
|
|
47
|
+
- 三个预览脚本,用真实组件与真实样式表把这一块渲染成静态页,便于目测:
|
|
48
|
+
`tools/preview-row.mjs`(各种行形态)、`tools/preview-actions.mjs`(逐个按钮 +
|
|
49
|
+
3× 放大)、`tools/preview-tips.mjs`(提示越界与底角)。
|
|
50
|
+
- 重新截了 `screenshot1.jpg` / `screenshot5.jpg`,它们现在显示图标按钮与绑定状态。
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
|
|
54
|
+
- **每行的操作按钮改为图标按钮**:编辑、重启、删除、项目绑定四个动作现在只画图标
|
|
55
|
+
(铅笔 / 圆箭头 / 垃圾桶 / 带锁的文件夹),文字移到悬停提示里。名称同时写在
|
|
56
|
+
`title`、`aria-label` 与 `data-tip` 上:`aria-label` 是读屏用的无障碍名称,
|
|
57
|
+
`title` 是触控与不支持 CSS 时的原生提示,`data-tip` 由样式表画出更快、可截图的
|
|
58
|
+
提示气泡(原生 `title` 要等约一秒)。提示在键盘聚焦时同样出现,且
|
|
59
|
+
`pointer-events:none`,不会把触发它的悬停吃掉。按钮尺寸与原来一样是
|
|
60
|
+
30×26(`.mcpmp-icon` 定宽,`.mcpmp-btn-sm` 定高),不会因为只剩图标而变小。
|
|
61
|
+
- **行尾那个「配置文件」标签去掉了**:用户自己的服务器是最常见的一行,这个标签只是
|
|
62
|
+
把有用信息挤到第二行的噪音;服务器来源只对 bundle 行与内置行还有意义,所以它们的
|
|
63
|
+
「部署内置」/「内置能力」标签保留。空出来的位置改放**项目绑定状态**
|
|
64
|
+
(「全局可用」/「仅限 N 个项目」),已绑定时标签文字变绿、悬停可看目录;
|
|
65
|
+
字典里随之失效的 `sourceUser` 已删除(中英两处)。
|
|
66
|
+
- `inject` 由 `['webServer']` 变为 `['webServer', 'tools']`:守卫与按会话限制就是本
|
|
67
|
+
特性的执行方式,声明成硬依赖会让插件在缺少 `tools` 时停泊,而不是「挂载了却没有
|
|
68
|
+
执行者」。
|
|
69
|
+
- README.md / README.en.md 增补「服务器行」与「项目绑定」两节、更新截图说明,
|
|
70
|
+
并写明它不是沙箱、以及上面那些有意留的边界。
|
|
71
|
+
|
|
72
|
+
### Fixed
|
|
73
|
+
|
|
74
|
+
- **悬停提示会被卡片裁掉**:`.mcpmp-card` 原本靠 `overflow:hidden` 给底角收圆,
|
|
75
|
+
而图标按钮的提示要画在按钮上方、越出卡片边界,于是被裁成两半。现在卡片不再裁切,
|
|
76
|
+
底角改由 `> *:last-child` 自己承担;卡片同时建立堆叠上下文,悬停时抬高一层,
|
|
77
|
+
提示不会被上面那张卡片盖住。
|
|
78
|
+
|
|
79
|
+
## [0.4.5] - 2026-11-08
|
|
80
|
+
|
|
81
|
+
### Fixed
|
|
82
|
+
|
|
83
|
+
- **DSH 0.2.2-rc.1 的设置侧边栏里,本行并排出现两个图标(左边链条例、右边齿轮)**:
|
|
84
|
+
新版 shell 把导航行图标改成了 `settings.section.icon` 槽位,并把自己画的默认
|
|
85
|
+
齿轮包进 `<span class="navIcon">`。于是旧的样式兜底
|
|
86
|
+
(`button[data-mcpmp-nav]>svg:first-child` 隐藏 + `::before` 遮罩)既隐藏不掉
|
|
87
|
+
齿轮,又照常画出自己的链条,两枚图标并排 —— 用户截图里的正是这一现象。
|
|
88
|
+
现在**优先把图标注册进这个槽位**(注册 id 必须等于 section 的 id `mcp`,shell
|
|
89
|
+
按行的 id 取用,取不到才回落到默认齿轮);槽位存在时旧的「标记行 + 遮罩」整条
|
|
90
|
+
链路直接关掉,行里只剩插件自己的链条图标。
|
|
91
|
+
- 没有该槽位的老版本(0.1.6-alpha.1 … 0.2.1)行为不变:页面照常注册,
|
|
92
|
+
旧兜底仍接管这一行。
|
|
93
|
+
|
|
94
|
+
### Added
|
|
95
|
+
|
|
96
|
+
- 回归用例:槽位可用时图标注册进去(id 与 section 一致、尺寸跟随槽位、颜色走
|
|
97
|
+
`currentColor`);槽位可用时不再启动行标记(否则就是这次的双图标);
|
|
98
|
+
槽位缺失时页面仍注册、兜底仍在观察(测试总数 127 → 131)。
|
|
99
|
+
|
|
8
100
|
## [0.4.4] - 2026-10-15
|
|
9
101
|
|
|
10
102
|
### Fixed
|
package/README.en.md
CHANGED
|
@@ -4,7 +4,8 @@ English | [中文](README.md) | [Changelog](CHANGELOG.md)
|
|
|
4
4
|
|
|
5
5
|
An MCP server manager plugin for DeepSeek Harness: it adds an "MCP" page to the
|
|
6
6
|
settings sidebar, where you can inspect, enable/disable, edit, restart, delete
|
|
7
|
-
and add MCP servers
|
|
7
|
+
and add MCP servers — and **bind a server to specific project directories** so
|
|
8
|
+
that only those projects can use it.
|
|
8
9
|
|
|
9
10
|
Why this plugin exists:
|
|
10
11
|
|
|
@@ -17,11 +18,15 @@ If this plugin stops working on a newer DSH release, please open an issue.
|
|
|
17
18
|
## Screenshots
|
|
18
19
|
|
|
19
20
|
**Settings → MCP**: the server list, connection state and enable/disable toggles.
|
|
21
|
+
Each row's edit / restart / delete / project-binding actions are icon buttons whose
|
|
22
|
+
labels appear on hover; the second line carries the connection state, the tool
|
|
23
|
+
count and the project-binding state.
|
|
20
24
|
|
|
21
25
|

|
|
22
26
|
|
|
23
27
|
**Expand a server**: every tool the server currently registers with the model,
|
|
24
|
-
with descriptions.
|
|
28
|
+
with descriptions. An expanded row also opens with a project-binding summary
|
|
29
|
+
listing the directories it is restricted to.
|
|
25
30
|
|
|
26
31
|

|
|
27
32
|
|
|
@@ -42,7 +47,7 @@ paste a whole replacement block, and renaming is just changing the name.
|
|
|
42
47
|
|
|
43
48
|
## Installation
|
|
44
49
|
|
|
45
|
-
**Requirements:** DSH >= 0.1.6-alpha.1 and < 0.3.0 (tested on 0.1.6-alpha.1 and 0.2.
|
|
50
|
+
**Requirements:** DSH >= 0.1.6-alpha.1 and < 0.3.0 (tested on 0.1.6-alpha.1, 0.2.0-rc.2 and 0.2.2-rc.1).
|
|
46
51
|
DSH itself needs Node.js >= 24.2.0 and Git >= 2.31.0.
|
|
47
52
|
|
|
48
53
|
### Option 1: one-click install from the plugin market
|
|
@@ -105,9 +110,51 @@ profile patch layer — that is your configuration data and will not be deleted.
|
|
|
105
110
|
| Edit | Two switchable modes: **form** (field by field) or **JSON** (one large textarea), see below |
|
|
106
111
|
| Restart | Destroys and re-initializes the server's connection in place (config unchanged); for recovering from dropped connections |
|
|
107
112
|
| Delete | Removes the server and all of its override rows from the config file |
|
|
113
|
+
| Icon actions | Each row's edit / restart / delete / project-binding actions are **icon buttons**; hovering (or reaching them with Tab) shows the label, which is also carried in `aria-label` for screen readers |
|
|
108
114
|
| Add | Paste an MCP configuration from **any mainstream tool**; the format is detected, and multiple servers per paste are supported (see table below) |
|
|
115
|
+
| Project binding | Restrict a server to a few project directories: sessions in other projects never see its tools and calls to them are refused. Takes effect on save, without touching the MCP connection (see below) |
|
|
109
116
|
| Bilingual | Chinese / English. Defaults to the harness UI language (falling back to the browser's language when unavailable); switch anytime from the page header — the choice is remembered, and host-side messages follow along |
|
|
110
117
|
|
|
118
|
+
## The server row
|
|
119
|
+
|
|
120
|
+
A row answers "how is this server doing right now", read left to right and top to
|
|
121
|
+
bottom:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
⌄ [D] dbx ✓
|
|
125
|
+
● Connected 25 tools All projects
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
- **⌄** expands or collapses the server's tool list;
|
|
129
|
+
- the **square avatar** holds the server name's first letter, coloured from the
|
|
130
|
+
name — a different name gets a different colour, which makes a long list
|
|
131
|
+
scannable;
|
|
132
|
+
- **dbx ✓** is the server name; the check means it is enabled;
|
|
133
|
+
- the second line carries the **connection state** (Connected / Connecting /
|
|
134
|
+
Pending / Failed / Unloading / Disabled), the **tool count**, and the **project-binding
|
|
135
|
+
state** (`All projects`, or `Bound to N project(s)`). A bound row paints that
|
|
136
|
+
chip's **text** green, and hovering it lists the bound directories;
|
|
137
|
+
- the far right is the **enable/disable switch**, preceded by up to four icon
|
|
138
|
+
buttons (which ones a row has depends on what it can do, see the table):
|
|
139
|
+
|
|
140
|
+
| Icon | Action | Notes |
|
|
141
|
+
| --- | --- | --- |
|
|
142
|
+
| Pencil | Edit | Opens the edit dialog (form / JSON modes); only on rows from the config file |
|
|
143
|
+
| Circular arrow | Restart | Reconnects in place, configuration unchanged; shown only while the server is mounted |
|
|
144
|
+
| Bin (red) | Delete | Removes the row and its override rows from the config file; only on rows from the config file |
|
|
145
|
+
| Locked folder | Project binding | Opens the binding dialog; its outline turns green once bound. Shown whenever the row has a serverName |
|
|
146
|
+
|
|
147
|
+
The buttons are icons only, with their names in a hover tooltip. So that a mouse
|
|
148
|
+
is not required, the name is carried in three places: `aria-label` (the
|
|
149
|
+
accessible name), `title` (the native tooltip for touch and for anything that
|
|
150
|
+
ignores CSS), and `data-tip` (the tooltip the stylesheet paints immediately —
|
|
151
|
+
the native `title` waits about a second).
|
|
152
|
+
|
|
153
|
+
Deployment-provided and built-in rows cannot be edited or deleted, so they carry
|
|
154
|
+
only restart and project-binding, plus a source tag at the end of the second line
|
|
155
|
+
(`Deployment` / `Built-in`). **Servers you added yourself no longer show a
|
|
156
|
+
"Config file" style tag** — that slot now holds the more useful binding state.
|
|
157
|
+
|
|
111
158
|
## The two edit modes
|
|
112
159
|
|
|
113
160
|
When editing an existing server, the dialog header carries a **segmented
|
|
@@ -208,6 +255,68 @@ the plugin tree within about a second of each save, so config changes are both
|
|
|
208
255
|
tree; it only writes the file, then the browser briefly polls to observe the
|
|
209
256
|
converged state.
|
|
210
257
|
|
|
258
|
+
## Project binding
|
|
259
|
+
|
|
260
|
+
MCP servers are globally available to the whole DSH instance by default. If you
|
|
261
|
+
want a server to exist in **one project only**, click the **locked-folder icon**
|
|
262
|
+
at the right of its row (its tooltip reads "Project binding") and list one
|
|
263
|
+
absolute project directory per line:
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
D:\work\my-project
|
|
267
|
+
~/work/another-project
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Once saved:
|
|
271
|
+
|
|
272
|
+
- Only sessions whose **working directory is one of those directories (or inside
|
|
273
|
+
one)** can see and call its tools;
|
|
274
|
+
- In every other project its tools **do not appear in the tool list at all**
|
|
275
|
+
(they are filtered per session), and even if a model insists on a name, the
|
|
276
|
+
call is refused before execution with a message naming the bound directories;
|
|
277
|
+
- Sessions that are already open are re-evaluated immediately — no dsh restart,
|
|
278
|
+
and the MCP connection itself is never touched;
|
|
279
|
+
- An existing binding can be changed at any time by clicking that icon again; the
|
|
280
|
+
dialog opens pre-filled with its current paths;
|
|
281
|
+
- Clearing every path **removes the binding**, returning the server to
|
|
282
|
+
"available everywhere".
|
|
283
|
+
|
|
284
|
+
Matching rules (`pathKey` / `isWithin` in `lib/index.js`):
|
|
285
|
+
|
|
286
|
+
- Only **absolute paths** are accepted; `~` expands to the current user's home
|
|
287
|
+
directory. A relative path is refused with a reason;
|
|
288
|
+
- On Windows matching is case-insensitive, `/` and `\` are equivalent, and a
|
|
289
|
+
trailing separator is optional;
|
|
290
|
+
- The test is "is it this directory, or below it", so binding `E:\work\alpha`
|
|
291
|
+
does **not** let the name-prefix sibling `E:\work\alphabeta` through.
|
|
292
|
+
|
|
293
|
+
Bindings live in **this plugin's own file**, not in the patch layer:
|
|
294
|
+
|
|
295
|
+
```
|
|
296
|
+
$DSH_HOME/profiles/<profile>/plugin-data/dsh-mcp-manager-plus/bindings.json
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
(override with the `DSH_MCP_MANAGER_BINDINGS` environment variable). Keeping them
|
|
300
|
+
out of the patch layer is deliberate: that layer composes the running plugin
|
|
301
|
+
tree, so a binding written there would remount every MCP connection on each
|
|
302
|
+
edit. Bindings are just plugin data, and an edit applies immediately in the
|
|
303
|
+
running process.
|
|
304
|
+
|
|
305
|
+
Deliberate limits, so you know what you are getting:
|
|
306
|
+
|
|
307
|
+
- **It is not a sandbox.** What it restricts is *which tools a model can see and
|
|
308
|
+
call*. The MCP server process and its connection still exist (the config row
|
|
309
|
+
remains global); only this session's visibility of, and access to, its tools
|
|
310
|
+
is constrained.
|
|
311
|
+
- **When the working directory cannot be determined, nothing is blocked**
|
|
312
|
+
(fail-open): better to miss a block than to lock a user out of their own
|
|
313
|
+
project.
|
|
314
|
+
- **A damaged or missing `bindings.json` reads as "no bindings"**, i.e. back to
|
|
315
|
+
globally available — one bad edit cannot make a server unusable everywhere.
|
|
316
|
+
- A binding is keyed by **serverName**, independent of the row's `id` in the
|
|
317
|
+
patch layer; renaming the server (a new serverName) is a different server and
|
|
318
|
+
must be bound again.
|
|
319
|
+
|
|
211
320
|
## Security model
|
|
212
321
|
|
|
213
322
|
- **Loopback only.** The API lives on the same loopback web server; non-loopback
|
|
@@ -223,11 +332,15 @@ converged state.
|
|
|
223
332
|
browser echoes them back; real secrets never appear on the page.
|
|
224
333
|
- **Bundle-provided servers are read-only.** Rows contributed by the bundle
|
|
225
334
|
layer can be enabled/disabled but not edited or deleted.
|
|
335
|
+
- **Project bindings only ever hold local data.** The binding table is served by
|
|
336
|
+
the same loopback API, accepts absolute paths only, and is re-parsed before
|
|
337
|
+
writing; it never enters the patch layer, so editing a binding cannot affect
|
|
338
|
+
how the plugin tree is composed.
|
|
226
339
|
|
|
227
340
|
## Development
|
|
228
341
|
|
|
229
342
|
```sh
|
|
230
|
-
node test/run.mjs # all eight suites (
|
|
343
|
+
node test/run.mjs # all eight suites (149 assertions)
|
|
231
344
|
```
|
|
232
345
|
|
|
233
346
|
| Suite | Coverage |
|
|
@@ -236,8 +349,8 @@ node test/run.mjs # all eight suites (127 assertions)
|
|
|
236
349
|
| `test/yaml.test.mjs` | the `js-yaml` compatibility layer: capability probing, skipping an incompatible copy, and `!!js` fidelity under the degraded parser |
|
|
237
350
|
| `test/import.test.mjs` | config formats of 14 tools, the TOML subset, JSON comments and trailing commas |
|
|
238
351
|
| `test/editjson.test.mjs` | JSON-mode editing: in-place updates, renames keeping id and overrides, multi-server rejection |
|
|
239
|
-
| `test/host.test.mjs` | every host-side HTTP route, driving the real `apply()` through a fake Cordis context |
|
|
240
|
-
| `test/client.test.mjs` | whether the shell can load the browser bundle and register the settings page
|
|
352
|
+
| `test/host.test.mjs` | every host-side HTTP route, driving the real `apply()` through a fake Cordis context; project-binding guard denials and per-session tool restrictions included |
|
|
353
|
+
| `test/client.test.mjs` | whether the shell can load the browser bundle and register the settings page; the mode switch, the icon buttons' three label carriers, and that the card does not clip its tooltips |
|
|
241
354
|
| `test/compose.test.mjs` | composing a real profile from the bundle layer, confirming this plugin's rows mount |
|
|
242
355
|
| `test/live.test.mjs` | read-only run against the real profile, confirming live configs read correctly with secrets masked |
|
|
243
356
|
|
|
@@ -245,11 +358,17 @@ The tests use no test framework — just Node's built-in `node:test` — and reu
|
|
|
245
358
|
the `js-yaml` from the profile (the same parse path as the runtime, compatibility
|
|
246
359
|
layer in `lib/yaml.js` included).
|
|
247
360
|
|
|
361
|
+
> One case in `test/compose.test.mjs` composes the real profile's plugin tree and
|
|
362
|
+
> asserts that no two bundles insert the same row id. It reads the profile on
|
|
363
|
+
> **this machine**, so if two installed plugins collide on an id that case fails
|
|
364
|
+
> — that is a problem with your profile, not a regression in this plugin, and the
|
|
365
|
+
> failure names the colliding id.
|
|
366
|
+
|
|
248
367
|
### Layout
|
|
249
368
|
|
|
250
369
|
| File | Purpose |
|
|
251
370
|
| --- | --- |
|
|
252
|
-
| `lib/index.js` | host side: HTTP API, inventory projection, write operations |
|
|
371
|
+
| `lib/index.js` | host side: HTTP API, inventory projection, write operations, and project-binding storage plus enforcement |
|
|
253
372
|
| `lib/import.js` | import parsing: each tool's config format → this plugin's server shape |
|
|
254
373
|
| `lib/patch.js` | patch-layer read/write: segmentation, parsing, validation, generation |
|
|
255
374
|
| `lib/yaml.js` | `js-yaml` compatibility: capability probing, skipping an incompatible copy, and a degraded parser when no copy can carry the custom type |
|
|
@@ -265,9 +384,13 @@ layer in `lib/yaml.js` included).
|
|
|
265
384
|
| `node tools/check-client-bundle.mjs` | loads the client bundle the way the shell does and checks the registration result and nav-icon CSS |
|
|
266
385
|
| `node tools/check-segmented.mjs` | checks the segmented switch's slider geometry (inset, half-width, offset) against the track assumptions |
|
|
267
386
|
| `node tools/preview-edit-modes.mjs` | renders both edit-dialog modes with the real components into `edit-modes-preview.html` |
|
|
387
|
+
| `node tools/preview-row.mjs` | renders every shape of server row (user / bundle / builtin / disabled / bound / expanded) into `row-preview.html` |
|
|
388
|
+
| `node tools/preview-actions.mjs` | renders each icon button with its tooltip, one at a time and at 3×, into `actions-preview.html` |
|
|
389
|
+
| `node tools/preview-tips.mjs` | checks that a tooltip escapes the card, that the last button's tip stays right-aligned, and that the bottom corners survive without `overflow:hidden`, into `tips-preview.html` |
|
|
268
390
|
| `node tools/check-nav-icon.mjs` | checks that the nav icon's mask payload is a drawable 16×16 template |
|
|
269
391
|
| `node tools/gen-icon-preview.cjs` | extracts icons from the dsh web bundle into the `icon-options.html` comparison page |
|
|
270
392
|
| `node tools/dump-icon.cjs <IconName>` | prints an icon's SVG path for hand-written overrides |
|
|
393
|
+
| `node tools/verify-release.mjs [version]` | post-publish verification: the registry serves the version, a fresh install pulled its own `js-yaml`, and both halves of the "profile hoists a v5" scenario; `--sync-mirror` also waits for the npmmirror mirror |
|
|
271
394
|
|
|
272
395
|
## License
|
|
273
396
|
|
package/README.md
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
[English](README.en.md) | 中文 | [更新日志](CHANGELOG.md)
|
|
4
4
|
|
|
5
5
|
MCP 服务器管理插件:在 DeepSeek Harness 设置界面的左侧边栏新增「MCP 管理」页面,
|
|
6
|
-
可直接查看、启用/停用、编辑、重启、删除与添加 MCP
|
|
6
|
+
可直接查看、启用/停用、编辑、重启、删除与添加 MCP 服务器,
|
|
7
|
+
也可以把某个服务器**绑定到指定项目目录**,让它只在那些项目里可用。
|
|
7
8
|
|
|
8
9
|
为什么要开发这个插件?
|
|
9
10
|
- 为了方便管理 DeepSeek Harness 中的 MCP 服务器,无需打开配置文件。
|
|
@@ -13,11 +14,13 @@ MCP 服务器管理插件:在 DeepSeek Harness 设置界面的左侧边栏新
|
|
|
13
14
|
|
|
14
15
|
## 截图
|
|
15
16
|
|
|
16
|
-
**设置 → MCP
|
|
17
|
+
**设置 → MCP 管理**:服务器列表、连接状态与启停开关。每行的编辑 / 重启 / 删除 /
|
|
18
|
+
项目绑定都是图标按钮,悬停显示名称;第二行依次是连接状态、工具数、以及项目绑定状态。
|
|
17
19
|
|
|
18
20
|

|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
**展开服务器**:查看该服务器当前注册到模型的全部工具及描述;展开后顶部还会有一条
|
|
23
|
+
项目绑定摘要,列出它被限定在哪些目录。
|
|
21
24
|
|
|
22
25
|

|
|
23
26
|
|
|
@@ -35,7 +38,7 @@ MCP 服务器管理插件:在 DeepSeek Harness 设置界面的左侧边栏新
|
|
|
35
38
|
|
|
36
39
|
## 安装说明
|
|
37
40
|
|
|
38
|
-
**版本要求:** DSH >= 0.1.6-alpha.1 且 < 0.3.0(已在 0.1.6-alpha.1 与 0.2.
|
|
41
|
+
**版本要求:** DSH >= 0.1.6-alpha.1 且 < 0.3.0(已在 0.1.6-alpha.1、0.2.0-rc.2 与 0.2.2-rc.1 上测试)。DSH 自身依赖 Node.js >= 24.2.0 与 Git >= 2.31.0。
|
|
39
42
|
|
|
40
43
|
### 方式一:插件市场一键安装
|
|
41
44
|
|
|
@@ -89,9 +92,43 @@ MCP 服务器行会原样保留——它们是你的配置数据,不会被连
|
|
|
89
92
|
| 编辑 | 两种模式可随时切换:**表单**(逐字段)或 **JSON**(大输入框),见下节 |
|
|
90
93
|
| 重启 | 就地销毁并重新初始化该服务器的连接(配置不变),用于连接中断后恢复 |
|
|
91
94
|
| 删除 | 从配置文件中移除该服务器及其所有覆盖行 |
|
|
95
|
+
| 图标操作 | 每行的编辑 / 重启 / 删除 / 项目绑定都是**图标按钮**,鼠标移上去(或键盘 Tab 聚焦)显示文字提示;名称同时写在 `aria-label` 里,读屏能读到 |
|
|
92
96
|
| 添加 | 粘贴**任意主流工具**的 MCP 配置即可,自动识别格式,支持一次导入多个(见下表) |
|
|
97
|
+
| 项目绑定 | 把某个服务器限定在几个项目目录里:其它项目的会话看不到它的工具,硬调也会被拒绝;保存即生效,不动 MCP 连接(见下节) |
|
|
93
98
|
| 多语言 | 中文 / English。默认跟随界面语言(取不到时按浏览器语言探测),页面右上角可随时切换并记住选择;宿主端的错误与提示文案同样跟随 |
|
|
94
99
|
|
|
100
|
+
## 服务器行
|
|
101
|
+
|
|
102
|
+
一行里放的是「这台服务器现在怎么样」,从上到下、从左到右:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
⌄ [D] dbx ✓
|
|
106
|
+
● 已连接 25 个工具 全局可用
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
- **⌄** 展开 / 收起该服务器的工具列表;
|
|
110
|
+
- **方头像**里是服务名的首字母,颜色由服务名决定,换一个名字换一种颜色,便于扫视;
|
|
111
|
+
- **dbx ✓** 是服务名,后面那个勾表示已启用;
|
|
112
|
+
- 第二行依次是**连接状态**(已连接 / 连接中 / 等待中 / 连接失败 / 卸载中 / 已停用)、
|
|
113
|
+
**工具数**、以及**项目绑定状态**(`全局可用` 或 `仅限 N 个项目`)。
|
|
114
|
+
已绑定时这个标签的**文字**会变成绿色,鼠标悬停可直接看到绑定的目录;
|
|
115
|
+
- 行的最右边是**启用开关**;开关左边最多四个图标按钮(取决于该行能做什么,见下表):
|
|
116
|
+
|
|
117
|
+
| 图标 | 动作 | 说明 |
|
|
118
|
+
| --- | --- | --- |
|
|
119
|
+
| 铅笔 | 编辑 | 打开编辑弹窗(表单 / JSON 两种模式);仅出现在配置文件里的行 |
|
|
120
|
+
| 圆箭头 | 重启 | 就地重连,配置不变;仅在该服务器已挂载时出现 |
|
|
121
|
+
| 垃圾桶(红) | 删除 | 从配置文件移除该行及其覆盖行;仅出现在配置文件里的行 |
|
|
122
|
+
| 带锁文件夹 | 项目绑定 | 打开项目绑定弹窗;已绑定时描边变绿。只要该行有 serverName 就出现 |
|
|
123
|
+
|
|
124
|
+
按钮只画图标,名称在悬停提示里。为了不只依赖鼠标,名称同时写在三个地方:
|
|
125
|
+
`aria-label`(读屏用的无障碍名称)、`title`(触控与不支持 CSS 时的原生提示)、
|
|
126
|
+
`data-tip`(样式表画的即时气泡,原生 `title` 要等约一秒才出来)。
|
|
127
|
+
|
|
128
|
+
部署内置与内置能力的行不能编辑或删除,所以它们只有重启与项目绑定两个按钮,
|
|
129
|
+
并在第二行末尾多一个来源标签(`部署内置` / `内置能力`)——**你自己添加的服务器
|
|
130
|
+
不再显示「配置文件」这类来源标签**,那个位置留给了更有用的绑定状态。
|
|
131
|
+
|
|
95
132
|
## 编辑时的两种模式
|
|
96
133
|
|
|
97
134
|
编辑已有服务器时,弹窗标题右侧有一个**分段开关**(带图标、带滑动指示块,`radiogroup` 语义,
|
|
@@ -177,6 +214,54 @@ $DSH_HOME/profiles/<profile>/cordis.patch.yml
|
|
|
177
214
|
所以配置改动**既是持久化的,也是热生效的** —— 插件本身不改动运行中的 loader 树,
|
|
178
215
|
只写文件,然后由浏览器端短暂轮询观察收敛后的实际状态。
|
|
179
216
|
|
|
217
|
+
## 项目绑定
|
|
218
|
+
|
|
219
|
+
MCP 服务器默认在整个 DSH 实例里全局可用。如果你希望某个服务器**只在某个项目里
|
|
220
|
+
出现**,点该行最右边那个**带锁文件夹图标**(悬停提示「项目绑定」),每行填一个
|
|
221
|
+
项目目录的绝对路径:
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
D:\work\my-project
|
|
225
|
+
~/work/another-project
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
保存后:
|
|
229
|
+
|
|
230
|
+
- 只有**工作目录落在这几个目录里(含其子目录)的会话**能看到并调用它的工具;
|
|
231
|
+
- 其它项目的会话里,它的工具**不出现在工具列表里**(被按会话过滤掉了),
|
|
232
|
+
即使模型硬报一个名字,调用也会在执行前被拒绝,并说明它被绑定到了哪些目录;
|
|
233
|
+
- 已经开着的会话也会被立即重新判定,不需要重启 dsh,也不动 MCP 连接本身;
|
|
234
|
+
- 已有服务器的绑定**随时可改**:再点一次那个图标即可,弹窗里预填当前路径;
|
|
235
|
+
- 清空全部路径即为**解除绑定**,它又回到「全局可用」。
|
|
236
|
+
|
|
237
|
+
匹配规则(`lib/index.js` 的 `pathKey` / `isWithin`):
|
|
238
|
+
|
|
239
|
+
- 只认**绝对路径**;`~` 会展开成当前用户的主目录。相对路径会被拒绝并提示原因;
|
|
240
|
+
- Windows 下大小写不敏感,`/` 与 `\` 等价,结尾的分隔符可有可无;
|
|
241
|
+
- 判断的是「就是它,或在它下面」,所以绑定 `E:\work\alpha` **不会**放过
|
|
242
|
+
名字只差一个前缀的兄弟目录 `E:\work\alphabeta`。
|
|
243
|
+
|
|
244
|
+
绑定数据存在**本插件自己的文件**里,而不是补丁层:
|
|
245
|
+
|
|
246
|
+
```
|
|
247
|
+
$DSH_HOME/profiles/<profile>/plugin-data/dsh-mcp-manager-plus/bindings.json
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
(可用环境变量 `DSH_MCP_MANAGER_BINDINGS` 指向别处。)刻意不写进补丁层,是因为补丁层
|
|
251
|
+
决定运行中的插件树 —— 把绑定写进去意味着每改一次绑定就要重新编排整棵树、重挂所有
|
|
252
|
+
MCP 连接;而绑定只是本插件的数据,改完在运行中的进程里立刻生效。
|
|
253
|
+
|
|
254
|
+
有意的边界,请知悉:
|
|
255
|
+
|
|
256
|
+
- **它不是沙箱**,挡的是「模型能看到并调用的工具」。MCP 服务器进程与连接照常存在
|
|
257
|
+
(配置行仍是全局的),被限制的是这个会话对它的工具可见性与调用权。
|
|
258
|
+
- **工作目录判断不出来时不拦截**(宁可不拦,也不误伤):宁可少拦一次,也不要把
|
|
259
|
+
用户挡在自己项目之外。
|
|
260
|
+
- **`bindings.json` 损坏或缺失时按「没有绑定」处理**,即回到全局可用 ——
|
|
261
|
+
一次坏编辑不会让服务器在所有项目里都用不了。
|
|
262
|
+
- 绑定按 **serverName** 记录,与该行在补丁层里的 `id` 无关;改名(换 serverName)
|
|
263
|
+
等于换了一个服务器,需要重新绑定。
|
|
264
|
+
|
|
180
265
|
## 安全约定
|
|
181
266
|
|
|
182
267
|
- **只响应本机请求。** API 挂在同一个 loopback web server 上,非 loopback 来源直接 403。
|
|
@@ -187,11 +272,13 @@ $DSH_HOME/profiles/<profile>/cordis.patch.yml
|
|
|
187
272
|
- **凭据不外传。** 形如 `KEY|PASSWORD|SECRET|TOKEN` 的配置值在读取时被掩码,
|
|
188
273
|
浏览器回传掩码时再从原值还原,真实密钥不会出现在页面里。
|
|
189
274
|
- **部署内置的服务器只读。** 由 bundle 层提供的行可以停用/启用,但不能编辑或删除。
|
|
275
|
+
- **项目绑定只收本机数据。** 绑定表由同一个 loopback API 读写,同样只接受绝对路径,
|
|
276
|
+
写入前重解析;它不写入补丁层,因此不会因为一次绑定编辑而影响插件树的编排。
|
|
190
277
|
|
|
191
278
|
## 开发
|
|
192
279
|
|
|
193
280
|
```sh
|
|
194
|
-
node test/run.mjs # 全部八个测试套件(共
|
|
281
|
+
node test/run.mjs # 全部八个测试套件(共 149 项)
|
|
195
282
|
```
|
|
196
283
|
|
|
197
284
|
| 套件 | 覆盖范围 |
|
|
@@ -200,19 +287,24 @@ node test/run.mjs # 全部八个测试套件(共 127 项)
|
|
|
200
287
|
| `test/yaml.test.mjs` | `js-yaml` 兼容层:能力探测、跳过硬编码不兼容的副本、降级解析下 `!!js` 的语义保真 |
|
|
201
288
|
| `test/import.test.mjs` | 14 种工具的配置格式、TOML 子集、JSON 注释与尾逗号 |
|
|
202
289
|
| `test/editjson.test.mjs` | JSON 模式编辑:原地更新、重命名保留 id 与覆盖、多条拒绝 |
|
|
203
|
-
| `test/host.test.mjs` | 宿主端全部 HTTP 路由,用假的 Cordis 上下文驱动真实 `apply()
|
|
204
|
-
| `test/client.test.mjs` | 浏览器 bundle 能否被 shell
|
|
290
|
+
| `test/host.test.mjs` | 宿主端全部 HTTP 路由,用假的 Cordis 上下文驱动真实 `apply()`;含项目绑定的守卫拦截与按会话工具限制 |
|
|
291
|
+
| `test/client.test.mjs` | 浏览器 bundle 能否被 shell 加载并注册设置页;含模式开关、图标按钮的三处标签载体、卡片不裁切提示 |
|
|
205
292
|
| `test/compose.test.mjs` | 用真实的 bundle 层组合 profile,确认本插件的行能挂载 |
|
|
206
293
|
| `test/live.test.mjs` | 只读地跑真实 profile,确认线上配置能被正确读出且凭据已掩码 |
|
|
207
294
|
|
|
208
295
|
测试不依赖任何测试框架,只用 Node 内置的 `node:test`,并复用 profile 中已有的
|
|
209
296
|
`js-yaml`(与运行时同一条解析路径,含 `lib/yaml.js` 的兼容层)。
|
|
210
297
|
|
|
298
|
+
> `test/compose.test.mjs` 里有一条用例会拿真实的 profile 组合出插件树,然后检查
|
|
299
|
+
> 没有两个 bundle 插入了同一个行 id。它读的是**当前机器上的 profile**,所以如果
|
|
300
|
+
> 你装的某个插件与另一个撞了 id,这条会失败——那是那套 profile 的问题,不是本插件
|
|
301
|
+
> 的回归,报错里会直接给出撞车的 id。
|
|
302
|
+
|
|
211
303
|
### 结构
|
|
212
304
|
|
|
213
305
|
| 文件 | 作用 |
|
|
214
306
|
| --- | --- |
|
|
215
|
-
| `lib/index.js` | 宿主端:HTTP API
|
|
307
|
+
| `lib/index.js` | 宿主端:HTTP API、清单投影、写操作、项目绑定的读写与执行 |
|
|
216
308
|
| `lib/import.js` | 导入解析:各工具配置格式 → 本插件的服务器形状 |
|
|
217
309
|
| `lib/patch.js` | 补丁层读写:分段、解析、校验、生成 |
|
|
218
310
|
| `lib/yaml.js` | `js-yaml` 兼容层:副本能力探测、跳过硬编码不兼容的副本、无自定义类型时的降级解析 |
|
|
@@ -228,9 +320,13 @@ node test/run.mjs # 全部八个测试套件(共 127 项)
|
|
|
228
320
|
| `node tools/check-client-bundle.mjs` | 按 shell 的方式加载客户端 bundle,检查注册结果与导航图标 CSS |
|
|
229
321
|
| `node tools/check-segmented.mjs` | 校验分段开关的滑块几何(内缩、半宽、位移)与轨道假设一致 |
|
|
230
322
|
| `node tools/preview-edit-modes.mjs` | 用真实组件渲染编辑弹窗的两种模式,生成 `edit-modes-preview.html` |
|
|
323
|
+
| `node tools/preview-row.mjs` | 用真实组件渲染服务器行的各种形态(用户行 / 内置行 / 停用行 / 已绑定 / 展开),生成 `row-preview.html` |
|
|
324
|
+
| `node tools/preview-actions.mjs` | 逐个渲染图标按钮与它的悬停提示(含 3× 放大),生成 `actions-preview.html` |
|
|
325
|
+
| `node tools/preview-tips.mjs` | 验证提示不被卡片裁切、最后一个按钮的提示右对齐、去掉 `overflow:hidden` 后底部圆角仍在,生成 `tips-preview.html` |
|
|
231
326
|
| `node tools/check-nav-icon.mjs` | 校验导航图标的 mask 载荷是合法可绘制的 16×16 模板 |
|
|
232
327
|
| `node tools/gen-icon-preview.cjs` | 从 dsh 前端 bundle 提取图标,生成 `icon-options.html` 对照页 |
|
|
233
328
|
| `node tools/dump-icon.cjs <IconName>` | 打印某个内置图标的 SVG 路径,便于手写覆盖 |
|
|
329
|
+
| `node tools/verify-release.mjs [版本]` | 发布后验证:registry 是否有该版本、全新安装是否带上了自己的 `js-yaml`、以及「profile 顶层被换成 v5」的两种情形;`--sync-mirror` 顺带等 npmmirror 同步 |
|
|
234
330
|
|
|
235
331
|
## License
|
|
236
332
|
|