dsh-mcp-connector 0.2.72 → 0.2.73

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
@@ -2,6 +2,13 @@
2
2
 
3
3
  本项目遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/);首个公开版本从 `0.1.0` 开始。
4
4
 
5
+ ## [0.2.73] - 2026-10-15
6
+
7
+ ### Fixed
8
+
9
+ - 兼容 DSH 0.2.1-alpha.1 起的 webStartup 服务,同时保留旧宿主 webRuntime 支持,修复面板正文及 API 路由未挂载导致的空白(#151)。两种服务并存时优先使用 webStartup 的可信主机配置,服务卸载时清理路由。
10
+ - 将插件 API 请求失败与 npm 版本查询失败区分提示,不再把路由不可用统一报告为 npm 网络错误。
11
+
5
12
  ## [0.2.72] - 2026-10-14
6
13
 
7
14
  ### Fixed
package/README.en.md CHANGED
@@ -215,7 +215,7 @@ npm run dev:ui
215
215
 
216
216
  Every Registry merge regenerates `catalog-stats.json`; an hourly workflow in this repository synchronizes the Chinese and English product copy plus a local stats snapshot. The static npm README updates with package releases, while the live badges above read the Registry directly and therefore stay current without another npm release.
217
217
 
218
- The current public version is [`dsh-mcp-connector@0.2.72`](https://www.npmjs.com/package/dsh-mcp-connector), with [GitHub Release v0.2.72](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.72).
218
+ The current public version is [`dsh-mcp-connector@0.2.73`](https://www.npmjs.com/package/dsh-mcp-connector), with [GitHub Release v0.2.73](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.73).
219
219
 
220
220
  See [CHANGELOG.md](CHANGELOG.md) for version history and [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md) for the Desktop release checklist.
221
221
 
package/README.md CHANGED
@@ -210,7 +210,7 @@ npm run dev:ui
210
210
 
211
211
  公共 Registry 每次合并后会生成 `catalog-stats.json`;本仓库的定时工作流每小时同步中英文介绍和统计快照。npm 页面中的静态正文随版本发布更新,上方动态统计徽标则直接读取 Registry,可在不发布新 npm 版本时保持实时数量一致。
212
212
 
213
- 当前公开版本为 [`dsh-mcp-connector@0.2.72`](https://www.npmjs.com/package/dsh-mcp-connector),对应 [GitHub Release v0.2.72](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.72)。
213
+ 当前公开版本为 [`dsh-mcp-connector@0.2.73`](https://www.npmjs.com/package/dsh-mcp-connector),对应 [GitHub Release v0.2.73](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.73)。
214
214
 
215
215
  版本能力与变更记录见 [CHANGELOG.md](CHANGELOG.md)。
216
216
  Desktop 发版回归见 [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md)。
package/lib/client.js CHANGED
@@ -1193,7 +1193,7 @@ window.__ModuleLoader__.load({
1193
1193
  if (disposed) return;
1194
1194
  setVersionStatus(status);
1195
1195
  setVersionCheckBusy(status.checking === true);
1196
- setVersionCheckFailed(!status.checking && status.sources?.npm?.ok !== true);
1196
+ setVersionCheckFailed(!status.checking && status.sources?.npm?.ok !== true ? "npm" : false);
1197
1197
  if (status.checking) {
1198
1198
  schedule(1e3);
1199
1199
  return;
@@ -1207,7 +1207,7 @@ window.__ModuleLoader__.load({
1207
1207
  console.warn("[mcp-connector] plugin update check failed:", error);
1208
1208
  if (!disposed) {
1209
1209
  setVersionCheckBusy(false);
1210
- setVersionCheckFailed(true);
1210
+ setVersionCheckFailed("api");
1211
1211
  schedule(VERSION_CHECK_RETRY_MS);
1212
1212
  }
1213
1213
  });
@@ -1668,7 +1668,7 @@ window.__ModuleLoader__.load({
1668
1668
  versionCheckFailed && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1669
1669
  className: "mcpConnectorUpdateStatus",
1670
1670
  "data-tone": "error",
1671
- children: "暂时无法确认 npm 最新版本,请重试"
1671
+ children: versionCheckFailed === "api" ? "插件 API 不可用,请检查 DSH 宿主兼容性或服务日志" : "暂时无法确认 npm 最新版本,请重试"
1672
1672
  }),
1673
1673
  versionStatus?.releasePending && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1674
1674
  className: "mcpConnectorVersion",
package/lib/index.js CHANGED
@@ -40,7 +40,7 @@ import { provision, disable, remove, entryIdFor } from './mcp-provision.js';
40
40
  import { classifyConnectionError, validateConnectionRecords } from './mcp-validation.js';
41
41
  import { listMcpTools, McpHttpError } from './mcp-http.js';
42
42
  import { registerTools } from './tools.js';
43
- import { mountWebRoutes } from './web.js';
43
+ import { injectWebRoutes } from './web.js';
44
44
  import { createVersionStatusService } from './version-status.js';
45
45
  import { assertSafeUrl, normalizeConnectionDisplayName } from './util.js';
46
46
  import { readLegacyGrantCandidates, planLegacyMigration, toConnectorGrant, toConnectionRecords } from './migration.js';
@@ -3445,17 +3445,13 @@ export async function apply(ctx, config) {
3445
3445
  const disposeTools = registerTools(ctx, observableApi);
3446
3446
 
3447
3447
  /* ───────────────────────── web 半区(图形化市场)──────────────────────── */
3448
- // webServer / webRuntime 仅存在于 web 部署;无此服务时静默跳过(纯对话工具场景仍可用)。
3449
- let disposeWeb = null;
3448
+ // webServer + 新版 webStartup 或旧版 webRuntime;纯对话部署不挂载 HTTP 路由。
3450
3449
  if (typeof ctx.inject === 'function') {
3451
3450
  try {
3452
- ctx.inject(['webServer', 'webRuntime'], (wctx) => {
3453
- disposeWeb = mountWebRoutes(wctx, observableApi, {
3454
- logger,
3455
- eventHub: statusEvents,
3456
- frameAncestors: config.frameAncestors,
3457
- });
3458
- logger.info('mcp-connector web UI mounted at /mcp-connector/ui/');
3451
+ injectWebRoutes(ctx, observableApi, {
3452
+ logger,
3453
+ eventHub: statusEvents,
3454
+ frameAncestors: config.frameAncestors,
3459
3455
  });
3460
3456
  } catch (error) {
3461
3457
  logger.warn(`mcp-connector web UI not mounted (webServer unavailable): ${error.message}`);
@@ -3467,7 +3463,6 @@ export async function apply(ctx, config) {
3467
3463
  clearTimeout(discoveryTimer);
3468
3464
  clearInterval(discoveryInterval);
3469
3465
  disposeTools();
3470
- disposeWeb?.();
3471
3466
  hostGovernance.dispose();
3472
3467
  hostScopes.dispose();
3473
3468
  hostSessionInjection.dispose();
package/lib/web.js CHANGED
@@ -7,7 +7,7 @@
7
7
  * - GET /mcp-connector/events 无敏感数据的实时状态 SSE
8
8
  *
9
9
  * 所有路由都过浏览器信任 fence(loopback + 同源),与 better-sidebar 同一策略。
10
- * 本模块只依赖 ctx.webServer / ctx.webRuntime;在非 web 部署(无这两个服务)时
10
+ * 本模块依赖 ctx.webServer 及 webStartup(新版)或 webRuntime(旧版);非 web 部署时
11
11
  * 调用方应跳过挂载,保证插件仍可用于纯对话工具场景。
12
12
  *
13
13
  * 静态资源响应的 `Content-Security-Policy` 由 `buildCsp()` 生成;其中
@@ -264,13 +264,47 @@ export function buildCsp(frameAncestors) {
264
264
 
265
265
  /* ───────────────────────── 路由挂载 ───────────────────────── */
266
266
 
267
+ /** Alternative dependencies, not an AND: alpha.1 removed webRuntime.
268
+ * Keep each mount owned by its injection context; prefer webStartup when both exist.
269
+ */
270
+ export function injectWebRoutes(ctx, api, options = {}) {
271
+ const candidates = new Map();
272
+ let active;
273
+ let dispose;
274
+ const reconcile = () => {
275
+ const next = candidates.get('webStartup') ?? candidates.get('webRuntime');
276
+ if (next === active) return;
277
+ dispose?.();
278
+ dispose = undefined;
279
+ active = next;
280
+ if (next) {
281
+ dispose = mountWebRoutes(next.ctx, api, {
282
+ ...options, trustedHosts: next.trustedHosts,
283
+ });
284
+ options.logger?.info?.('mcp-connector web UI mounted at /mcp-connector/ui/');
285
+ }
286
+ };
287
+ for (const name of ['webStartup', 'webRuntime']) {
288
+ ctx.inject(['webServer', name], (wctx) => {
289
+ wctx.effect(() => {
290
+ const candidate = { ctx: wctx, trustedHosts: wctx[name].trustedHosts ?? [] };
291
+ candidates.set(name, candidate);
292
+ reconcile();
293
+ return () => {
294
+ if (candidates.get(name) === candidate) candidates.delete(name);
295
+ reconcile();
296
+ };
297
+ });
298
+ });
299
+ }
300
+ }
301
+
267
302
  /**
268
- * 挂载 web 路由。`wctx` 为已注入 webServer/webRuntime 的子上下文。
303
+ * 挂载 web 路由。`wctx` 为已注入 webServer 和对应信任服务的子上下文。
269
304
  * `frameAncestors` 为面板可嵌入白名单(缺省 = `['self']`,只有同源页面能内嵌;
270
305
  * 桌面壳场景由调用方显式追加外壳源)。返回 disposer(卸载三条 prefix 路由)。
271
306
  */
272
- export function mountWebRoutes(wctx, api, { logger, eventHub, frameAncestors } = {}) {
273
- const trustedHosts = wctx.webRuntime?.trustedHosts ?? [];
307
+ export function mountWebRoutes(wctx, api, { logger, eventHub, frameAncestors, trustedHosts = wctx.webStartup?.trustedHosts ?? wctx.webRuntime?.trustedHosts ?? [] } = {}) {
274
308
  const fence = (req) => isTrustedWebRequest(req, trustedHosts);
275
309
  const csp = buildCsp(frameAncestors);
276
310
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mcp-connector",
3
- "version": "0.2.72",
3
+ "version": "0.2.73",
4
4
  "description": "DeepSeek Harness MCP Connector: connect servers, search tools across active connections, and troubleshoot discovery. Includes a continuously updated catalog; supports OAuth 2.0 PKCE, API keys, Streamable HTTP/stdio, and mcpServers JSON import.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",