@lstions/dsh-skill-mcp-panel 1.11.0 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -11,6 +11,8 @@
11
11
 
12
12
  | 版本 | 日期 | 提交 | 内容 |
13
13
  |---|---|---|---|
14
+ | 1.12.1 | 2026-12-06 | 见下 | 工具数读取兼容 DSH 0.2.3 的注册表 API(`visible()`/`names()`),修复高版本宿主上所有 MCP 行显示「无工具」 |
15
+ | 1.12.0 | 2026-12-04 | 见下 | MCP「重新注册工具」(`mcp.reregister`):声明行重挂、外层行 fiber 重启,工具数取自真实注册表 |
14
16
  | 1.11.0 | 2026-11-14 | 见下 | 改名 `@lstions/dsh-skill-mcp-panel` 并补齐 npm 发布元数据(license/repository/engines.dsh/publishConfig) |
15
17
  | 1.10.0 | 2026-11-14 | 见下 | MCP 行级操作常显(编辑/删除无需展开)、工具列表限高滚动、修复主面板无法滚动 |
16
18
  | 1.9.2 | 2026-11-14 | 见下 | 修禁用态主按钮在深色主题下前景色被 `.skn_button:disabled` 覆盖(对比度 ≈1.9:1) |
@@ -52,6 +54,44 @@
52
54
 
53
55
  `test/version-check.mjs` 会阻止这件事再次发生:同一个版本号在下方出现两次即测试失败。
54
56
 
57
+ ## [1.12.1] - 2026-12-06
58
+
59
+ ### 修复:DSH 0.2.3 宿主上 MCP 工具数恒为 0
60
+
61
+ - `dsh-tools` 0.2.3 移除了 `schemas()` / `definitions()`,改用作用域感知的
62
+ `visible()` / `names()` / `registered()` / `getAll()`,候选本身就是定义。
63
+ 面板原来只读 `schemas()`,于是在 0.2.3 宿主上**每个已连接、工具已注册的 MCP
64
+ 行都显示「无工具」**——「重新注册工具」返回 applied 但计数仍是 0。
65
+ - `toolsFor` 现在按宿主实际暴露的 API 枚举:0.2.2 及更早仍走 `schemas()`;
66
+ 0.2.3 优先 `visible()`,退而 `names()` + `registered()`;描述优先取定义自身,
67
+ 老宿主再回退到 `get(name)`。无法枚举时仍按 0 降级,不抛异常。
68
+ - 新增 `mcp-inventory` 门禁:分别用仅实现 `visible()` 和仅实现
69
+ `names()`/`registered()` 的假注册表断言工具计数与描述,防止回归。
70
+
71
+ ---
72
+
73
+ ## [1.12.0] - 2026-12-04
74
+
75
+ ### 新增:MCP「重新注册工具」(`mcp.reregister`)
76
+
77
+ - 每个**启用中**的 MCP 行新增「重新注册工具 / Re-register tools」操作:行级常显,
78
+ `aria-label` 带服务器名,关闭的行不提供(不会借此悄悄连上)。
79
+ - **本插件声明的服务器**:先 dispose 旧实例,再按同一配置重新挂载,工具从真实
80
+ `ctx.tools` 复读;同一 `serverName` 只保留一份注册,旧实例不残留。
81
+ - **外层 composition 层插入的行**(profile `cordis.patch.yml` 等):用该行
82
+ **自己的 fiber** `restart()` 在内存中重建客户端 —— 不重写用户的组合文件、
83
+ 不需要重启宿主;没有可重启 fiber 时如实 `refused` 并提示重启宿主。
84
+ - 结论只用注册表能证明的事实:重连后零工具**不是失败**(服务器可能本来就没有工具),
85
+ detail 写明「N 个工具」或「当前无工具」;失败时带真实原因。
86
+ - 状态提示条现在显示 host 返回的 `detail`(拒绝原因、重连后的真实工具数),
87
+ 不再只有 Applied / Refused 两个词。
88
+ - 门禁:`mcp-live` 用真实 Cordis + 真实 stdio 子进程证明重注册发布的是**新一代**
89
+ 注册(注册表计数器);`mcp-inventory` 覆盖拒绝路径与两条重连路径;
90
+ `ui-page` 覆盖按钮常显与 `mcp.reregister` 提交;`host-http` 覆盖新操作经
91
+ HTTP 路由到 MCP manager。
92
+
93
+ ---
94
+
55
95
  ## [1.11.0] - 2026-11-14
