dsh-mcp 1.12.0 → 1.13.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.en.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Changelog
2
2
 
3
- **[简体中文](CHANGELOG.zh.md) | English**
3
+ **[简体中文](CHANGELOG.md) | English**
4
4
 
5
5
  All notable changes to this project are documented in this file.
6
6
 
@@ -9,8 +9,34 @@ 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.1.6-alpha.2`** — developed and verified on `0.1.6-alpha.2` (declared in `package.json` → `dsh.supported`). When the DSH and plugin versions do not match, the Settings page reports a diagnosis (check the `cordis.patch.yml` row → restart `dsh web` → hard-refresh → upgrade both sides).
13
- - **Release convention**: every version entry states `- **Supported DSH version**: dsh <version>`, mirrored in the GitHub Release notes.
12
+ - **Supported DSH version**: **dsh `0.1.6-alpha.2`** — developed and verified on `0.1.6-alpha.2` (declared in `package.json` → `dsh.supported`). 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
+ - **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
+
15
+ ## [1.13.0] - 2026-10-08
16
+
17
+ - **Supported DSH version**: **dsh `0.1.6-alpha.2`**
18
+
19
+ ### Changed
20
+
21
+ - **The package declares `dsh.bundle`, so it now installs and enables as a bundle**: it declared none before, and the DSH Web plugin manager refused the install at the `not-a-bundle` branch of `plugin-manager.inspect()` — `dsh-mcp declares no dsh.bundle` (both registry and local-path sources are refused), while `dsh plugin add` merely installed the package as a plain profile dependency that still needed a hand-written `- insert: [{ id: dsh-mcp, name: dsh-mcp }]` row to take effect. `package.json` now declares `dsh.bundle.patch` → the package-root `cordis.patch.yml`: installing writes `dsh-mcp` into `dsh.profile.bundles` and that patch inserts the plugin row. `cordis.patch.yml` was added to `files` so it ships in the tarball
22
+ - **The registration row moved into the package; the user patch layers only override config**: `$DSH_HOME/profiles/<profile>/cordis.patch.yml` (profile layer) and `$DSH_HOME/cordis.patch.yml` (machine layer) no longer insert the same id — they use an id-targeted entry to override `config` (`probeTimeoutMs` / `allowBrowserOnMount`), because one row id declared by two layers makes the loader fail to compose. Both READMEs' install, registration and troubleshooting sections were rewritten accordingly, and now state that the in-package bundle patch and the profile patch used for declared servers are two different files
23
+
24
+ ### Notes
25
+
26
+ - Added `test/bundle-manifest.test.mjs`: it asserts the manifest declares `dsh.bundle.patch`, that the referenced patch exists and is listed in `files`, and that the patch parses to exactly one inserted row `{ id: dsh-mcp, name: dsh-mcp }` (`js-yaml` parses it; environments without the DSH module closure skip only that subtest)
27
+
28
+ ## [1.12.1] - 2026-10-07
29
+
30
+ - **Supported DSH version**: **dsh `0.1.6-alpha.2`**
31
+
32
+ ### Fixed
33
+
34
+ - **stdio servers now actually receive the process-level environment variables ([#11](https://github.com/ArvinQi/dsh-mcp/issues/11))**: `global_env` was only used for `streamable-http` header substitution — the stdio branch dropped it entirely — and the parent process environment is no substitute, because `dsh-mcp-client` strips `KEY`/`TOKEN`/`SECRET`/`PASSWORD`-shaped names out of the inherited env before merging the server's own. So a stdio server that only reads its key from the environment (such as `tavily`, `npx -y tavily-mcp`) and whose per-server env the form no longer edits could only start keyless (it surfaced as `tavily_research` reporting "requires an API key" while keyless `tavily_search`/`tavily_extract` worked). `toClientConfig()`'s stdio branch now merges `global_env` with the server's own env into the child process, with the **per-server entry winning** on a collision; the settings hint, both READMEs and this document now state the real scope (injected into stdio children *and* available to HTTP header substitution)
35
+ - **Automatic remount after a credential update works again ([#12](https://github.com/ArvinQi/dsh-mcp/issues/12))**: `managedServerId()` recovered the server id from `DSH_MCP_<serverId>_<name>` with `lastIndexOf("_")`, but both the id (`mcp_<12 hex>`) and the variable name may contain `_`: as soon as the name had an underscore (`TAVILY_API_KEY`, `MY_VAR`) it split in the wrong place and produced an id that is not in the table, so the `credentials/reference-updated` handler silently skipped the remount — **rotating a key through the credentials UI or another plugin left the server on its old value until a manual refresh**. It now matches the id's fixed shape (`mcp_[0-9a-f]{12}`) exactly, and keeps `DSH_MCP_ENV_*` (process-level) and `DSH_MCP_OAUTH_*` refs unresolved
36
+
37
+ ### Notes
38
+
39
+ - Each fix ships with a regression test: `test/stdio-env.test.mjs` spawns a real child through a real mount and reads the environment it received back (it fails against the old implementation), and `test/managed-server-id.test.mjs` runs a ref-resolution matrix against the shipped `lib/index.js` function
14
40
 
15
41
  ## [1.12.0] - 2026-09-18
16
42
 
package/CHANGELOG.md CHANGED
@@ -9,8 +9,34 @@
9
9
 
10
10
  ## 兼容性
11
11
 
12
- - **支持版本**:**dsh `0.1.6-alpha.2`** —— 本插件在 `0.1.6-alpha.2` 上开发与验证(`package.json` → `dsh.supported` 同步声明)。DSH 与插件版本不匹配时,设置页会给出排查诊断(核对 `cordis.patch.yml` 注册行 → 重启 `dsh web` → 硬刷新 → 同步升级)。
13
- - **发版约定**:每个版本条目都要声明 `- **支持版本**:dsh <版本>`,并在 GitHub Release notes 中同步。
12
+ - **支持版本**:**dsh `0.1.6-alpha.2`** —— 本插件在 `0.1.6-alpha.2` 上开发与验证(`package.json` → `dsh.supported` 同步声明)。DSH 与插件版本不匹配时,设置页会给出排查诊断(核对 bundle 是否已选中 → 重启 `dsh web` → 硬刷新 → 同步升级)。
13
+ - **发版约定**:每个版本条目都要声明 `- **支持版本**:dsh <版本>`,并在 GitHub Release notes 中同步。Release 正文用**中文**(与本文档一致),标题层级与条目一致。
14
+
15
+ ## [1.13.0] - 2026-10-08
16
+
17
+ - **支持版本**:**dsh `0.1.6-alpha.2`**
18
+
19
+ ### 变更
20
+
21
+ - **声明 `dsh.bundle`,插件现在能作为 bundle 安装/启用**:此前包内没有 `dsh.bundle`,DSH Web 的插件管理页在 `plugin-manager.inspect()` 的 `not-a-bundle` 分支直接拒掉安装——报错 `dsh-mcp declares no dsh.bundle`(registry 与本地路径两种来源都拒),`dsh plugin add` 也只把包当作普通依赖装进 profile,必须再手写 `- insert: [{ id: dsh-mcp, name: dsh-mcp }]` 注册行才生效。现在 `package.json` 声明 `dsh.bundle.patch` → 包根 `cordis.patch.yml`:安装时 DSH 自动把 `dsh-mcp` 写入 `dsh.profile.bundles`,并由该 patch insert 插件行;`cordis.patch.yml` 已加入 `files`,随 tarball 发布
22
+ - **注册行移入包内,用户 patch 层只做配置覆盖**:`$DSH_HOME/profiles/<profile>/cordis.patch.yml`(用户层)与 `$DSH_HOME/cordis.patch.yml`(机器层)不再 insert 同一 id,改用 id-targeted 条目覆盖 `config`(`probeTimeoutMs` / `allowBrowserOnMount`)——同一 id 由两层声明会让 loader 组合失败。README 中英的安装、注册与排查章节据此重写,并说明「包内 bundle patch」与「声明式服务器用的 profile patch」是两个文件
23
+
24
+ ### 说明
25
+
26
+ - 新增 `test/bundle-manifest.test.mjs`:断言清单声明 `dsh.bundle.patch`、被引用的 patch 文件存在且列入 `files`、patch 解析后恰好 insert 一行 `{ id: dsh-mcp, name: dsh-mcp }`(解析用 `js-yaml`;无 DSH 模块闭包的环境只跳过该子测试)
27
+
28
+ ## [1.12.1] - 2026-10-07
29
+
30
+ - **支持版本**:**dsh `0.1.6-alpha.2`**
31
+
32
+ ### 修复
33
+
34
+ - **stdio 服务器现在真的能拿到进程级环境变量([#11](https://github.com/ArvinQi/dsh-mcp/issues/11))**:`global_env` 此前只用于 `streamable-http` 的请求头替换,stdio 分支把它整个丢掉;而父进程环境也不是替代通道——`dsh-mcp-client` 会把 `KEY`/`TOKEN`/`SECRET`/`PASSWORD` 形状的父环境变量剥离后再与服务器 env 合并。于是像 `tavily`(`npx -y tavily-mcp`)这类只吃环境变量、且表单不再编辑 per-server env 的 stdio 服务器,只能以「无密钥」状态启动(表现为 `tavily_research` 报 "requires an API key",而 keyless 的 `tavily_search`/`tavily_extract` 正常)。现在 `toClientConfig()` 的 stdio 分支把 `global_env` 与服务器自身 env 合并后注入子进程,同名时**服务器 env 优先**;设置页提示、README 中英与本文档同步改为「stdio 子进程注入 + HTTP 请求头引用」的实际作用域
35
+ - **凭据引用更新后的自动重挂载恢复正常([#12](https://github.com/ArvinQi/dsh-mcp/issues/12))**:`managedServerId()` 用 `lastIndexOf("_")` 从 `DSH_MCP_<serverId>_<变量名>` 反解服务器 id,而 id(`mcp_<12位十六进制>`)与变量名都可能含 `_`:只要变量名带下划线(`TAVILY_API_KEY`、`MY_VAR`)就切错位置、解析出表里不存在的 id,`credentials/reference-updated` 处理器于是静默跳过重挂载——**通过凭据管理界面或其它插件轮换密钥后,服务器继续用旧值直到手动刷新**。现在按 id 的固定格式 `mcp_[0-9a-f]{12}` 精确匹配,并对 `DSH_MCP_ENV_*`(进程级)与 `DSH_MCP_OAUTH_*` 引用保持不解析
36
+
37
+ ### 说明
38
+
39
+ - 两个修复各配一条回归测试:`test/stdio-env.test.mjs` 通过真实挂载 + 真实子进程读回环境变量(改回旧实现即失败),`test/managed-server-id.test.mjs` 直接读 `lib/index.js` 中发布态的函数做引用解析矩阵
14
40
 
15
41
  ## [1.12.0] - 2026-09-18
16
42
 
package/README.en.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![dshfind](https://dshfind.com/api/badge/ArvinQi/dsh-mcp?lang=en)](https://dshfind.com/en/plugins/ArvinQi/dsh-mcp?ref=badge)
4
4
 
5
- > **Supported DSH version**: `dsh 0.1.6-alpha.2` — developed and verified on `0.1.6-alpha.2`, declared in `package.json` → `dsh.supported`. When the DSH and plugin versions do not match, the Settings page shows a diagnosis (check the registration row → restart `dsh web` → hard-refresh → upgrade both sides).
5
+ > **Supported DSH version**: `dsh 0.1.6-alpha.2` — developed and verified on `0.1.6-alpha.2`, 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
  ![Settings preview](static/snapshot.en.webp)
8
8
 
@@ -17,7 +17,7 @@
17
17
  **Highlights:**
18
18
 
19
19
  - **Visual management**: server list / create / edit / delete / test connection / enable-disable / refresh, all in the UI
20
- - **Process-level environment variables**: a global key-value list (expanded by default, batch-add supported); header values can reference a variable by bare name or `${NAME}` and are substituted at connect time (e.g. `Authorization: Bearer ${TOKEN}`)
20
+ - **Process-level environment variables**: a global key-value list (expanded by default, batch-add supported); injected into every stdio server's child process and referenced by streamable-http header values by bare name or `${NAME}`, substituted at connect time (e.g. `Authorization: Bearer ${TOKEN}`); a per-server env entry wins on collision
21
21
  - **Whole-list JSON config**: the "JSON config editor" panel views/edits every server as one JSON array; applying saves immediately (create/update/delete)
22
22
  - **Fine-grained tool control**: expand each server to see its tools, all checked by default; uncheck to load only what you need
23
23
  - **Image result passthrough**: images returned by MCP tools (screenshots/charts) are projected through the attachment service into model image context, with strict preflight and bounded fallbacks (PR #4)
@@ -88,7 +88,8 @@ Since 1.11.0 those declarations appear in Settings → MCP, badged "cordis decla
88
88
 
89
89
  ```
