dsh-mcp 1.12.1 → 1.14.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,9 +9,47 @@ 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).
12
+ - **Supported DSH version**: **dsh `0.2.0-rc.2`** — the latest release is developed and verified on `0.2.0-rc.2` (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.14.0] - 2026-10-13
16
+
17
+ - **Supported DSH version**: **dsh `0.2.0-rc.2`**
18
+
19
+ ### Changed
20
+
21
+ - **HTTPS servers are verified against the system trust store by default**: the host's `streamable-http` connections and its OAuth metadata discovery / dynamic registration / token exchange all went through Node's bundled root store, so intranet hosts (Ctrip Root CA, Zscaler/Sangfor proxy roots — CAs that only live in the OS keychain) failed with `fetch failed` / `UNABLE_TO_VERIFY_LEAF_SIGNATURE` unless `dsh web` was started with `NODE_OPTIONS=--use-system-ca` or `NODE_EXTRA_CA_CERTS`. The new `lib/system-ca.js` merges the operating system's roots into Node's default store at plugin start (`tls.getCACertificates('system')`, keeping every bundled root, idempotent), so HTTPS requests verify exactly what the OS trusts; on older hosts (Node < 24.9, no such API) it falls back to a scoped fetch bound to an undici Agent carrying the system roots. Neither path touches `http` servers or sites that were already trusted. Measured on the user's machine: 135 system roots are merged; and the DSH desktop runtime drops `NODE_OPTIONS` outright (`Node.js environment variables are disabled…`), so intranet HTTPS works exactly because of this merge — a server whose certificate is issued by `Ctrip Root Certificate Authority` connects without the variable
22
+ - **OAuth authorization is now a button plus 5s polling, and the Host opens the browser**: the server card shows an "Authorize" button when authorization is missing (new `oauthStart` / `oauthStatus` Remotes). Clicking it makes the **Host** open the authorization page in the system browser — a client-side `window.open` is denied inside the DSH shell and only flashes a blank tab, which was the "nothing happens" root cause. The row then shows "authorizing…" and polls the status every 5 seconds; once tokens land the existing `credentials/reference-updated` path remounts the server, the button disappears and the tools appear. Mounts and "Test connection" share one loopback flow (`createToolAuthorizationUrl` now dedupes concurrent requests per server)
23
+ - **The editor no longer carries its own authorization button**: the "open authorization page" button and link paragraph are gone (they cannot open in the shell and only added noise); the editor keeps the OAuth switch, a one-line hint and an "authorizing… / authorization complete" status, and "Test connection" remains its probe
24
+ - **The authorization outcome is visible**: the Host records the last flow's result per server, `oauthStatus` returns `pending` and `error` (the authorization server's `access_denied`, or a token-exchange failure), and the row renders "authorizing… / authorization failed: reason / authorization did not complete (retry)". The server view gained `oauthAuthorized` (list/upsert/adopt results) as the basis for the button and badge
25
+
26
+ ### Fixed
27
+
28
+ - **No more "authorization failed" before the user authorized**: an OAuth server used to render a red "mount failed" with the raw error as soon as it needed authorization, and Test connection popped the browser and could block for up to 5 minutes. `test` no longer opens a browser or blocks for an OAuth server — it returns an `oauthRequired` marker immediately; the mount records `status.oauthRequired` from a provider callback before the error is thrown (the `mcp-client` wrapper replaces the error, so the flag must be set early); the page renders that as an "awaiting authorization" badge and a one-line hint
29
+ - **The loopback callback port no longer leaks, and a retry is no longer shadowed by a stale connection**: the callback answered with keep-alive, so `server.close()` waited for the connection to end and the next authorization on the same stable port could have its callback delivered to the previous (closed) listener — the new one never fired and the page polled forever. Callbacks now answer with `Connection: close` and are force-closed via `closeAllConnections()`; the regression test proves a deny-then-retry succeeds without leaving a listening port behind
30
+ - **A working OAuth server is no longer flagged as unauthorized**: a server that is `live` and serving tools (its static headers are enough) keeps its normal status badge and a plain "Authorize" button; the red "not authorized" badge/button and the hint are reserved for servers the missing authorization actually blocks
31
+ - **No more raw authorization-link text when authorization is missing**: the several-hundred-character authorization URL embedded in the mount error (it contains `response_type=code`) is recognized and reduced to a one-line "click Authorize to finish"; real failures still show their diagnostic text
32
+
33
+ ### Notes
34
+
35
+ - Added `test/oauth-flow.test.mjs`: a built-in fake OAuth server (RFC 9728 resource metadata + RFC 8414 authorization-server metadata + registration/token endpoints, with `/mcp` always answering a 401 challenge) drives the real SDK flow, covering `oauthStart` payload validation and "the Host opens the browser", the `pending → authorized` poll, Test connection reporting `oauthRequired` instead of a failure, the mount's `status.oauthRequired`, and a deny (`access_denied`) followed by a successful retry that leaves no listening port behind
36
+ - Added `test/system-ca.test.mjs`: it mints a 127.0.0.1 self-signed certificate with openssl, serves HTTPS, and asserts that `fetch` fails before the merge and succeeds after while every bundled root survives (skipped without openssl or on Node < 24.9)
37
+ - Added `test/client-bundle.test.mjs`: it loads the built artifact through the shell's `__ModuleLoader__` wire format and asserts the exports plus the new copy/Remotes, so a stale `lib/client.js` fails the suite
38
+ - Verified live against a `dsh web` host (`web` profile): `mcpManager/oauthStart` and `oauthStatus` answer (`octop-memory-oauth: authorized:false`, `bigdata-adhoc-mcp-oauth: authorized:true`), `list` returns `oauthAuthorized`, and the served client bundle rev matches the repository build
39
+
40
+ ## [1.13.0] - 2026-10-08
41
+
42
+ - **Supported DSH version**: **dsh `0.1.6-alpha.2`**
43
+
44
+ ### Changed
45
+
46
+ - **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
47
+ - **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
48
+
49
+ ### Notes
50
+
51
+ - 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)
52
+
15
53
  ## [1.12.1] - 2026-10-07
16
54
 
17
55
  - **Supported DSH version**: **dsh `0.1.6-alpha.2`**