56
96
 
57
97
  ### 发布:改名为 scoped 包并补齐 npm 元数据
package/README.md CHANGED
@@ -53,7 +53,7 @@ duplicate of itself.
53
53
  From the npm registry (the normal flow):
54
54
 
55
55
  ```sh
56
- dsh plugin --profile web add @lstions/dsh-skill-mcp-panel@1.11.0
56
+ dsh plugin --profile web add @lstions/dsh-skill-mcp-panel@1.12.1
57
57
  # then restart the profile
58
58
  ```
59
59
 
@@ -85,7 +85,7 @@ cat ~/.dsh/profiles/web/package.json
85
85
 
86
86
  | Spec | Result |
87
87
  |---|---|
88
- | `@lstions/dsh-skill-mcp-panel@1.11.0` | from the registry — installs and auto-selects the bundle |
88
+ | `@lstions/dsh-skill-mcp-panel@1.12.1` | from the registry — installs and auto-selects the bundle |
89
89
  | `/abs/path` or `file:/abs/path` | local checkout, same behaviour |
90
90
  | `https://github.com/<owner>/<repo>.git` | pnpm clones it; needs credentials/network |
91
91
  | `git@github.com:<owner>/<repo>.git` | **broken in `dsh`** — see below |
@@ -255,8 +255,10 @@ sections:
255
255
  Cordis layer inserted. Each row shows transport, target, the user's note, live
256
256
  phase, tool count and registered tool names (counted from the real tool
257
257
  registry, never inferred from configuration). Servers this plugin declared can be added, edited,
258
- removed and toggled; rows from an outer layer can only be toggled, and a row
259
- the harness itself manages is shown read-only with the reason.
258
+ removed and toggled; rows from an outer layer can be toggled, and a row
259
+ the harness itself manages is shown read-only with the reason. Every enabled
260
+ row — owned or outer — also gets **Re-register tools**, which reconnects it and
261
+ republishes its tools without restarting the host.
260
262
 
261
263
  "Every layer" means **Cordis/DSH composition layers only** — bundle, profile,
262
264
  preset, session plugin. This section is deliberately scoped to the harness: it
@@ -472,6 +474,15 @@ Two honesty requirements, both tested:
472
474
  only the in-memory instance; the persisted config keeps the user's value).
473
475
  - **A tool-less server is not a failed server.** A server that legitimately
474
476
  exposes no tools is reported as connected, not as broken.
477
+ - **Re-registration is a reconnect, not a host restart.** `mcp.reregister` is
478
+ the recovery action for a row that is present but shows zero tools: a
479
+ connection that died, a client that exhausted its retry budget, or a
480
+ generation swap that rolled back. A server this plugin owns is unmounted and
481
+ mounted again; an outer row is restarted through **its own fiber**
482
+ (`fiber.restart()`), which disposes and re-applies the plugin in memory with
483
+ the same config — no composition file is rewritten. A row with no live fiber
484
+ is refused with "restart the host instead", and a disabled row is never
485
+ connected behind the user's back.
475
486
 
476
487
  ## Management HTTP channel
477
488
 
@@ -493,8 +504,8 @@ Every write is fenced:
493
504
  content type without a preflight it will not pass.
494
505
  - **`writeAccess`** may be tightened to `loopback` in configuration.
495
506
 