90
90
  dsh-mcp/
91
- ├── package.json name=dsh-mcp; dsh.client declaration; zero npm dependencies
91
+ ├── package.json name=dsh-mcp; dsh.bundle (auto-registration) and dsh.client declarations; zero npm dependencies
92
+ ├── cordis.patch.yml bundle patch: inserts the plugin row (id/name = dsh-mcp) on install
92
93
  ├── lib/
93
94
  │ ├── index.js host half (McpManagerService, built from mcp-manager)
94
95
  │ ├── cordis-servers.js reads natively declared MCP servers from the patch layers (1.11.0)
@@ -132,13 +133,20 @@ npm test
132
133
 
133
134
  ### 1. Install
134
135
 
135
- **Option 1: npm (after publishing)**
136
+ **Option 1: Web UI (recommended)**
137
+
138
+ DSH Web → **Settings → Plugins**, enter the package name `dsh-mcp` (or the absolute path of a local
139
+ directory) → Install. This runs the same pnpm path as `dsh plugin add`; since 1.13.0 the package
140
+ declares `dsh.bundle`, so installing it registers it as a profile bundle layer automatically (see
141
+ section 2) and no hand-written registration row is needed.
142
+
143
+ **Option 2: npm (after publishing)**
136
144
 
137
145
  ```sh
138
146
  dsh plugin --profile web add dsh-mcp
139
147
  ```
