dsh-mcp-connector 0.2.102 → 0.2.103
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 +7 -0
- package/README.en.md +13 -7
- package/README.md +13 -7
- 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 +29 -29
- 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 +29 -29
- package/docs/screenshots/en/demo.gif +0 -0
- package/docs/tutorials/FIRST-SUCCESS-SCENARIOS.md +1 -1
- package/lib/client.js +266 -65
- package/lib/i18n/locales/en/client.js +6 -0
- package/lib/index.js +10 -1
- package/lib/settings.js +123 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.en.md
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
# MCP Connector: a Specialist Data Marketplace for DeepSeek Harness
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://github.com/duhu2000/dsh-mcp-connector/blob/main/docs/metrics/npm-downloads.json)
|
|
5
|
-
npm downloads include upgrades, repeat installs and automation; they are not unique users or successful installs. The chart shows its UTC cutoff. [Install](#get-started) · [First successful connection](https://github.com/duhu2000/dsh-mcp-connector/blob/main/docs/tutorials/FIRST-SUCCESS-SCENARIOS.md)
|
|
6
|
-
<!-- npm-download-trend:end -->
|
|
3
|
+
|
|
7
4
|
|
|
8
5
|
> MCP Connector for DeepSeek Harness: a data marketplace connecting specialist providers and open data sources. Browse 100+ connectors, manage authorization, search tools and troubleshoot MCP connections.
|
|
9
6
|
|
|
@@ -43,6 +40,11 @@ Tool browsing does not execute target tools. Parameter summaries may omit comple
|
|
|
43
40
|
[](https://github.com/duhu2000/dsh-mcp-connector-registry/blob/main/catalog-stats.json)
|
|
44
41
|
[](https://github.com/duhu2000/dsh-mcp-connector-registry/blob/main/catalog-stats.json)
|
|
45
42
|
|
|
43
|
+
<!-- npm-download-trend:start -->
|
|
44
|
+
[](https://github.com/duhu2000/dsh-mcp-connector/blob/main/docs/metrics/npm-downloads.json)
|
|
45
|
+
npm downloads include upgrades, repeat installs and automation; they are not unique users or successful installs. The chart shows its UTC cutoff. [Install](#get-started) · [First successful connection](https://github.com/duhu2000/dsh-mcp-connector/blob/main/docs/tutorials/FIRST-SUCCESS-SCENARIOS.md)
|
|
46
|
+
<!-- npm-download-trend:end -->
|
|
47
|
+
|
|
46
48
|
## Get started
|
|
47
49
|
|
|
48
50
|
Search for **`dsh-mcp-connector`** in your plugin marketplace, or run the command below. Default Desktop and Web installations both use the `web` profile; custom deployments should use the profile actually loaded by their host.
|
|
@@ -119,7 +121,7 @@ As of 2026-10-24, the public Registry publishes 112 connector descriptors. After
|
|
|
119
121
|
| Connection diagnostics and last-success cache | |
|
|
120
122
|
|  | |
|
|
121
123
|
|
|
122
|
-
<!-- generated:media -->English UI screenshots and GIF were captured from v0.2.
|
|
124
|
+
<!-- generated:media -->English UI screenshots and GIF were captured from v0.2.103 (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 -->
|
|
123
125
|
|
|
124
126
|
## Installation
|
|
125
127
|
|
|
@@ -198,7 +200,11 @@ Remote catalog requests (including the fallback source) honor `HTTP_PROXY`, `HTT
|
|
|
198
200
|
|
|
199
201
|
The proxy variables must be present in the running DSH process. After changing them, fully exit and restart DSH Desktop or launch `dsh web` from a shell with those variables set; changing Windows user environment variables does not update an already-running process. The connector does not read OS proxy settings or infer a local proxy address.
|
|
200
202
|
|
|
201
|
-
`
|
|
203
|
+
`entryLocation` controls where the entry appears: `both` (default — the sidebar icon and the Settings quick-open button both work), `sidebar` (sidebar icon only; Settings does not offer an open button), or `settings` (hide the sidebar icon and enter from Settings only). Every value keeps at least one entry so the panel never becomes unreachable. Invalid values passed to the plugin configuration are rejected by the schema rather than silently accepted.
|
|
204
|
+
|
|
205
|
+
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.
|
|
206
|
+
|
|
207
|
+
`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.
|
|
202
208
|
|
|
203
209
|
`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:
|
|
204
210
|
|
|
@@ -250,7 +256,7 @@ npm run dev:ui
|
|
|
250
256
|
|
|
251
257
|
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.
|
|
252
258
|
|
|
253
|
-
<!-- generated:version -->The current public version is [`dsh-mcp-connector@0.2.
|
|
259
|
+
<!-- generated:version -->The current public version is [`dsh-mcp-connector@0.2.103`](https://www.npmjs.com/package/dsh-mcp-connector), with [GitHub Release v0.2.103](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.103).<!-- /generated:version -->
|
|
254
260
|
|
|
255
261
|
See [CHANGELOG.md](CHANGELOG.md) for version history and [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md) for the Desktop release checklist.
|
|
256
262
|
|
package/README.md
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
# MCP连接器:DeepSeek Harness 的专业数据源市场
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://github.com/duhu2000/dsh-mcp-connector/blob/main/docs/metrics/npm-downloads.json)
|
|
5
|
-
npm 下载次数包含升级、重复安装及自动化下载,不等于独立用户数或成功安装数;数据截止日期见图中 UTC 标注。[安装使用](#开始使用) · [首次成功教程](docs/tutorials/FIRST-SUCCESS-SCENARIOS.md)
|
|
6
|
-
<!-- npm-download-trend:end -->
|
|
3
|
+
|
|
7
4
|
|
|
8
5
|
> DeepSeek Harness 的 MCP 数据市场:汇聚各类垂直领域数据厂商与开放数据源,通过超百个 MCP连接器接入 MCP Server,统一授权、查找工具与连接排障。
|
|
9
6
|
|
|
@@ -55,6 +52,11 @@ Install with `dsh plugin --profile web add dsh-mcp-connector`, then select **EN*
|
|
|
55
52
|
[](https://github.com/duhu2000/dsh-mcp-connector-registry/blob/main/catalog-stats.json)
|
|
56
53
|
[](https://github.com/duhu2000/dsh-mcp-connector-registry/blob/main/catalog-stats.json)
|
|
57
54
|
|
|
55
|
+
<!-- npm-download-trend:start -->
|
|
56
|
+
[](https://github.com/duhu2000/dsh-mcp-connector/blob/main/docs/metrics/npm-downloads.json)
|
|
57
|
+
npm 下载次数包含升级、重复安装及自动化下载,不等于独立用户数或成功安装数;数据截止日期见图中 UTC 标注。[安装使用](#开始使用) · [首次成功教程](docs/tutorials/FIRST-SUCCESS-SCENARIOS.md)
|
|
58
|
+
<!-- npm-download-trend:end -->
|
|
59
|
+
|
|
58
60
|
## 开始使用
|
|
59
61
|
|
|
60
62
|
在插件市场搜索完整包名 **`dsh-mcp-connector`**,或在本机终端运行下方命令。当前默认 Desktop 和 Web 都使用 `web` profile;自定义部署请以宿主实际加载的 profile 为准。
|
|
@@ -133,7 +135,7 @@ Desktop 需要完全退出并重新启动应用;Web 需要停止原 `dsh web`
|
|
|
133
135
|
| 连接诊断与最后成功缓存 | |
|
|
134
136
|
|  | |
|
|
135
137
|
|
|
136
|
-
<!-- generated:media -->截图与 GIF 采集自 v0.2.
|
|
138
|
+
<!-- generated:media -->截图与 GIF 采集自 v0.2.103(2026-11-13)无凭据 Mock 页面,展示界面而非真实业务验收;市场数量是测试夹具。来源与更新方法见 [素材说明](docs/screenshots/README.md)。<!-- /generated:media -->
|
|
137
139
|
|
|
138
140
|
## 安装
|
|
139
141
|
|
|
@@ -206,7 +208,11 @@ Bundle 默认配置位于 `cordis.patch.yml`:
|
|
|
206
208
|
|
|
207
209
|
代理变量必须存在于正在运行的 DSH 进程中。修改后请完全退出并重启 DSH Desktop,或从已设置变量的终端启动 `dsh web`;修改 Windows 用户环境变量不会更新已有进程。连接器不会读取系统代理设置,也不会猜测本机代理地址。
|
|
208
210
|
|
|
209
|
-
`
|
|
211
|
+
`entryLocation` 控制入口出现在哪里,取值为 `both`(默认:侧栏图标与设置页的快捷打开按钮都可用)、`sidebar`(只保留侧栏图标,设置页不提供打开按钮)、或 `settings`(隐藏侧栏图标,只从设置页进入)。三档都至少保留一处入口,避免面板变得无法打开。传给插件配置的非法值会被 schema 拒绝,而不是静默接受。
|
|
212
|
+
|
|
213
|
+
从旧版升级时,若设置文档里只有 `showSidebarEntry` 而没有 `entryLocation`,插件按旧字段的实际行为翻译:`true` → `both`(旧版侧栏可见、设置页也有打开按钮),`false` → `settings`。这样升级既不会悄悄删掉既有入口,也不会让隐藏过的侧栏重新出现。分层解析中用户自己的覆盖优先于部署基线;「恢复默认」会同时清掉新字段与旧的布尔覆盖。
|
|
214
|
+
|
|
215
|
+
`showSidebarEntry` 默认为 `true`,为兼容既有配置保留;一旦显式设置 `entryLocation`,它不再影响界面。关闭入口只隐藏快捷方式,不停用连接器、已连接 MCP Server 或工具。
|
|
210
216
|
|
|
211
217
|
`compactManagementTools` 默认为 `false`,兼容原有对话管理工具。希望降低管理工具上下文开销时,可在插件配置中设为 `true` 并重载插件(必要时重启 DSH),下一次推理使用新工具集:
|
|
212
218
|
|
|
@@ -257,7 +263,7 @@ npm run dev:ui
|
|
|
257
263
|
|
|
258
264
|
公共 Registry 每次合并后会生成 `catalog-stats.json`;本仓库的定时工作流每小时同步中英文介绍和统计快照。npm 页面中的静态正文随版本发布更新,上方动态统计徽标则直接读取 Registry,可在不发布新 npm 版本时保持实时数量一致。
|
|
259
265
|
|
|
260
|
-
<!-- generated:version -->当前公开版本为 [`dsh-mcp-connector@0.2.
|
|
266
|
+
<!-- generated:version -->当前公开版本为 [`dsh-mcp-connector@0.2.103`](https://www.npmjs.com/package/dsh-mcp-connector),对应 [GitHub Release v0.2.103](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.103)。<!-- /generated:version -->
|
|
261
267
|
|
|
262
268
|
版本能力与变更记录见 [CHANGELOG.md](CHANGELOG.md)。
|
|
263
269
|
Desktop 发版回归见 [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md)。
|
|
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.103 于 2026-11-13 重新采集,未修改截图中的版本文字。<!-- /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-
|
|
6
|
-
"sourceVersion": "0.2.
|
|
5
|
+
"capturedOn": "2026-11-13",
|
|
6
|
+
"sourceVersion": "0.2.103",
|
|
7
7
|
"sourceFingerprint": "4d8135cd206dcb890002f8dee5b64bd1664806d68b1b9e5393743d47b1a5aa8b",
|
|
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": "
|
|
20
|
+
"sha256": "f22d9cd4672a546ecb3da94cadb8e3fa00c25d0c57a7ae0200bef2975e2e4b2e",
|
|
21
21
|
"width": 1280,
|
|
22
22
|
"height": 720,
|
|
23
|
-
"capturedOn": "2026-11-
|
|
24
|
-
"sourceVersion": "0.2.
|
|
23
|
+
"capturedOn": "2026-11-13",
|
|
24
|
+
"sourceVersion": "0.2.103"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"path": "docs/screenshots/02-connector-detail.jpg",
|
|
28
|
-
"sha256": "
|
|
28
|
+
"sha256": "997525769d07ae9c91ac423d6c977fef629306c5dea0451fc38782d7bef4c7bb",
|
|
29
29
|
"width": 1280,
|
|
30
30
|
"height": 720,
|
|
31
|
-
"capturedOn": "2026-11-
|
|
32
|
-
"sourceVersion": "0.2.
|
|
31
|
+
"capturedOn": "2026-11-13",
|
|
32
|
+
"sourceVersion": "0.2.103"
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
"path": "docs/screenshots/03-tool-discovery.jpg",
|
|
36
|
-
"sha256": "
|
|
36
|
+
"sha256": "a7a75386f4f3f14c6ef6e8c9caa87f98267cb3b4dcddf870ac2618d1fa1f43db",
|
|
37
37
|
"width": 1280,
|
|
38
38
|
"height": 720,
|
|
39
|
-
"capturedOn": "2026-11-
|
|
40
|
-
"sourceVersion": "0.2.
|
|
39
|
+
"capturedOn": "2026-11-13",
|
|
40
|
+
"sourceVersion": "0.2.103"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
"path": "docs/screenshots/04-json-import.jpg",
|
|
44
|
-
"sha256": "
|
|
44
|
+
"sha256": "ca6bcb14de279320a03dc60d3a857f3b15a93d5bba52bf82c12a443906fb8a5d",
|
|
45
45
|
"width": 1280,
|
|
46
46
|
"height": 720,
|
|
47
|
-
"capturedOn": "2026-11-
|
|
48
|
-
"sourceVersion": "0.2.
|
|
47
|
+
"capturedOn": "2026-11-13",
|
|
48
|
+
"sourceVersion": "0.2.103"
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
"path": "docs/screenshots/05-unified-tool-search.png",
|
|
52
|
-
"sha256": "
|
|
52
|
+
"sha256": "52db1a99be0616d3b567cb3659fa534c65f1d5b1328508010675d682220d32c5",
|
|
53
53
|
"width": 1280,
|
|
54
54
|
"height": 720,
|
|
55
|
-
"capturedOn": "2026-11-
|
|
56
|
-
"sourceVersion": "0.2.
|
|
55
|
+
"capturedOn": "2026-11-13",
|
|
56
|
+
"sourceVersion": "0.2.103"
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
"path": "docs/screenshots/06-tool-parameters.png",
|
|
60
|
-
"sha256": "
|
|
60
|
+
"sha256": "c21df32d1c5401582c7a2d9612ee402564acf43e2cb1416402f969e28d4eb5a8",
|
|
61
61
|
"width": 1280,
|
|
62
62
|
"height": 720,
|
|
63
|
-
"capturedOn": "2026-11-
|
|
64
|
-
"sourceVersion": "0.2.
|
|
63
|
+
"capturedOn": "2026-11-13",
|
|
64
|
+
"sourceVersion": "0.2.103"
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
"path": "docs/screenshots/07-connection-diagnostics.png",
|
|
68
|
-
"sha256": "
|
|
68
|
+
"sha256": "6a5aa4f1af68cd6b5801a473d83ea587a3450927dba43e9c55f520cdbe3dda70",
|
|
69
69
|
"width": 1280,
|
|
70
70
|
"height": 720,
|
|
71
|
-
"capturedOn": "2026-11-
|
|
72
|
-
"sourceVersion": "0.2.
|
|
71
|
+
"capturedOn": "2026-11-13",
|
|
72
|
+
"sourceVersion": "0.2.103"
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
"path": "docs/screenshots/08-ten-recommendations.jpg",
|
|
76
|
-
"sha256": "
|
|
76
|
+
"sha256": "81dd2b27489d0a2d2585f82c75083b95080a54103c162982e45644f62bcec170",
|
|
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-
|
|
85
|
-
"sourceVersion": "0.2.
|
|
84
|
+
"capturedOn": "2026-11-13",
|
|
85
|
+
"sourceVersion": "0.2.103"
|
|
86
86
|
}
|
|
87
87
|
],
|
|
88
88
|
"demo": {
|
|
89
89
|
"path": "docs/demo.gif",
|
|
90
|
-
"sha256": "
|
|
90
|
+
"sha256": "3780a4f1b1e1f3332a19759cbbce9f42b32cc26ca593ea79d6dbea2588205e2e",
|
|
91
91
|
"width": 960,
|
|
92
92
|
"height": 540,
|
|
93
|
-
"capturedOn": "2026-11-
|
|
94
|
-
"sourceVersion": "0.2.
|
|
93
|
+
"capturedOn": "2026-11-13",
|
|
94
|
+
"sourceVersion": "0.2.103",
|
|
95
95
|
"durationSeconds": 36
|
|
96
96
|
}
|
|
97
97
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"capture": {
|
|
4
4
|
"locale": "en",
|
|
5
|
-
"capturedOn": "2026-11-
|
|
6
|
-
"sourceVersion": "0.2.
|
|
5
|
+
"capturedOn": "2026-11-13",
|
|
6
|
+
"sourceVersion": "0.2.103",
|
|
7
7
|
"sourceFingerprint": "4d8135cd206dcb890002f8dee5b64bd1664806d68b1b9e5393743d47b1a5aa8b",
|
|
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": "
|
|
20
|
+
"sha256": "46fb2808073c13dafbf594223762d435b637d5d5f4851e2acfa22766944466b7",
|
|
21
21
|
"width": 1280,
|
|
22
22
|
"height": 720,
|
|
23
|
-
"capturedOn": "2026-11-
|
|
24
|
-
"sourceVersion": "0.2.
|
|
23
|
+
"capturedOn": "2026-11-13",
|
|
24
|
+
"sourceVersion": "0.2.103"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"path": "docs/screenshots/en/02-connector-detail.jpg",
|
|
28
|
-
"sha256": "
|
|
28
|
+
"sha256": "53d0a89e1031b8471ffa97a658a342b2e9fcf90fe316cab42d362d52d63ebf16",
|
|
29
29
|
"width": 1280,
|
|
30
30
|
"height": 720,
|
|
31
|
-
"capturedOn": "2026-11-
|
|
32
|
-
"sourceVersion": "0.2.
|
|
31
|
+
"capturedOn": "2026-11-13",
|
|
32
|
+
"sourceVersion": "0.2.103"
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
"path": "docs/screenshots/en/03-tool-discovery.jpg",
|
|
36
|
-
"sha256": "
|
|
36
|
+
"sha256": "6e7fca632bee65d5be82c54f18e16bae7069463a45b4846aa93904031e86d4aa",
|
|
37
37
|
"width": 1280,
|
|
38
38
|
"height": 720,
|
|
39
|
-
"capturedOn": "2026-11-
|
|
40
|
-
"sourceVersion": "0.2.
|
|
39
|
+
"capturedOn": "2026-11-13",
|
|
40
|
+
"sourceVersion": "0.2.103"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
"path": "docs/screenshots/en/04-json-import.jpg",
|
|
44
|
-
"sha256": "
|
|
44
|
+
"sha256": "644e1b471da734e02a8267af0db3e8a8c2848d96475559485c9a08ac9baf492b",
|
|
45
45
|
"width": 1280,
|
|
46
46
|
"height": 720,
|
|
47
|
-
"capturedOn": "2026-11-
|
|
48
|
-
"sourceVersion": "0.2.
|
|
47
|
+
"capturedOn": "2026-11-13",
|
|
48
|
+
"sourceVersion": "0.2.103"
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
"path": "docs/screenshots/en/05-unified-tool-search.png",
|
|
52
|
-
"sha256": "
|
|
52
|
+
"sha256": "654515ab33ada49225e7452eeb6b6013e1c4dabc4831e88690fec767328caf88",
|
|
53
53
|
"width": 1280,
|
|
54
54
|
"height": 720,
|
|
55
|
-
"capturedOn": "2026-11-
|
|
56
|
-
"sourceVersion": "0.2.
|
|
55
|
+
"capturedOn": "2026-11-13",
|
|
56
|
+
"sourceVersion": "0.2.103"
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
"path": "docs/screenshots/en/06-tool-parameters.png",
|
|
60
|
-
"sha256": "
|
|
60
|
+
"sha256": "9433906d7106c63d51ad972f8f49a7cafd20c0b85fd048591d9d90e0c25d9047",
|
|
61
61
|
"width": 1280,
|
|
62
62
|
"height": 720,
|
|
63
|
-
"capturedOn": "2026-11-
|
|
64
|
-
"sourceVersion": "0.2.
|
|
63
|
+
"capturedOn": "2026-11-13",
|
|
64
|
+
"sourceVersion": "0.2.103"
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
"path": "docs/screenshots/en/07-connection-diagnostics.png",
|
|
68
|
-
"sha256": "
|
|
68
|
+
"sha256": "274e7fd19d08ab22b7503a3cd1e836d1b6b079c6d582a33c626926e78fa7a32a",
|
|
69
69
|
"width": 1280,
|
|
70
70
|
"height": 720,
|
|
71
|
-
"capturedOn": "2026-11-
|
|
72
|
-
"sourceVersion": "0.2.
|
|
71
|
+
"capturedOn": "2026-11-13",
|
|
72
|
+
"sourceVersion": "0.2.103"
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
"path": "docs/screenshots/en/08-ten-recommendations.jpg",
|
|
76
|
-
"sha256": "
|
|
76
|
+
"sha256": "023a9ce77f0c457fc160f716feb31434e3897e9e178d3ab73263bd5d0538d1b2",
|
|
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-
|
|
85
|
-
"sourceVersion": "0.2.
|
|
84
|
+
"capturedOn": "2026-11-13",
|
|
85
|
+
"sourceVersion": "0.2.103"
|
|
86
86
|
}
|
|
87
87
|
],
|
|
88
88
|
"demo": {
|
|
89
89
|
"path": "docs/screenshots/en/demo.gif",
|
|
90
|
-
"sha256": "
|
|
90
|
+
"sha256": "aa3fd6e40ea133111b9f6c17be68e12bd96415b76fdd8f6becf36a895c3ca5a9",
|
|
91
91
|
"width": 960,
|
|
92
92
|
"height": 540,
|
|
93
|
-
"capturedOn": "2026-11-
|
|
94
|
-
"sourceVersion": "0.2.
|
|
93
|
+
"capturedOn": "2026-11-13",
|
|
94
|
+
"sourceVersion": "0.2.103",
|
|
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.103`<!-- /generated:version -->;当前 Workspace;企查查 OAuth 可用;测试账号具有目标企业数据权限 |
|
|
12
12
|
| 权限/管理员 | 账号权限、组织授权和可见字段由服务商控制;企业组织可能需要管理员开通,当前文档不能替代审批 |
|
|
13
13
|
| 费用 | 可能受套餐、次数或字段权限影响;MCP连接器无法确认本次费用,调用前在服务商侧核对 |
|
|
14
14
|
| 运行/数据去向 | 远程 MCP Server;企业名称、查询参数和调用结果经 DSH Host 发送到/返回自 `agent.qcc.com` |
|
package/lib/client.js
CHANGED
|
@@ -35,6 +35,12 @@ window.__ModuleLoader__.load({
|
|
|
35
35
|
"插件版本检查 API 请求失败:请检查网络、DSH 服务和反向代理连接": "Plugin version API request failed: check the network, DSH service, and reverse-proxy connection",
|
|
36
36
|
"MCP连接器": "MCP Connector",
|
|
37
37
|
"控制侧边栏入口和快捷打开方式。": "Control how the MCP Connector is opened.",
|
|
38
|
+
"控制入口在哪里出现,以及快捷打开方式。": "Control where the entry appears and how it opens.",
|
|
39
|
+
"入口展示位置": "Entry placement",
|
|
40
|
+
"至少保留一处入口,避免面板变得无法打开。": "Keep at least one entry so the panel never becomes unreachable.",
|
|
41
|
+
"两边显示": "Both",
|
|
42
|
+
"仅侧边栏": "Sidebar only",
|
|
43
|
+
"仅设置": "Settings only",
|
|
38
44
|
"在侧边栏显示 MCP连接器": "Show MCP Connector in the sidebar",
|
|
39
45
|
"关闭后只隐藏入口,不影响已连接的 MCP Server 和工具。": "Turning this off only hides the shortcut. Connected MCP servers and tools remain available.",
|
|
40
46
|
"侧边栏入口当前显示。": "The sidebar shortcut is visible.",
|
|
@@ -237,6 +243,10 @@ window.__ModuleLoader__.load({
|
|
|
237
243
|
const PLUGIN_PACKAGE_NAME = "dsh-mcp-connector";
|
|
238
244
|
const CONNECTOR_SETTINGS_NAMESPACE = "mcp-connector";
|
|
239
245
|
const SHOW_SIDEBAR_ENTRY_FIELD = "showSidebarEntry";
|
|
246
|
+
const ENTRY_LOCATION_FIELD = "entryLocation";
|
|
247
|
+
const ENTRY_LOCATIONS = Object.freeze(["both", "sidebar", "settings"]);
|
|
248
|
+
/** 全新安装默认档位:与旧 showSidebarEntry=true 的实际行为一致。 */
|
|
249
|
+
const DEFAULT_ENTRY_LOCATION = "both";
|
|
240
250
|
const CONNECTOR_MODAL_Z_INDEX = 1100;
|
|
241
251
|
const UPDATE_PROVIDER_OPERATION_POLL_MS = 1e3;
|
|
242
252
|
const UPDATE_PROVIDER_ADAPTERS = Object.freeze([
|
|
@@ -557,39 +567,38 @@ window.__ModuleLoader__.load({
|
|
|
557
567
|
display: block;
|
|
558
568
|
margin-top: 5px;
|
|
559
569
|
}
|
|
560
|
-
.
|
|
561
|
-
|
|
570
|
+
.mcpConnectorSettingsSegments {
|
|
571
|
+
display: inline-flex;
|
|
572
|
+
flex: none;
|
|
573
|
+
gap: 2px;
|
|
574
|
+
padding: 3px;
|
|
575
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.28));
|
|
576
|
+
border-radius: 9px;
|
|
577
|
+
background: var(--dsw-alias-fill-secondary, rgba(127, 127, 127, 0.14));
|
|
578
|
+
}
|
|
579
|
+
.mcpConnectorSettingsSegment {
|
|
562
580
|
appearance: none;
|
|
563
|
-
|
|
564
|
-
height: 24px;
|
|
565
|
-
margin: 0;
|
|
581
|
+
padding: 4px 12px;
|
|
566
582
|
border: 0;
|
|
567
|
-
border-radius:
|
|
568
|
-
|
|
583
|
+
border-radius: 7px;
|
|
584
|
+
color: var(--dsw-alias-label-secondary, inherit);
|
|
585
|
+
background: transparent;
|
|
586
|
+
font: inherit;
|
|
587
|
+
font-size: 12.5px;
|
|
588
|
+
line-height: 18px;
|
|
589
|
+
white-space: nowrap;
|
|
569
590
|
cursor: pointer;
|
|
570
|
-
transition: background 0.16s;
|
|
591
|
+
transition: background 0.16s, color 0.16s;
|
|
571
592
|
}
|
|
572
|
-
.
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
width: 18px;
|
|
577
|
-
height: 18px;
|
|
578
|
-
border-radius: 50%;
|
|
579
|
-
background: #ffffff;
|
|
580
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
|
|
581
|
-
content: "";
|
|
582
|
-
transition: transform 0.16s;
|
|
583
|
-
}
|
|
584
|
-
.mcpConnectorSettingsSwitch:checked {
|
|
585
|
-
background: var(--dsw-alias-state-success, #16a34a);
|
|
586
|
-
}
|
|
587
|
-
.mcpConnectorSettingsSwitch:checked::after {
|
|
588
|
-
transform: translateX(18px);
|
|
593
|
+
.mcpConnectorSettingsSegment[data-active="true"] {
|
|
594
|
+
color: var(--dsw-alias-label-primary, inherit);
|
|
595
|
+
background: var(--dsw-alias-bg-layer-3, rgba(127, 127, 127, 0.22));
|
|
596
|
+
font-weight: 600;
|
|
589
597
|
}
|
|
590
|
-
.
|
|
591
|
-
|
|
592
|
-
|
|
598
|
+
.mcpConnectorSettingsSegment:disabled { cursor: default; opacity: 0.55; }
|
|
599
|
+
.mcpConnectorSettingsSegment:focus-visible {
|
|
600
|
+
outline: 2px solid var(--dsw-alias-brand-primary, currentColor);
|
|
601
|
+
outline-offset: 1px;
|
|
593
602
|
}
|
|
594
603
|
.mcpConnectorSettingsFooter {
|
|
595
604
|
display: flex;
|
|
@@ -1050,17 +1059,145 @@ window.__ModuleLoader__.load({
|
|
|
1050
1059
|
};
|
|
1051
1060
|
}
|
|
1052
1061
|
|
|
1062
|
+
/**
|
|
1063
|
+
* 归一化入口展示位置;非法值回退 `sidebar`,绝不抛错。
|
|
1064
|
+
*
|
|
1065
|
+
* @param {unknown} value 设置值或配置值
|
|
1066
|
+
* @returns {"both"|"sidebar"|"settings"}
|
|
1067
|
+
*/
|
|
1068
|
+
function normalizeEntryLocation(value) {
|
|
1069
|
+
return ENTRY_LOCATIONS.includes(value) ? value : DEFAULT_ENTRY_LOCATION;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* 把旧版布尔开关翻译成新枚举。
|
|
1074
|
+
*
|
|
1075
|
+
* 旧版 `showSidebarEntry: false` 的实际效果是「侧栏不显示」,对应新版的
|
|
1076
|
+
* `settings`;`true` 对应 `sidebar`。没有这层映射的话,曾经隐藏过入口的用户
|
|
1077
|
+
* 升级后会突然重新看到侧栏图标。
|
|
1078
|
+
*
|
|
1079
|
+
* @param {unknown} value 旧版布尔值
|
|
1080
|
+
* @returns {"sidebar"|"settings"|undefined}
|
|
1081
|
+
*/
|
|
1082
|
+
/**
|
|
1083
|
+
* 旧布尔开关 → 新档位。
|
|
1084
|
+
*
|
|
1085
|
+
* 旧版 true 的实际行为是「侧栏可见 **且** 设置卡片提供打开按钮」,
|
|
1086
|
+
* 对应 both;false 是「只在设置页打开」,对应 settings。
|
|
1087
|
+
* 把 true 映射成 sidebar 会悄悄删掉设置页那个现存入口。
|
|
1088
|
+
*
|
|
1089
|
+
* @param {unknown} value 旧布尔值
|
|
1090
|
+
* @returns {"both"|"settings"|undefined}
|
|
1091
|
+
*/
|
|
1092
|
+
function entryLocationFromLegacyFlag(value) {
|
|
1093
|
+
if (value === false) return "settings";
|
|
1094
|
+
if (value === true) return "both";
|
|
1095
|
+
return void 0;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
/** 从一层设置里读旧布尔值。 */
|
|
1099
|
+
function readLegacyFlag(source) {
|
|
1100
|
+
if (typeof source !== "object" || source === null || Array.isArray(source)) return void 0;
|
|
1101
|
+
return source[SHOW_SIDEBAR_ENTRY_FIELD];
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
/** 从一层设置里读合法的新字段。 */
|
|
1105
|
+
function readEntryLocation(source) {
|
|
1106
|
+
if (typeof source !== "object" || source === null || Array.isArray(source)) return void 0;
|
|
1107
|
+
const value = source[ENTRY_LOCATION_FIELD];
|
|
1108
|
+
return ENTRY_LOCATIONS.includes(value) ? value : void 0;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
/**
|
|
1112
|
+
* 当前生效的入口展示位置。
|
|
1113
|
+
*
|
|
1114
|
+
* 解析顺序:新字段 → 旧布尔开关 → `sidebar`。第二步是升级兼容的关键,
|
|
1115
|
+
* 只认新字段会让「曾经隐藏侧栏」的历史用户重新看到入口。
|
|
1116
|
+
*
|
|
1117
|
+
* 设置未就绪时 fail-open 回退 `sidebar`,入口继续可见。
|
|
1118
|
+
*
|
|
1119
|
+
* @param {any} snapshot settingsScope 快照
|
|
1120
|
+
* @returns {"both"|"sidebar"|"settings"}
|
|
1121
|
+
*/
|
|
1122
|
+
/**
|
|
1123
|
+
* 当前生效的入口展示位置(分层解析)。
|
|
1124
|
+
*
|
|
1125
|
+
* 优先级:用户显式 entryLocation → 用户旧布尔覆盖 → 基线 entryLocation
|
|
1126
|
+
* → 基线旧布尔 → 默认档位。
|
|
1127
|
+
*
|
|
1128
|
+
* **必须看 user/base 而不是只看 value**:value 是三层合并结果,其中的
|
|
1129
|
+
* entryLocation 可能由 base 或 schema 默认值合成,无法证明用户选过。
|
|
1130
|
+
* 只读 value 会让「用户旧覆盖 + 基线新字段」时旧覆盖被盖掉。
|
|
1131
|
+
*
|
|
1132
|
+
* 设置未就绪时 fail-open 回退默认档位,入口继续可见。
|
|
1133
|
+
*
|
|
1134
|
+
* @param {any} snapshot settingsScope 快照
|
|
1135
|
+
* @returns {"both"|"sidebar"|"settings"}
|
|
1136
|
+
*/
|
|
1137
|
+
function resolveEntryLocation(snapshot) {
|
|
1138
|
+
if (snapshot?.status !== "ready") return DEFAULT_ENTRY_LOCATION;
|
|
1139
|
+
|
|
1140
|
+
const userLocation = readEntryLocation(snapshot.user);
|
|
1141
|
+
if (userLocation !== void 0) return userLocation;
|
|
1142
|
+
|
|
1143
|
+
const userLegacy = entryLocationFromLegacyFlag(readLegacyFlag(snapshot.user));
|
|
1144
|
+
if (userLegacy !== void 0) return userLegacy;
|
|
1145
|
+
|
|
1146
|
+
const baseLocation = readEntryLocation(snapshot.base);
|
|
1147
|
+
if (baseLocation !== void 0) return baseLocation;
|
|
1148
|
+
|
|
1149
|
+
const baseLegacy = entryLocationFromLegacyFlag(readLegacyFlag(snapshot.base));
|
|
1150
|
+
if (baseLegacy !== void 0) return baseLegacy;
|
|
1151
|
+
|
|
1152
|
+
// 没有分层信息时(旧宿主/精简快照)退回合并值。
|
|
1153
|
+
// 这里同样要先认新字段、再翻译旧布尔,最后才用默认值:
|
|
1154
|
+
// 只读 entryLocation 会让「只有旧布尔」的 ready 快照错误回退到默认档位,
|
|
1155
|
+
// 把原本隐藏的侧栏重新显示出来。
|
|
1156
|
+
const mergedLocation = readEntryLocation(snapshot.value);
|
|
1157
|
+
if (mergedLocation !== void 0) return mergedLocation;
|
|
1158
|
+
|
|
1159
|
+
const mergedLegacyLocation = entryLocationFromLegacyFlag(readLegacyFlag(snapshot.value));
|
|
1160
|
+
if (mergedLegacyLocation !== void 0) return mergedLegacyLocation;
|
|
1161
|
+
|
|
1162
|
+
return DEFAULT_ENTRY_LOCATION;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
/**
|
|
1166
|
+
* 侧栏图标是否显示:由入口展示位置派生。
|
|
1167
|
+
*
|
|
1168
|
+
* 只有 `settings` 档隐藏图标;`both` 与 `sidebar` 都保留。
|
|
1169
|
+
*
|
|
1170
|
+
* @param {any} snapshot settingsScope 快照
|
|
1171
|
+
* @returns {boolean}
|
|
1172
|
+
*/
|
|
1053
1173
|
function resolveSidebarVisible(snapshot) {
|
|
1054
|
-
return snapshot
|
|
1055
|
-
|
|
1056
|
-
|
|
1174
|
+
return resolveEntryLocation(snapshot) !== "settings";
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* 设置页的「打开 MCP连接器」快捷按钮是否可用。
|
|
1179
|
+
*
|
|
1180
|
+
* `sidebar` 档的承诺是「侧栏是唯一快捷入口」,所以设置页不再提供第二个
|
|
1181
|
+
* 打开方式;`both` 与 `settings` 都需要这个按钮。配置卡片本身在所有档位
|
|
1182
|
+
* 都保留,否则用户无法改回偏好。
|
|
1183
|
+
*
|
|
1184
|
+
* @param {string} location 当前入口展示位置
|
|
1185
|
+
* @returns {boolean}
|
|
1186
|
+
*/
|
|
1187
|
+
function resolveSettingsQuickOpen(location) {
|
|
1188
|
+
return normalizeEntryLocation(location) !== "sidebar";
|
|
1057
1189
|
}
|
|
1058
1190
|
|
|
1059
1191
|
/** 设置卡片文案:中英文都来自同一份 msgid 词典。 */
|
|
1060
1192
|
function connectorSettingsCopy() {
|
|
1061
1193
|
return {
|
|
1062
1194
|
title: t("MCP连接器"),
|
|
1063
|
-
description: t("
|
|
1195
|
+
description: t("控制入口在哪里出现,以及快捷打开方式。"),
|
|
1196
|
+
location: t("入口展示位置"),
|
|
1197
|
+
locationHint: t("至少保留一处入口,避免面板变得无法打开。"),
|
|
1198
|
+
both: t("两边显示"),
|
|
1199
|
+
sidebarOnly: t("仅侧边栏"),
|
|
1200
|
+
settingsOnly: t("仅设置"),
|
|
1064
1201
|
show: t("在侧边栏显示 MCP连接器"),
|
|
1065
1202
|
hint: t("关闭后只隐藏入口,不影响已连接的 MCP Server 和工具。"),
|
|
1066
1203
|
visible: t("侧边栏入口当前显示。"),
|
|
@@ -1086,39 +1223,91 @@ window.__ModuleLoader__.load({
|
|
|
1086
1223
|
const [saving, setSaving] = (0, react.useState)(false);
|
|
1087
1224
|
const [failed, setFailed] = (0, react.useState)(false);
|
|
1088
1225
|
if (snapshot.status !== "ready") return null;
|
|
1226
|
+
const location = resolveEntryLocation(snapshot);
|
|
1089
1227
|
const visible = resolveSidebarVisible(snapshot);
|
|
1228
|
+
const quickOpen = resolveSettingsQuickOpen(location);
|
|
1090
1229
|
const writable = snapshot.writable === true;
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
&&
|
|
1230
|
+
// 「恢复默认」要覆盖两种情况:用户选过新字段,或只留了旧布尔覆盖。
|
|
1231
|
+
const hasUserOverride = (source) => source !== null
|
|
1232
|
+
&& typeof source === "object"
|
|
1233
|
+
&& (Object.prototype.hasOwnProperty.call(source, ENTRY_LOCATION_FIELD)
|
|
1234
|
+
|| Object.prototype.hasOwnProperty.call(source, SHOW_SIDEBAR_ENTRY_FIELD));
|
|
1235
|
+
const overridden = hasUserOverride(snapshot.user);
|
|
1236
|
+
const options = [
|
|
1237
|
+
{ value: "both", label: copy.both },
|
|
1238
|
+
{ value: "sidebar", label: copy.sidebarOnly },
|
|
1239
|
+
{ value: "settings", label: copy.settingsOnly }
|
|
1240
|
+
];
|
|
1094
1241
|
|
|
1095
1242
|
const save = async (next) => {
|
|
1243
|
+
if (saving || next === location) return;
|
|
1096
1244
|
setSaving(true);
|
|
1097
1245
|
setFailed(false);
|
|
1098
1246
|
try {
|
|
1099
|
-
await settingsScope.set(
|
|
1247
|
+
await settingsScope.set(ENTRY_LOCATION_FIELD, next);
|
|
1100
1248
|
const confirmed = settingsScope.getSnapshot();
|
|
1101
|
-
setFailed(confirmed.status !== "ready" ||
|
|
1249
|
+
setFailed(confirmed.status !== "ready" || resolveEntryLocation(confirmed) !== next);
|
|
1102
1250
|
} catch (error) {
|
|
1103
|
-
console.error("[mcp-connector]
|
|
1251
|
+
console.error("[mcp-connector] entry location update failed:", error);
|
|
1104
1252
|
setFailed(true);
|
|
1105
1253
|
} finally {
|
|
1106
1254
|
setSaving(false);
|
|
1107
1255
|
}
|
|
1108
1256
|
};
|
|
1109
1257
|
|
|
1258
|
+
/**
|
|
1259
|
+
* 清掉入口展示位置的全部用户覆盖。
|
|
1260
|
+
*
|
|
1261
|
+
* 老版 settingsScope(如 @deepseek-ai/dsh-client-ui-settings@0.1.2-rc.1)
|
|
1262
|
+
* 只暴露单字段 set/unset,没有 mutate。那种 scope 上直接调 mutate 会抛
|
|
1263
|
+
* `settingsScope.mutate is not a function`,一个键都清不掉。
|
|
1264
|
+
*
|
|
1265
|
+
* @param {any} scope settingsScope 实例
|
|
1266
|
+
* @returns {Promise<void>}
|
|
1267
|
+
*/
|
|
1268
|
+
async function resetEntryPreferences(scope) {
|
|
1269
|
+
const supportsAtomicReset = typeof scope?.mutate === "function";
|
|
1270
|
+
if (supportsAtomicReset) {
|
|
1271
|
+
// 新宿主:一次原子写,两个键要么都清、要么都不动。
|
|
1272
|
+
await scope.mutate([
|
|
1273
|
+
{ op: "unset", path: [ENTRY_LOCATION_FIELD] },
|
|
1274
|
+
{ op: "unset", path: [SHOW_SIDEBAR_ENTRY_FIELD] },
|
|
1275
|
+
]);
|
|
1276
|
+
return;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
// 老宿主只有单字段 set/unset,无法原子提交,只能逐键清。
|
|
1280
|
+
if (typeof scope?.unset !== "function") {
|
|
1281
|
+
throw new Error("settingsScope exposes neither mutate nor unset");
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
// 只清用户文档里真实存在的键:对「只有 showSidebarEntry」的 profile,
|
|
1285
|
+
// 再补一次 unset(entryLocation) 是纯多余写入,老宿主上还会多一次落盘。
|
|
1286
|
+
const user = scope.getSnapshot()?.user;
|
|
1287
|
+
const hasUserKey = (field) => user !== null
|
|
1288
|
+
&& typeof user === "object"
|
|
1289
|
+
&& Object.prototype.hasOwnProperty.call(user, field);
|
|
1290
|
+
|
|
1291
|
+
// 顺序:先清旧布尔,让解析继续停在用户显式选的 entryLocation 上;
|
|
1292
|
+
// 最后再清新字段,回到部署基线。反过来会让旧值在中间态复活,侧栏闪一下。
|
|
1293
|
+
if (hasUserKey(SHOW_SIDEBAR_ENTRY_FIELD)) await scope.unset(SHOW_SIDEBAR_ENTRY_FIELD);
|
|
1294
|
+
if (hasUserKey(ENTRY_LOCATION_FIELD)) await scope.unset(ENTRY_LOCATION_FIELD);
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1110
1297
|
const reset = async () => {
|
|
1111
1298
|
setSaving(true);
|
|
1112
1299
|
setFailed(false);
|
|
1113
1300
|
try {
|
|
1114
|
-
await settingsScope
|
|
1301
|
+
await resetEntryPreferences(settingsScope);
|
|
1302
|
+
|
|
1115
1303
|
const confirmed = settingsScope.getSnapshot();
|
|
1116
1304
|
const stillOverridden = confirmed.user !== null
|
|
1117
1305
|
&& typeof confirmed.user === "object"
|
|
1118
|
-
&& Object.prototype.hasOwnProperty.call(confirmed.user,
|
|
1306
|
+
&& (Object.prototype.hasOwnProperty.call(confirmed.user, ENTRY_LOCATION_FIELD)
|
|
1307
|
+
|| Object.prototype.hasOwnProperty.call(confirmed.user, SHOW_SIDEBAR_ENTRY_FIELD));
|
|
1119
1308
|
setFailed(confirmed.status !== "ready" || stillOverridden);
|
|
1120
1309
|
} catch (error) {
|
|
1121
|
-
console.error("[mcp-connector]
|
|
1310
|
+
console.error("[mcp-connector] entry location reset failed:", error);
|
|
1122
1311
|
setFailed(true);
|
|
1123
1312
|
} finally {
|
|
1124
1313
|
setSaving(false);
|
|
@@ -1152,22 +1341,26 @@ window.__ModuleLoader__.load({
|
|
|
1152
1341
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1153
1342
|
className: "mcpConnectorSettingsRow",
|
|
1154
1343
|
children: [
|
|
1155
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
1156
|
-
htmlFor: "mcp-connector-show-sidebar-entry",
|
|
1344
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1157
1345
|
children: [
|
|
1158
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "mcpConnectorSettingsLabel", children: copy.
|
|
1159
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "mcpConnectorSettingsHint", children: copy.
|
|
1346
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "mcpConnectorSettingsLabel", children: copy.location }),
|
|
1347
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "mcpConnectorSettingsHint", children: copy.locationHint })
|
|
1160
1348
|
]
|
|
1161
1349
|
}),
|
|
1162
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1350
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1351
|
+
className: "mcpConnectorSettingsSegments",
|
|
1352
|
+
role: "radiogroup",
|
|
1353
|
+
"aria-label": copy.location,
|
|
1354
|
+
children: options.map((option) => (0, react_jsx_runtime.jsx)("button", {
|
|
1355
|
+
type: "button",
|
|
1356
|
+
className: "mcpConnectorSettingsSegment",
|
|
1357
|
+
role: "radio",
|
|
1358
|
+
"aria-checked": location === option.value,
|
|
1359
|
+
"data-active": location === option.value ? "true" : "false",
|
|
1360
|
+
disabled: !writable || saving,
|
|
1361
|
+
onClick: () => { void save(option.value); },
|
|
1362
|
+
children: option.label
|
|
1363
|
+
}, option.value))
|
|
1171
1364
|
})
|
|
1172
1365
|
]
|
|
1173
1366
|
}),
|
|
@@ -1187,14 +1380,16 @@ window.__ModuleLoader__.load({
|
|
|
1187
1380
|
onClick: () => { void reset(); },
|
|
1188
1381
|
children: copy.reset
|
|
1189
1382
|
}),
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1383
|
+
quickOpen ? (
|
|
1384
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1385
|
+
type: "button",
|
|
1386
|
+
className: "mcpConnectorSettingsButton",
|
|
1387
|
+
"data-primary": true,
|
|
1388
|
+
"aria-haspopup": "dialog",
|
|
1389
|
+
onClick: () => { actions.open(); },
|
|
1390
|
+
children: copy.open
|
|
1391
|
+
})
|
|
1392
|
+
) : null
|
|
1198
1393
|
]
|
|
1199
1394
|
})
|
|
1200
1395
|
]
|
|
@@ -1218,9 +1413,15 @@ window.__ModuleLoader__.load({
|
|
|
1218
1413
|
namespace: CONNECTOR_SETTINGS_NAMESPACE,
|
|
1219
1414
|
decode(value) {
|
|
1220
1415
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1416
|
+
// 新字段与历史布尔开关都接受:旧 profile 的设置文档里可能只有后者。
|
|
1417
|
+
const decoded = {};
|
|
1418
|
+
if (typeof value[ENTRY_LOCATION_FIELD] === "string") {
|
|
1419
|
+
decoded[ENTRY_LOCATION_FIELD] = value[ENTRY_LOCATION_FIELD];
|
|
1420
|
+
}
|
|
1421
|
+
if (typeof value[SHOW_SIDEBAR_ENTRY_FIELD] === "boolean") {
|
|
1422
|
+
decoded[SHOW_SIDEBAR_ENTRY_FIELD] = value[SHOW_SIDEBAR_ENTRY_FIELD];
|
|
1423
|
+
}
|
|
1424
|
+
return Object.keys(decoded).length > 0 ? decoded : void 0;
|
|
1224
1425
|
}
|
|
1225
1426
|
});
|
|
1226
1427
|
if (typeof settingsScope?.getSnapshot !== "function"
|
|
@@ -15,6 +15,12 @@ export default {
|
|
|
15
15
|
"插件版本检查 API 请求失败:请检查网络、DSH 服务和反向代理连接": "Plugin version API request failed: check the network, DSH service, and reverse-proxy connection",
|
|
16
16
|
"MCP连接器": "MCP Connector",
|
|
17
17
|
"控制侧边栏入口和快捷打开方式。": "Control how the MCP Connector is opened.",
|
|
18
|
+
"控制入口在哪里出现,以及快捷打开方式。": "Control where the entry appears and how it opens.",
|
|
19
|
+
"入口展示位置": "Entry placement",
|
|
20
|
+
"至少保留一处入口,避免面板变得无法打开。": "Keep at least one entry so the panel never becomes unreachable.",
|
|
21
|
+
"两边显示": "Both",
|
|
22
|
+
"仅侧边栏": "Sidebar only",
|
|
23
|
+
"仅设置": "Settings only",
|
|
18
24
|
"在侧边栏显示 MCP连接器": "Show MCP Connector in the sidebar",
|
|
19
25
|
"关闭后只隐藏入口,不影响已连接的 MCP Server 和工具。": "Turning this off only hides the shortcut. Connected MCP servers and tools remain available.",
|
|
20
26
|
"侧边栏入口当前显示。": "The sidebar shortcut is visible.",
|
package/lib/index.js
CHANGED
|
@@ -147,8 +147,17 @@ export const Config = z.object({
|
|
|
147
147
|
openBrowser: z.boolean().default(true),
|
|
148
148
|
/** 授权账号标识(预留多账号) */
|
|
149
149
|
account: z.string().default(DEFAULT_ACCOUNT),
|
|
150
|
-
/** 是否在 DSH 主侧边栏显示 MCP
|
|
150
|
+
/** 是否在 DSH 主侧边栏显示 MCP连接器快捷入口(旧字段,保留兼容) */
|
|
151
151
|
showSidebarEntry: z.boolean().default(true),
|
|
152
|
+
/**
|
|
153
|
+
* 入口展示位置:`both` / `sidebar` / `settings`。
|
|
154
|
+
*
|
|
155
|
+
* **不给默认值**:省略表示「沿用旧 showSidebarEntry 表达的可见性」,
|
|
156
|
+
* 由 installConnectorSettings() 翻译成等价档位。若在这里写 default,
|
|
157
|
+
* 该值会提前注入 settings base,把用户的旧布尔覆盖盖掉。
|
|
158
|
+
* 传入非法值会被 schema 拒绝,与 README 的承诺一致。
|
|
159
|
+
*/
|
|
160
|
+
entryLocation: z.union(['both', 'sidebar', 'settings'].map((value) => z.const(value))),
|
|
152
161
|
/** 精简对话管理工具为发现入口 + 会话入口;旧配置默认保留全量工具。修改后重载插件。 */
|
|
153
162
|
compactManagementTools: z.boolean().default(false),
|
|
154
163
|
/**
|
package/lib/settings.js
CHANGED
|
@@ -2,9 +2,124 @@ import z from '@deepseek-ai/schemastery';
|
|
|
2
2
|
|
|
3
3
|
export const CONNECTOR_SETTINGS_NAMESPACE = 'mcp-connector';
|
|
4
4
|
export const SHOW_SIDEBAR_ENTRY_FIELD = 'showSidebarEntry';
|
|
5
|
+
export const ENTRY_LOCATION_FIELD = 'entryLocation';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 入口展示位置的三个档位。
|
|
9
|
+
*
|
|
10
|
+
* - `both`:侧栏图标与设置页的快捷打开按钮都可用;
|
|
11
|
+
* - `sidebar`:只保留侧栏图标,设置页只负责改偏好;
|
|
12
|
+
* - `settings`:隐藏侧栏图标,只从设置页进入。
|
|
13
|
+
*
|
|
14
|
+
* 三档都至少保留一处入口,避免把面板锁成打不开。
|
|
15
|
+
*/
|
|
16
|
+
export const ENTRY_LOCATIONS = ['both', 'sidebar', 'settings'];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 全新安装的默认档位。
|
|
20
|
+
*
|
|
21
|
+
* 与旧行为保持一致:以前 `showSidebarEntry` 默认 `true`,侧栏可见且设置卡片
|
|
22
|
+
* 提供打开按钮,等价于 `both`。
|
|
23
|
+
*/
|
|
24
|
+
export const DEFAULT_ENTRY_LOCATION = 'both';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 归一化入口展示位置;非法值回退默认档位。
|
|
28
|
+
*
|
|
29
|
+
* @param {unknown} value 配置值、设置文档中的值或界面传入值
|
|
30
|
+
* @returns {'both'|'sidebar'|'settings'}
|
|
31
|
+
*/
|
|
32
|
+
export function normalizeEntryLocation(value) {
|
|
33
|
+
return ENTRY_LOCATIONS.includes(value) ? value : DEFAULT_ENTRY_LOCATION;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 把旧版布尔开关翻译成新枚举。
|
|
38
|
+
*
|
|
39
|
+
* 旧版 `showSidebarEntry` 的**实际**行为:
|
|
40
|
+
* - `true`:侧栏可见 **且** 设置卡片提供「打开 MCP连接器」按钮 → `both`
|
|
41
|
+
* - `false`:侧栏隐藏,只能从设置卡片打开 → `settings`
|
|
42
|
+
*
|
|
43
|
+
* 把 `true` 直接映射成 `sidebar` 会悄悄删掉设置页那个现存入口,
|
|
44
|
+
* 所以必须映射到 `both`。
|
|
45
|
+
*
|
|
46
|
+
* @param {unknown} value 旧版布尔值
|
|
47
|
+
* @returns {'both'|'settings'|undefined} 无法判断时返回 undefined
|
|
48
|
+
*/
|
|
49
|
+
export function entryLocationFromLegacyFlag(value) {
|
|
50
|
+
if (value === false) return 'settings';
|
|
51
|
+
if (value === true) return 'both';
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 旧版布尔开关的**有效值**:用户覆盖优先,其次部署基线。
|
|
57
|
+
*
|
|
58
|
+
* 两个来源都要看,因为分层解析里 `user` 会覆盖 `base`。只看其中一层会
|
|
59
|
+
* 让另一层的旧偏好被合成出来的新字段盖掉。
|
|
60
|
+
*
|
|
61
|
+
* @param {{ user?: unknown, base?: unknown }} layers 快照的分层
|
|
62
|
+
* @returns {'both'|'settings'|undefined}
|
|
63
|
+
*/
|
|
64
|
+
export function legacyLocationFromLayers(layers) {
|
|
65
|
+
const fromUser = entryLocationFromLegacyFlag(readLegacyFlag(layers?.user));
|
|
66
|
+
if (fromUser !== undefined) return fromUser;
|
|
67
|
+
return entryLocationFromLegacyFlag(readLegacyFlag(layers?.base));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function readLegacyFlag(source) {
|
|
71
|
+
if (typeof source !== 'object' || source === null || Array.isArray(source)) return undefined;
|
|
72
|
+
return source[SHOW_SIDEBAR_ENTRY_FIELD];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 从分层快照解析入口展示位置。
|
|
77
|
+
*
|
|
78
|
+
* **优先级**:用户显式选的 `entryLocation` → 用户旧布尔覆盖 → 部署基线的
|
|
79
|
+
* `entryLocation` → 基线旧布尔 → 默认档位。
|
|
80
|
+
*
|
|
81
|
+
* 之所以先看 `user` 再回退旧布尔:`value` 是三层合并后的结果,其中
|
|
82
|
+
* `entryLocation` 可能由 base 或 schema 默认值合成而来,**不能证明用户选过**。
|
|
83
|
+
* 早先的实现只读 `value`,导致「用户旧覆盖 + 基线新字段」时旧覆盖被盖掉。
|
|
84
|
+
*
|
|
85
|
+
* @param {{ user?: unknown, base?: unknown }} layers 快照的分层
|
|
86
|
+
* @returns {'both'|'sidebar'|'settings'}
|
|
87
|
+
*/
|
|
88
|
+
export function resolveLocationFromLayers(layers) {
|
|
89
|
+
const userLocation = readLocation(layers?.user);
|
|
90
|
+
if (userLocation !== undefined) return userLocation;
|
|
91
|
+
|
|
92
|
+
const fromUserLegacy = entryLocationFromLegacyFlag(readLegacyFlag(layers?.user));
|
|
93
|
+
if (fromUserLegacy !== undefined) return fromUserLegacy;
|
|
94
|
+
|
|
95
|
+
const baseLocation = readLocation(layers?.base);
|
|
96
|
+
if (baseLocation !== undefined) return baseLocation;
|
|
97
|
+
|
|
98
|
+
const fromBaseLegacy = entryLocationFromLegacyFlag(readLegacyFlag(layers?.base));
|
|
99
|
+
if (fromBaseLegacy !== undefined) return fromBaseLegacy;
|
|
100
|
+
|
|
101
|
+
// 没有分层信息时(精简快照只有合并后的 value)也要先认新字段、再翻译旧布尔:
|
|
102
|
+
// 只读 value.entryLocation 会让「只有旧布尔」的快照错误回退到默认档位。
|
|
103
|
+
const mergedLocation = readLocation(layers?.value);
|
|
104
|
+
if (mergedLocation !== undefined) return mergedLocation;
|
|
105
|
+
|
|
106
|
+
const fromMergedLegacy = entryLocationFromLegacyFlag(readLegacyFlag(layers?.value));
|
|
107
|
+
if (fromMergedLegacy !== undefined) return fromMergedLegacy;
|
|
108
|
+
|
|
109
|
+
return DEFAULT_ENTRY_LOCATION;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function readLocation(source) {
|
|
113
|
+
if (typeof source !== 'object' || source === null || Array.isArray(source)) return undefined;
|
|
114
|
+
const value = source[ENTRY_LOCATION_FIELD];
|
|
115
|
+
return ENTRY_LOCATIONS.includes(value) ? value : undefined;
|
|
116
|
+
}
|
|
5
117
|
|
|
6
118
|
export const ConnectorSettings = z.object({
|
|
7
119
|
[SHOW_SIDEBAR_ENTRY_FIELD]: z.boolean().default(true),
|
|
120
|
+
[ENTRY_LOCATION_FIELD]: z
|
|
121
|
+
.union(ENTRY_LOCATIONS.map((location) => z.const(location)))
|
|
122
|
+
.default(DEFAULT_ENTRY_LOCATION),
|
|
8
123
|
});
|
|
9
124
|
|
|
10
125
|
/**
|
|
@@ -17,9 +132,17 @@ export function installConnectorSettings(ctx, config = {}) {
|
|
|
17
132
|
ctx.inject(['settings'], (settingsCtx) => {
|
|
18
133
|
if (typeof settingsCtx?.settings?.register !== 'function') return;
|
|
19
134
|
|
|
135
|
+
// 组合配置里显式写了 entryLocation 就用它;否则把旧布尔开关翻译成等价档位,
|
|
136
|
+
// 让升级前后「侧栏是否出现、设置页有没有打开按钮」都保持不变。
|
|
137
|
+
const explicit = config[ENTRY_LOCATION_FIELD];
|
|
138
|
+
const base = ENTRY_LOCATIONS.includes(explicit)
|
|
139
|
+
? explicit
|
|
140
|
+
: (entryLocationFromLegacyFlag(config[SHOW_SIDEBAR_ENTRY_FIELD]) ?? DEFAULT_ENTRY_LOCATION);
|
|
141
|
+
|
|
20
142
|
settingsCtx.settings.register(CONNECTOR_SETTINGS_NAMESPACE, ConnectorSettings, {
|
|
21
143
|
base: {
|
|
22
144
|
[SHOW_SIDEBAR_ENTRY_FIELD]: config[SHOW_SIDEBAR_ENTRY_FIELD] !== false,
|
|
145
|
+
[ENTRY_LOCATION_FIELD]: base,
|
|
23
146
|
},
|
|
24
147
|
});
|
|
25
148
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mcp-connector",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.103",
|
|
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",
|