496
- The MCP operations are `mcp.toggle`, `mcp.add`, `mcp.configure`,
497
- `mcp.preview`, `mcp.import` and `mcp.remove`. `mcp.preview` (inspect without
507
+ The MCP operations are `mcp.toggle`, `mcp.reregister`, `mcp.add`,
508
+ `mcp.configure`, `mcp.preview`, `mcp.import` and `mcp.remove`. `mcp.preview` (inspect without
498
509
  writing) and `mcp.import` answer with **one result per server** in document
499
510
  order; every other kind answers with one result.
500
511
 
@@ -710,7 +721,7 @@ Node.js ≥ 20.13 for `fs.watch(..., { recursive: true })`, plus
710
721
  Releases are semver and every released version has a `vX.Y.Z` git tag pointing at
711
722
  the exact commit; [CHANGELOG.md](CHANGELOG.md) records what changed.
712
723
 
713
- **Referenceable versions start at `1.4.0`; the current version is `1.11.0`.**
724
+ **Referenceable versions start at `1.4.0`; the current version is `1.12.1`.**
714
725
  Before `1.4.0`, this repository published some version numbers twice with
715
726
  different content:
716
727
 
package/lib/client.js CHANGED
@@ -72,6 +72,7 @@ window.__ModuleLoader__.load({
72
72
  ".skn_error{color:var(--dsw-alias-state-error-primary);font-size:13px;line-height:18px;margin:0}" +
73
73
  ".skn_errors{color:var(--dsw-alias-state-error-primary);margin:0;padding-left:18px;font-size:12px;line-height:18px}" +
74
74
  ".skn_notice{border-radius:8px;align-self:flex-start;padding:4px 10px;font-size:13px;line-height:18px;margin:0}" +
75
+ ".skn_noticeDetail{opacity:.85}" +
75
76
  ".skn_filters{align-items:center;gap:8px;flex-wrap:wrap;display:flex}" +
76
77
  ".skn_input{height:32px;font:inherit;font-size:13px;border-radius:8px;padding:0 10px;border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);min-width:160px}" +
77
78
  ".skn_groups,.skn_rows,.skn_conflicts,.skn_servers{flex-direction:column;gap:2px;margin:0;padding:0;list-style:none;display:flex}" +
@@ -519,6 +520,8 @@ const UI_EN = {
519
520
  "mcp.confirmRemove": "Remove “{name}”?",
520
521
  "mcp.toggle.enable": "Enable “{name}”",
521
522
  "mcp.toggle.disable": "Disable “{name}”",
523
+ "mcp.reregister": "Re-register tools",
524
+ "mcp.reregister.hint": "Reconnect this server and register its tools again, without restarting the host",
522
525
  "mcp.field.serverName": "Name",
523
526
  "mcp.field.transport": "Transport",
524
527
  "mcp.field.command": "Command",
@@ -661,6 +664,8 @@ const UI_ZH = {
661
664
  "mcp.confirmRemove": "确定删除「{name}」?",
662
665
  "mcp.toggle.enable": "启用「{name}」",
663
666
  "mcp.toggle.disable": "关闭「{name}」",
667
+ "mcp.reregister": "重新注册工具",
668
+ "mcp.reregister.hint": "重新连接该服务器并重新注册它的工具,无需重启宿主",
664
669
  "mcp.field.serverName": "名称",
665
670
  "mcp.field.transport": "传输方式",
666
671
  "mcp.field.command": "命令",
@@ -1341,7 +1346,7 @@ const UI_ZH = {
1341
1346
  * a page that "helpfully" showed the real token would be the leak.
1342
1347
  */
1343
1348
  function McpServerRow(props) {
1344
- const { t, server, busy, onToggle, onConfigure, onRemove, writable } = props;
1349
+ const { t, server, busy, onToggle, onConfigure, onRemove, onReregister, writable } = props;
1345
1350
  const [open, setOpen] = react.useState(false);
1346
1351
  const [editing, setEditing] = react.useState(false);
1347
1352
  // The row's config is the full transport config (masked secrets one level
@@ -1399,6 +1404,22 @@ const UI_ZH = {
1399
1404
  react.createElement(
1400
1405
  "div",
1401
1406
  { className: "skn_serverActions" },
1407
+ // Recovery is always reachable: a row whose client gave up retrying has
1408
+ // zero tools but is otherwise indistinguishable from a healthy row here.
1409
+ server.enabled !== false && writable !== false
1410
+ ? react.createElement(
1411
+ "button",
1412
+ {
1413
+ type: "button",
1414
+ className: "skn_button skn_buttonSmall",
1415
+ disabled: busy,
1416
+ title: t("mcp.reregister.hint"),
1417
+ "aria-label": t("mcp.reregister.hint") + ": " + server.serverName,
1418
+ onClick: () => onReregister(server),
1419
+ },
1420
+ t("mcp.reregister"),
1421
+ )
1422
+ : null,
1402
1423
  editable
1403
1424
  ? react.createElement(
1404
1425
  "button",
@@ -1745,6 +1766,13 @@ const UI_ZH = {
1745
1766
  (server) => runOp({ kind: "mcp.remove", serverName: server.serverName }, server.serverName),
1746
1767
  [runOp],
1747
1768
  );
1769
+ // Reconnect + re-register: the recovery action for a row whose tools
1770
+ // vanished (a dead connection, an exhausted retry budget, a rolled-back
1771
+ // generation swap). The host reports exactly what the registry proves.
1772
+ const reregisterServer = react.useCallback(
1773
+ (server) => runOp({ kind: "mcp.reregister", serverName: server.serverName }, server.serverName),
1774
+ [runOp],
1775
+ );
1748
1776
 
1749
1777
  /** 关掉导入表单,并清空这一轮输入的所有内容。 */
1750
1778
  const closeImport = react.useCallback(() => {
@@ -1837,6 +1865,12 @@ const UI_ZH = {
1837
1865
  "p",
1838
1866
  { className: "skn_notice skn_badge-" + notice.tone, role: "status" },
1839
1867
  t(notice.key, notice.params),
1868
+ // The host detail is the only place a refusal reason or the real
1869
+ // tool count after a re-register appears. Dropping it made
1870
+ // "applied" hide a server that came back with zero tools.
1871
+ typeof notice.detail === "string" && notice.detail !== ""
1872
+ ? react.createElement("span", { className: "skn_noticeDetail" }, " — " + notice.detail)
1873
+ : null,
1840
1874
  )
1841
1875
  : null,
1842
1876
 
@@ -2030,6 +2064,7 @@ const UI_ZH = {
2030
2064
  onToggle: toggleServer,
2031
2065
  onConfigure: configureServer,
2032
2066
  onRemove: removeServer,
2067
+ onReregister: reregisterServer,
2033
2068
  writable: state.writable !== false,
2034
2069
  }),
2035
2070
  ),
package/lib/contract.js CHANGED
@@ -117,6 +117,8 @@ export const OP = {
117
117
  CONFIG_UNSET: 'config.unset',
118
118
  /** Enable or disable a mounted MCP server row. */
119
119
  MCP_TOGGLE: 'mcp.toggle',
120
+ /** Reconnect one server and register its tools again, without a host restart. */
121
+ MCP_REREGISTER: 'mcp.reregister',
120
122
  /** Rewrite one server's connection configuration. */
121
123
  MCP_CONFIGURE: 'mcp.configure',
122
124
  /** Declare a new MCP server owned by this plugin. */
package/lib/index.js CHANGED
@@ -732,6 +732,7 @@ function resolveConfig(raw) {
732
732
  /** Operation kinds this module handles itself; everything else MCP owns. */
733
733
  const MCP_KINDS = new Set([
734
734
  OP.MCP_TOGGLE,
735
+ OP.MCP_REREGISTER,
735
736
  OP.MCP_CONFIGURE,
736
737
  OP.MCP_ADD,
737
738
  OP.MCP_PREVIEW,
package/lib/mcp.js CHANGED
@@ -761,6 +761,45 @@ export function createMcpManager(deps = {}) {
761
761
  }
762
762
  }
763
763
 
764
+ /**
765
+ * Enumerate the tools a host tool registry exposes, across the DSH APIs.
766
+ *
767
+ * `dsh-tools` 0.2.2 and older publish `schemas()`, the model-facing
768
+ * projection. 0.2.3 replaced it with the scope-aware `visible()` /
769
+ * `names()` / `registered()` family, whose candidates ARE the definitions.
770
+ * Reading only `schemas()` made every MCP row report zero tools on a 0.2.3
771
+ * host even though the servers were connected and the tools were registered.
772
+ *
773
+ * @param {object} registry - the live `tools` service
774
+ * @returns {Array<{name: string, description?: unknown}>}
775
+ */
776
+ function registryTools(registry) {
777
+ const collected = []
778
+ if (typeof registry.schemas === 'function') {
779
+ for (const schema of registry.schemas() ?? []) {
780
+ if (typeof schema?.name === 'string') collected.push(schema)
781
+ }
782
+ return collected
783
+ }
784
+ if (typeof registry.visible === 'function') {
785
+ for (const [name, candidate] of registry.visible() ?? []) {
786
+ if (typeof name !== 'string') continue
787
+ const definition = candidate?.definition ?? candidate
788
+ collected.push({ name, description: definition?.description })
789
+ }
790
+ return collected
791
+ }
792
+ if (typeof registry.names === 'function' && typeof registry.registered === 'function') {
793
+ for (const name of registry.names()?.known ?? []) {
794
+ if (typeof name !== 'string') continue
795
+ const definition = registry.registered(name)
796
+ collected.push({ name, description: definition?.description })
797
+ }
798
+ return collected
799
+ }
800
+ return collected
801
+ }
802
+
764
803
  /**
765
804
  * Enumerate every live tool belonging to one MCP server.
766
805
  *
@@ -768,10 +807,6 @@ export function createMcpManager(deps = {}) {
768
807
  * configuration: a server that failed to connect, or whose generation swap
769
808
  * was rolled back, must report zero tools even though its row exists.
770
809
  *
771
- * `ctx.tools.schemas()` is the public projection of visible definitions
772
- * (`dsh-tools`), and `get(name)` the scope-aware lookup; both are used so a
773
- * registry exposing only one of them still answers.
774
- *
775
810
  * @param {string} serverName
776
811
  * @returns {{tools: object[], schemas: Map<string, object>}}
777
812
  */
@@ -782,22 +817,25 @@ export function createMcpManager(deps = {}) {
782
817
  const registry = toolsRegistry()
783
818
  if (registry === undefined) return { tools, schemas }
784
819
 
785
- const collected = []
820
+ let collected = []
786
821
  try {
787
- if (typeof registry.schemas === 'function') {
788
- for (const schema of registry.schemas() ?? []) {
789
- if (typeof schema?.name === 'string') collected.push(schema)
790
- }
791
- }
822
+ collected = registryTools(registry)
792
823
  } catch (error) {
793
- log(`skill-mcp-panel: could not read ctx.tools.schemas(): ${String(error)}`)
824
+ log(`skill-mcp-panel: could not enumerate ctx.tools: ${String(error)}`)
794
825
  }
795
- // A registry may expose `get` without an enumerator; names are then read
796
- // off the schema list only, which is the same public projection.
797
826
  for (const schema of collected) {
798
827
  if (!schema.name.startsWith(prefix)) continue
799
- const definition = typeof registry.get === 'function' ? registry.get(schema.name) : undefined
800
- const description = text(definition?.description ?? schema.description)
828
+ // Older hosts project schemas and resolve the definition through
829
+ // `get`; newer hosts hand the definition over directly.
830
+ let description = text(schema.description)
831
+ if (description === '' && typeof registry.get === 'function') {
832
+ try {
833
+ description = text(registry.get(schema.name)?.description)
834
+ } catch {
835
+ // A root registry can be absent while a step is being assembled;
836
+ // the name is still registered, so keep the entry without text.
837
+ }
838
+ }
801
839
  tools.push({ name: schema.name, description })
802
840
  schemas.set(schema.name, { name: schema.name, description })
803
841
  }
@@ -964,6 +1002,37 @@ export function createMcpManager(deps = {}) {
964
1002
  return out
965
1003
  }
966
1004
 
1005
+ /**
1006
+ * The Loader entry whose MCP client config names one server.
1007
+ *
1008
+ * `entry.fiber` is the plugin fiber the Loader created for that row — the
1009
+ * handle an in-memory re-registration restarts. A row the host has not
1010
+ * instantiated carries no fiber, and a row from a non-Loader composition
1011
+ * has no entry here at all.
1012
+ *
1013
+ * @param {string} serverName
1014
+ * @returns {object|undefined} the Loader entry, when one is addressable.
1015
+ */
1016
+ async function loaderEntryFor(serverName) {
1017
+ const service = loader()
1018
+ if (service === undefined || typeof service.entries !== 'function') return undefined
1019
+ let iterable
1020
+ try {
1021
+ iterable = service.entries()
1022
+ } catch (error) {
1023
+ log(`skill-mcp-panel: could not enumerate loader entries: ${String(error)}`)
1024
+ return undefined
1025
+ }
1026
+ for (const entry of iterable ?? []) {
1027
+ const options = entry?.options
1028
+ if (options === undefined || options === null) continue
1029
+ if (options.group) continue
1030
+ if (options.name !== MCP_CLIENT_MODULE) continue
1031
+ if (text(options.config?.serverName) === serverName) return entry
1032
+ }
1033
+ return undefined
1034
+ }
1035
+
967
1036
  /**
968
1037
  * Coerce a stored transport onto the contract's enum.
969
1038
  *
@@ -1382,6 +1451,116 @@ export function createMcpManager(deps = {}) {
1382
1451
  return mapChangeResult(OP.MCP_TOGGLE, change, serverName)
1383
1452
  }
1384
1453
 
1454
+ /**
1455
+ * Reconnect one server and register its tools again.
1456
+ *
1457
+ * This is the recovery action for the states the panel can SEE but not fix
1458
+ * any other way: a client whose connection died, whose retry budget was
1459
+ * exhausted, or whose generation swap was rolled back leaves its row in
1460
+ * place with zero tools, and only a reconnect brings the tools back. Two
1461
+ * ownership paths answer honestly:
1462
+ *
1463
+ * - A server THIS plugin declared is unmounted and mounted again through the
1464
+ * client module it owns, then the live registry is read back.
1465
+ * - A Loader row from an outer layer is restarted through its own fiber.
1466
+ * `fiber.restart()` is an in-memory operation: it disposes the plugin and
1467
+ * re-applies it with the SAME config, so no composition file is rewritten
1468
+ * and the reserved serverName is released by the dispose half first.
1469
+ *
1470
+ * A reconnect that ends with zero tools is reported as itself, never as a
1471
+ * failure: a server may legitimately expose none. The status only claims
1472
+ * what the registry proves.
1473
+ *
1474
+ * @param {object} op - an `mcp.reregister` operation.
1475
+ * @returns {Promise<object>} an ApplyResult.
1476
+ */
1477
+ async function reregister(op) {
1478
+ const serverName = text(op?.serverName ?? op?.target)
1479
+ if (serverName === '') return result(OP.MCP_REREGISTER, STATUS.REFUSED, 'serverName is required.', serverName)
1480
+ if (disposed) return result(OP.MCP_REREGISTER, STATUS.REFUSED, 'the MCP manager is shutting down.', serverName)
1481
+
1482
+ const declaration = readDeclaredSafe().find((item) => item.serverName === serverName)
1483
+ if (declaration !== undefined) {
1484
+ if (declaration.enabled === false) {
1485
+ return result(OP.MCP_REREGISTER, STATUS.REFUSED, `"${serverName}" is disabled; enable it before re-registering its tools.`, serverName)
1486
+ }
1487
+ const { config, error } = normalizeConfig(declaration.config, declaration.config)
1488
+ if (config === null) {
1489
+ return result(OP.MCP_REREGISTER, STATUS.REFUSED, `"${serverName}" cannot be re-registered: ${error}.`, serverName)
1490
+ }
1491
+ // One live instance per serverName: the old generation has to close
1492
+ // before the new one can reserve the namespace, exactly as configure.
1493
+ const closed = await disposeMount(serverName)
1494
+ if (closed.error !== null) {
1495
+ return result(
1496
+ OP.MCP_REREGISTER,
1497
+ STATUS.REFUSED,
1498
+ `"${serverName}" was disconnected for the re-registration, but its previous connection did not close cleanly: ${closed.error}`,
1499
+ serverName
1500
+ )
1501
+ }
1502
+ const mounted = await mount(serverName, config)
1503
+ if (!mounted.ok) {
1504
+ return result(
1505
+ OP.MCP_REREGISTER,
1506
+ STATUS.REFUSED,
1507
+ `"${serverName}" was disconnected for the re-registration, but reconnecting failed (${mounted.error}); its tools are not registered.`,
1508
+ serverName
1509
+ )
1510
+ }
1511
+ const count = await awaitTools(serverName)
1512
+ return result(
1513
+ OP.MCP_REREGISTER,
1514
+ STATUS.APPLIED,
1515
+ count > 0
1516
+ ? `"${serverName}" was re-registered; ${count} tool(s) are registered.`
1517
+ : `"${serverName}" was re-registered; it exposes no tools.`,
1518
+ serverName
1519
+ )
1520
+ }
1521
+
1522
+ const loaderRows = await readLoaderRows()
1523
+ const row = loaderRows.rows.find((item) => text(item.config?.serverName) === serverName)
1524
+ if (row === undefined) {
1525
+ return result(OP.MCP_REREGISTER, STATUS.REFUSED, `no MCP server named "${serverName}" is declared or mounted.`, serverName)
1526
+ }
1527
+ if (row.enabled === false) {
1528
+ return result(OP.MCP_REREGISTER, STATUS.REFUSED, `"${serverName}" is disabled; enable it before re-registering its tools.`, serverName)
1529
+ }
1530
+ const entry = await loaderEntryFor(serverName)
1531
+ const fiber = entry?.fiber
1532
+ if (fiber === undefined || fiber === null) {
1533
+ return result(
1534
+ OP.MCP_REREGISTER,
1535
+ STATUS.REFUSED,
1536
+ `"${serverName}" has no live fiber in this host, so its tools cannot be re-registered here; restart the host instead.`,
1537
+ serverName
1538
+ )
1539
+ }
1540
+ if (typeof fiber.restart !== 'function') {
1541
+ return result(
1542
+ OP.MCP_REREGISTER,
1543
+ STATUS.REFUSED,
1544
+ `"${serverName}" exposes no restartable fiber, so its tools cannot be re-registered here; restart the host instead.`,
1545
+ serverName
1546
+ )
1547
+ }
1548
+ try {
1549
+ await fiber.restart()
1550
+ } catch (error) {
1551
+ return result(OP.MCP_REREGISTER, STATUS.REFUSED, `"${serverName}" could not be re-registered: ${describeFailure(error)}`, serverName)
1552
+ }
1553
+ const count = await awaitTools(serverName, 2000)
1554
+ return result(
1555
+ OP.MCP_REREGISTER,
1556
+ STATUS.APPLIED,
1557
+ count > 0
1558
+ ? `"${serverName}" was re-registered; ${count} tool(s) are registered.`
1559
+ : `"${serverName}" was re-registered; it currently exposes no tools (its connection may have failed).`,
1560
+ serverName
1561
+ )
1562
+ }
1563
+
1385
1564
  /**
1386
1565
  * Map a plugin manager `ChangeResult` onto an {@link STATUS}.
1387
1566
  *
@@ -1924,6 +2103,8 @@ export function createMcpManager(deps = {}) {
1924
2103
  switch (kind) {
1925
2104
  case OP.MCP_TOGGLE:
1926
2105
  return await toggle(op)
2106
+ case OP.MCP_REREGISTER:
2107
+ return await reregister(op)
1927
2108
  case OP.MCP_ADD:
1928
2109
  return await add(op)
1929
2110
  case OP.MCP_IMPORT:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lstions/dsh-skill-mcp-panel",
3
- "version": "1.11.0",
3
+ "version": "1.12.1",
4
4
  "description": "Recursive, multi-root skill discovery with per-skill switches, duplicate-name reporting and MCP server management for the DeepSeek Harness",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -48,10 +48,6 @@
48
48
  "CHANGELOG.md",
49
49
  "LICENSE"
50
50
  ],
51
- "scripts": {
52
- "test": "node test/all.mjs",
53
- "test:tree": "node test/realtree.mjs"
54
- },
55
51
  "engines": {
56
52
  "node": ">=20.13.0",
57
53
  "dsh": ">=0.1.7-alpha.1 <0.3.0-0"
@@ -79,5 +75,9 @@
79
75
  "publishConfig": {
80
76
  "access": "public",
81
77
  "tag": "latest"
78
+ },
79
+ "scripts": {
80
+ "test": "node test/all.mjs",
81
+ "test:tree": "node test/realtree.mjs"
82
82
  }
83
- }
83
+ }