140
148
 
141
- **Option 2: GitHub git source**
149
+ **Option 3: GitHub git source**
142
150
 
143
151
  ```sh
144
152
  dsh plugin --profile web add github:ArvinQi/dsh-mcp
@@ -146,7 +154,7 @@ dsh plugin --profile web add github:ArvinQi/dsh-mcp
146
154
  dsh plugin --profile web add git+https://github.com/ArvinQi/dsh-mcp.git
147
155
  ```
148
156
 
149
- **Option 3: local development (link)**
157
+ **Option 4: local development (link)**
150
158
 
151
159
  ```sh
152
160
  dsh plugin --profile web add link:<absolute path to this repo>
@@ -158,17 +166,37 @@ dsh plugin --profile web add link:<absolute path to this repo>
158
166
 
159
167
  ### 2. Registration (all install options)
160
168
 
161
- Append to `$DSH_HOME/profiles/web/cordis.patch.yml` (`$DSH_HOME` defaults to `~/.dsh`):
169
+ **Since 1.13.0 registration is automatic.** The package manifest declares `dsh.bundle.patch`,
170
+ pointing at the shipped `<package dir>/cordis.patch.yml`. On install, DSH writes the package name
171
+ into `dsh.profile.bundles` in `$DSH_HOME/profiles/<profile>/package.json`, and that patch then
172
+ inserts the plugin row (one row provides both the host manager and the client settings page):
162
173
 
163
174
  ```yaml
175
+ # <package dir>/cordis.patch.yml — ships with the package, applies once the bundle is selected
164
176
  - insert:
165
177
  - id: dsh-mcp
166
178
  name: dsh-mcp
167
179
  ```
168
180
 
169
- > ⚠️ **This step is mandatory**: dsh-mcp does not declare `dsh.bundle`, so `dsh plugin add` only
170
- > installs the package into the profile — **it does not activate the plugin**. Without the
171
- > registration row the plugin never mounts.
181
+ > ⚠️ Do not insert the same row again in your own `$DSH_HOME/profiles/<profile>/cordis.patch.yml`
182
+ > (or the machine-wide `$DSH_HOME/cordis.patch.yml`): one row id declared by two layers makes the
183
+ > loader fail to compose. Those two files are the **user patch layer**, distinct from the bundle
184
+ > patch that ships inside the package.
185
+
186
+ To override configuration, use an **id-targeted** entry (the user patch layer applies after every
187
+ bundle layer, and it replaces the whole `config`, so keys you omit fall back to the `Config`
188
+ defaults):
189
+
190
+ ```yaml
191
+ - id: dsh-mcp
192
+ config:
193
+ allowBrowserOnMount: true
194
+ ```
195
+
196
+ > Upgrading a profile from an older release (<1.13.0): replace that
197
+ > `- insert: [{ id: dsh-mcp, name: dsh-mcp }]` block with the id-targeted override above, and get
198
+ > `dsh-mcp` into `dsh.profile.bundles` (enable it in the Web Plugins page once `dsh-mcp` shows as
199
+ > installed, or add the name to that array directly).
172
200
 
173
201
  Then **restart `dsh web`** and **hard-refresh the browser** (`Cmd/Ctrl + Shift + R`):
174
202
 
@@ -188,17 +216,19 @@ Then **restart `dsh web`** and **hard-refresh the browser** (`Cmd/Ctrl + Shift +
188
216
 
