dsh-mcp-connector 0.2.94 → 0.2.96

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
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.96
4
+
5
+ - Honor catalog TTL on startup; use audited stale cache immediately and refresh in the background, renew freshness on HTTP 304, and cancel superseded/disposed refreshes (#219). First installation without a valid cache still uses the existing foreground fetch path.
6
+ - Expose exact connection keys and Workspace scope to the health-check tool; reject mismatched identifiers and prevent scoped checks from overwriting connector-wide health (#218).
7
+ - Finish initialize validation when the matching SSE response arrives instead of waiting for a persistent stream to close. Handle fragmented/multiline events, ignore unrelated responses, and preserve authentication failures (#218).
8
+ - Local synthetic regression reproduces the persistent-SSE timeout and verifies the fix. This does not establish the original reporter's root cause or replace Windows Desktop / business-call acceptance; #218 and #219 remain open pending review and reporter verification.
9
+
10
+ ## 0.2.95
11
+
12
+ - Add a standalone Settings → MCP Connector page with the existing sidebar visibility switch and open-panel action, including hosts without a Plugins settings page (#216).
13
+ - Retain the legacy plugin settings card and shared profile preference; hiding the shortcut does not disable connections or tools.
14
+ - Cover delayed settings slots, removal/remount and opening with the sidebar hidden. Windows Desktop and the original reporter environment still require acceptance; this does not close #166 or #216.
15
+
3
16
  ## 0.2.94
4
17
 
5
18
  - Clarify session activation steps and expose exact preview revision and activation arguments in model-visible text, without inventing user consent (#212).
package/README.en.md CHANGED
@@ -114,7 +114,7 @@ As of 2026-10-24, the public Registry publishes 112 connector descriptors. After
114
114
  | Connection diagnostics and last-success cache | |
115
115
  | ![Connection diagnostics](https://raw.githubusercontent.com/duhu2000/dsh-mcp-connector/main/docs/screenshots/en/07-connection-diagnostics.png) | |
116
116
 
117
- <!-- generated:media -->English UI screenshots and GIF were captured from v0.2.94 (2026-11-05), using the credential-free Mock harness. Provider content retains its original language. They demonstrate UI, not real business acceptance; counts are fixtures. See [asset provenance](docs/screenshots/README.md).<!-- /generated:media -->
117
+ <!-- generated:media -->English UI screenshots and GIF were captured from v0.2.96 (2026-11-09), using the credential-free Mock harness. Provider content retains its original language. They demonstrate UI, not real business acceptance; counts are fixtures. See [asset provenance](docs/screenshots/README.md).<!-- /generated:media -->
118
118
 
119
119
  ## Installation
120
120
 
@@ -245,7 +245,7 @@ npm run dev:ui
245
245
 
246
246
  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.
247
247
 
248
- <!-- generated:version -->The current public version is [`dsh-mcp-connector@0.2.94`](https://www.npmjs.com/package/dsh-mcp-connector), with [GitHub Release v0.2.94](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.94).<!-- /generated:version -->
248
+ <!-- generated:version -->The current public version is [`dsh-mcp-connector@0.2.96`](https://www.npmjs.com/package/dsh-mcp-connector), with [GitHub Release v0.2.96](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.96).<!-- /generated:version -->
249
249
 
250
250
  See [CHANGELOG.md](CHANGELOG.md) for version history and [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md) for the Desktop release checklist.
251
251
 
package/README.md CHANGED
@@ -128,7 +128,7 @@ Desktop 需要完全退出并重新启动应用;Web 需要停止原 `dsh web`
128
128
  | 连接诊断与最后成功缓存 | |
129
129
  | ![连接诊断](https://raw.githubusercontent.com/duhu2000/dsh-mcp-connector/main/docs/screenshots/07-connection-diagnostics.png) | |
130
130
 
131
- <!-- generated:media -->截图与 GIF 采集自 v0.2.94(2026-11-05)无凭据 Mock 页面,展示界面而非真实业务验收;市场数量是测试夹具。来源与更新方法见 [素材说明](docs/screenshots/README.md)。<!-- /generated:media -->
131
+ <!-- generated:media -->截图与 GIF 采集自 v0.2.96(2026-11-09)无凭据 Mock 页面,展示界面而非真实业务验收;市场数量是测试夹具。来源与更新方法见 [素材说明](docs/screenshots/README.md)。<!-- /generated:media -->
132
132
 
133
133
  ## 安装
134
134
 
@@ -252,7 +252,7 @@ npm run dev:ui
252
252
 
253
253
  公共 Registry 每次合并后会生成 `catalog-stats.json`;本仓库的定时工作流每小时同步中英文介绍和统计快照。npm 页面中的静态正文随版本发布更新,上方动态统计徽标则直接读取 Registry,可在不发布新 npm 版本时保持实时数量一致。
254
254
 
255
- <!-- generated:version -->当前公开版本为 [`dsh-mcp-connector@0.2.94`](https://www.npmjs.com/package/dsh-mcp-connector),对应 [GitHub Release v0.2.94](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.94)。<!-- /generated:version -->
255
+ <!-- generated:version -->当前公开版本为 [`dsh-mcp-connector@0.2.96`](https://www.npmjs.com/package/dsh-mcp-connector),对应 [GitHub Release v0.2.96](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.96)。<!-- /generated:version -->
256
256
 
257
257
  版本能力与变更记录见 [CHANGELOG.md](CHANGELOG.md)。
258
258
  Desktop 发版回归见 [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md)。
@@ -48,7 +48,7 @@ dsh web
48
48
  重启后,可以用以下任一方式打开:
49
49
 
50
50
  - 在 DSH 左侧主导航点击“MCP连接器”。DSH `>=0.2.0-rc.2` 使用宿主原生面板行,展开、折叠、选中态和键盘操作均与其他主导航一致;DSH `0.1.x` 自动使用左侧底部兼容入口。
51
- - 打开“设置 → 插件 → 插件配置 → MCP连接器”,展开卡片并点击“打开 MCP连接器”。该按钮直接复用同一个连接器弹框,不要求侧边栏入口可见;关闭弹框后仍回到设置页。
51
+ - 打开“设置 → MCP连接器”,展开卡片并点击“打开 MCP连接器”。支持旧插件配置页的宿主也可从“设置 → 插件 → 插件配置 → MCP连接器”进入;部分 DSH 版本没有“插件”菜单,不应以该菜单是否存在判断插件安装状态。按钮复用同一个连接器弹框,不要求侧边栏入口可见;关闭弹框后仍回到设置页。
52
52
 
53
53
  如需腾出侧边栏空间,可在同一配置卡片关闭“在侧边栏显示 MCP连接器”。该偏好作用于当前 DSH profile,并在重启后保留;它只隐藏快捷入口,不停用插件、已连接 MCP Server 或工具。如果隐藏时正在原生连接器面板,页面会先返回当前会话;之后仍可从该配置卡片直接打开弹框,或重新开启入口。旧版 DSH 没有 Settings 能力时,插件保持入口可见,不会因设置功能进入 Safe Mode。
54
54
 
Binary file
@@ -1,6 +1,6 @@
1
1
  # 产品截图与演示的来源及更新
2
2
 
3
- <!-- generated:media -->本组 8 张截图和 GIF 均从 v0.2.94 于 2026-11-05 重新采集,未修改截图中的版本文字。<!-- /generated:media -->
3
+ <!-- generated:media -->本组 8 张截图和 GIF 均从 v0.2.96 于 2026-11-09 重新采集,未修改截图中的版本文字。<!-- /generated:media -->
4
4
 
5
5
  前七张素材由真实产品 UI 的无凭据 Mock harness 渲染:1280×720 浏览器视口、800px 产品面板、桌面两列卡片。顶部保留“无凭据 Mock”标识;目录数、连接数与工具数是演示夹具,不代表生产统计或真实授权、业务验收。不会读取用户 profile、调用服务商或上传业务数据。
6
6
 
@@ -2,8 +2,8 @@
2
2
  "schemaVersion": 1,
3
3
  "capture": {
4
4
  "locale": "zh-CN",
5
- "capturedOn": "2026-11-05",
6
- "sourceVersion": "0.2.94",
5
+ "capturedOn": "2026-11-09",
6
+ "sourceVersion": "0.2.96",
7
7
  "sourceFingerprint": "b788ef56910a9889473ba31cf85cb234f4b55ab49c1a47ca1e8e52d760b9ce0a",
8
8
  "browserViewport": {
9
9
  "width": 1280,
@@ -17,63 +17,63 @@
17
17
  "screenshots": [
18
18
  {
19
19
  "path": "docs/screenshots/01-market-overview.jpg",
20
- "sha256": "884eab7f5fe457aae32c24a002033b11403f9877bdd010d2336bf529f82a0da3",
20
+ "sha256": "401f41f9d3b80c9bb55571ac6fdd06ebda7bc95d847a1ef0ff41650a32328962",
21
21
  "width": 1280,
22
22
  "height": 720,
23
- "capturedOn": "2026-11-05",
24
- "sourceVersion": "0.2.94"
23
+ "capturedOn": "2026-11-09",
24
+ "sourceVersion": "0.2.96"
25
25
  },
26
26
  {
27
27
  "path": "docs/screenshots/02-connector-detail.jpg",
28
- "sha256": "08af9e72444546c3f79c6624b3f318d8a53c86e761670fe2ef8fcb5e13c5f48f",
28
+ "sha256": "13dffa3de9fa0730131936e0206165b7d224871eb9254a613947dee809b756be",
29
29
  "width": 1280,
30
30
  "height": 720,
31
- "capturedOn": "2026-11-05",
32
- "sourceVersion": "0.2.94"
31
+ "capturedOn": "2026-11-09",
32
+ "sourceVersion": "0.2.96"
33
33
  },
34
34
  {
35
35
  "path": "docs/screenshots/03-tool-discovery.jpg",
36
- "sha256": "6b3953c90f81e0cd75a1cef3e8f6ee5c177fdd0d82a824adf94e7453b9c9cbc2",
36
+ "sha256": "17f51c4cdcb3372de05e0d8ebf5872cf7b95687f36934ff0f097a831dfccb7fe",
37
37
  "width": 1280,
38
38
  "height": 720,
39
- "capturedOn": "2026-11-05",
40
- "sourceVersion": "0.2.94"
39
+ "capturedOn": "2026-11-09",
40
+ "sourceVersion": "0.2.96"
41
41
  },
42
42
  {
43
43
  "path": "docs/screenshots/04-json-import.jpg",
44
- "sha256": "926af9fbb9ea2252dc09e37c6b70e1efb8635fea97095ca89045ffe3d2483159",
44
+ "sha256": "9f887081dca4992d9bb5e053afdeaa18c2d9ab1e0ce83b5ca567d37dae3a8e44",
45
45
  "width": 1280,
46
46
  "height": 720,
47
- "capturedOn": "2026-11-05",
48
- "sourceVersion": "0.2.94"
47
+ "capturedOn": "2026-11-09",
48
+ "sourceVersion": "0.2.96"
49
49
  },
50
50
  {
51
51
  "path": "docs/screenshots/05-unified-tool-search.png",
52
- "sha256": "ba4ed1e8553c00406ef2c274f5ec319112a0bceb03884ea09cc6e789560031d0",
52
+ "sha256": "ea75769105fca29572a29f376595605fe0b6ded1b89da092f06c4b63143c3b51",
53
53
  "width": 1280,
54
54
  "height": 720,
55
- "capturedOn": "2026-11-05",
56
- "sourceVersion": "0.2.94"
55
+ "capturedOn": "2026-11-09",
56
+ "sourceVersion": "0.2.96"
57
57
  },
58
58
  {
59
59
  "path": "docs/screenshots/06-tool-parameters.png",
60
- "sha256": "286f1c8fe785cd2bfc9d372a116ba2a34c70927a00cad5f2f72a8e61cb1b8d2a",
60
+ "sha256": "84d1fc20248f7e070c2c33086550acb3372088d44018fb640dd3802664f7bfa7",
61
61
  "width": 1280,
62
62
  "height": 720,
63
- "capturedOn": "2026-11-05",
64
- "sourceVersion": "0.2.94"
63
+ "capturedOn": "2026-11-09",
64
+ "sourceVersion": "0.2.96"
65
65
  },
66
66
  {
67
67
  "path": "docs/screenshots/07-connection-diagnostics.png",
68
- "sha256": "7eac678fa8740cfdbaeb46046d8fedce81eaa88c820a230c3dc8e2826fd4e8ff",
68
+ "sha256": "7310a9ad7bcd1cb509f76c87cec655f459220df21b25a7676c77f43af385ea88",
69
69
  "width": 1280,
70
70
  "height": 720,
71
- "capturedOn": "2026-11-05",
72
- "sourceVersion": "0.2.94"
71
+ "capturedOn": "2026-11-09",
72
+ "sourceVersion": "0.2.96"
73
73
  },
74
74
  {
75
75
  "path": "docs/screenshots/08-ten-recommendations.jpg",
76
- "sha256": "8e70743a7eedca89022a1eeeb3ad9b2ce15a6424ba22a40a90c2de158448d84e",
76
+ "sha256": "ddd2736f35a62e5e8dd353c85fd7114c461000f8407721ec869474fd4dd18374",
77
77
  "width": 1280,
78
78
  "height": 1400,
79
79
  "browserViewport": {
@@ -81,17 +81,17 @@
81
81
  "height": 1400
82
82
  },
83
83
  "panelHeight": 1280,
84
- "capturedOn": "2026-11-05",
85
- "sourceVersion": "0.2.94"
84
+ "capturedOn": "2026-11-09",
85
+ "sourceVersion": "0.2.96"
86
86
  }
87
87
  ],
88
88
  "demo": {
89
89
  "path": "docs/demo.gif",
90
- "sha256": "0f365fb7e9ec4a0700e9f27ee43dfa54fbf39204b5f0499b1903fb8838cca697",
90
+ "sha256": "2c8d30b89271b98d1655bbaef36593f87bddb4d4e33ab8f925cff705e3bba9ff",
91
91
  "width": 960,
92
92
  "height": 540,
93
- "capturedOn": "2026-11-05",
94
- "sourceVersion": "0.2.94",
93
+ "capturedOn": "2026-11-09",
94
+ "sourceVersion": "0.2.96",
95
95
  "durationSeconds": 36
96
96
  }
97
97
  }
@@ -2,8 +2,8 @@
2
2
  "schemaVersion": 1,
3
3
  "capture": {
4
4
  "locale": "en",
5
- "capturedOn": "2026-11-05",
6
- "sourceVersion": "0.2.94",
5
+ "capturedOn": "2026-11-09",
6
+ "sourceVersion": "0.2.96",
7
7
  "sourceFingerprint": "b788ef56910a9889473ba31cf85cb234f4b55ab49c1a47ca1e8e52d760b9ce0a",
8
8
  "browserViewport": {
9
9
  "width": 1280,
@@ -17,63 +17,63 @@
17
17
  "screenshots": [
18
18
  {
19
19
  "path": "docs/screenshots/en/01-market-overview.jpg",
20
- "sha256": "958a5b4079817dcba1fd13102c936d52a6dca3365ff8387da3d526bebe836fb6",
20
+ "sha256": "d4ac70c40e6fd04ff5a2738bea649073fe98285f697a4ac1c8498ad9d4485595",
21
21
  "width": 1280,
22
22
  "height": 720,
23
- "capturedOn": "2026-11-05",
24
- "sourceVersion": "0.2.94"
23
+ "capturedOn": "2026-11-09",
24
+ "sourceVersion": "0.2.96"
25
25
  },
26
26
  {
27
27
  "path": "docs/screenshots/en/02-connector-detail.jpg",
28
- "sha256": "10b0d7fba56d87380b639c2b165eec861c03e9506d91e0ed6d6242765e1b167a",
28
+ "sha256": "a3ece902b88d9d424c167fa7577c58f1785451531b29efee4854df78a8fc658e",
29
29
  "width": 1280,
30
30
  "height": 720,
31
- "capturedOn": "2026-11-05",
32
- "sourceVersion": "0.2.94"
31
+ "capturedOn": "2026-11-09",
32
+ "sourceVersion": "0.2.96"
33
33
  },
34
34
  {
35
35
  "path": "docs/screenshots/en/03-tool-discovery.jpg",
36
- "sha256": "91afc635817245b517fb5d1e471ae947fd00dd8e156ae1a9b3cd3f1ca328fe63",
36
+ "sha256": "9857f2b4b485d218bc45bdea045e0d879087f55b154e1b491ed5b91a5fe3aeb0",
37
37
  "width": 1280,
38
38
  "height": 720,
39
- "capturedOn": "2026-11-05",
40
- "sourceVersion": "0.2.94"
39
+ "capturedOn": "2026-11-09",
40
+ "sourceVersion": "0.2.96"
41
41
  },
42
42
  {
43
43
  "path": "docs/screenshots/en/04-json-import.jpg",
44
- "sha256": "e7bc7eb8c00ade5d687762f82d3ada45f3914de4741a2dcebf82d8b2dbc66256",
44
+ "sha256": "6e2d57d2832421f38bc7ca23a34843da22c04df2450c116efe80d01c0d0d4219",
45
45
  "width": 1280,
46
46
  "height": 720,
47
- "capturedOn": "2026-11-05",
48
- "sourceVersion": "0.2.94"
47
+ "capturedOn": "2026-11-09",
48
+ "sourceVersion": "0.2.96"
49
49
  },
50
50
  {
51
51
  "path": "docs/screenshots/en/05-unified-tool-search.png",
52
- "sha256": "016fa09d9b1c78537defaad4671e3ec1051af4967cd12d0e238d61c00f6c56ba",
52
+ "sha256": "a00aedb700c6fd257fcb3b28a98cf2e3aecfcd41354f02522bae004897bca5d0",
53
53
  "width": 1280,
54
54
  "height": 720,
55
- "capturedOn": "2026-11-05",
56
- "sourceVersion": "0.2.94"
55
+ "capturedOn": "2026-11-09",
56
+ "sourceVersion": "0.2.96"
57
57
  },
58
58
  {
59
59
  "path": "docs/screenshots/en/06-tool-parameters.png",
60
- "sha256": "ac0308563a8e00ab9df93a5bf4ce88c3c84e7d4c2f4fb0c3d10b1b376241c6cc",
60
+ "sha256": "2cd229a11667c5382b0cb374c3d2b04444bd6d69d31a9f4f038b57e85b9bd76e",
61
61
  "width": 1280,
62
62
  "height": 720,
63
- "capturedOn": "2026-11-05",
64
- "sourceVersion": "0.2.94"
63
+ "capturedOn": "2026-11-09",
64
+ "sourceVersion": "0.2.96"
65
65
  },
66
66
  {
67
67
  "path": "docs/screenshots/en/07-connection-diagnostics.png",
68
- "sha256": "503839bb3fcaadde04c7780928f7c1786ead0819f9b82c46ecec30842de1ecb0",
68
+ "sha256": "4f2e79dfa93fcf7feec2122ca6e0789606f1527a8baab9aa2e5eb30911628fac",
69
69
  "width": 1280,
70
70
  "height": 720,
71
- "capturedOn": "2026-11-05",
72
- "sourceVersion": "0.2.94"
71
+ "capturedOn": "2026-11-09",
72
+ "sourceVersion": "0.2.96"
73
73
  },
74
74
  {
75
75
  "path": "docs/screenshots/en/08-ten-recommendations.jpg",
76
- "sha256": "a4a3b384f0db1794eb9c83ddc08bb2cc29feff0d4d1fcbd53b82db95b49b8e51",
76
+ "sha256": "c360f618049ae2a68fe67a537bb1c77fd8cd9b98ddd13036e4ea4d8da1949f03",
77
77
  "width": 1280,
78
78
  "height": 1400,
79
79
  "browserViewport": {
@@ -81,17 +81,17 @@
81
81
  "height": 1400
82
82
  },
83
83
  "panelHeight": 1280,
84
- "capturedOn": "2026-11-05",
85
- "sourceVersion": "0.2.94"
84
+ "capturedOn": "2026-11-09",
85
+ "sourceVersion": "0.2.96"
86
86
  }
87
87
  ],
88
88
  "demo": {
89
89
  "path": "docs/screenshots/en/demo.gif",
90
- "sha256": "6faaabeaaf760b90c050a61ee0e93e01bdbe7f8b150bfe9652dd0de37e176c5c",
90
+ "sha256": "93485fda6525bb7a4da6aa3691cf9a319dec8d2d1e0f3c6ae60984cc5a2bf939",
91
91
  "width": 960,
92
92
  "height": 540,
93
- "capturedOn": "2026-11-05",
94
- "sourceVersion": "0.2.94",
93
+ "capturedOn": "2026-11-09",
94
+ "sourceVersion": "0.2.96",
95
95
  "durationSeconds": 36
96
96
  }
97
97
  }
Binary file
@@ -8,7 +8,7 @@
8
8
 
9
9
  | 项目 | 验收要求 |
10
10
  |---|---|
11
- | 前提 | <!-- generated:version -->正式 `dsh-mcp-connector@0.2.94`<!-- /generated:version -->;当前 Workspace;企查查 OAuth 可用;测试账号具有目标企业数据权限 |
11
+ | 前提 | <!-- generated:version -->正式 `dsh-mcp-connector@0.2.96`<!-- /generated:version -->;当前 Workspace;企查查 OAuth 可用;测试账号具有目标企业数据权限 |
12
12
  | 权限/管理员 | 账号权限、组织授权和可见字段由服务商控制;企业组织可能需要管理员开通,当前文档不能替代审批 |
13
13
  | 费用 | 可能受套餐、次数或字段权限影响;MCP连接器无法确认本次费用,调用前在服务商侧核对 |
14
14
  | 运行/数据去向 | 远程 MCP Server;企业名称、查询参数和调用结果经 DSH Host 发送到/返回自 `agent.qcc.com` |
package/lib/catalog.js CHANGED
@@ -173,7 +173,8 @@ export async function readLimitedJson(response, maxBytes = MAX_CATALOG_BYTES, {
173
173
  }
174
174
 
175
175
  /** 拉取远程 registry(HTTPS + TTL 缓存 + 可选 ETag) */
176
- export async function fetchRemoteCatalog(catalogUrl, { requestTimeoutMs, etag, t = tZh } = {}) {
176
+ export async function fetchRemoteCatalog(catalogUrl, { requestTimeoutMs, etag, signal, t = tZh } = {}) {
177
+ signal?.throwIfAborted();
177
178
  assertSafeUrl(catalogUrl);
178
179
  // Node 20+ does not consistently enable environment proxies for global fetch.
179
180
  // Scope the dispatcher to this request rather than changing the DSH Host's
@@ -188,7 +189,7 @@ export async function fetchRemoteCatalog(catalogUrl, { requestTimeoutMs, etag, t
188
189
  if (etag) headers['If-None-Match'] = etag;
189
190
  const response = await fetch(catalogUrl, {
190
191
  headers,
191
- signal: controller.signal,
192
+ signal: signal ? AbortSignal.any([signal, controller.signal]) : controller.signal,
192
193
  ...(dispatcher ? { dispatcher } : {}),
193
194
  });
194
195
  assertSafeUrl(response.url || catalogUrl);
@@ -219,10 +220,12 @@ export async function fetchRemoteCatalogWithFallback(catalogUrl, fallbackUrls =
219
220
  const fetched = await fetchRemoteCatalog(urls[index], {
220
221
  requestTimeoutMs: opts.requestTimeoutMs,
221
222
  etag: index === 0 ? opts.etag : undefined,
223
+ signal: opts.signal,
222
224
  t,
223
225
  });
224
226
  return index === 0 ? fetched : { ...fetched, etag: undefined };
225
227
  } catch (error) {
228
+ opts.signal?.throwIfAborted();
226
229
  lastError = error;
227
230
  opts.onSourceError?.({ index, error });
228
231
  }
package/lib/client.js CHANGED
@@ -1200,6 +1200,13 @@ window.__ModuleLoader__.load({
1200
1200
  });
1201
1201
  }
1202
1202
 
1203
+ function ConnectorSettingsSection(props) {
1204
+ return (0, react_jsx_runtime.jsx)("ul", {
1205
+ style: { listStyle: "none", margin: 0, padding: 0 },
1206
+ children: (0, react_jsx_runtime.jsx)(ConnectorSettingsCard, props)
1207
+ });
1208
+ }
1209
+
1203
1210
  function installClientSettings(ctx, marketView) {
1204
1211
  if (typeof ctx.inject !== "function") return;
1205
1212
  ctx.inject(["settingsScope"], (settingsCtx) => {
@@ -1225,6 +1232,16 @@ window.__ModuleLoader__.load({
1225
1232
  };
1226
1233
  }, "mcp-connector: sidebar visibility setting");
1227
1234
  settingsCtx.effect(() => installSettingsStyles(), "mcp-connector: settings styles");
1235
+ // Modern hosts may omit the Plugins page entirely. Contribute our own
1236
+ // section without depending on settings.plugin.item or widening tools.
1237
+ settingsCtx.slots.inject("settings.section", () => settingsCtx.slots.register({
1238
+ name: "settings.section",
1239
+ id: CONNECTOR_SETTINGS_NAMESPACE,
1240
+ order: 80,
1241
+ label: t("MCP连接器"),
1242
+ store: marketView,
1243
+ inject: () => ({ settingsScope })
1244
+ }, ConnectorSettingsSection));
1228
1245
  settingsCtx.slots.inject("settings.plugin.item", () => settingsCtx.slots.register({
1229
1246
  name: "settings.plugin.item",
1230
1247
  key: CONNECTOR_SETTINGS_NAMESPACE,
package/lib/index.js CHANGED
@@ -325,6 +325,35 @@ export async function apply(ctx, config) {
325
325
 
326
326
  /* ───────────────────────── 目录加载 ───────────────────────── */
327
327
 
328
+ let catalogController;
329
+ let catalogBackgroundCache;
330
+ let catalogTimer;
331
+ let catalogDisposed = false;
332
+ let catalogWrite = Promise.resolve();
333
+
334
+ async function updateRemoteCatalog(cached) {
335
+ catalogController?.abort();
336
+ const controller = new AbortController();
337
+ catalogController = controller;
338
+ const fetched = await fetchRemoteCatalogWithFallback(config.catalogUrl, catalogFallbackUrls(), {
339
+ requestTimeoutMs: config.requestTimeoutMs,
340
+ etag: cached?.etag,
341
+ signal: controller.signal,
342
+ onSourceError: warnCatalogSourceFailure,
343
+ });
344
+ controller.signal.throwIfAborted();
345
+ if (catalogDisposed) return;
346
+ const connectors = fetched.notModified ? cached.connectors : fetched.connectors;
347
+ state.remoteConnectors = connectors;
348
+ await recomputeMerged();
349
+ // A 304 also renews the cache freshness timestamp.
350
+ catalogWrite = catalogWrite.then(async () => {
351
+ if (catalogDisposed || controller.signal.aborted) return;
352
+ await catalogStore.putRemote({ etag: fetched.notModified ? cached.etag : fetched.etag, connectors });
353
+ }).catch(() => {});
354
+ await catalogWrite;
355
+ }
356
+
328
357
  async function recomputeMerged() {
329
358
  const bundled = loadBundledCatalog();
330
359
  const configConnectors = (config.connectors ?? []).map((raw) => auditDescriptor(normalizeConnectorDescriptor(raw)));
@@ -366,27 +395,24 @@ export async function apply(ctx, config) {
366
395
  // 远程 registry(含缓存)
367
396
  if (config.catalogUrl) {
368
397
  const cached = await catalogStore.getRemote().catch(() => null);
398
+ let validCache;
369
399
  try {
370
- const fetched = await fetchRemoteCatalogWithFallback(
371
- config.catalogUrl,
372
- catalogFallbackUrls(),
373
- {
374
- requestTimeoutMs: config.requestTimeoutMs,
375
- etag: cached?.etag,
376
- onSourceError: warnCatalogSourceFailure,
377
- },
378
- );
379
- if (fetched.notModified) {
380
- state.remoteConnectors = cached?.connectors ?? [];
381
- } else {
382
- state.remoteConnectors = fetched.connectors;
383
- if (config.persistSecrets || true) {
384
- await catalogStore.putRemote({ etag: fetched.etag, connectors: fetched.connectors }).catch(() => {});
385
- }
400
+ if (Array.isArray(cached?.connectors)) {
401
+ const connectors = cached.connectors.map(raw => auditDescriptor(normalizeConnectorDescriptor(auditRawDescriptor(raw))));
402
+ validCache = { ...cached, connectors };
403
+ state.remoteConnectors = connectors;
386
404
  }
387
405
  } catch (error) {
388
- logger.warn(`catalog fetch failed (using cache if any): ${error.message}`);
389
- state.remoteConnectors = cached?.connectors ?? [];
406
+ logger.warn(`skip invalid remote catalog cache: ${error.message}`);
407
+ }
408
+ if (validCache) {
409
+ const age = Date.now() - Number(validCache.updatedAt);
410
+ if (!(Number.isFinite(age) && age >= 0 && age < (config.catalogTtlMs ?? DEFAULT_CATALOG_TTL_MS))) {
411
+ catalogBackgroundCache = validCache;
412
+ }
413
+ } else {
414
+ try { await updateRemoteCatalog(); }
415
+ catch (error) { logger.warn(`catalog fetch failed (using bundled catalog): ${error.message}`); }
390
416
  }
391
417
  }
392
418
  await recomputeMerged();
@@ -2550,20 +2576,25 @@ export async function apply(ctx, config) {
2550
2576
  },
2551
2577
 
2552
2578
  async healthCheck(connectorId, workspaceId, connectionKey) {
2553
- if (connectionKey && !explorerRecords(workspaceId).some((record) => record.key === connectionKey && record.connectorId === connectorId)) {
2579
+ const scoped = Boolean(workspaceId || connectionKey);
2580
+ const candidates = scoped ? explorerRecords(workspaceId) : [...state.connections.values()];
2581
+ if (connectorId && !candidates.some(record => record.connectorId === String(connectorId))) {
2582
+ return { ok: false, message: t('连接不存在、已停用或当前工作区不可见') };
2583
+ }
2584
+ if (connectionKey && !candidates.some((record) => record.key === connectionKey && (!connectorId || record.connectorId === connectorId))) {
2554
2585
  return { ok: false, message: t('连接不存在、已停用或当前工作区不可见') };
2555
2586
  }
2556
2587
  const targetIds = connectorId
2557
2588
  ? [String(connectorId)]
2558
- : [...new Set([...state.connections.values()].map((record) => record.connectorId).filter(Boolean))];
2589
+ : [...new Set(candidates.filter(record => !connectionKey || record.key === connectionKey).map((record) => record.connectorId).filter(Boolean))];
2559
2590
  const summaries = [];
2560
2591
  for (const id of targetIds) {
2561
- const records = [...state.connections.values()].filter((record) => record.connectorId === id
2592
+ const records = candidates.filter((record) => record.connectorId === id
2562
2593
  && (!connectionKey || record.key === connectionKey));
2563
2594
  const enabledRecords = records.filter((record) => record.enabled !== false);
2564
2595
  if (records.length === 0 || enabledRecords.length === 0) {
2565
2596
  const summary = healthSummary(id, records, [], Date.now());
2566
- state.health.set(id, summary);
2597
+ if (!scoped) state.health.set(id, summary);
2567
2598
  summaries.push(summary);
2568
2599
  continue;
2569
2600
  }
@@ -2611,7 +2642,7 @@ export async function apply(ctx, config) {
2611
2642
  });
2612
2643
  checkedResults = validation.detail.results;
2613
2644
  }
2614
- const summary = connectionKey ? healthSummary(id, records, [...immediateResults, ...checkedResults], Date.now())
2645
+ const summary = scoped ? healthSummary(id, records, [...immediateResults, ...checkedResults], Date.now())
2615
2646
  : cacheHealth(id, records, [...immediateResults, ...checkedResults]);
2616
2647
  if (connectionKey && state.connections.get(connectionKey) === records[0]) {
2617
2648
  connectionChecks.set(connectionKey, { record: records[0], summary, at: Date.now() });
@@ -3098,17 +3129,8 @@ export async function apply(ctx, config) {
3098
3129
  return { ok: true, message: t(`市场已刷新,共 {count} 个连接器`, { count: visibleCount }) };
3099
3130
  }
3100
3131
  try {
3101
- const fetched = await fetchRemoteCatalogWithFallback(
3102
- config.catalogUrl,
3103
- catalogFallbackUrls(),
3104
- {
3105
- requestTimeoutMs: config.requestTimeoutMs,
3106
- onSourceError: warnCatalogSourceFailure,
3107
- },
3108
- );
3109
- state.remoteConnectors = fetched.connectors;
3110
- await catalogStore.putRemote({ etag: fetched.etag, connectors: fetched.connectors }).catch(() => {});
3111
- await recomputeMerged();
3132
+ clearTimeout(catalogTimer);
3133
+ await updateRemoteCatalog();
3112
3134
  const visibleCount = listCatalog(state.merged, { publishedOnly: true }).length;
3113
3135
  return { ok: true, message: t(`市场已刷新,共 {count} 个连接器`, { count: visibleCount }) };
3114
3136
  } catch (error) {
@@ -3703,6 +3725,9 @@ export async function apply(ctx, config) {
3703
3725
  }
3704
3726
 
3705
3727
  ctx.effect(() => () => {
3728
+ catalogDisposed = true;
3729
+ clearTimeout(catalogTimer);
3730
+ catalogController?.abort();
3706
3731
  connectionStatistics.dispose();
3707
3732
  discoveryDisposed = true;
3708
3733
  clearTimeout(discoveryTimer);
@@ -3716,6 +3741,15 @@ export async function apply(ctx, config) {
3716
3741
  for (const g of state.grants.values()) if (g.timer) clearTimeout(g.timer);
3717
3742
  });
3718
3743
 
3744
+ if (catalogBackgroundCache) {
3745
+ catalogTimer = setTimeout(() => {
3746
+ void updateRemoteCatalog(catalogBackgroundCache).catch(error => {
3747
+ if (!catalogDisposed && error.name !== 'AbortError') logger.warn(`catalog background refresh failed (using cache): ${error.message}`);
3748
+ });
3749
+ }, 0);
3750
+ catalogTimer.unref?.();
3751
+ }
3752
+
3719
3753
  logger.info(t('mcp-connector active(目录 {count} 个连接器,已连接 {connected} 条)', { count: state.merged.length, connected: state.connections.size }));
3720
3754
  }
3721
3755
 
@@ -12,6 +12,42 @@ const tZh = createTranslator(DEFAULT_LOCALE);
12
12
 
13
13
  const MAX_RESPONSE_BYTES = 2 * 1024 * 1024;
14
14
 
15
+ // SSE may remain open after initialize. Consume complete events, not EOF,
16
+ // and ignore notifications / responses for another JSON-RPC request.
17
+ async function readInitializePayload(response, { t }) {
18
+ if (!(response.headers.get('content-type') ?? '').toLowerCase().includes('text/event-stream')) {
19
+ return parseMcpPayload(await readLimitedText(response, MAX_RESPONSE_BYTES, { t }));
20
+ }
21
+ if (!response.body) return undefined;
22
+ const reader = response.body.getReader();
23
+ const decoder = new TextDecoder();
24
+ let buffer = '';
25
+ let total = 0;
26
+ try {
27
+ for (;;) {
28
+ const { done, value } = await reader.read();
29
+ if (done) return undefined;
30
+ total += value.byteLength;
31
+ if (total > MAX_RESPONSE_BYTES) throw new Error(t('MCP 响应过大'));
32
+ buffer += decoder.decode(value, { stream: true });
33
+ let boundary;
34
+ while ((boundary = /\r\n\r\n|\n\n|\r\r/.exec(buffer))) {
35
+ const event = buffer.slice(0, boundary.index);
36
+ buffer = buffer.slice(boundary.index + boundary[0].length);
37
+ const data = event.split(/\r\n|\n|\r/).filter(line => line.startsWith('data:'))
38
+ .map(line => line.slice(5).replace(/^ /, '')).join('\n');
39
+ let payload;
40
+ try { payload = JSON.parse(data); } catch { continue; }
41
+ if (payload?.jsonrpc === '2.0' && payload.id === 1 && ('result' in payload || 'error' in payload)) return payload;
42
+ }
43
+ }
44
+ } finally {
45
+ // Cancellation must not await a server closing its persistent stream.
46
+ void reader.cancel().catch(() => {});
47
+ reader.releaseLock();
48
+ }
49
+ }
50
+
15
51
  async function readLimitedText(response, maxBytes = MAX_RESPONSE_BYTES, { t = tZh } = {}) {
16
52
  const declared = Number(response.headers.get('content-length'));
17
53
  if (Number.isFinite(declared) && declared > maxBytes) throw new Error(t('MCP 响应过大'));
@@ -180,8 +216,7 @@ export async function validateConnectionRecord(record, {
180
216
  return failed(record, 'http', message, { httpStatus: response.status });
181
217
  }
182
218
 
183
- const text = await readLimitedText(response, MAX_RESPONSE_BYTES, { t });
184
- const payload = parseMcpPayload(text, response.headers.get('content-type') ?? '');
219
+ const payload = await readInitializePayload(response, { t });
185
220
  if (!payload || payload.jsonrpc !== '2.0') {
186
221
  return failed(record, 'protocol', t('目标地址可访问,但未返回有效的 MCP 初始化响应'));
187
222
  }
package/lib/tools.js CHANGED
@@ -412,13 +412,15 @@ export function registerTools(ctx, api, { compact = false, t = createTranslator(
412
412
  type: 'object',
413
413
  properties: {
414
414
  connectorId: { type: 'string', description: t('连接器 id(可选)') },
415
+ workspaceId: { type: 'string', description: t('可选;只加载在该 Workspace 可见的已连接 Server') },
416
+ connectionKey: { type: 'string', description: t('可选;来自 status 的连接 key,限定手动、JSON 或目录安装的单条连接') },
415
417
  },
416
418
  additionalProperties: false,
417
419
  },
418
420
  output: healthOutput(t),
419
421
  timeoutMs: 120_000,
420
422
  async execute(args) {
421
- return api.healthCheck(args?.connectorId);
423
+ return api.healthCheck(args?.connectorId, args?.workspaceId, args?.connectionKey);
422
424
  },
423
425
  });
424
426
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mcp-connector",
3
- "version": "0.2.94",
3
+ "version": "0.2.96",
4
4
  "description": "MCP Connector for DeepSeek Harness: a data marketplace connecting enterprise, financial, legal, patent and research data. Manage authorization, search tools and troubleshoot MCP connections. Supports OAuth, API keys and HTTP/stdio.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",