dsh-mcp-connector 0.2.104 → 0.2.105
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 +6 -0
- package/README.en.md +4 -2
- package/README.md +4 -2
- package/docs/USER-GUIDE.md +1 -1
- package/docs/screenshots/01-market-overview.jpg +0 -0
- package/docs/screenshots/02-connector-detail.jpg +0 -0
- package/docs/screenshots/03-tool-discovery.jpg +0 -0
- package/docs/screenshots/04-json-import.jpg +0 -0
- package/docs/screenshots/05-unified-tool-search.png +0 -0
- package/docs/screenshots/06-tool-parameters.png +0 -0
- package/docs/screenshots/07-connection-diagnostics.png +0 -0
- package/docs/screenshots/08-ten-recommendations.jpg +0 -0
- package/docs/screenshots/README.md +1 -1
- package/docs/screenshots/assets.json +20 -20
- package/docs/screenshots/en/01-market-overview.jpg +0 -0
- package/docs/screenshots/en/02-connector-detail.jpg +0 -0
- package/docs/screenshots/en/03-tool-discovery.jpg +0 -0
- package/docs/screenshots/en/04-json-import.jpg +0 -0
- package/docs/screenshots/en/05-unified-tool-search.png +0 -0
- package/docs/screenshots/en/06-tool-parameters.png +0 -0
- package/docs/screenshots/en/07-connection-diagnostics.png +0 -0
- package/docs/screenshots/en/08-ten-recommendations.jpg +0 -0
- package/docs/screenshots/en/assets.json +20 -20
- package/docs/screenshots/en/demo.gif +0 -0
- package/docs/tutorials/FIRST-SUCCESS-SCENARIOS.md +1 -1
- package/lib/client.js +80 -53
- package/lib/index.js +29 -10
- package/lib/settings.js +12 -8
- package/package.json +1 -1
- package/ui/index.html +168 -64
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.105 - 2026-11-13
|
|
4
|
+
|
|
5
|
+
- 修复使用 configForms 的 DSH Desktop 上的连接器入口设置,支持切换入口位置和恢复默认设置(#236)。
|
|
6
|
+
- 工具详情按当前连接器内的原始工具名去重。企查查的全量入口与分类入口共用的工具只显示一次,搜索和分页使用相同计数。可切换服务入口查看参数或调整策略(#242)。
|
|
7
|
+
- Desktop hosts using configForms can save and reset the connector entry location. Tool details count each name once across a connector’s endpoints, and parameter views and policy changes use the selected endpoint.
|
|
8
|
+
|
|
3
9
|
## 0.2.104 - 2026-11-13
|
|
4
10
|
|
|
5
11
|
- 升级命令使用宿主提供的实际 profile,支持 Desktop、Web 和自定义名称;无法确认时显示更新指引,不再默认使用 `web`。
|
package/README.en.md
CHANGED
|
@@ -129,7 +129,7 @@ As of 2026-10-24, the public Registry publishes 112 connector descriptors. After
|
|
|
129
129
|
| Connection diagnostics and last-success cache | |
|
|
130
130
|
|  | |
|
|
131
131
|
|
|
132
|
-
<!-- generated:media -->English UI screenshots and GIF were captured from v0.2.
|
|
132
|
+
<!-- generated:media -->English UI screenshots and GIF were captured from v0.2.105 (2026-11-13), 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 -->
|
|
133
133
|
|
|
134
134
|
## Installation
|
|
135
135
|
|
|
@@ -217,6 +217,8 @@ The proxy variables must be present in the running DSH process. After changing t
|
|
|
217
217
|
|
|
218
218
|
When upgrading from a document that still holds only `showSidebarEntry`, the legacy boolean is translated by its actual behaviour: `true` → `both` (the old sidebar-visible state also offered the Settings open button), `false` → `settings`. That keeps an upgrade from silently dropping an existing entry point or re-revealing a hidden sidebar. In layered resolution a user override wins over the deployment base, and Restore defaults clears both the new field and any legacy boolean override.
|
|
219
219
|
|
|
220
|
+
Open **Settings → MCP Connector** to change the entry location or restore the default. Current Desktop hosts save the preference to the active profile through `configForms`. Older hosts use `settingsScope`. If neither service is available, or Settings has nowhere to display the card, use the sidebar to open the connector. To change the entry location, open the same profile with a host that provides the settings service and page.
|
|
221
|
+
|
|
220
222
|
`showSidebarEntry` defaults to `true` and is kept for configuration compatibility; once `entryLocation` is set explicitly it no longer affects the UI. Hiding the entry only hides the shortcut; connectors, connected MCP servers and tools keep working.
|
|
221
223
|
|
|
222
224
|
`compactManagementTools` defaults to `false` for backward compatibility. Set it to `true` in the plugin configuration and reload the plugin (or restart DSH) to expose only two management tools at the next inference boundary:
|
|
@@ -269,7 +271,7 @@ npm run dev:ui
|
|
|
269
271
|
|
|
270
272
|
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.
|
|
271
273
|
|
|
272
|
-
<!-- generated:version -->The current public version is [`dsh-mcp-connector@0.2.
|
|
274
|
+
<!-- generated:version -->The current public version is [`dsh-mcp-connector@0.2.105`](https://www.npmjs.com/package/dsh-mcp-connector), with [GitHub Release v0.2.105](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.105).<!-- /generated:version -->
|
|
273
275
|
|
|
274
276
|
See [CHANGELOG.md](CHANGELOG.md) for version history and [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md) for the Desktop release checklist.
|
|
275
277
|
|
package/README.md
CHANGED
|
@@ -143,7 +143,7 @@ Desktop 需要完全退出并重新启动应用;Web 需要停止原 `dsh web`
|
|
|
143
143
|
| 连接诊断与最后成功缓存 | |
|
|
144
144
|
|  | |
|
|
145
145
|
|
|
146
|
-
<!-- generated:media -->截图与 GIF 采集自 v0.2.
|
|
146
|
+
<!-- generated:media -->截图与 GIF 采集自 v0.2.105(2026-11-13)无凭据 Mock 页面,展示界面而非真实业务验收;市场数量是测试夹具。来源与更新方法见 [素材说明](docs/screenshots/README.md)。<!-- /generated:media -->
|
|
147
147
|
|
|
148
148
|
## 安装
|
|
149
149
|
|
|
@@ -225,6 +225,8 @@ Bundle 默认配置位于 `cordis.patch.yml`:
|
|
|
225
225
|
|
|
226
226
|
从旧版升级时,若设置文档里只有 `showSidebarEntry` 而没有 `entryLocation`,插件按旧字段的实际行为翻译:`true` → `both`(旧版侧栏可见、设置页也有打开按钮),`false` → `settings`。这样升级既不会悄悄删掉既有入口,也不会让隐藏过的侧栏重新出现。分层解析中用户自己的覆盖优先于部署基线;「恢复默认」会同时清掉新字段与旧的布尔覆盖。
|
|
227
227
|
|
|
228
|
+
在 **设置 → MCP连接器** 中可以切换入口位置或恢复默认。当前 Desktop 通过 `configForms` 将偏好写入当前 profile;旧版宿主通过 `settingsScope` 保存。若宿主未提供这两种服务,或未提供放置卡片的设置页入口,仍可从侧栏打开连接器。要更改入口位置,请在启用了设置服务和设置页的宿主中打开同一 profile。
|
|
229
|
+
|
|
228
230
|
`showSidebarEntry` 默认为 `true`,为兼容既有配置保留;一旦显式设置 `entryLocation`,它不再影响界面。关闭入口只隐藏快捷方式,不停用连接器、已连接 MCP Server 或工具。
|
|
229
231
|
|
|
230
232
|
`compactManagementTools` 默认为 `false`,兼容原有对话管理工具。希望降低管理工具上下文开销时,可在插件配置中设为 `true` 并重载插件(必要时重启 DSH),下一次推理使用新工具集:
|
|
@@ -276,7 +278,7 @@ npm run dev:ui
|
|
|
276
278
|
|
|
277
279
|
公共 Registry 每次合并后会生成 `catalog-stats.json`;本仓库的定时工作流每小时同步中英文介绍和统计快照。npm 页面中的静态正文随版本发布更新,上方动态统计徽标则直接读取 Registry,可在不发布新 npm 版本时保持实时数量一致。
|
|
278
280
|
|
|
279
|
-
<!-- generated:version -->当前公开版本为 [`dsh-mcp-connector@0.2.
|
|
281
|
+
<!-- generated:version -->当前公开版本为 [`dsh-mcp-connector@0.2.105`](https://www.npmjs.com/package/dsh-mcp-connector),对应 [GitHub Release v0.2.105](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.105)。<!-- /generated:version -->
|
|
280
282
|
|
|
281
283
|
版本能力与变更记录见 [CHANGELOG.md](CHANGELOG.md)。
|
|
282
284
|
Desktop 发版回归见 [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md)。
|
package/docs/USER-GUIDE.md
CHANGED
|
@@ -120,7 +120,7 @@ OAuth 一键连接要求服务商支持标准 OAuth 2.1/PKCE 和公开元数据
|
|
|
120
120
|
|
|
121
121
|
1. 阅读服务说明、鉴权方式、数据范围与可能产生的费用或副作用。
|
|
122
122
|
2. 在“试试这样用”中选择示例 Prompt;带变量的模板会先要求补齐查询主体等信息。
|
|
123
|
-
3.
|
|
123
|
+
3. 展开“工具详情”查看工具总数和服务入口数。同一连接器内,名称完全相同的工具在总数、默认列表及搜索结果中只算一次。选择服务入口可查看它提供的工具。一个工具有多个入口时,选择所需入口后再查看参数或调整该入口的工具策略。
|
|
124
124
|
4. 点击“去试试”或 Prompt 的发送按钮,在当前工作区创建或复用空白会话并写入草稿。如果已有未发送文字或附件,会保留原草稿并另建会话。插件只带入草稿,核对后再自行发送。
|
|
125
125
|
|
|
126
126
|
连接成功后,工具按 `mcp__<serverName>__*` 前缀提供给模型。工具清单来自服务端,实际数量会随服务商权限和版本变化。成功发现后,插件会在当前 profile 保存一份安全裁剪的工具元数据;实时发现失败时仍显示这份“最后成功缓存”,但保持连接失败/未知状态并标注缓存时间,超过 24 小时还会显示陈旧提示。详情与“已安装”列表会展示最近一次诊断的阶段、稳定错误码、说明、建议动作和最近成功时间。
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 产品截图与演示的来源及更新
|
|
2
2
|
|
|
3
|
-
<!-- generated:media -->本组 8 张截图和 GIF 均从 v0.2.
|
|
3
|
+
<!-- generated:media -->本组 8 张截图和 GIF 均从 v0.2.105 于 2026-11-13 重新采集,未修改截图中的版本文字。<!-- /generated:media -->
|
|
4
4
|
|
|
5
5
|
前七张素材由真实产品 UI 的无凭据 Mock harness 渲染:1280×720 浏览器视口、800px 产品面板、桌面两列卡片。顶部保留“无凭据 Mock”标识;目录数、连接数与工具数是演示夹具,不代表生产统计或真实授权、业务验收。不会读取用户 profile、调用服务商或上传业务数据。
|
|
6
6
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"capture": {
|
|
4
4
|
"locale": "zh-CN",
|
|
5
5
|
"capturedOn": "2026-11-13",
|
|
6
|
-
"sourceVersion": "0.2.
|
|
7
|
-
"sourceFingerprint": "
|
|
6
|
+
"sourceVersion": "0.2.105",
|
|
7
|
+
"sourceFingerprint": "45f634fcb74fbca16beec3844c151912635e859098ebc5d4e64e720734c46a64",
|
|
8
8
|
"browserViewport": {
|
|
9
9
|
"width": 1280,
|
|
10
10
|
"height": 720
|
|
@@ -17,63 +17,63 @@
|
|
|
17
17
|
"screenshots": [
|
|
18
18
|
{
|
|
19
19
|
"path": "docs/screenshots/01-market-overview.jpg",
|
|
20
|
-
"sha256": "
|
|
20
|
+
"sha256": "ea047c103f94aa0a99c8b8a16083aca48b43837aafd59207037c2b6945b08259",
|
|
21
21
|
"width": 1280,
|
|
22
22
|
"height": 720,
|
|
23
23
|
"capturedOn": "2026-11-13",
|
|
24
|
-
"sourceVersion": "0.2.
|
|
24
|
+
"sourceVersion": "0.2.105"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"path": "docs/screenshots/02-connector-detail.jpg",
|
|
28
|
-
"sha256": "
|
|
28
|
+
"sha256": "b2ebd4c1a0cdd8a21cabff6bde3ad3d8c5f9c36b0013663565f3efb6b61c19de",
|
|
29
29
|
"width": 1280,
|
|
30
30
|
"height": 720,
|
|
31
31
|
"capturedOn": "2026-11-13",
|
|
32
|
-
"sourceVersion": "0.2.
|
|
32
|
+
"sourceVersion": "0.2.105"
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
"path": "docs/screenshots/03-tool-discovery.jpg",
|
|
36
|
-
"sha256": "
|
|
36
|
+
"sha256": "c1e9460c98121b4a2997740697c111b53ec78e6727616cecc22c8d26170874e1",
|
|
37
37
|
"width": 1280,
|
|
38
38
|
"height": 720,
|
|
39
39
|
"capturedOn": "2026-11-13",
|
|
40
|
-
"sourceVersion": "0.2.
|
|
40
|
+
"sourceVersion": "0.2.105"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
"path": "docs/screenshots/04-json-import.jpg",
|
|
44
|
-
"sha256": "
|
|
44
|
+
"sha256": "b1681985fe6e9f352bd4f14fa50712af14aed5a38a801b382435ffebaaf35fd6",
|
|
45
45
|
"width": 1280,
|
|
46
46
|
"height": 720,
|
|
47
47
|
"capturedOn": "2026-11-13",
|
|
48
|
-
"sourceVersion": "0.2.
|
|
48
|
+
"sourceVersion": "0.2.105"
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
"path": "docs/screenshots/05-unified-tool-search.png",
|
|
52
|
-
"sha256": "
|
|
52
|
+
"sha256": "414820be2afc9d414e21f4d89c136dc26abe47a6a5c45e1ac042af6b2476fbe6",
|
|
53
53
|
"width": 1280,
|
|
54
54
|
"height": 720,
|
|
55
55
|
"capturedOn": "2026-11-13",
|
|
56
|
-
"sourceVersion": "0.2.
|
|
56
|
+
"sourceVersion": "0.2.105"
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
"path": "docs/screenshots/06-tool-parameters.png",
|
|
60
|
-
"sha256": "
|
|
60
|
+
"sha256": "ae5d7a613caf80cbc81d80e2d29d405039073f4d166d6e3e57221d691d49dd24",
|
|
61
61
|
"width": 1280,
|
|
62
62
|
"height": 720,
|
|
63
63
|
"capturedOn": "2026-11-13",
|
|
64
|
-
"sourceVersion": "0.2.
|
|
64
|
+
"sourceVersion": "0.2.105"
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
"path": "docs/screenshots/07-connection-diagnostics.png",
|
|
68
|
-
"sha256": "
|
|
68
|
+
"sha256": "3e8bac1647881baf0bc3794f9ac3b2472f6aca8542dd3208cdfab677d9d4ac96",
|
|
69
69
|
"width": 1280,
|
|
70
70
|
"height": 720,
|
|
71
71
|
"capturedOn": "2026-11-13",
|
|
72
|
-
"sourceVersion": "0.2.
|
|
72
|
+
"sourceVersion": "0.2.105"
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
"path": "docs/screenshots/08-ten-recommendations.jpg",
|
|
76
|
-
"sha256": "
|
|
76
|
+
"sha256": "0f94c5118818d605416abe38f3ec8e23e51ee02adc1a96bf790e9a5924be08d4",
|
|
77
77
|
"width": 1280,
|
|
78
78
|
"height": 1400,
|
|
79
79
|
"browserViewport": {
|
|
@@ -82,16 +82,16 @@
|
|
|
82
82
|
},
|
|
83
83
|
"panelHeight": 1280,
|
|
84
84
|
"capturedOn": "2026-11-13",
|
|
85
|
-
"sourceVersion": "0.2.
|
|
85
|
+
"sourceVersion": "0.2.105"
|
|
86
86
|
}
|
|
87
87
|
],
|
|
88
88
|
"demo": {
|
|
89
89
|
"path": "docs/demo.gif",
|
|
90
|
-
"sha256": "
|
|
90
|
+
"sha256": "b2ea6c0724b2be7ac73e77f0d671d208550bb9471f834f669eb899c345828791",
|
|
91
91
|
"width": 960,
|
|
92
92
|
"height": 540,
|
|
93
93
|
"capturedOn": "2026-11-13",
|
|
94
|
-
"sourceVersion": "0.2.
|
|
94
|
+
"sourceVersion": "0.2.105",
|
|
95
95
|
"durationSeconds": 36
|
|
96
96
|
}
|
|
97
97
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"capture": {
|
|
4
4
|
"locale": "en",
|
|
5
5
|
"capturedOn": "2026-11-13",
|
|
6
|
-
"sourceVersion": "0.2.
|
|
7
|
-
"sourceFingerprint": "
|
|
6
|
+
"sourceVersion": "0.2.105",
|
|
7
|
+
"sourceFingerprint": "45f634fcb74fbca16beec3844c151912635e859098ebc5d4e64e720734c46a64",
|
|
8
8
|
"browserViewport": {
|
|
9
9
|
"width": 1280,
|
|
10
10
|
"height": 720
|
|
@@ -17,63 +17,63 @@
|
|
|
17
17
|
"screenshots": [
|
|
18
18
|
{
|
|
19
19
|
"path": "docs/screenshots/en/01-market-overview.jpg",
|
|
20
|
-
"sha256": "
|
|
20
|
+
"sha256": "23f6b72f9bf0f53a349e6729d88baa24218588fd7a2f3e1696c67b90e3f2910c",
|
|
21
21
|
"width": 1280,
|
|
22
22
|
"height": 720,
|
|
23
23
|
"capturedOn": "2026-11-13",
|
|
24
|
-
"sourceVersion": "0.2.
|
|
24
|
+
"sourceVersion": "0.2.105"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"path": "docs/screenshots/en/02-connector-detail.jpg",
|
|
28
|
-
"sha256": "
|
|
28
|
+
"sha256": "910eca28003c05a98676ed2c8a19e1282fd40bb116c5a6207830bc8eadf73b16",
|
|
29
29
|
"width": 1280,
|
|
30
30
|
"height": 720,
|
|
31
31
|
"capturedOn": "2026-11-13",
|
|
32
|
-
"sourceVersion": "0.2.
|
|
32
|
+
"sourceVersion": "0.2.105"
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
"path": "docs/screenshots/en/03-tool-discovery.jpg",
|
|
36
|
-
"sha256": "
|
|
36
|
+
"sha256": "08b81045ed750b8533f1d13f1f4333c9164f460242bad46a9e914e3ab00fe5e3",
|
|
37
37
|
"width": 1280,
|
|
38
38
|
"height": 720,
|
|
39
39
|
"capturedOn": "2026-11-13",
|
|
40
|
-
"sourceVersion": "0.2.
|
|
40
|
+
"sourceVersion": "0.2.105"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
"path": "docs/screenshots/en/04-json-import.jpg",
|
|
44
|
-
"sha256": "
|
|
44
|
+
"sha256": "74bf69299db8b0e44903aa9f74004ae20793d6ab172ce255d8282f1c7715e4b0",
|
|
45
45
|
"width": 1280,
|
|
46
46
|
"height": 720,
|
|
47
47
|
"capturedOn": "2026-11-13",
|
|
48
|
-
"sourceVersion": "0.2.
|
|
48
|
+
"sourceVersion": "0.2.105"
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
"path": "docs/screenshots/en/05-unified-tool-search.png",
|
|
52
|
-
"sha256": "
|
|
52
|
+
"sha256": "0157d19dd4172e5273a75ce3684de332aa7d78c784677f091f565717cc650d74",
|
|
53
53
|
"width": 1280,
|
|
54
54
|
"height": 720,
|
|
55
55
|
"capturedOn": "2026-11-13",
|
|
56
|
-
"sourceVersion": "0.2.
|
|
56
|
+
"sourceVersion": "0.2.105"
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
"path": "docs/screenshots/en/06-tool-parameters.png",
|
|
60
|
-
"sha256": "
|
|
60
|
+
"sha256": "1d2b87f00802ca875fbeb32fe50153c4e1c508325cf29255995c336fdedac52f",
|
|
61
61
|
"width": 1280,
|
|
62
62
|
"height": 720,
|
|
63
63
|
"capturedOn": "2026-11-13",
|
|
64
|
-
"sourceVersion": "0.2.
|
|
64
|
+
"sourceVersion": "0.2.105"
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
"path": "docs/screenshots/en/07-connection-diagnostics.png",
|
|
68
|
-
"sha256": "
|
|
68
|
+
"sha256": "3256ff9f499817061cdeae00de49be7134baa6507c7a2f25e143d5d4311b8081",
|
|
69
69
|
"width": 1280,
|
|
70
70
|
"height": 720,
|
|
71
71
|
"capturedOn": "2026-11-13",
|
|
72
|
-
"sourceVersion": "0.2.
|
|
72
|
+
"sourceVersion": "0.2.105"
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
"path": "docs/screenshots/en/08-ten-recommendations.jpg",
|
|
76
|
-
"sha256": "
|
|
76
|
+
"sha256": "0ef802c1b93347d4326c09cb17dfbd93a99c2080cd4fe08b3e07b6a5e73cdd58",
|
|
77
77
|
"width": 1280,
|
|
78
78
|
"height": 1400,
|
|
79
79
|
"browserViewport": {
|
|
@@ -82,16 +82,16 @@
|
|
|
82
82
|
},
|
|
83
83
|
"panelHeight": 1280,
|
|
84
84
|
"capturedOn": "2026-11-13",
|
|
85
|
-
"sourceVersion": "0.2.
|
|
85
|
+
"sourceVersion": "0.2.105"
|
|
86
86
|
}
|
|
87
87
|
],
|
|
88
88
|
"demo": {
|
|
89
89
|
"path": "docs/screenshots/en/demo.gif",
|
|
90
|
-
"sha256": "
|
|
90
|
+
"sha256": "2a6665295a05f7fa46712f8596780fab311d9abfc942d7d0bff521a7e1c06178",
|
|
91
91
|
"width": 960,
|
|
92
92
|
"height": 540,
|
|
93
93
|
"capturedOn": "2026-11-13",
|
|
94
|
-
"sourceVersion": "0.2.
|
|
94
|
+
"sourceVersion": "0.2.105",
|
|
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.
|
|
11
|
+
| 前提 | <!-- generated:version -->正式 `dsh-mcp-connector@0.2.105`<!-- /generated:version -->;当前 Workspace;企查查 OAuth 可用;测试账号具有目标企业数据权限 |
|
|
12
12
|
| 权限/管理员 | 账号权限、组织授权和可见字段由服务商控制;企业组织可能需要管理员开通,当前文档不能替代审批 |
|
|
13
13
|
| 费用 | 可能受套餐、次数或字段权限影响;MCP连接器无法确认本次费用,调用前在服务商侧核对 |
|
|
14
14
|
| 运行/数据去向 | 远程 MCP Server;企业名称、查询参数和调用结果经 DSH Host 发送到/返回自 `agent.qcc.com` |
|
package/lib/client.js
CHANGED
|
@@ -1276,7 +1276,7 @@ window.__ModuleLoader__.load({
|
|
|
1276
1276
|
}
|
|
1277
1277
|
|
|
1278
1278
|
function ConnectorSettingsCard(props) {
|
|
1279
|
-
const { settingsScope, actions } = props;
|
|
1279
|
+
const { settingsScope, actions, configForm = false } = props;
|
|
1280
1280
|
const copy = connectorSettingsCopy();
|
|
1281
1281
|
const snapshot = (0, react.useSyncExternalStore)(
|
|
1282
1282
|
(listener) => settingsScope.subscribe(listener),
|
|
@@ -1307,9 +1307,9 @@ window.__ModuleLoader__.load({
|
|
|
1307
1307
|
setSaving(true);
|
|
1308
1308
|
setFailed(false);
|
|
1309
1309
|
try {
|
|
1310
|
-
await settingsScope.set(ENTRY_LOCATION_FIELD, next);
|
|
1310
|
+
const accepted = await settingsScope.set(ENTRY_LOCATION_FIELD, next);
|
|
1311
1311
|
const confirmed = settingsScope.getSnapshot();
|
|
1312
|
-
setFailed(confirmed.status !== "ready" || resolveEntryLocation(confirmed) !== next);
|
|
1312
|
+
setFailed(accepted === false || confirmed.status !== "ready" || resolveEntryLocation(confirmed) !== next);
|
|
1313
1313
|
} catch (error) {
|
|
1314
1314
|
console.error("[mcp-connector] entry location update failed:", error);
|
|
1315
1315
|
setFailed(true);
|
|
@@ -1321,22 +1321,21 @@ window.__ModuleLoader__.load({
|
|
|
1321
1321
|
/**
|
|
1322
1322
|
* 清掉入口展示位置的全部用户覆盖。
|
|
1323
1323
|
*
|
|
1324
|
-
* 老版 settingsScope(如 @deepseek-ai/dsh-client-ui-settings@0.1.
|
|
1324
|
+
* 老版 settingsScope(如 @deepseek-ai/dsh-client-ui-settings@0.1.1-rc.2)
|
|
1325
1325
|
* 只暴露单字段 set/unset,没有 mutate。那种 scope 上直接调 mutate 会抛
|
|
1326
1326
|
* `settingsScope.mutate is not a function`,一个键都清不掉。
|
|
1327
1327
|
*
|
|
1328
1328
|
* @param {any} scope settingsScope 实例
|
|
1329
|
-
* @returns {Promise<void>}
|
|
1329
|
+
* @returns {Promise<boolean|void>}
|
|
1330
1330
|
*/
|
|
1331
1331
|
async function resetEntryPreferences(scope) {
|
|
1332
1332
|
const supportsAtomicReset = typeof scope?.mutate === "function";
|
|
1333
1333
|
if (supportsAtomicReset) {
|
|
1334
1334
|
// 新宿主:一次原子写,两个键要么都清、要么都不动。
|
|
1335
|
-
|
|
1335
|
+
return scope.mutate([
|
|
1336
1336
|
{ op: "unset", path: [ENTRY_LOCATION_FIELD] },
|
|
1337
1337
|
{ op: "unset", path: [SHOW_SIDEBAR_ENTRY_FIELD] },
|
|
1338
1338
|
]);
|
|
1339
|
-
return;
|
|
1340
1339
|
}
|
|
1341
1340
|
|
|
1342
1341
|
// 老宿主只有单字段 set/unset,无法原子提交,只能逐键清。
|
|
@@ -1361,14 +1360,14 @@ window.__ModuleLoader__.load({
|
|
|
1361
1360
|
setSaving(true);
|
|
1362
1361
|
setFailed(false);
|
|
1363
1362
|
try {
|
|
1364
|
-
await resetEntryPreferences(settingsScope);
|
|
1365
|
-
|
|
1363
|
+
const accepted = await resetEntryPreferences(settingsScope);
|
|
1366
1364
|
const confirmed = settingsScope.getSnapshot();
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1365
|
+
// configForms persists a complete entry config. Other edits can keep
|
|
1366
|
+
// inherited fields in user even after the Host accepted both clears.
|
|
1367
|
+
const restored = configForm
|
|
1368
|
+
? resolveEntryLocation(confirmed) === resolveEntryLocation({ status: "ready", base: confirmed.base })
|
|
1369
|
+
: !hasUserOverride(confirmed.user);
|
|
1370
|
+
setFailed(accepted === false || confirmed.status !== "ready" || !restored);
|
|
1372
1371
|
} catch (error) {
|
|
1373
1372
|
console.error("[mcp-connector] entry location reset failed:", error);
|
|
1374
1373
|
setFailed(true);
|
|
@@ -1470,51 +1469,79 @@ window.__ModuleLoader__.load({
|
|
|
1470
1469
|
|
|
1471
1470
|
function installClientSettings(ctx, marketView) {
|
|
1472
1471
|
if (typeof ctx.inject !== "function") return;
|
|
1472
|
+
const slots = new Set();
|
|
1473
|
+
let modern;
|
|
1474
|
+
let legacy;
|
|
1475
|
+
|
|
1476
|
+
function sync() {
|
|
1477
|
+
// Prefer the new form once it is ready. A compatibility provider can
|
|
1478
|
+
// remain usable while the modern Host loads or withdraws its form.
|
|
1479
|
+
const scope = modern?.getSnapshot()?.status === "ready" ? modern
|
|
1480
|
+
: legacy?.getSnapshot()?.status === "ready" ? legacy : undefined;
|
|
1481
|
+
for (const update of slots) update(scope);
|
|
1482
|
+
marketView.syncSidebarVisible(!slots.size || resolveSidebarVisible(scope?.getSnapshot()));
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
function registerCard(name, options, component) {
|
|
1486
|
+
ctx.slots.inject(name, () => {
|
|
1487
|
+
let current;
|
|
1488
|
+
let disposeCard;
|
|
1489
|
+
const update = (scope) => {
|
|
1490
|
+
if (current === scope) return;
|
|
1491
|
+
disposeCard?.();
|
|
1492
|
+
current = scope;
|
|
1493
|
+
disposeCard = scope && ctx.slots.register({
|
|
1494
|
+
...options, name, store: marketView,
|
|
1495
|
+
inject: () => ({ settingsScope: scope, configForm: scope === modern })
|
|
1496
|
+
}, component);
|
|
1497
|
+
};
|
|
1498
|
+
slots.add(update);
|
|
1499
|
+
sync();
|
|
1500
|
+
return () => {
|
|
1501
|
+
slots.delete(update);
|
|
1502
|
+
update(undefined);
|
|
1503
|
+
sync();
|
|
1504
|
+
};
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
function observe(providerCtx, scope, isModern) {
|
|
1509
|
+
if (typeof scope?.getSnapshot !== "function" || typeof scope.subscribe !== "function") return;
|
|
1510
|
+
providerCtx.effect(() => {
|
|
1511
|
+
const unsubscribe = scope.subscribe(sync);
|
|
1512
|
+
if (isModern) modern = scope;
|
|
1513
|
+
else legacy = scope;
|
|
1514
|
+
sync();
|
|
1515
|
+
return () => {
|
|
1516
|
+
unsubscribe();
|
|
1517
|
+
if (isModern) modern = undefined;
|
|
1518
|
+
else legacy = undefined;
|
|
1519
|
+
sync();
|
|
1520
|
+
};
|
|
1521
|
+
}, "mcp-connector: settings provider");
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
ctx.effect(installSettingsStyles, "mcp-connector: settings styles");
|
|
1525
|
+
registerCard("settings.section", { id: CONNECTOR_SETTINGS_NAMESPACE, order: 80, label: t("MCP连接器") }, ConnectorSettingsSection);
|
|
1526
|
+
registerCard("settings.plugin.item", { key: CONNECTOR_SETTINGS_NAMESPACE }, ConnectorSettingsCard);
|
|
1527
|
+
ctx.inject(["configForms"], (settingsCtx) => {
|
|
1528
|
+
if (typeof settingsCtx.configForms?.get !== "function") return;
|
|
1529
|
+
const scope = settingsCtx.configForms.get(CONNECTOR_SETTINGS_NAMESPACE);
|
|
1530
|
+
observe(settingsCtx, scope, true);
|
|
1531
|
+
});
|
|
1473
1532
|
ctx.inject(["settingsScope"], (settingsCtx) => {
|
|
1474
|
-
if (typeof settingsCtx
|
|
1475
|
-
const
|
|
1533
|
+
if (typeof settingsCtx.settingsScope?.bind !== "function") return;
|
|
1534
|
+
const scope = settingsCtx.settingsScope.bind({
|
|
1476
1535
|
namespace: CONNECTOR_SETTINGS_NAMESPACE,
|
|
1477
1536
|
decode(value) {
|
|
1478
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return
|
|
1479
|
-
// 新字段与历史布尔开关都接受:旧 profile 的设置文档里可能只有后者。
|
|
1537
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return undefined;
|
|
1480
1538
|
const decoded = {};
|
|
1481
|
-
if (typeof value[ENTRY_LOCATION_FIELD] === "string")
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
if (typeof value[SHOW_SIDEBAR_ENTRY_FIELD] === "boolean") {
|
|
1485
|
-
decoded[SHOW_SIDEBAR_ENTRY_FIELD] = value[SHOW_SIDEBAR_ENTRY_FIELD];
|
|
1486
|
-
}
|
|
1487
|
-
return Object.keys(decoded).length > 0 ? decoded : void 0;
|
|
1539
|
+
if (typeof value[ENTRY_LOCATION_FIELD] === "string") decoded[ENTRY_LOCATION_FIELD] = value[ENTRY_LOCATION_FIELD];
|
|
1540
|
+
if (typeof value[SHOW_SIDEBAR_ENTRY_FIELD] === "boolean") decoded[SHOW_SIDEBAR_ENTRY_FIELD] = value[SHOW_SIDEBAR_ENTRY_FIELD];
|
|
1541
|
+
return Object.keys(decoded).length > 0 ? decoded : undefined;
|
|
1488
1542
|
}
|
|
1489
1543
|
});
|
|
1490
|
-
|
|
1491
|
-
|| typeof settingsScope?.subscribe !== "function") return;
|
|
1492
|
-
settingsCtx.effect(() => {
|
|
1493
|
-
const sync = () => { marketView.syncSidebarVisible(resolveSidebarVisible(settingsScope.getSnapshot())); };
|
|
1494
|
-
sync();
|
|
1495
|
-
const unsubscribe = settingsScope.subscribe(sync);
|
|
1496
|
-
return () => {
|
|
1497
|
-
unsubscribe();
|
|
1498
|
-
marketView.syncSidebarVisible(true);
|
|
1499
|
-
};
|
|
1500
|
-
}, "mcp-connector: sidebar visibility setting");
|
|
1501
|
-
settingsCtx.effect(() => installSettingsStyles(), "mcp-connector: settings styles");
|
|
1502
|
-
// Modern hosts may omit the Plugins page entirely. Contribute our own
|
|
1503
|
-
// section without depending on settings.plugin.item or widening tools.
|
|
1504
|
-
settingsCtx.slots.inject("settings.section", () => settingsCtx.slots.register({
|
|
1505
|
-
name: "settings.section",
|
|
1506
|
-
id: CONNECTOR_SETTINGS_NAMESPACE,
|
|
1507
|
-
order: 80,
|
|
1508
|
-
label: t("MCP连接器"),
|
|
1509
|
-
store: marketView,
|
|
1510
|
-
inject: () => ({ settingsScope })
|
|
1511
|
-
}, ConnectorSettingsSection));
|
|
1512
|
-
settingsCtx.slots.inject("settings.plugin.item", () => settingsCtx.slots.register({
|
|
1513
|
-
name: "settings.plugin.item",
|
|
1514
|
-
key: CONNECTOR_SETTINGS_NAMESPACE,
|
|
1515
|
-
store: marketView,
|
|
1516
|
-
inject: () => ({ settingsScope })
|
|
1517
|
-
}, ConnectorSettingsCard));
|
|
1544
|
+
observe(settingsCtx, scope, false);
|
|
1518
1545
|
});
|
|
1519
1546
|
}
|
|
1520
1547
|
|
package/lib/index.js
CHANGED
|
@@ -90,6 +90,19 @@ export const name = 'mcp-connector';
|
|
|
90
90
|
|
|
91
91
|
export const inject = ['tools', 'storageDomain', 'loader', 'workspaceRegistry'];
|
|
92
92
|
|
|
93
|
+
function countConnectorTools(servers) {
|
|
94
|
+
const names = new Set();
|
|
95
|
+
let totalToolEntries = 0;
|
|
96
|
+
for (const server of servers) {
|
|
97
|
+
totalToolEntries += server.tools.length;
|
|
98
|
+
for (const tool of server.tools) {
|
|
99
|
+
if (typeof tool?.name === 'string' && tool.name.trim()) names.add(tool.name);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// totalTools is the historical per-server sum used by existing API clients.
|
|
103
|
+
return { uniqueToolCount: names.size, totalToolEntries, totalTools: totalToolEntries };
|
|
104
|
+
}
|
|
105
|
+
|
|
93
106
|
/**
|
|
94
107
|
* 读取用户在 DSH 里选择的界面语言。
|
|
95
108
|
*
|
|
@@ -120,6 +133,12 @@ function readHostLocalePreference(ctx) {
|
|
|
120
133
|
return undefined;
|
|
121
134
|
}
|
|
122
135
|
|
|
136
|
+
// Config forms expose volatile fields. Older schemastery versions parse the
|
|
137
|
+
// same fields as ordinary values for the settingsScope generation.
|
|
138
|
+
function formField(schema) {
|
|
139
|
+
return typeof schema.volatile === 'function' ? schema.volatile() : schema;
|
|
140
|
+
}
|
|
141
|
+
|
|
123
142
|
export const Config = z.object({
|
|
124
143
|
/** 远程目录 URL(默认公共 registry;显式空字符串 = 仅内置目录) */
|
|
125
144
|
catalogUrl: z.string().default(DEFAULT_CATALOG_URL),
|
|
@@ -148,7 +167,7 @@ export const Config = z.object({
|
|
|
148
167
|
/** 授权账号标识(预留多账号) */
|
|
149
168
|
account: z.string().default(DEFAULT_ACCOUNT),
|
|
150
169
|
/** 是否在 DSH 主侧边栏显示 MCP连接器快捷入口(旧字段,保留兼容) */
|
|
151
|
-
showSidebarEntry: z.boolean().default(true),
|
|
170
|
+
showSidebarEntry: formField(z.boolean().default(true)),
|
|
152
171
|
/**
|
|
153
172
|
* 入口展示位置:`both` / `sidebar` / `settings`。
|
|
154
173
|
*
|
|
@@ -157,7 +176,7 @@ export const Config = z.object({
|
|
|
157
176
|
* 该值会提前注入 settings base,把用户的旧布尔覆盖盖掉。
|
|
158
177
|
* 传入非法值会被 schema 拒绝,与 README 的承诺一致。
|
|
159
178
|
*/
|
|
160
|
-
entryLocation: z.union(['both', 'sidebar', 'settings'].map((value) => z.const(value))),
|
|
179
|
+
entryLocation: formField(z.union(['both', 'sidebar', 'settings'].map((value) => z.const(value)))),
|
|
161
180
|
/** 精简对话管理工具为发现入口 + 会话入口;旧配置默认保留全量工具。修改后重载插件。 */
|
|
162
181
|
compactManagementTools: z.boolean().default(false),
|
|
163
182
|
/**
|
|
@@ -3520,7 +3539,7 @@ export async function apply(ctx, config) {
|
|
|
3520
3539
|
error: current?.error || (!cached && !current ? t('正在后台发现工具,请稍候') : undefined),
|
|
3521
3540
|
errorKind: current?.errorKind, errorStage: current?.errorStage, diagnosticCode: current?.diagnosticCode,
|
|
3522
3541
|
policy: serverPolicy(record),
|
|
3523
|
-
...(cached ? { cacheObservedAt: cached.observedAt, cacheAgeMs: cached.cacheAgeMs, stale: cached.stale } : {}),
|
|
3542
|
+
...(cached ? { cacheObservedAt: cached.observedAt, cacheAgeMs: cached.cacheAgeMs, stale: cached.stale, cacheTruncated: cached.entry.truncated === true } : {}),
|
|
3524
3543
|
tools: (cached?.entry.tools || []).map((tool) => decorateToolPolicy(record, {
|
|
3525
3544
|
name: tool.name, title: tool.title || tool.name, description: tool.description || '',
|
|
3526
3545
|
})),
|
|
@@ -3528,7 +3547,7 @@ export async function apply(ctx, config) {
|
|
|
3528
3547
|
});
|
|
3529
3548
|
const health = observedHealth(connectorId, records);
|
|
3530
3549
|
return { ok: servers.some((server) => server.ok), message: t('最近工具发现状态'), detail: {
|
|
3531
|
-
connectorId, servers,
|
|
3550
|
+
connectorId, servers, ...countConnectorTools(servers),
|
|
3532
3551
|
source: 'last-success-cache',
|
|
3533
3552
|
connectionState: health.connectionState, diagnostic: health.diagnostic,
|
|
3534
3553
|
discoveryDiagnostic: discoveryHealth(connectorId, records, servers).diagnostic,
|
|
@@ -3543,11 +3562,11 @@ export async function apply(ctx, config) {
|
|
|
3543
3562
|
tools: snapshot.tools,
|
|
3544
3563
|
}));
|
|
3545
3564
|
if (servers.length === 0) return { ok: false, message: t(`连接器 "{name}" 尚未连接,且目录暂无工具快照`, { name: connector.name }) };
|
|
3546
|
-
const
|
|
3565
|
+
const counts = countConnectorTools(servers);
|
|
3547
3566
|
return {
|
|
3548
3567
|
ok: true,
|
|
3549
|
-
message: t(`目录预览:{count} 个 server,{toolCount} 个工具`, { count: servers.length, toolCount:
|
|
3550
|
-
detail: { connectorId, servers,
|
|
3568
|
+
message: t(`目录预览:{count} 个 server,{toolCount} 个工具`, { count: servers.length, toolCount: counts.uniqueToolCount }),
|
|
3569
|
+
detail: { connectorId, servers, ...counts, source: 'snapshot' },
|
|
3551
3570
|
};
|
|
3552
3571
|
}
|
|
3553
3572
|
|
|
@@ -3689,7 +3708,7 @@ export async function apply(ctx, config) {
|
|
|
3689
3708
|
discoveryPlans.set(record.key, { record, ...nextDiscovery(prior?.record === record ? prior : null, servers[index], at) });
|
|
3690
3709
|
}
|
|
3691
3710
|
});
|
|
3692
|
-
const
|
|
3711
|
+
const counts = countConnectorTools(servers);
|
|
3693
3712
|
const availableServers = servers.filter((server) => server.ok).length;
|
|
3694
3713
|
const unknownServers = servers.filter((server) => server.unknown).length;
|
|
3695
3714
|
const failedServers = servers.length - availableServers - unknownServers;
|
|
@@ -3726,11 +3745,11 @@ export async function apply(ctx, config) {
|
|
|
3726
3745
|
summary: unknownSummary,
|
|
3727
3746
|
more: unknownServers > 3 ? t(';另有 {count} 个 Server 尚未确认', { count: unknownServers - 3 }) : '',
|
|
3728
3747
|
})
|
|
3729
|
-
: t('共 {count} 个 server,{toolCount} 个工具', { count: servers.length, toolCount:
|
|
3748
|
+
: t('共 {count} 个 server,{toolCount} 个工具', { count: servers.length, toolCount: counts.uniqueToolCount }),
|
|
3730
3749
|
detail: {
|
|
3731
3750
|
connectorId,
|
|
3732
3751
|
servers,
|
|
3733
|
-
|
|
3752
|
+
...counts,
|
|
3734
3753
|
availableServers,
|
|
3735
3754
|
failedServers,
|
|
3736
3755
|
unknownServers,
|
package/lib/settings.js
CHANGED
|
@@ -122,26 +122,30 @@ export const ConnectorSettings = z.object({
|
|
|
122
122
|
.default(DEFAULT_ENTRY_LOCATION),
|
|
123
123
|
});
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
*/
|
|
125
|
+
function configValue(field) {
|
|
126
|
+
return typeof field?.get === 'function' ? field.get() : field;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Install the custom card's presentation policy or the legacy namespace. */
|
|
130
130
|
export function installConnectorSettings(ctx, config = {}) {
|
|
131
131
|
if (typeof ctx.inject !== 'function') return;
|
|
132
132
|
ctx.inject(['settings'], (settingsCtx) => {
|
|
133
|
+
if (typeof settingsCtx?.settings?.configure === 'function' && typeof settingsCtx.effect === 'function') {
|
|
134
|
+
settingsCtx.effect(() => settingsCtx.settings.configure({ auto: false }, ctx.fiber));
|
|
135
|
+
}
|
|
133
136
|
if (typeof settingsCtx?.settings?.register !== 'function') return;
|
|
134
137
|
|
|
135
138
|
// 组合配置里显式写了 entryLocation 就用它;否则把旧布尔开关翻译成等价档位,
|
|
136
139
|
// 让升级前后「侧栏是否出现、设置页有没有打开按钮」都保持不变。
|
|
137
|
-
const explicit = config[ENTRY_LOCATION_FIELD];
|
|
140
|
+
const explicit = configValue(config[ENTRY_LOCATION_FIELD]);
|
|
141
|
+
const showSidebarEntry = configValue(config[SHOW_SIDEBAR_ENTRY_FIELD]);
|
|
138
142
|
const base = ENTRY_LOCATIONS.includes(explicit)
|
|
139
143
|
? explicit
|
|
140
|
-
: (entryLocationFromLegacyFlag(
|
|
144
|
+
: (entryLocationFromLegacyFlag(showSidebarEntry) ?? DEFAULT_ENTRY_LOCATION);
|
|
141
145
|
|
|
142
146
|
settingsCtx.settings.register(CONNECTOR_SETTINGS_NAMESPACE, ConnectorSettings, {
|
|
143
147
|
base: {
|
|
144
|
-
[SHOW_SIDEBAR_ENTRY_FIELD]:
|
|
148
|
+
[SHOW_SIDEBAR_ENTRY_FIELD]: showSidebarEntry !== false,
|
|
145
149
|
[ENTRY_LOCATION_FIELD]: base,
|
|
146
150
|
},
|
|
147
151
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mcp-connector",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.105",
|
|
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",
|
package/ui/index.html
CHANGED
|
@@ -336,6 +336,9 @@
|
|
|
336
336
|
.tools-summary { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: auto; }
|
|
337
337
|
.tools-panel { background: var(--bg); padding: 12px; }
|
|
338
338
|
.tools-toolbar { margin-bottom: 10px; }
|
|
339
|
+
.tools-entry-row, .tool-source-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--text-2); margin: 6px 0; }
|
|
340
|
+
.tools-entry-row select, .tool-source-row select { width: auto; max-width: min(100%, 22em); }
|
|
341
|
+
.tools-entry-hint { margin: 6px 0 10px; color: var(--text-2); font-size: 12px; }
|
|
339
342
|
.governance-bar {
|
|
340
343
|
display: flex; align-items: center; gap: 8px; padding: 9px 10px; margin-bottom: 10px;
|
|
341
344
|
border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: 12px;
|
|
@@ -365,7 +368,7 @@
|
|
|
365
368
|
.tool-item { padding: 10px 12px; border-top: 1px solid #f0f1f3; }
|
|
366
369
|
.tool-item:first-child { border-top: 0; }
|
|
367
370
|
.tool-item:hover { background: var(--accent-light); }
|
|
368
|
-
.tool-name-row { display: flex; align-items: center; gap: 7px; }
|
|
371
|
+
.tool-name-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
|
|
369
372
|
.tool-detail-btn { margin-left: auto; border: 0; background: transparent; color: var(--accent); font-size: 12px; cursor: pointer; padding: 2px 4px; }
|
|
370
373
|
.tool-schema { margin: 10px 0 0; padding: 10px; border-radius: 8px; background: var(--bg); max-height: 320px; overflow: auto; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
371
374
|
.tool-name { color: var(--text); font: 600 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; overflow-wrap: anywhere; }
|
|
@@ -572,6 +575,8 @@
|
|
|
572
575
|
<button class="text-btn" id="policy-rollback" type="button" hidden>撤销最近变更</button>
|
|
573
576
|
</div>
|
|
574
577
|
<div class="tools-toolbar">
|
|
578
|
+
<p class="tools-entry-hint" id="tools-entry-hint" hidden></p>
|
|
579
|
+
<label class="tools-entry-row" id="tools-entry-row" hidden><span id="tools-entry-label">查看范围</span><select class="policy-select" id="tools-entry"></select></label>
|
|
575
580
|
<input class="tools-search" id="tools-search" type="search" placeholder="搜索工具名称或描述…" autocomplete="off" />
|
|
576
581
|
</div>
|
|
577
582
|
<div class="tools-list" id="detail-tools">
|
|
@@ -786,7 +791,20 @@
|
|
|
786
791
|
"请输入{name}": "Enter {name}",
|
|
787
792
|
"· 精选 {visible} / 共 {total} 条": "· {visible} of {total} curated",
|
|
788
793
|
"暂无预设 Prompt": "No preset prompts",
|
|
789
|
-
"{
|
|
794
|
+
"{tools} 个工具 · {servers} 个服务入口": "{tools} tools · {servers} service endpoints",
|
|
795
|
+
"查看范围": "View",
|
|
796
|
+
"所有工具": "All tools",
|
|
797
|
+
"{entry}({count} 个工具)": "{entry} ({count} tools)",
|
|
798
|
+
"全部工具入口包含 {tools} 个工具,另外 {entries} 个入口按业务分类提供其中的工具。": "The full endpoint includes all {tools} tools. The other {entries} endpoints offer subsets by category.",
|
|
799
|
+
"可用入口": "Available endpoints",
|
|
800
|
+
"当前入口": "Selected endpoint",
|
|
801
|
+
"全部工具({entry})": "Full catalog ({entry})",
|
|
802
|
+
"风险({entry})": "Risk ({entry})",
|
|
803
|
+
"知识产权({entry})": "Intellectual property ({entry})",
|
|
804
|
+
"经营({entry})": "Operations ({entry})",
|
|
805
|
+
"历史({entry})": "History ({entry})",
|
|
806
|
+
"人员({entry})": "Executives ({entry})",
|
|
807
|
+
"正在后台发现工具,请稍候": "Tool discovery is in progress. Please wait.",
|
|
790
808
|
"搜索 {count} 个工具的名称或描述…": "Search {count} tools by name or description…",
|
|
791
809
|
"搜索工具名称或描述…": "Search tool names or descriptions…",
|
|
792
810
|
"搜索连接器…": "Search connectors…",
|
|
@@ -1339,6 +1357,7 @@
|
|
|
1339
1357
|
let promptPage = 0;
|
|
1340
1358
|
let detailConnector = null;
|
|
1341
1359
|
let detailToolServers = [];
|
|
1360
|
+
const detailToolSources = new Map();
|
|
1342
1361
|
let detailGovernance = null;
|
|
1343
1362
|
let detailNeedsReconfigure = false;
|
|
1344
1363
|
let detailFailureState = '';
|
|
@@ -1816,12 +1835,15 @@
|
|
|
1816
1835
|
: `<div style="color:var(--muted);font-size:13px;">${t('暂无预设 Prompt')}</div>`;
|
|
1817
1836
|
}
|
|
1818
1837
|
|
|
1819
|
-
function
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1838
|
+
function resetDetailTools() {
|
|
1839
|
+
detailToolServers = [];
|
|
1840
|
+
detailToolSources.clear();
|
|
1841
|
+
toolRenderLimit = 50;
|
|
1842
|
+
$('#tools-entry').value = '';
|
|
1843
|
+
$('#tools-entry-row').hidden = true;
|
|
1844
|
+
$('#tools-entry-hint').hidden = true;
|
|
1845
|
+
$('#tools-search').value = '';
|
|
1846
|
+
$('#tools-search').placeholder = t('搜索工具名称或描述…');
|
|
1825
1847
|
}
|
|
1826
1848
|
|
|
1827
1849
|
function isDeprecatedTool(tool) {
|
|
@@ -1950,60 +1972,135 @@
|
|
|
1950
1972
|
return score;
|
|
1951
1973
|
}
|
|
1952
1974
|
|
|
1953
|
-
function
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1975
|
+
function toolEntryName(server) {
|
|
1976
|
+
return server.serverName || server.serverKey || '';
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
function toolEntryLabel(server) {
|
|
1980
|
+
const entry = toolEntryName(server);
|
|
1981
|
+
if (detailConnector?.id !== 'qcc-company') return entry;
|
|
1982
|
+
switch (entry) {
|
|
1983
|
+
case 'qcc-company': return t('全部工具({entry})', { entry });
|
|
1984
|
+
case 'qcc-risk': return t('风险({entry})', { entry });
|
|
1985
|
+
case 'qcc-ipr': return t('知识产权({entry})', { entry });
|
|
1986
|
+
case 'qcc-operation': return t('经营({entry})', { entry });
|
|
1987
|
+
case 'qcc-history': return t('历史({entry})', { entry });
|
|
1988
|
+
case 'qcc-executive': return t('人员({entry})', { entry });
|
|
1989
|
+
default: return entry;
|
|
1959
1990
|
}
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
const
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
const
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
if (
|
|
1971
|
-
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
function groupDetailTools(servers) {
|
|
1994
|
+
const groups = new Map();
|
|
1995
|
+
const counts = new Map();
|
|
1996
|
+
for (const server of servers) {
|
|
1997
|
+
const names = new Set();
|
|
1998
|
+
for (const tool of server.tools || []) {
|
|
1999
|
+
if (typeof tool?.name !== 'string' || !tool.name.trim() || names.has(tool.name)) continue;
|
|
2000
|
+
names.add(tool.name);
|
|
2001
|
+
if (!groups.has(tool.name)) groups.set(tool.name, []);
|
|
2002
|
+
groups.get(tool.name).push({ server, tool });
|
|
1972
2003
|
}
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2004
|
+
counts.set(server, names.size);
|
|
2005
|
+
}
|
|
2006
|
+
return { groups, counts };
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
function updateToolsToolbar(groups, counts) {
|
|
2010
|
+
const entrySelect = $('#tools-entry');
|
|
2011
|
+
const selected = detailToolServers.find((server) => toolEntryName(server) === entrySelect.value);
|
|
2012
|
+
const options = detailToolServers.map((server) => {
|
|
2013
|
+
const entry = toolEntryName(server);
|
|
2014
|
+
return `<option value="${esc(entry)}" ${server === selected ? 'selected' : ''}>${esc(t('{entry}({count} 个工具)', { entry: toolEntryLabel(server), count: counts.get(server) }))}</option>`;
|
|
2015
|
+
});
|
|
2016
|
+
entrySelect.innerHTML = `<option value="">${t('所有工具')}</option>${options.join('')}`;
|
|
2017
|
+
$('#tools-entry-row').hidden = detailToolServers.length < 2;
|
|
2018
|
+
const full = detailToolServers.find((server) => server.serverKey === 'company' || server.serverName === 'qcc-company');
|
|
2019
|
+
const hint = $('#tools-entry-hint');
|
|
2020
|
+
const complete = detailConnector?.id === 'qcc-company' && detailToolServers.length > 1 && full
|
|
2021
|
+
&& counts.get(full) === groups.size && detailToolServers.every((server) => counts.get(server) > 0
|
|
2022
|
+
&& server.ok && !server.error && !server.pending && !server.stale && !server.preview && !server.cacheTruncated);
|
|
2023
|
+
hint.hidden = !complete;
|
|
2024
|
+
hint.textContent = complete ? t('全部工具入口包含 {tools} 个工具,另外 {entries} 个入口按业务分类提供其中的工具。', {
|
|
2025
|
+
tools: groups.size, entries: detailToolServers.length - 1,
|
|
2026
|
+
}) : '';
|
|
2027
|
+
const count = selected ? counts.get(selected) : groups.size;
|
|
2028
|
+
$('#tools-search').placeholder = count ? t('搜索 {count} 个工具的名称或描述…', { count }) : t('搜索工具名称或描述…');
|
|
2029
|
+
$('#tools-summary').textContent = t('{tools} 个工具 · {servers} 个服务入口', { tools: groups.size, servers: detailToolServers.length });
|
|
2030
|
+
return selected;
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
function cacheLabel(server) {
|
|
2034
|
+
if (!server.cached) return '';
|
|
2035
|
+
return t(' · 最后成功缓存 {at}{stale}', {
|
|
2036
|
+
at: server.cacheObservedAt ? new Date(server.cacheObservedAt).toLocaleString(t.locale, { hour12: false }) : '',
|
|
2037
|
+
stale: server.stale ? t(' · 已超过 24 小时') : '',
|
|
2038
|
+
});
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
function renderEntryStatus(server, showHeader) {
|
|
2042
|
+
if (!showHeader && !server.error && (server.ok || server.cached)) return '';
|
|
2043
|
+
const label = toolEntryLabel(server);
|
|
2044
|
+
const serverSelect = policySelect('server', server.policy?.configuredEffect, server.serverName, '', '', t('{label} Server 策略', { label }));
|
|
2045
|
+
const status = server.ok || server.cached ? cacheLabel(server) : t(server.pending ? '正在发现' : '加载失败');
|
|
2046
|
+
let message = server.error;
|
|
2047
|
+
if (message && server.cached) message = t('实时读取失败:{error};以下为最后成功缓存。', { error: message });
|
|
2048
|
+
if (!message && !server.ok && !server.cached) message = t(server.pending ? '正在后台发现工具,请稍候' : '未知错误');
|
|
2049
|
+
if (!message && server.managed && !server.tools?.length) message = t('Host 已完成 stdio 初始化,但该 Server 当前没有可展示的工具。');
|
|
2050
|
+
return `<div class="tools-server"><div class="tools-server-header"><span class="tools-server-copy">${esc(label)} <span class="count">${esc(status)}</span></span>${serverSelect}</div>${message ? `<div class="tools-error">${esc(message)}</div>` : ''}</div>`;
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
function matchedDetailTools(groups, entry, query) {
|
|
2054
|
+
const rows = [];
|
|
2055
|
+
for (const [name, allSources] of groups) {
|
|
2056
|
+
const sources = entry ? allSources.filter((source) => source.server === entry) : allSources;
|
|
2057
|
+
if (!sources.length) continue;
|
|
2058
|
+
let best = sources[0];
|
|
2059
|
+
let score = -1;
|
|
2060
|
+
if (query) {
|
|
2061
|
+
for (const source of sources) {
|
|
2062
|
+
const candidate = toolSearchScore(source.tool, query);
|
|
2063
|
+
if (candidate > score) { score = candidate; best = source; }
|
|
2064
|
+
}
|
|
2065
|
+
if (score < 0) continue;
|
|
2066
|
+
}
|
|
2067
|
+
const preferred = detailToolSources.get(name);
|
|
2068
|
+
const selected = sources.find((source) => toolEntryName(source.server) === preferred) || best;
|
|
2069
|
+
rows.push({ name, sources, selected, score });
|
|
2070
|
+
}
|
|
2071
|
+
return rows.sort((a, b) => query ? b.score - a.score || a.name.localeCompare(b.name)
|
|
2072
|
+
: Number(isDeprecatedTool(a.selected.tool)) - Number(isDeprecatedTool(b.selected.tool)));
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
function renderDetailTool({ name, sources, selected }) {
|
|
2076
|
+
const { server, tool } = selected;
|
|
2077
|
+
const entry = toolEntryName(server);
|
|
2078
|
+
const sourceLabels = sources.map((source) => toolEntryLabel(source.server));
|
|
2079
|
+
const sourceOptions = sources.length > 1 ? `<label class="tool-source-row">${t('当前入口')}<select class="policy-select" data-tool-source data-tool-name="${esc(name)}">${sources.map((source) =>
|
|
2080
|
+
`<option value="${esc(toolEntryName(source.server))}" ${source === selected ? 'selected' : ''}>${esc(toolEntryLabel(source.server))}</option>`).join('')}</select></label>` : '';
|
|
2081
|
+
const description = tool.description || (tool.title && tool.title !== name ? tool.title : '');
|
|
2082
|
+
const toolSelect = policySelect('tool', tool.policy?.configuredEffect, server.serverName, name, tool.publicName, t('{name} Tool 策略', { name: `${entry} / ${name}` }));
|
|
2083
|
+
const detailButton = server.preview ? '' : `<button class="tool-detail-btn" type="button" data-tool-detail="true" data-server-name="${esc(server.serverName || '')}" data-tool-name="${esc(name)}">${t('参数详情')}</button>`;
|
|
2084
|
+
return `<div class="tool-item"><div class="tool-name-row"><div class="tool-name">${esc(name)}</div>${isDeprecatedTool(tool) ? `<span class="tool-deprecated">${t('已弃用')}</span>` : ''}${policyBadge(tool.policy)}</div>
|
|
2085
|
+
<div class="tool-source-row">${t('可用入口')} · ${esc(sourceLabels.join(' / '))}</div>
|
|
2086
|
+
<div class="tool-name-row">${sourceOptions}${esc(cacheLabel(server))}${detailButton}${toolSelect}</div>
|
|
2087
|
+
<div class="tool-description${description ? '' : ' empty'}">${esc(description || t('暂无描述'))}</div></div>`;
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
function renderTools() {
|
|
2091
|
+
const query = normalizeToolSearchText($('#tools-search').value);
|
|
2092
|
+
const { groups, counts } = groupDetailTools(detailToolServers);
|
|
2093
|
+
const entry = updateToolsToolbar(groups, counts);
|
|
2094
|
+
const servers = entry ? [entry] : detailToolServers;
|
|
2095
|
+
const status = servers.map((server) => renderEntryStatus(server, servers.length === 1)).join('');
|
|
2096
|
+
const matched = matchedDetailTools(groups, entry, query);
|
|
2097
|
+
const visible = matched.slice(0, toolRenderLimit);
|
|
2098
|
+
const remaining = matched.length - visible.length;
|
|
2099
|
+
const more = remaining ? `<button class="tools-more" id="tools-more" type="button">${t('再显示 {step} 个(剩余 {remaining})', { step: Math.min(50, remaining), remaining })}</button>` : '';
|
|
2100
|
+
const empty = query ? t('没有匹配“{query}”的工具', { query: $('#tools-search').value.trim() }) : t('暂无可用工具');
|
|
2101
|
+
const items = visible.length ? `<div class="tools-server">${visible.map(renderDetailTool).join('')}</div>` : `<div class="tools-empty">${esc(empty)}</div>`;
|
|
2102
|
+
$('#detail-tools').innerHTML = status + items + more;
|
|
2103
|
+
if (query) $('#tools-summary').textContent = t('匹配 {matched} 个工具 · 已渲染 {shown}', { matched: matched.length, shown: visible.length });
|
|
2007
2104
|
}
|
|
2008
2105
|
|
|
2009
2106
|
function openModal(title, bodyHtml) {
|
|
@@ -3315,10 +3412,8 @@
|
|
|
3315
3412
|
detailPrompts = (d.prompts || []).filter((prompt) => prompt?.text || prompt?.title);
|
|
3316
3413
|
promptPage = 0;
|
|
3317
3414
|
renderPromptPage();
|
|
3318
|
-
|
|
3415
|
+
resetDetailTools();
|
|
3319
3416
|
detailGovernance = null;
|
|
3320
|
-
toolRenderLimit = 50;
|
|
3321
|
-
$('#tools-search').value = '';
|
|
3322
3417
|
$('#tools-disclosure').open = false;
|
|
3323
3418
|
$('#tools-summary').textContent = t('加载中…');
|
|
3324
3419
|
$('#detail-tools').innerHTML = `<div class="tools-loading">${t('正在读取可用工具及描述…')}</div>`;
|
|
@@ -3389,7 +3484,6 @@
|
|
|
3389
3484
|
renderPromptPage();
|
|
3390
3485
|
detailToolServers = toolsResult.detail?.servers || [];
|
|
3391
3486
|
if (detailToolServers.some((server) => (server.tools || []).length > 0)) recordLocalConversion('toolDiscoverySucceeded', connectorId);
|
|
3392
|
-
updateToolsSummary();
|
|
3393
3487
|
renderTools();
|
|
3394
3488
|
},
|
|
3395
3489
|
submitPromptVariables() {
|
|
@@ -3465,9 +3559,18 @@
|
|
|
3465
3559
|
if (prompt && detailConnector?.connected?.length && !detailNeedsReconfigure) openPromptForm(prompt);
|
|
3466
3560
|
});
|
|
3467
3561
|
$('#tools-search').addEventListener('input', () => { toolRenderLimit = 50; renderTools(); });
|
|
3562
|
+
$('#tools-entry').addEventListener('change', () => { toolRenderLimit = 50; renderTools(); });
|
|
3468
3563
|
$('#connection-policy').addEventListener('change', (event) => applyPolicySelection(event.target));
|
|
3469
3564
|
$('#policy-rollback').addEventListener('click', rollbackLatestPolicy);
|
|
3470
3565
|
$('#detail-tools').addEventListener('change', (event) => {
|
|
3566
|
+
const source = event.target.closest('select[data-tool-source]');
|
|
3567
|
+
if (source) {
|
|
3568
|
+
detailToolSources.set(source.dataset.toolName, source.value);
|
|
3569
|
+
renderTools();
|
|
3570
|
+
const selects = $('#detail-tools').querySelectorAll('select[data-tool-source]');
|
|
3571
|
+
Array.from(selects).find((select) => select.dataset.toolName === source.dataset.toolName)?.focus();
|
|
3572
|
+
return;
|
|
3573
|
+
}
|
|
3471
3574
|
const select = event.target.closest('select[data-policy-scope]');
|
|
3472
3575
|
if (select) applyPolicySelection(select);
|
|
3473
3576
|
});
|
|
@@ -3737,6 +3840,7 @@
|
|
|
3737
3840
|
setText('#prompt-title', '试试这样用');
|
|
3738
3841
|
setText('#prompt-next', '换一批');
|
|
3739
3842
|
setText('#tools-title', '工具详情');
|
|
3843
|
+
setText('#tools-entry-label', '查看范围');
|
|
3740
3844
|
setText('#governance-title', '连接策略');
|
|
3741
3845
|
setText('#policy-rollback', '撤销最近变更');
|
|
3742
3846
|
setText('#tools-loading', '加载中...');
|