189
217
  Check in order:
190
218
 
191
- 1. **Is the plugin registered?** Confirm `$DSH_HOME/profiles/web/cordis.patch.yml` has the
192
- `- insert: [{ id: dsh-mcp, name: dsh-mcp }]` row (`id`/`name` must exactly match the package
193
- name `dsh-mcp`). `dsh plugin add` does not equal activation — **without the registration row
194
- the plugin never mounts**.
219
+ 1. **Is the plugin row registered?** `dsh.profile.bundles` in
220
+ `$DSH_HOME/profiles/web/package.json` should contain `dsh-mcp` (the Web Plugins page should show
221
+ `dsh-mcp` as installed and enabled). Since 1.13.0 the install writes this automatically; for a
222
+ profile migrated from an older release, follow section 2 — convert the old manual insert into an
223
+ id-targeted override and select the package into `bundles`. **One row id declared by two layers
224
+ does not take effect.**
195
225
  2. **Did you restart `dsh web`?** Refreshing the browser is not enough — the settings entry comes
196
226
  from the client roster, and roster changes require **restarting the process**.
197
227
  3. **Did you hard-refresh the browser?** After the restart use `Cmd/Ctrl + Shift + R`
198
228
  (Windows/Linux: `Ctrl + Shift + R`); a plain `F5` may load a cached old page.
199
229
  4. **Is it installed in the right profile?** Make sure both the install and the registration use
200
- the `web` profile (`dsh plugin --profile web add dsh-mcp` +
201
- `$DSH_HOME/profiles/web/cordis.patch.yml`); other profiles have their own settings pages.
230
+ the `web` profile (`dsh plugin --profile web add dsh-mcp` + that profile's
231
+ `dsh.profile.bundles`); other profiles have their own settings pages.
202
232
  5. **Is it the latest version?** npm metadata caching can pin an old version; force the version
203
233
  with `dsh plugin --profile web add dsh-mcp@latest` (or `@1.8.0`).
204
234
 
@@ -209,9 +239,9 @@ Check in order:
209
239
  mix with the new host (typical symptom: `client api: ... 404` or `env is not iterable` — both
210
240
  come from mixing versions);
211
241
  - An error shaped like `transport failure for /api/mcpManager/list: HTTP 404` means the host did
212
- not register the `mcpManager` service: usually the plugin host half is not active (missing
213
- cordis.patch.yml row / wrong profile) or the client and host versions disagree. Verify the
214
- registration row per Q1, confirm the install targets the `web` profile, restart, and
242
+ not register the `mcpManager` service: usually the plugin host half is not active (the bundle is
243
+ not selected in `dsh.profile.bundles`, or the wrong profile was installed) or the client and host
244
+ versions disagree. Verify `bundles` and the install location per Q1, restart, and
215
245
  hard-refresh; if it persists, upgrade both `dsh web` and the plugin to the latest versions.
216
246
 
217
247
  **Q3: MCP tools do not show up in an agent session?**
@@ -240,7 +270,8 @@ Check in order:
240
270
 
241
271
  **Process env vars** (below the injection mode, expanded by default):
242
272
 
243
- - Configure global key-value pairs referenced by every server's header substitution;
273
+ - Configure global key-value pairs shared by every server: **injected into each stdio server's child
274
+ process**, and referenced by streamable-http header substitution;
244
275
  secret values are stored in the credentials document, a blank value keeps the stored one
245
276
  - **process.env wins**: if a variable already exists in the process environment (`process.env`)
246
277
  under the same name, that value is used verbatim (name unchanged) at connect/display time and
@@ -248,7 +279,9 @@ Check in order:
248
279
  (e.g. `export ADA_TOKEN=...`) then restart `dsh web`
249
280
  - Batch-add (paste one `NAME=value` per line) or add rows one by one
250
281
  - A header value can reference a variable by **bare name** or **`${NAME}`** (e.g. `Authorization: Bearer ${GITLAB_TOKEN}`),
251
- substituted at connect time (priority: server env > process-level env > system environment)
282
+ substituted at connect time (priority: server env > process-level env > system environment);
283
+ a stdio child's environment follows the same precedence, so a per-server env entry overrides
284
+ the process-level value
252
285
 
253
286
  **JSON config editor** (top-right of the MCP config module):