package/CHANGELOG.md CHANGED
@@ -9,9 +9,47 @@
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` → 硬刷新 → 同步升级)。
12
+ - **支持版本**:**dsh `0.2.0-rc.2`** —— 最新版本在 `0.2.0-rc.2` 上开发与验证(`package.json` → `dsh.supported` 同步声明);历史版本条目各自声明当时验证的版本。DSH 与插件版本不匹配时,设置页会给出排查诊断(核对 bundle 是否已选中 → 重启 `dsh web` → 硬刷新 → 同步升级)。
13
13
  - **发版约定**:每个版本条目都要声明 `- **支持版本**:dsh <版本>`,并在 GitHub Release notes 中同步。Release 正文用**中文**(与本文档一致),标题层级与条目一致。
14
14
 
15
+ ## [1.14.0] - 2026-10-13
16
+
17
+ - **支持版本**:**dsh `0.2.0-rc.2`**
18
+
19
+ ### 变更
20
+
21
+ - **HTTPS 服务器默认按系统证书校验**:宿主的 `streamable-http` 连接、OAuth 元数据发现/动态注册/token 交换此前都走 Node 自带的根证书库,于是内网域名(Ctrip Root CA、Zscaler/Sangfor 代理根等只装在系统钥匙串里的 CA)报 `fetch failed` / `UNABLE_TO_VERIFY_LEAF_SIGNATURE`,必须先给 `dsh web` 加 `NODE_OPTIONS=--use-system-ca` 或 `NODE_EXTRA_CA_CERTS` 才能用。现在新模块 `lib/system-ca.js` 在插件启动时把**操作系统信任库的根证书并入 Node 默认库**(`tls.getCACertificates('system')`,保留 Node 自带根、重复调用幂等),HTTPS 请求即按系统证书校验;宿主 Node 较旧(< 24.9,无该 API)时退回用 undici Agent 携带系统根做定向 fetch,两条路径都不影响 `http` 服务器与原本就信任的站点。真机实测:本机识别 135 条系统根证书;且 DSH 桌面的 Electron-as-Node 运行时会直接丢弃 `NODE_OPTIONS`(日志 `Node.js environment variables are disabled…`),所以内网 HTTPS 正是靠这个合并才通——证书签发者为 `Ctrip Root Certificate Authority` 的 MCP 服务器在未设该环境变量时也能连通
22
+ - **OAuth 授权改为「按钮 + 5 秒轮询」,浏览器由宿主打开**:服务器卡片在授权缺失时显示「OAuth 授权」按钮(新增 Remote `oauthStart` / `oauthStatus`);点击后由**宿主**用系统浏览器打开授权页——客户端 `window.open` 在 DSH 外壳里会被拒绝、只闪一下空白标签页,这是"点了没反应"的根因;随后行上显示「授权中…」并每 5 秒查询一次授权状态,token 落库后照旧经 `credentials/reference-updated` 自动重挂载,按钮消失、工具出现。挂载与「测试连接」共用同一个回环回调流程(`createToolAuthorizationUrl` 增加同服务器并发去重),先挂载再点按钮不会重复起监听、不会抢同一个固定端口
23
+ - **编辑表单不再有自己的授权按钮**:删掉「打开授权页面」按钮与链接段落(外壳里打不开、只会制造噪音),编辑页只保留 OAuth 勾选、一行说明与「授权中/授权成功」状态;「测试连接」仍是表单里的探测方式
24
+ - **授权结果可见**:宿主按服务器记录最近一次流程结果,`oauthStatus` 返回 `pending` 与 `error`(授权服务器回的 `access_denied`、或 token 交换失败),列表行据此显示「授权中… / 授权失败: 原因 / 授权未完成(可重试)」,不再是"点完没有任何反馈";新增 `oauthAuthorized` 视图字段(列表/upsert/adopt 结果)作为按钮与徽标的依据
25
+
26
+ ### 修复
27
+
28
+ - **授权完成前不再显示「授权失败」**:此前 OAuth 服务器的挂载/测试在用户尚未授权时就以红色「挂载失败」+ 原文错误呈现,测试连接还会自动弹浏览器并最多阻塞 5 分钟。现在 `test` 对 OAuth 服务器不再自动开浏览器、不再阻塞,改为立即返回带 `oauthRequired` 标记的结果;挂载侧由 provider 回调在抛错前标记 `status.oauthRequired`(`mcp-client` 会包装错误、吞掉稳定错误码,所以标记必须提前完成);设置页遇到该标记只显示「等待授权」徽标与一行提示
29
+ - **回环回调端口不再泄漏,重试不再被旧连接顶掉**:回调此前用 keep-alive 应答,`server.close()` 会一直等连接释放;同一稳定端口的下一次授权可能把回环请求投递给上一个已关闭的监听器,新监听器永远收不到回调(表现为一直"授权中")。现在回调响应带 `Connection: close`,处理结束强制 `closeAllConnections()`,回归测试里"先拒绝再重试"必须成功且进程不残留端口
30
+ - **不再把正常工作的 OAuth 服务器标成未授权**:服务器 `live` 且有工具(静态 token 已够用)时保持正常状态徽标,只留一个普通「OAuth 授权」按钮;红色「未授权」徽标/红色按钮与提示仅用于授权确实卡住挂载(失败、无工具)的服务器
31
+ - **未授权时不再显示授权链接长文本**:挂载错误里那条几百字符的授权 URL(带 `response_type=code`)被识别并收敛成一行「点击「OAuth 授权」完成授权即可」,其余真实故障仍原样显示
32
+
33
+ ### 说明
34
+
35
+ - 新增 `test/oauth-flow.test.mjs`:用一个内置的假 OAuth 服务器(RFC 9728 资源元数据 + RFC 8414 授权服务器元数据 + 注册/token 端点,`/mcp` 一律回 401 挑战)真跑 SDK 授权链路,覆盖 `oauthStart` 参数校验与"宿主负责打开浏览器"、`pending → authorized` 轮询、测试连接返回 `oauthRequired` 而非失败、挂载 `status.oauthRequired`、以及"先拒绝(`access_denied`)再重试必须成功且不残留监听端口"
36
+ - 新增 `test/system-ca.test.mjs`:用 openssl 现造 127.0.0.1 自签证书起 HTTPS 服务,断言合并前 `fetch` 失败、合并后成功,且 Node 自带根证书全部保留(无 openssl 或 Node < 24.9 的环境自动跳过)
37
+ - 新增 `test/client-bundle.test.mjs`:按 shell 的 `__ModuleLoader__` 线上格式加载构建产物,断言导出与新增文案/Remote,防止 `lib/client.js` 陈旧
38
+ - 真机验证:`dsh web`(`web` profile)宿主 `mcpManager/oauthStart` / `oauthStatus` 正常应答(`octop-memory-oauth: authorized:false`、`bigdata-adhoc-mcp-oauth: authorized:true`),`list` 返回 `oauthAuthorized`,客户端包 rev 与仓库构建一致
39
+
40
+ ## [1.13.0] - 2026-10-08
41
+
42
+ - **支持版本**:**dsh `0.1.6-alpha.2`**
43
+
44
+ ### 变更
45
+
46
+ - **声明 `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 发布
47
+ - **注册行移入包内,用户 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」是两个文件
48
+
49
+ ### 说明
50
+
51
+ - 新增 `test/bundle-manifest.test.mjs`:断言清单声明 `dsh.bundle.patch`、被引用的 patch 文件存在且列入 `files`、patch 解析后恰好 insert 一行 `{ id: dsh-mcp, name: dsh-mcp }`(解析用 `js-yaml`;无 DSH 模块闭包的环境只跳过该子测试)
52
+
15
53
  ## [1.12.1] - 2026-10-07
16
54
 
17
55
  - **支持版本**:**dsh `0.1.6-alpha.2`**
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.2.0-rc.2` — the latest release is developed and verified on `0.2.0-rc.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
 
@@ -23,7 +23,8 @@
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)
24
24
  - **Two injection modes**: `search` (on-demand, token-saving) and `full` (inject everything)
25
25
  - **Zero npm dependencies**: plugs into DeepSeek Harness internals, install and go
26
- - **OAuth authentication**: for `streamable-http` servers using MCP OAuth (authorization-code + PKCE), the browser opens automatically for authorization on connect; tokens and OAuth client info are persisted and refreshed automatically by the SDK (auto-renewed while active within 24h), with automatic re-authorization after expiry
26
+ - **OAuth authentication**: for `streamable-http` servers using MCP OAuth (authorization-code + PKCE), the server card has an **Authorize** button and the **Host opens the system browser** for the login; the page then polls the authorization status every 5 seconds. Tokens and OAuth client info are persisted and refreshed automatically by the SDK (auto-renewed while active within 24h), with re-authorization after expiry. **Before you authorize it only says "authorizing"; a real failure reports its reason**
27
+ - **HTTPS verified against the system trust store by default**: intranet/corporate CAs (roots installed in the OS keychain) no longer need `NODE_OPTIONS=--use-system-ca` on `dsh web`; the plugin merges the OS store into Node's default root store at startup
27
28
  - **Three install paths**: npm / GitHub git source / local link; bilingual UI and docs
28
29
 
29
30
  Migrated and merged from uncommitted MCP work in the `deepseek-harness` repository:
@@ -47,9 +48,13 @@ Migrated and merged from uncommitted MCP work in the `deepseek-harness` reposito
47
48
  - Injection mode: `search` (on-demand, default — the model hot-injects tools via `mcp_tool_search`) and `full` (inject every enabled tool each request).
48
49
  - Expandable per-server tool list, all checked by default; unchecking a tool keeps it out of injection. Changes take effect immediately.
49
50
  - **OAuth authentication** (host, `lib/oauth.js`): on a 401 + OAuth challenge from a `streamable-http`
50
- server, runs the authorization-code + PKCE flow automatically — opens the browser, receives the
51
- callback on a loopback server, persists tokens, and refreshes them on demand; test connection and
52
- mounts share the same token.
51
+ server, runs the authorization-code + PKCE flow — receives the callback on a loopback server,
52
+ persists tokens, and refreshes them on demand; the settings page offers an "Authorize" button
53
+ (Remote `oauthStart`, the Host opens the system browser) and a 5s `oauthStatus` poll returning
54
+ `pending` / `authorized` / the failure reason. Test connections share the mount's token.
55
+ - **System certificate verification** (host, `lib/system-ca.js`): at startup the OS trust store's roots
56
+ are merged into Node's default store, so HTTPS connections and OAuth discovery/registration/token
57
+ exchange verify against the system store (on Node < 24.9 it falls back to a scoped undici-Agent fetch).
53
58
  - **Remote self-mount**: the client half mounts the `mcpManager` Remote namespace itself via `ctx.remote.$mount()` in `apply()`,
54
59
  so no in-box package modification is required.
55
60
  - **Declared servers are read too** (host, `lib/cordis-servers.js`): `@deepseek-ai/dsh-mcp-client` rows
@@ -80,7 +85,7 @@ Since 1.11.0 those declarations appear in Settings → MCP, badged "cordis decla
80
85
  - **Imported into storages as mirrors**: at startup and on every refresh the declarations are imported into the storage domain (id `cordis:<rowId>`, with `origin/declaredIn/declaredRowId`), **import only** — a row created in the plugin is never overwritten; a mirror whose declaration disappeared is **removed automatically** (a mirror is only a copy of a declaration, so an ownerless one must not pile up); a declaration containing a `!!js` expression is skipped and flagged with the reason (its value only resolves inside the Loader). Mirrors are never mounted — the composition owns the mount.
81
86
  - **Take over / give back**: clicking "Take over" makes the plugin write an id-targeted `disabled: true` into its own **managed block** in `cordis.patch.yml` (a `.dsh-mcp.bak` backup is taken before the first write; atomic, idempotent, reversible, confined to that block). The declaration releases the `serverName` and the plugin mounts its own row instead — enabling **OAuth authorization, managed credentials, `${VAR}` header substitution and connection tests**. A hard mount failure rolls back automatically (the block is removed and the row returns to mirror state) and reports why; "Give back" hands the mount back to the declaration and deletes the managed row. A declaration without an explicit `id`, or one containing a `!!js` expression, cannot be taken over.
82
87
  - **OAuth / placeholder limit (`needsPlugin`)**: a declaration can carry neither an OAuth provider nor `${VAR}` / bare-name placeholder substitution — only the plugin does those. Such a declaration can therefore only work while the plugin owns the mount: the page reports it as **failed with the reason** (not "connecting"), "Give back" makes its tools disappear (the confirmation and the result warning both say so), and taking it over again restores them.