254
287
 
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![dshfind](https://dshfind.com/api/badge/ArvinQi/dsh-mcp?lang=zh)](https://dshfind.com/zh/plugins/ArvinQi/dsh-mcp?ref=badge)
6
6
 
7
- > **支持版本**:`dsh 0.1.6-alpha.2` —— 本插件在 `0.1.6-alpha.2` 上开发与验证,`package.json` → `dsh.supported` 同步声明。DSH 与插件两侧版本不匹配时,设置页会给出排查诊断(检查注册行 → 重启 `dsh web` → 硬刷新 → 同步升级)。
7
+ > **支持版本**:`dsh 0.1.6-alpha.2` —— 本插件在 `0.1.6-alpha.2` 上开发与验证,`package.json` → `dsh.supported` 同步声明。DSH 与插件两侧版本不匹配时,设置页会给出排查诊断(检查 bundle 是否已选中 → 重启 `dsh web` → 硬刷新 → 同步升级)。
8
8
 
9
9
  ![设置页预览](static/snapshot.webp)
10
10
 
@@ -19,7 +19,7 @@
19
19
  **功能优势:**
20
20
 
21
21
  - **可视化管理**:服务器列表 / 新建 / 编辑 / 删除 / 测试连接 / 启停 / 刷新,全 UI 操作
22
- - **进程级环境变量**:全局 KV 配置(默认展开、支持批量添加),服务器请求头 value 写 `变量名` 或 `${变量名}` 即可在连接时自动替换为配置值(如 `Authorization: Bearer ${TOKEN}`)
22
+ - **进程级环境变量**:全局 KV 配置(默认展开、支持批量添加);stdio 服务器的子进程直接注入,streamable-http 服务器的请求头 value 写 `变量名` 或 `${变量名}` 即可在连接时自动替换为配置值(如 `Authorization: Bearer ${TOKEN}`);同名时服务器自身 env 优先
23
23
  - **JSON 全量配置**:「JSON 维护配置」面板以一段 JSON 数组查看/编辑全部服务器配置,应用即保存(新增/更新/删除)
24
24
  - **工具级精细控制**:每个服务器展开工具列表,默认全选,可取消勾选只加载需要的部分
25
25
  - **图片结果透传**:MCP 工具返回的图片(截图/图表等)经附件服务投影为图片引用进入模型上下文,带严格预检与有界降级文案(PR #4)
@@ -94,7 +94,8 @@ DSH 原生支持在组合里直接声明 MCP 服务器:**一行一台**,`nam
94
94
 
95
95
  ```
96
96
  dsh-mcp/
97
- ├── package.json name=dsh-mcp;dsh.client 声明;零 npm dependencies
97
+ ├── package.json name=dsh-mcp;dsh.bundle(自动注册)与 dsh.client 声明;零 npm dependencies
98
+ ├── cordis.patch.yml bundle patch:安装后自动 insert 插件行(id/name = dsh-mcp)
98
99
  ├── lib/
99
100
  │ ├── index.js host 半部(McpManagerService,源自 mcp-manager 构建产物)
100
101
  │ ├── cordis-servers.js 读取 patch 层原生声明的 MCP 服务器(1.11.0)
@@ -137,13 +138,19 @@ npm test
137
138
 
138
139
  ### 1. 安装
139
140
 
140
- **方式一:npm(发布到 npm 后)**
141
+ **方式一:Web 界面(推荐)**
142
+
143
+ DSH Web → **设置 → 插件**,填入包名 `dsh-mcp`(或本地目录的绝对路径)→ 安装。走的是与
144
+ `dsh plugin add` 相同的 pnpm 路径;1.13.0 起包内声明了 `dsh.bundle`,安装即自动注册为
145
+ profile 的 bundle 层(见第 2 节),不再需要手写注册行。
146
+
147
+ **方式二:npm(发布到 npm 后)**
141
148
 
142
149
  ```sh
143
150
  dsh plugin --profile web add dsh-mcp
144
151
  ```
145
152
 
146
- **方式二:GitHub git 源**
153
+ **方式三:GitHub git 源**
147
154
 
148
155
  ```sh
149
156
  dsh plugin --profile web add github:ArvinQi/dsh-mcp
@@ -151,7 +158,7 @@ dsh plugin --profile web add github:ArvinQi/dsh-mcp
151
158
  dsh plugin --profile web add git+https://github.com/ArvinQi/dsh-mcp.git
152
159
  ```
153
160
 
154
- **方式三:本地开发(link)**
161
+ **方式四:本地开发(link)**
155
162
 
156
163
  ```sh
157
164
  dsh plugin --profile web add link:<本仓库绝对路径>
@@ -161,18 +168,36 @@ dsh plugin --profile web add link:<本仓库绝对路径>
161
168
  > symlink(本机开发用,不入库),否则 `link:` 安装的 symlink 被 realpath 后无法解析
162
169
  > `@deepseek-ai/*`。
163
170
 
164
- ### 2. 注册与生效(三种方式通用)
171
+ ### 2. 注册与生效(四种方式通用)
165
172
 
166
- 在 `$DSH_HOME/profiles/web/cordis.patch.yml`(`$DSH_HOME` 默认 `~/.dsh`)追加:
173
+ **1.13.0 起自动注册,无需手写注册行**。包内 `package.json` 声明了 `dsh.bundle.patch`,指向随包
174
+ 发布的 `<包目录>/cordis.patch.yml`。DSH 在安装时会把包名写入
175
+ `$DSH_HOME/profiles/<profile>/package.json` 的 `dsh.profile.bundles`,该 patch 随即自动 insert
176
+ 插件行(host 管理器与 client 设置页由同一行提供):
167
177
 
168
178
  ```yaml
179
+ # <包目录>/cordis.patch.yml —— 随包发布,bundle 被选中后自动生效
169
180
  - insert:
170
181
  - id: dsh-mcp
171
182
  name: dsh-mcp
172
183
  ```
173
184
 
174
- > ⚠️ **这一步必须手动完成**:dsh-mcp 未声明 `dsh.bundle`,`dsh plugin add` 只负责把包装进
175
- > profile,**不会自动进入运行组合**。漏掉注册行则插件完全不生效。
185
+ > ⚠️ 不要在自己的 `$DSH_HOME/profiles/<profile>/cordis.patch.yml`(或机器级
186
+ > `$DSH_HOME/cordis.patch.yml`)里再 insert 同一行:同一 id 由两层声明会让 loader 组合失败。
187
+ > 这两个文件是**用户 patch 层**,和包内随包发布的 bundle patch 是两回事。
188
+
189
+ 需要覆盖配置时用 **id-targeted** 条目(用户 patch 层在所有 bundle 层之后应用,且会替换整份
190
+ `config`,未列出的键回落到 `Config` 默认值):
191
+
192
+ ```yaml
193
+ - id: dsh-mcp
194
+ config:
195
+ allowBrowserOnMount: true
196
+ ```
197
+
198
+ > 从旧版(<1.13.0)升级的 profile:把原来那段 `- insert: [{ id: dsh-mcp, name: dsh-mcp }]`
199
+ > 换成上面的 id-targeted 覆盖,并让 `dsh-mcp` 进入 `dsh.profile.bundles`(Web 插件页把
200
+ > `dsh-mcp` 显示为「已安装」后启用,或直接加进该数组)。
176
201
 
177
202
  然后**重启 `dsh web`**,并**硬刷新浏览器**(`Cmd/Ctrl + Shift + R`):
178
203
 
@@ -190,15 +215,16 @@ dsh plugin --profile web add link:<本仓库绝对路径>
190
215
 
191
216
  按顺序检查:
192
217
 
193
- 1. **是否已注册插件行**:确认 `$DSH_HOME/profiles/web/cordis.patch.yml` 已追加
194
- `- insert: [{ id: dsh-mcp, name: dsh-mcp }]`(`id`/`name` 必须与插件包名 `dsh-mcp` 完全一致)。
195
- `dsh plugin add` 不等于生效,**没有注册行插件不会挂载**。
218
+ 1. **插件行是否已注册**:`$DSH_HOME/profiles/web/package.json` 的 `dsh.profile.bundles` 应含
219
+ `dsh-mcp`(Web 插件页里 `dsh-mcp` 应显示为「已安装 + 已启用」)。1.13.0 起安装自动写入;
220
+ 旧版手工 insert 的 profile 按第 2 节改成 id-targeted 覆盖并把包选入 bundles——同一 id 由两层
221
+ 声明不会生效。
196
222
  2. **是否重启了 `dsh web`**:仅刷新浏览器不够——设置页入口来自 client roster,
197
223
  插件集变更必须**重启进程**才进入 roster。
198
224
  3. **是否硬刷新了浏览器**:重启后用 `Cmd/Ctrl + Shift + R`(Windows/Linux:`Ctrl + Shift + R`)
199
225
  强制刷新;普通 `F5` 可能加载缓存的旧页面。
200
226
  4. **是否装到了正确的 profile**:确认安装与注册都在 `web` profile
201
- (`dsh plugin --profile web add dsh-mcp` + `$DSH_HOME/profiles/web/cordis.patch.yml`);
227
+ (`dsh plugin --profile web add dsh-mcp` + 该 profile 的 `dsh.profile.bundles`);
202
228
  装到其他 profile 则在其他 profile 的设置页查看。
203
229
  5. **是否为最新版本**:npm 元数据缓存可能导致装到旧版,可强制指定版本
204
230
  `dsh plugin --profile web add dsh-mcp@latest`(或 `@1.8.0`)。
@@ -209,8 +235,8 @@ dsh plugin --profile web add link:<本仓库绝对路径>
209
235
  - 若升级过插件,请重启后**硬刷新**,避免旧 client bundle 与新版 host 不匹配
210
236
  (典型现象:操作报 `client api: ... 404` 或 `env is not iterable`,都是新旧版本混用所致);
211
237
  - 报错形如 `transport failure for /api/mcpManager/list: HTTP 404` 表示宿主端没有注册
212
- `mcpManager` 服务:多半是插件 host 半未生效(漏了 cordis.patch.yml 注册行/装错 profile)或
213
- client 与 host 版本不一致。请按 Q1 核对注册行、确认安装到了 `web` profile、重启后硬刷新;
238
+ `mcpManager` 服务:多半是插件 host 半未生效(bundle 未被选入 `dsh.profile.bundles`,或装错
239
+ profile)或 client 与 host 版本不一致。请按 Q1 核对 bundles 与安装位置、重启后硬刷新;
214
240
  仍不行则把 `dsh web` 与插件版本都升到最新再试。
215
241
 
216
242
  **Q3:MCP 工具没有出现在 agent 会话里?**
@@ -238,12 +264,13 @@ dsh plugin --profile web add link:<本仓库绝对路径>
238
264
 
239
265
  **进程环境变量**(注入模式下方,默认展开):
240
266
 
241
- - 配置全局键值对,供所有服务器的请求头替换引用;secret 值写入凭据文档,留空保留原值
267
+ - 配置全局键值对,供所有服务器使用:**stdio 服务器的子进程直接注入**,streamable-http 服务器用于请求头替换引用;secret 值写入凭据文档,留空保留原值
242
268
  - **process.env 优先**:若变量在进程环境变量(`process.env`)中已存在同名值,连接/展示时直接采用该值(不改名),
243
269
  存储值仅作为兜底——请先在启动脚本里 `export ADA_TOKEN=...` 再重启 `dsh web`
244
270
  - 支持「批量添加」(粘贴多行 `NAME=value`)与「添加变量」逐行添加
245
271
  - 服务器请求头 value 可直接写**变量名**或 **`${变量名}`**(如 `Authorization: Bearer ${GITLAB_TOKEN}`),
246
- 连接时自动替换(优先级:服务器 env > 进程级 env > 系统环境变量)
272
+ 连接时自动替换(优先级:服务器 env > 进程级 env > 系统环境变量);stdio 子进程的环境与此一致,
273
+ 同名时服务器自身 env 覆盖进程级 env
247
274
 
248
275
  **JSON 维护配置**(MCP 配置模块右上角):
249
276
 
@@ -0,0 +1,15 @@
1
+ # dsh-mcp bundle patch: the single row that provides the MCP manager.
2
+ #
3
+ # The row's package carries both halves, so one row is enough:
4
+ # - host: McpManagerService (persisted server definitions, runtime mounts of
5
+ # @deepseek-ai/dsh-mcp-client, credential injection, connection probes)
6
+ # - client: the Settings → MCP page, mounted through this package's `dsh.client`
7
+ # declaration (scanned by client-modules while the row is active)
8
+ #
9
+ # The row keeps the Config schema defaults (probeTimeoutMs 15000,
10
+ # allowBrowserOnMount true). A profile overrides them with an id-targeted entry
11
+ # in its own cordis.patch.yml, applied after every bundle layer; do not insert a
12
+ # second row with this id.
13
+ - insert:
14
+ - id: dsh-mcp
15
+ name: dsh-mcp
package/lib/client.js CHANGED
@@ -16632,7 +16632,7 @@ var zh = {
16632
16632
  serversJsonSaving: "\u5E94\u7528\u4E2D\u2026",
16633
16633
  serversJsonDone: "\u5DF2\u5E94\u7528",
16634
16634
  globalEnv: "\u8FDB\u7A0B\u73AF\u5883\u53D8\u91CF",
16635
- globalEnvHint: "\u8FDB\u7A0B\u7EA7\u73AF\u5883\u53D8\u91CF\uFF0C\u4F9B\u6240\u6709 MCP \u670D\u52A1\u5668\u7684\u8BF7\u6C42\u5934\u66FF\u6362\u5F15\u7528\uFF08headers \u503C\u5199 ${\u53D8\u91CF\u540D} \u6216\u76F4\u63A5\u5199\u53D8\u91CF\u540D\uFF09\u3002secret \u503C\u5199\u5165\u51ED\u636E\u6587\u6863\uFF0C\u4E0D\u5728\u6B64\u660E\u6587\u663E\u793A\uFF1B\u7559\u7A7A\u4FDD\u7559\u539F\u503C\u3002",
16635
+ globalEnvHint: "\u8FDB\u7A0B\u7EA7\u73AF\u5883\u53D8\u91CF\uFF0C\u4F9B\u6240\u6709 MCP \u670D\u52A1\u5668\u4F7F\u7528\uFF1Astdio \u670D\u52A1\u5668\u7684\u5B50\u8FDB\u7A0B\u76F4\u63A5\u6CE8\u5165\uFF0Cstreamable-http \u670D\u52A1\u5668\u7684\u8BF7\u6C42\u5934\u66FF\u6362\u5F15\u7528\uFF08headers \u503C\u5199 ${\u53D8\u91CF\u540D} \u6216\u76F4\u63A5\u5199\u53D8\u91CF\u540D\uFF09\uFF0C\u540C\u540D\u65F6\u670D\u52A1\u5668\u81EA\u8EAB env \u4F18\u5148\u3002secret \u503C\u5199\u5165\u51ED\u636E\u6587\u6863\uFF0C\u4E0D\u5728\u6B64\u660E\u6587\u663E\u793A\uFF1B\u7559\u7A7A\u4FDD\u7559\u539F\u503C\u3002",
16636
16636
  globalEnvName: "\u53D8\u91CF\u540D",
16637
16637
  globalEnvValue: "\u503C",
16638
16638
  globalEnvSecret: "\u79C1\u5BC6",
@@ -16757,7 +16757,7 @@ var en = {
16757
16757
  serversJsonSaving: "Applying\u2026",
16758
16758
  serversJsonDone: "Applied",
16759
16759
  globalEnv: "Process env vars",
16760
- globalEnvHint: "Process-level environment variables referenced by every server's header substitution (write ${NAME} or a bare name in a header value). Secret values are stored in the credentials document, never shown here; blank keeps the stored value.",
16760
+ globalEnvHint: "Process-level environment variables shared by every MCP server: injected into each stdio server's child process, and referenced by streamable-http header substitution (write ${NAME} or a bare name in a header value); a per-server env entry wins on collision. Secret values are stored in the credentials document, never shown here; blank keeps the stored value.",
16761
16761
  globalEnvName: "Name",
16762
16762
  globalEnvValue: "Value",
16763
16763
  globalEnvSecret: "secret",
package/lib/index.js CHANGED
@@ -97,9 +97,10 @@ const mcpServersDomainSpec = defineDomain({
97
97
  name: "mcp_servers",
98
98
  version: 0,
99
99
  tables: { servers: domainTable(mcpServerRowSchema),
100
- // Process-level environment variables: shared by every server's header
101
- // substitution. Plain values live here; secret values are stored in the
102
- // credentials document under DSH_MCP_ENV_<name>.
100
+ // Process-level environment variables: shared by every server — passed into
101
+ // every stdio child process's environment and available to streamable-http
102
+ // header substitution. Plain values live here; secret values are stored in
103
+ // the credentials document under DSH_MCP_ENV_<name>.
103
104
  global_env: domainTable(z$1.object({
104
105
  name: envVarNameSchema,
105
106
  secret: z$1.boolean(),
@@ -341,10 +342,12 @@ function sameRecord(left, right) {
341
342
  */
342
343
  function managedServerId(ref) {
343
344
  if (!ref.startsWith(SECRET_REF_PREFIX)) return void 0;
344
- const rest = ref.slice(8);
345
- const separator = rest.lastIndexOf("_");
346
- if (separator <= 0) return void 0;
347
- return rest.slice(0, separator);
345
+ // The ref is `<prefix><serverId>_<env name>`, and BOTH halves may contain
346
+ // `_` (ids are `mcp_<12 hex>`, env names are arbitrary POSIX names), so
347
+ // splitting on the last `_` misreads any name containing one. Match the id's
348
+ // fixed shape instead.
349
+ const match = /^(mcp_[0-9a-f]{12})_/.exec(ref.slice(SECRET_REF_PREFIX.length));
350
+ return match === null ? void 0 : match[1];
348
351
  }
349
352
  /** Credential reference holding one secret env value. */
350
353
  function secretRef(id, name) {
@@ -1007,7 +1010,8 @@ let McpManagerService = (() => {
1007
1010
  * Resolve the process-level env map. The process environment wins: a
1008
1011
  * variable present in process.env is used verbatim (by the same name);
1009
1012
  * otherwise the stored value (secret from credentials, plain from the
1010
- * table) is used as a fallback.
1013
+ * table) is used as a fallback. The map feeds every stdio child process's
1014
+ * environment and every `streamable-http` header substitution.
1011
1015
  */
1012
1016
  async resolveGlobalEnv() {
1013
1017
  const env = {};
@@ -1033,7 +1037,15 @@ let McpManagerService = (() => {
1033
1037
  command: spec.command,
1034
1038
  args: [...spec.args],
1035
1039
  cwd: spec.cwd,
1036
- env,
1040
+ // Process-level env vars reach the child too — the parent process
1041
+ // environment is not a channel (dsh-mcp-client merges the spec env
1042
+ // over a parent env scrubbed of credential-shaped names, so
1043
+ // `TAVILY_API_KEY` never survives inheritance). Per-server env
1044
+ // keeps priority over the process-level value.
1045
+ env: {
1046
+ ...globalEnv,
1047
+ ...env
1048
+ },
1037
1049
  toolCallTimeoutMs: spec.toolCallTimeoutMs,
1038
1050
  failOnStartupError: spec.failOnStartupError
1039
1051
  };
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "dsh-mcp",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
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",
7
7
  "exports": {
8
8
  ".": "./lib/index.js",
9
9
  "./client": "./lib/client.js",
10
+ "./cordis.patch.yml": "./cordis.patch.yml",
10
11
  "./package.json": "./package.json"
11
12
  },
12
13
  "files": [
@@ -14,6 +15,7 @@
14
15
  "src",
15
16
  "scripts",
16
17
  "static",
18
+ "cordis.patch.yml",
17
19
  "README.md",
18
20
  "README.en.md",
19
21
  "CHANGELOG.md",
@@ -40,6 +42,9 @@
40
42
  },
41
43
  "dsh": {
42
44
  "supported": "0.1.6-alpha.2",
45
+ "bundle": {
46
+ "patch": "./cordis.patch.yml"
47
+ },
43
48
  "client": {
44
49
  "inject": [
45
50
  "@deepseek-ai/dsh-api-remotes",
package/scripts/test.mjs CHANGED
@@ -28,6 +28,7 @@ const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..')
28
28
  const NEEDS_DSH_CLOSURE = new Set([
29
29
  'cordis-servers.test.mjs',
30
30
  'patch-writer.test.mjs',
31
+ 'stdio-env.test.mjs',
31
32
  'takeover.test.mjs',
32
33
  ])
33
34
 
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Process-level environment-variable editor: a global key-value list shared
3
- * by every MCP server's header substitution. Values are referenced from
4
- * server headers as `${NAME}` or by bare name; secret values are stored in
5
- * the credentials document and never shown back.
3
+ * by every MCP server — injected into each stdio server's child process, and
4
+ * referenced from streamable-http header values as `${NAME}` or by bare name.
5
+ * Secret values are stored in the credentials document and never shown back.
6
6
  * @module dsh-mcp/client/GlobalEnvEditor
7
7
  */
8
8
 
@@ -353,8 +353,9 @@ export function McpSettingsSection(props: McpSettingsSectionProps): ReactNode {
353
353
  injected={{ envList: props.envList, envSet: props.envSet }}
354
354
  t={t}
355
355
  onApplied={() => {
356
- // New process env may feed header substitution: refresh server
357
- // rows (connection attempts re-resolve env) but keep the tool list.
356
+ // New process env may feed stdio children and header
357
+ // substitution: refresh server rows (connection attempts
358
+ // re-resolve env) but keep the tool list.
358
359
  refreshServer('')
359
360
  }}
360
361
  />
@@ -108,7 +108,7 @@ export const zh = {
108
108
  serversJsonSaving: '应用中…',
109
109
  serversJsonDone: '已应用',
110
110
  globalEnv: '进程环境变量',
111
- globalEnvHint: '进程级环境变量,供所有 MCP 服务器的请求头替换引用(headers 值写 ${变量名} 或直接写变量名)。secret 值写入凭据文档,不在此明文显示;留空保留原值。',
111
+ globalEnvHint: '进程级环境变量,供所有 MCP 服务器使用:stdio 服务器的子进程直接注入,streamable-http 服务器的请求头替换引用(headers 值写 ${变量名} 或直接写变量名),同名时服务器自身 env 优先。secret 值写入凭据文档,不在此明文显示;留空保留原值。',
112
112
  globalEnvName: '变量名',
113
113
  globalEnvValue: '值',
114
114
  globalEnvSecret: '私密',
@@ -238,7 +238,7 @@ export const en = {
238
238
  serversJsonSaving: 'Applying…',
239
239
  serversJsonDone: 'Applied',
240
240
  globalEnv: 'Process env vars',
241
- globalEnvHint: 'Process-level environment variables referenced by every server\'s header substitution (write ${NAME} or a bare name in a header value). Secret values are stored in the credentials document, never shown here; blank keeps the stored value.',
241
+ globalEnvHint: 'Process-level environment variables shared by every MCP server: injected into each stdio server\'s child process, and referenced by streamable-http header substitution (write ${NAME} or a bare name in a header value); a per-server env entry wins on collision. Secret values are stored in the credentials document, never shown here; blank keeps the stored value.',
242
242
  globalEnvName: 'Name',
243
243
  globalEnvValue: 'Value',
244
244
  globalEnvSecret: 'secret',