83
- - **OAuth is an explicit switch (since 1.11.1)**: an OAuth provider is attached only when the server sets `oauth: true` (the form's "Use OAuth authorization" checkbox, off by default). **Do not tick it for servers that authenticate with static tokens or custom headers** — otherwise a 401 is treated as an OAuth challenge and the plugin keeps opening the browser (with its `127.0.0.1:<port>/callback` loopback listener). The plugin also opens the browser **at most once per server per process**; later automatic attempts return the authorization-link error, and "Test connection" can still start one on demand. Upgrading migrates automatically from existing OAuth credentials, so servers that genuinely need OAuth are unaffected.
88
+ - **OAuth is an explicit switch (since 1.11.1)**: an OAuth provider is attached only when the server sets `oauth: true` (the form's "Use OAuth authorization" checkbox, off by default). **Do not tick it for servers that authenticate with static tokens or custom headers** — otherwise a 401 is treated as an OAuth challenge and the plugin starts a `127.0.0.1:<port>/callback` loopback flow. Authorization is started from the settings page's button: a mount still opens the browser **at most once per server per process**, an unauthorized server renders "awaiting authorization" and polls every 5s instead of a failure, and "Test connection" no longer opens a browser — it returns the authorization-required marker and the button opens the page. Upgrading migrates automatically from existing OAuth credentials, so servers that genuinely need OAuth are unaffected.
84
89
  - **Safe degradation when the hot reload does not commit**: if the native tools have not unregistered within 5 seconds of writing the disable block (that profile's patch hot reload did not commit — a sibling entry failing its re-apply rolls the whole generation back), the plugin **registers the takeover without mounting** (the managed row is marked `pendingTakeover`); the next dsh start mounts it, and "Give back" reports the same need for a restart. A mount is also always skipped when same-named `mcp__<server>__` tools already exist without a local mount, so the plugin never fights a still-mounted declaration for one name.
85
90
  - **Tool search covers them**: search/hot injection and per-tool switches work by `mcp__` prefix across the whole tool set, so declared tools need no extra configuration.
86
91
 
@@ -88,13 +93,15 @@ Since 1.11.0 those declarations appear in Settings → MCP, badged "cordis decla
88
93
 
89
94
  ```
90
95
  dsh-mcp/
91
- ├── package.json name=dsh-mcp; dsh.client declaration; zero npm dependencies
96
+ ├── package.json name=dsh-mcp; dsh.bundle (auto-registration) and dsh.client declarations; zero npm dependencies
97
+ ├── cordis.patch.yml bundle patch: inserts the plugin row (id/name = dsh-mcp) on install
92
98
  ├── lib/
93
99
  │ ├── index.js host half (McpManagerService, built from mcp-manager)
94
100
  │ ├── cordis-servers.js reads natively declared MCP servers from the patch layers (1.11.0)
95
101
  │ ├── patch-writer.js managed-block writer: disables a declaration on takeover (backup/atomic/idempotent)
96
102
  │ ├── mcp-client.js vendored MCP client (from @deepseek-ai/dsh-mcp-client, with tool-list stability extension)
97
103
  │ ├── oauth.js MCP OAuth client provider (authorization-code + PKCE, loopback callback, token persistence)
104
+ │ ├── system-ca.js system CA trust: merges the OS roots into Node's default store (1.14.0)
98
105
  │ ├── probe.js vendored connection probe (from mcp-client/src/probe.ts)
99
106
  │ ├── transport.js vendored transport factory (from mcp-client/src/transport.ts)
100
107
  │ └── client.js browser half (esbuild bundle, ModuleLoader wire format)
@@ -132,13 +139,20 @@ npm test
132
139
 
133
140
  ### 1. Install
134
141
 
135
- **Option 1: npm (after publishing)**
142
+ **Option 1: Web UI (recommended)**
143
+
144
+ DSH Web → **Settings → Plugins**, enter the package name `dsh-mcp` (or the absolute path of a local
145
+ directory) → Install. This runs the same pnpm path as `dsh plugin add`; since 1.13.0 the package
146
+ declares `dsh.bundle`, so installing it registers it as a profile bundle layer automatically (see
147
+ section 2) and no hand-written registration row is needed.
148
+
149
+ **Option 2: npm (after publishing)**
136
150
 
137
151
  ```sh
138
152
  dsh plugin --profile web add dsh-mcp
139
153
  ```
140
154
 
141
- **Option 2: GitHub git source**
155
+ **Option 3: GitHub git source**
142
156
 
143
157
  ```sh
144
158
  dsh plugin --profile web add github:ArvinQi/dsh-mcp
@@ -146,7 +160,7 @@ dsh plugin --profile web add github:ArvinQi/dsh-mcp
146
160
  dsh plugin --profile web add git+https://github.com/ArvinQi/dsh-mcp.git
147
161
  ```
148
162
 
149
- **Option 3: local development (link)**
163
+ **Option 4: local development (link)**
150
164
 
151
165
  ```sh
152
166
  dsh plugin --profile web add link:<absolute path to this repo>
@@ -158,17 +172,37 @@ dsh plugin --profile web add link:<absolute path to this repo>
158
172
 
159
173
  ### 2. Registration (all install options)
160
174
 
161
- Append to `$DSH_HOME/profiles/web/cordis.patch.yml` (`$DSH_HOME` defaults to `~/.dsh`):
175
+ **Since 1.13.0 registration is automatic.** The package manifest declares `dsh.bundle.patch`,
176
+ pointing at the shipped `<package dir>/cordis.patch.yml`. On install, DSH writes the package name
177
+ into `dsh.profile.bundles` in `$DSH_HOME/profiles/<profile>/package.json`, and that patch then
178
+ inserts the plugin row (one row provides both the host manager and the client settings page):
162
179
 
163
180
  ```yaml
181
+ # <package dir>/cordis.patch.yml — ships with the package, applies once the bundle is selected
164
182
  - insert:
165
183
  - id: dsh-mcp
166
184
  name: dsh-mcp
167
185
  ```
168
186
 
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.
187
+ > ⚠️ Do not insert the same row again in your own `$DSH_HOME/profiles/<profile>/cordis.patch.yml`
188
+ > (or the machine-wide `$DSH_HOME/cordis.patch.yml`): one row id declared by two layers makes the
189
+ > loader fail to compose. Those two files are the **user patch layer**, distinct from the bundle
190
+ > patch that ships inside the package.
191
+
192
+ To override configuration, use an **id-targeted** entry (the user patch layer applies after every
193
+ bundle layer, and it replaces the whole `config`, so keys you omit fall back to the `Config`
194
+ defaults):
195
+
196
+ ```yaml
197
+ - id: dsh-mcp
198
+ config:
199
+ allowBrowserOnMount: true
200
+ ```
201
+
202
+ > Upgrading a profile from an older release (<1.13.0): replace that
203
+ > `- insert: [{ id: dsh-mcp, name: dsh-mcp }]` block with the id-targeted override above, and get
204
+ > `dsh-mcp` into `dsh.profile.bundles` (enable it in the Web Plugins page once `dsh-mcp` shows as
205
+ > installed, or add the name to that array directly).
172
206
 
173
207
  Then **restart `dsh web`** and **hard-refresh the browser** (`Cmd/Ctrl + Shift + R`):
174
208
 
@@ -188,17 +222,19 @@ Then **restart `dsh web`** and **hard-refresh the browser** (`Cmd/Ctrl + Shift +
188
222
 
189
223
  Check in order:
190
224
 
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**.
225
+ 1. **Is the plugin row registered?** `dsh.profile.bundles` in
226
+ `$DSH_HOME/profiles/web/package.json` should contain `dsh-mcp` (the Web Plugins page should show
227
+ `dsh-mcp` as installed and enabled). Since 1.13.0 the install writes this automatically; for a
228
+ profile migrated from an older release, follow section 2 — convert the old manual insert into an
229
+ id-targeted override and select the package into `bundles`. **One row id declared by two layers
230
+ does not take effect.**
195
231
  2. **Did you restart `dsh web`?** Refreshing the browser is not enough — the settings entry comes
196
232
  from the client roster, and roster changes require **restarting the process**.
197
233
  3. **Did you hard-refresh the browser?** After the restart use `Cmd/Ctrl + Shift + R`
198
234
  (Windows/Linux: `Ctrl + Shift + R`); a plain `F5` may load a cached old page.
199
235
  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.
236
+ the `web` profile (`dsh plugin --profile web add dsh-mcp` + that profile's
237
+ `dsh.profile.bundles`); other profiles have their own settings pages.
202
238
  5. **Is it the latest version?** npm metadata caching can pin an old version; force the version
203
239
  with `dsh plugin --profile web add dsh-mcp@latest` (or `@1.8.0`).
204
240
 
@@ -209,9 +245,9 @@ Check in order:
209
245
  mix with the new host (typical symptom: `client api: ... 404` or `env is not iterable` — both
210
246
  come from mixing versions);
211
247
  - 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
248
+ not register the `mcpManager` service: usually the plugin host half is not active (the bundle is
249
+ not selected in `dsh.profile.bundles`, or the wrong profile was installed) or the client and host
250
+ versions disagree. Verify `bundles` and the install location per Q1, restart, and
215
251
  hard-refresh; if it persists, upgrade both `dsh web` and the plugin to the latest versions.
216
252
 
217
253
  **Q3: MCP tools do not show up in an agent session?**
@@ -228,8 +264,11 @@ Check in order:
228
264
  `Authorization` header, so a 401 is never mistaken for an OAuth challenge that opens the browser.
229
265
  For a static-token server, make sure the request headers are correct;
230
266
  - If an HTTPS intranet host reports `fetch failed` / `unable to verify the first certificate`, the
231
- host Node does not trust the internal CA: start `dsh web` with `NODE_OPTIONS=--use-system-ca`
232
- (or add the root cert to `NODE_EXTRA_CA_CERTS`), then restart the host and hard-refresh.
267
+ host Node does not trust the internal CA. **Since 1.14.0 the plugin merges the system trust store
268
+ into Node's default store at startup** (see the system-certificate note under "OAuth servers"), so
269
+ no extra configuration is normally needed; if it still fails, check that the root really is installed
270
+ in the OS keychain, or fall back to `NODE_OPTIONS=--use-system-ca` / `NODE_EXTRA_CA_CERTS`, then
271
+ restart the host and hard-refresh.
233
272
 
234
273
  **Add a server**:
235
274
 
@@ -262,16 +301,34 @@ Check in order:
262
301
 
263
302
  **OAuth servers** (`streamable-http` using MCP OAuth, e.g. OAuth-protected gateway services):
264
303
 
265
- - Just fill in the URL and test the connection; when the server responds with a 401 + OAuth challenge,
266
- the plugin **opens the browser automatically** for authorization.
267
- - Log in / approve in the browser and return to DSH; the test result refreshes automatically
268
- ("connection succeeded + tool count").
304
+ - Fill in the URL and tick "Use OAuth authorization"; when authorization is missing the card shows an
305
+ **Authorize** button (the editor has no button of its own — just the switch, a one-line hint and an
306
+ "authorizing / authorization complete" status).
307
+ - Clicking it makes the **Host open the system browser** (a client-side `window.open` is denied inside the
308
+ DSH shell and only flashes), the row shows "authorizing…" and **checks the status every 5 seconds**; a
309
+ manual link in the row covers the case where the browser did not come up.
310
+ - On success the button disappears and the tools appear; a failure reports its reason (e.g.
311
+ "authorization failed: access_denied"), and an expired callback says "authorization did not complete
312
+ (retry)". Nothing is reported as failed before you authorize.
269
313
  - Tokens and the registered OAuth client are persisted in the credentials document (scoped by `serverName`)
270
314
  and refreshed automatically by the MCP SDK (auto-renewed while active within 24h); after authorizing once,
271
315
  mounts and later test connections reuse the same token, and an expired token triggers a fresh
272
- browser authorization automatically.
273
- - The first authorization needs browser interaction, so the test/connect wait budget is relaxed to
274
- 5 minutes; non-OAuth servers are unaffected and fail fast.
316
+ authorization automatically.
317
+ - A server that is already live and serving tools (its static token is enough) is not flagged red; the red
318
+ badge/button is reserved for servers the missing authorization actually blocks.
319
+ - The first mount (`allowBrowserOnMount`, on by default) may still open the browser once; set
320
+ `allowBrowserOnMount: false` in the profile patch to make authorization fully button-driven. Non-OAuth
321
+ servers are unaffected and fail fast.
322
+
323
+ **HTTPS intranet certificates**:
324
+
325
+ - At startup the plugin merges the **operating system trust store** into Node's default root store
326
+ (`lib/system-ca.js`), so `streamable-http` connections and OAuth discovery/registration/token exchange
327
+ trust exactly what the browser and curl trust: a root installed in the OS keychain (corporate CA,
328
+ Zscaler/Sangfor proxy root, ...) needs no `NODE_OPTIONS=--use-system-ca` / `NODE_EXTRA_CA_CERTS`.
329
+ - Every bundled Node root survives (merge, not replace; idempotent); on hosts below Node 24.9 (no
330
+ `tls.getCACertificates`) it falls back to a scoped undici-Agent fetch carrying the system roots, and
331
+ keeps the previous behaviour if even that is unavailable.
275
332
 
276
333
  **Day-to-day management**:
277
334
 
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.2.0-rc.2` —— 最新版本在 `0.2.0-rc.2` 上开发与验证,`package.json` → `dsh.supported` 同步声明。DSH 与插件两侧版本不匹配时,设置页会给出排查诊断(检查 bundle 是否已选中 → 重启 `dsh web` → 硬刷新 → 同步升级)。
8
8
 
9
9
  ![设置页预览](static/snapshot.webp)
10
10
 
@@ -25,7 +25,8 @@
25
25
  - **图片结果透传**:MCP 工具返回的图片(截图/图表等)经附件服务投影为图片引用进入模型上下文,带严格预检与有界降级文案(PR #4)
26
26
  - **双注入模式**:`search`(按需检索,省 token)与 `full`(全量注入)
27
27
  - **零 npm 依赖**:直接对接 DeepSeek Harness 内部能力,安装即用
28
- - **OAuth 认证支持**:`streamable-http` 服务器若走 MCP OAuth(授权码 + PKCE),连接时自动打开浏览器授权;token 与 client 信息持久化、由 SDK 自动刷新(24 小时内活跃自动续期),失效后自动重新授权
28
+ - **OAuth 认证支持**:`streamable-http` 服务器若走 MCP OAuth(授权码 + PKCE),服务器卡片点「OAuth 授权」按钮,**由宿主打开系统浏览器**完成授权,本页每 5 秒轮询授权状态;token 与 client 信息持久化、由 SDK 自动刷新(24 小时内活跃自动续期),失效后重新授权。**授权完成前只显示「授权中」,授权失败会写明原因**
29
+ - **HTTPS 默认按系统证书校验**:内网/公司 CA(只装在系统钥匙串里的根证书)无需再给 `dsh web` 加 `NODE_OPTIONS=--use-system-ca`,插件启动时把系统信任库并入 Node 默认根证书库
29
30
  - **三种安装方式**:npm / GitHub git 源 / 本地 link;中英文界面与文档
30
31
 
31
32
  ## 功能
@@ -34,9 +35,12 @@
34
35
  `@deepseek-ai/dsh-mcp-client` 实例、环境变量注入(明文入定义、secret 走 credentials)、
35
36
  连接探测(test)。
36
37
  - **Web 设置管理页**(client):Settings → MCP,列表/编辑/删除/测试服务器。
37
- - **OAuth 认证**(host,`lib/oauth.js`):`streamable-http` 服务器遇 401 + OAuth 挑战时自动走
38
- 授权码 + PKCE 流程,打开浏览器授权、回环回调收码、token 持久化并按需自动刷新;
39
- 测试连接与挂载共用同一份 token。
38
+ - **OAuth 认证**(host,`lib/oauth.js`):`streamable-http` 服务器遇 401 + OAuth 挑战时走
39
+ 授权码 + PKCE 流程,回环回调收码、token 持久化并按需自动刷新;设置页提供「OAuth 授权」按钮
40
+ (Remote `oauthStart`,浏览器由宿主用系统浏览器打开)与每 5 秒一次的 `oauthStatus` 轮询
41
+ (返回 `pending` / `authorized` / 失败原因),测试连接与挂载共用同一份 token。
42
+ - **系统证书校验**(host,`lib/system-ca.js`):启动时把操作系统信任库的根证书并入 Node 默认库,
43
+ HTTPS 连接与 OAuth 发现/注册/token 交换因此按系统证书校验(Node < 24.9 时退回 undici Agent 定向 fetch)。
40
44
  - **Remote 自挂载**:client 半部在 `apply()` 里自行 `ctx.remote.$mount()` 挂载 `mcpManager`
41
45
  命名空间(原实现依赖 api-remotes 的 in-box 修改,独立版不再需要任何 in-box 包改动)。
42
46
  - **读取声明式服务器**(host,`lib/cordis-servers.js`):把 patch 层里原生声明的
@@ -80,8 +84,9 @@ DSH 原生支持在组合里直接声明 MCP 服务器:**一行一台**,`nam
80
84
  重新「接管」。
81
85
  - **OAuth 是显式开关(1.11.1 起)**:服务器配置里的 `oauth: true`(设置页「使用 OAuth 授权」勾选,默认关)
82
86
  才会挂 OAuth provider。**用静态 token 或自定义头认证的服务器不要勾**——否则它返回 401 时会被当成 OAuth
83
- 挑战,插件会反复打开浏览器授权(并起 `127.0.0.1:<port>/callback` 回环回调)。另外,同一服务器**每个进程
84
- 最多自动弹一次**浏览器,之后只返回带授权链接的错误;手动「测试连接」仍可随时发起授权。升级时会按已有
87
+ 挑战,起 `127.0.0.1:<port>/callback` 回环回调。授权由设置页的按钮发起(见下节):挂载阶段同一服务器
88
+ **每个进程最多自动弹一次**浏览器,未授权时页面显示「等待授权」并每 5 秒轮询状态,不报授权失败;
89
+ 「测试连接」不再自动弹浏览器,而是返回需要授权的标记,由按钮打开授权页。升级时会按已有
85
90
  OAuth 凭据自动迁移,真正需要 OAuth 的服务器不受影响。
86
91
  - **热重载未提交时的安全降级**:写入停用块后若原生工具 5 秒内没有注销(该 profile 的 patch 热重载未提交,
87
92
  例如某个兄弟条目重建失败导致整代回滚),插件会**登记接管但暂不挂载**(管理行标记 `pendingTakeover`),
@@ -94,13 +99,15 @@ DSH 原生支持在组合里直接声明 MCP 服务器:**一行一台**,`nam
94
99
 
95
100
  ```
96
101
  dsh-mcp/
97
- ├── package.json name=dsh-mcp;dsh.client 声明;零 npm dependencies
102
+ ├── package.json name=dsh-mcp;dsh.bundle(自动注册)与 dsh.client 声明;零 npm dependencies
103
+ ├── cordis.patch.yml bundle patch:安装后自动 insert 插件行(id/name = dsh-mcp)
98
104
  ├── lib/
99
105
  │ ├── index.js host 半部(McpManagerService,源自 mcp-manager 构建产物)
100
106
  │ ├── cordis-servers.js 读取 patch 层原生声明的 MCP 服务器(1.11.0)
101
107
  │ ├── patch-writer.js 受管块写入器:接管时在 patch 文件里停用声明行(备份/原子/幂等)
102
108
  │ ├── mcp-client.js vendored MCP 客户端(源自 @deepseek-ai/dsh-mcp-client,含工具列表稳定扩展)
103
109
  │ ├── oauth.js MCP OAuth 客户端提供者(授权码 + PKCE、回环回调、token 持久化)
110
+ │ ├── system-ca.js 系统证书信任:把操作系统根证书并入 Node 默认库(1.14.0)
104
111
  │ ├── probe.js vendored 连接探测(源自 mcp-client/src/probe.ts)
105
112
  │ ├── transport.js vendored 传输工厂(源自 mcp-client/src/transport.ts)
106
113
  │ └── client.js 浏览器半部(esbuild 打包,ModuleLoader wire format)
@@ -137,13 +144,19 @@ npm test
137
144
 
138
145
  ### 1. 安装
139
146
 
140
- **方式一:npm(发布到 npm 后)**
147
+ **方式一:Web 界面(推荐)**
148
+
149
+ DSH Web → **设置 → 插件**,填入包名 `dsh-mcp`(或本地目录的绝对路径)→ 安装。走的是与
150
+ `dsh plugin add` 相同的 pnpm 路径;1.13.0 起包内声明了 `dsh.bundle`,安装即自动注册为
151
+ profile 的 bundle 层(见第 2 节),不再需要手写注册行。
152
+
153
+ **方式二:npm(发布到 npm 后)**
141
154
 
142
155
  ```sh
143
156
  dsh plugin --profile web add dsh-mcp
144
157
  ```
145
158
 
146
- **方式二:GitHub git 源**
159
+ **方式三:GitHub git 源**
147
160
 
148
161
  ```sh
149
162
  dsh plugin --profile web add github:ArvinQi/dsh-mcp
@@ -151,7 +164,7 @@ dsh plugin --profile web add github:ArvinQi/dsh-mcp
151
164
  dsh plugin --profile web add git+https://github.com/ArvinQi/dsh-mcp.git
152
165
  ```
153
166
 
154
- **方式三:本地开发(link)**
167
+ **方式四:本地开发(link)**
155
168
 
156
169
  ```sh
157
170
  dsh plugin --profile web add link:<本仓库绝对路径>
@@ -161,18 +174,36 @@ dsh plugin --profile web add link:<本仓库绝对路径>
161
174
  > symlink(本机开发用,不入库),否则 `link:` 安装的 symlink 被 realpath 后无法解析
162
175
  > `@deepseek-ai/*`。
163
176
 
164
- ### 2. 注册与生效(三种方式通用)
177
+ ### 2. 注册与生效(四种方式通用)
165
178
 
166
- 在 `$DSH_HOME/profiles/web/cordis.patch.yml`(`$DSH_HOME` 默认 `~/.dsh`)追加:
179
+ **1.13.0 起自动注册,无需手写注册行**。包内 `package.json` 声明了 `dsh.bundle.patch`,指向随包
180
+ 发布的 `<包目录>/cordis.patch.yml`。DSH 在安装时会把包名写入
181
+ `$DSH_HOME/profiles/<profile>/package.json` 的 `dsh.profile.bundles`,该 patch 随即自动 insert
182
+ 插件行(host 管理器与 client 设置页由同一行提供):
167
183
 
168
184
  ```yaml
185
+ # <包目录>/cordis.patch.yml —— 随包发布,bundle 被选中后自动生效
169
186
  - insert:
170
187
  - id: dsh-mcp
171
188
  name: dsh-mcp
172
189
  ```
173
190
 
174
- > ⚠️ **这一步必须手动完成**:dsh-mcp 未声明 `dsh.bundle`,`dsh plugin add` 只负责把包装进
175
- > profile,**不会自动进入运行组合**。漏掉注册行则插件完全不生效。
191
+ > ⚠️ 不要在自己的 `$DSH_HOME/profiles/<profile>/cordis.patch.yml`(或机器级
192
+ > `$DSH_HOME/cordis.patch.yml`)里再 insert 同一行:同一 id 由两层声明会让 loader 组合失败。
193
+ > 这两个文件是**用户 patch 层**,和包内随包发布的 bundle patch 是两回事。
194
+
195
+ 需要覆盖配置时用 **id-targeted** 条目(用户 patch 层在所有 bundle 层之后应用,且会替换整份
196
+ `config`,未列出的键回落到 `Config` 默认值):
197
+
198
+ ```yaml
199
+ - id: dsh-mcp
200
+ config:
201
+ allowBrowserOnMount: true
202
+ ```
203
+
204
+ > 从旧版(<1.13.0)升级的 profile:把原来那段 `- insert: [{ id: dsh-mcp, name: dsh-mcp }]`
205
+ > 换成上面的 id-targeted 覆盖,并让 `dsh-mcp` 进入 `dsh.profile.bundles`(Web 插件页把
206
+ > `dsh-mcp` 显示为「已安装」后启用,或直接加进该数组)。
176
207
 
177
208
  然后**重启 `dsh web`**,并**硬刷新浏览器**(`Cmd/Ctrl + Shift + R`):
178
209
 
@@ -190,15 +221,16 @@ dsh plugin --profile web add link:<本仓库绝对路径>
190
221
 
191
222
  按顺序检查:
192
223
 
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` 不等于生效,**没有注册行插件不会挂载**。
224
+ 1. **插件行是否已注册**:`$DSH_HOME/profiles/web/package.json` 的 `dsh.profile.bundles` 应含
225
+ `dsh-mcp`(Web 插件页里 `dsh-mcp` 应显示为「已安装 + 已启用」)。1.13.0 起安装自动写入;
226
+ 旧版手工 insert 的 profile 按第 2 节改成 id-targeted 覆盖并把包选入 bundles——同一 id 由两层
227
+ 声明不会生效。
196
228
  2. **是否重启了 `dsh web`**:仅刷新浏览器不够——设置页入口来自 client roster,
197
229
  插件集变更必须**重启进程**才进入 roster。
198
230
  3. **是否硬刷新了浏览器**:重启后用 `Cmd/Ctrl + Shift + R`(Windows/Linux:`Ctrl + Shift + R`)
199
231
  强制刷新;普通 `F5` 可能加载缓存的旧页面。
200
232
  4. **是否装到了正确的 profile**:确认安装与注册都在 `web` profile
201
- (`dsh plugin --profile web add dsh-mcp` + `$DSH_HOME/profiles/web/cordis.patch.yml`);
233
+ (`dsh plugin --profile web add dsh-mcp` + 该 profile 的 `dsh.profile.bundles`);
202
234
  装到其他 profile 则在其他 profile 的设置页查看。
203
235
  5. **是否为最新版本**:npm 元数据缓存可能导致装到旧版,可强制指定版本
204
236
  `dsh plugin --profile web add dsh-mcp@latest`(或 `@1.8.0`)。
@@ -209,8 +241,8 @@ dsh plugin --profile web add link:<本仓库绝对路径>
209
241
  - 若升级过插件,请重启后**硬刷新**,避免旧 client bundle 与新版 host 不匹配
210
242
  (典型现象:操作报 `client api: ... 404` 或 `env is not iterable`,都是新旧版本混用所致);
211
243
  - 报错形如 `transport failure for /api/mcpManager/list: HTTP 404` 表示宿主端没有注册
212
- `mcpManager` 服务:多半是插件 host 半未生效(漏了 cordis.patch.yml 注册行/装错 profile)或
213
- client 与 host 版本不一致。请按 Q1 核对注册行、确认安装到了 `web` profile、重启后硬刷新;
244
+ `mcpManager` 服务:多半是插件 host 半未生效(bundle 未被选入 `dsh.profile.bundles`,或装错
245
+ profile)或 client 与 host 版本不一致。请按 Q1 核对 bundles 与安装位置、重启后硬刷新;
214
246
  仍不行则把 `dsh web` 与插件版本都升到最新再试。
215
247
 
216
248
  **Q3:MCP 工具没有出现在 agent 会话里?**
@@ -226,8 +258,9 @@ dsh plugin --profile web add link:<本仓库绝对路径>
226
258
  401 被误当成 OAuth 挑战而打开浏览器授权。若你连的是需要静态 token 的服务器,确认请求头
227
259
  正确即可;
228
260
  - 若 https 内网域名报 `fetch failed` / `unable to verify the first certificate`,是宿主 Node
229
- 不信任公司内网 CA:用 `NODE_OPTIONS=--use-system-ca` 启动 `dsh web`(或把根证书加入
230
- `NODE_EXTRA_CA_CERTS`),再重启宿主与硬刷新浏览器。
261
+ 不信任公司内网 CA。**1.14.0 起插件启动时已自动把系统信任库并入 Node 默认库**(见「OAuth 服务器」下方的
262
+ 系统证书说明),通常无需额外配置;仍失败时再检查系统钥匙串里是否装了该根证书,或临时用
263
+ `NODE_OPTIONS=--use-system-ca` / `NODE_EXTRA_CA_CERTS` 启动 `dsh web` 兜底,并重启宿主与硬刷新浏览器。
231
264
 
232
265
  **添加服务器**:
233
266
 
@@ -254,11 +287,27 @@ dsh plugin --profile web add link:<本仓库绝对路径>
254
287
 
255
288
  **OAuth 服务器**(`streamable-http` 走 MCP OAuth,如受 OAuth 保护的网关服务):
256
289
 
257
- - 只需正常填写 URL 并测试连接;服务器返回 401 + OAuth 挑战时,插件**自动打开浏览器**完成授权
258
- - 在浏览器中登录/同意后返回 DSH,测试结果自动刷新(「连接成功 + 工具数」)
290
+ - 正常填写 URL 并勾选「使用 OAuth 授权」;授权缺失时服务器卡片会出现 **「OAuth 授权」按钮**
291
+ (编辑页不再有自己的按钮,只保留勾选、一行说明与「授权中/授权成功」状态)
292
+ - 点击按钮**由宿主打开系统浏览器**(客户端 `window.open` 在 DSH 外壳里会被拒绝、只闪一下),
293
+ 行上显示「授权中…」并**每 5 秒检查一次授权状态**;浏览器没起来时可以点行内的手动链接
294
+ - 授权成功后按钮消失、工具出现;失败会写明原因(如「授权失败: access_denied」),
295
+ 回调消失则显示「授权未完成(可重试)」——授权完成前不会报失败
259
296
  - token 与 OAuth client 信息持久化在凭据文档(按 `serverName` 隔离),由 MCP SDK 自动刷新
260
- (24 小时内活跃自动续期);失效后自动重新授权,授权一次后挂载与测试复用
261
- - 首次授权需浏览器交互,测试/连接等待时间放宽至 5 分钟;非 OAuth 服务器不受影响,连接失败即时返回
297
+ (24 小时内活跃自动续期);失效后重新授权,授权一次后挂载与测试复用
298
+ - 已经 `live` 且有工具的服务器(静态 token 够用)不会被打上红色「未授权」,只保留一个普通授权按钮;
299
+ 红色徽标/红色按钮只用于授权确实卡住挂载的服务器
300
+ - 第一次挂载(`allowBrowserOnMount`,默认开)仍可能自动弹一次浏览器;把 profile 的
301
+ `allowBrowserOnMount` 设为 `false` 即可完全改为「按钮驱动」。非 OAuth 服务器不受影响,连接失败即时返回
302
+
303
+ **HTTPS 内网证书**:
304
+
305
+ - 插件启动时把**操作系统信任库**的根证书并入 Node 默认根证书库(`lib/system-ca.js`),
306
+ `streamable-http` 连接、OAuth 元数据发现/注册/token 交换因此与浏览器、curl 的信任一致:
307
+ 只要根证书装在系统钥匙串里(公司内网 CA、Zscaler/Sangfor 代理根等),就无需再设置
308
+ `NODE_OPTIONS=--use-system-ca` / `NODE_EXTRA_CA_CERTS`
309
+ - Node 自带根证书全部保留(并入而非替换,幂等);宿主 Node 低于 24.9(无 `tls.getCACertificates`)时
310
+ 退回用 undici Agent 携带系统根做定向 fetch,失败则维持原行为
262
311
 
263
312
  **日常管理**:
264
313
 
@@ -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