dsh-mcp-connector 0.2.86 → 0.2.87
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 +16 -0
- package/README.en.md +8 -2
- package/README.md +8 -2
- package/docs/CONNECTION-SCOPES.md +10 -0
- 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 +6 -3
- package/docs/screenshots/assets.json +31 -18
- package/docs/tutorials/FIRST-SUCCESS-SCENARIOS.md +1 -1
- package/lib/connection-scopes.js +20 -5
- package/lib/index.js +7 -4
- package/lib/tools.js +2 -1
- package/package.json +1 -1
- package/screenshots.json +2 -1
- package/scripts/ui-harness.mjs +7 -4
- package/ui/index.html +20 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
本项目遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/);首个公开版本从 `0.1.0` 开始。
|
|
4
4
|
|
|
5
|
+
## [0.2.87] - 2026-10-31
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- #199:已安装连接的范围管理支持一次选择多个工作区;替换指定范围时取消原有全局可见,首次连接保留单选入口。
|
|
10
|
+
- 作用域 API 支持 targetWorkspaceIds,保留旧单目标 copy/move 兼容;批量校验、预览版本检查、持久化和历史回滚复用现有 projects 列表,不复制凭据或连接。
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- 保存作用域时拒绝重叠写入,避免并发修改覆盖;保存失败不更新内存范围。
|
|
15
|
+
|
|
16
|
+
### Verification
|
|
17
|
+
|
|
18
|
+
- 完整检查 518 通过、8 条件跳过、0 失败;隔离真实浏览器验证空选拒绝、多选应用与回显。
|
|
19
|
+
- Web/Host 测试及无凭据 Mock 浏览器验收不等于 Windows Desktop 实机验收;#199 保留开放。
|
|
20
|
+
|
|
5
21
|
## [0.2.86] - 2026-10-31
|
|
6
22
|
|
|
7
23
|
### Changed
|
package/README.en.md
CHANGED
|
@@ -10,6 +10,12 @@ OAuth availability depends on each provider's client-registration policy and acc
|
|
|
10
10
|
|
|
11
11
|
[简体中文](README.md)
|
|
12
12
|
|
|
13
|
+
### Homepage recommendations
|
|
14
|
+
|
|
15
|
+
The homepage shows ten recommendations in a fixed order: Qichacha company data, Tencent Docs, Feishu, Notion, GitHub, Playwright, Wind stock data, Qichacha legal data, Amap, and Context7. All available recommended cards are expanded by default. This is a curated selection, not a usage ranking; provider authorization and configuration requirements still apply.
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
13
19
|
### Tool discovery and troubleshooting
|
|
14
20
|
|
|
15
21
|
Search cached tools across enabled connections visible to the current workspace in the Tools tab. Filter by connection, service and latest discovery status, then open parameter details for types, required fields and nested structures. Without a selected workspace, only global connections appear.
|
|
@@ -106,7 +112,7 @@ As of 2026-10-24, the public Registry publishes 112 connector descriptors. After
|
|
|
106
112
|
| Connection diagnostics and last-success cache | |
|
|
107
113
|
|  | |
|
|
108
114
|
|
|
109
|
-
<!-- generated:media -->Screenshots and GIF were captured from v0.2.
|
|
115
|
+
<!-- generated:media -->Screenshots and GIF were captured from v0.2.87 (2026-10-31), using the credential-free Mock harness. They demonstrate UI, not real business acceptance; counts are fixtures. See [asset provenance](docs/screenshots/README.md).<!-- /generated:media -->
|
|
110
116
|
|
|
111
117
|
## Installation
|
|
112
118
|
|
|
@@ -231,7 +237,7 @@ npm run dev:ui
|
|
|
231
237
|
|
|
232
238
|
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.
|
|
233
239
|
|
|
234
|
-
<!-- generated:version -->The current public version is [`dsh-mcp-connector@0.2.
|
|
240
|
+
<!-- generated:version -->The current public version is [`dsh-mcp-connector@0.2.87`](https://www.npmjs.com/package/dsh-mcp-connector), with [GitHub Release v0.2.87](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.87).<!-- /generated:version -->
|
|
235
241
|
|
|
236
242
|
See [CHANGELOG.md](CHANGELOG.md) for version history and [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md) for the Desktop release checklist.
|
|
237
243
|
|
package/README.md
CHANGED
|
@@ -10,6 +10,12 @@ OAuth 是否可用取决于服务商的客户端注册、账号权限与授权
|
|
|
10
10
|
|
|
11
11
|
[English](README.en.md)
|
|
12
12
|
|
|
13
|
+
### 首页推荐
|
|
14
|
+
|
|
15
|
+
首页“推荐”默认展开十张卡片:企查查·企业工商、腾讯文档、飞书开放平台、Notion、GitHub、Playwright、Wind·股票数据、企查查·法律数据、高德地图、Context7。按固定顺序展示,不因连接状态重排;这是场景推荐,不是使用量排行。接入时仍需满足各服务的授权和配置条件。
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
13
19
|
### 工具查找与故障处理
|
|
14
20
|
|
|
15
21
|
在“工具”页统一查找当前工作区可见、已启用连接的工具。输入工具名或描述,再按连接、服务和最近发现状态筛选;点击“参数详情”查看类型、必填项与嵌套结构。未选择工作区时,仅展示全局连接。
|
|
@@ -108,7 +114,7 @@ Desktop 需要完全退出并重新启动应用;Web 需要停止原 `dsh web`
|
|
|
108
114
|
| 连接诊断与最后成功缓存 | |
|
|
109
115
|
|  | |
|
|
110
116
|
|
|
111
|
-
<!-- generated:media -->截图与 GIF 采集自 v0.2.
|
|
117
|
+
<!-- generated:media -->截图与 GIF 采集自 v0.2.87(2026-10-31)无凭据 Mock 页面,展示界面而非真实业务验收;市场数量是测试夹具。来源与更新方法见 [素材说明](docs/screenshots/README.md)。<!-- /generated:media -->
|
|
112
118
|
|
|
113
119
|
## 安装
|
|
114
120
|
|
|
@@ -226,7 +232,7 @@ npm run dev:ui
|
|
|
226
232
|
|
|
227
233
|
公共 Registry 每次合并后会生成 `catalog-stats.json`;本仓库的定时工作流每小时同步中英文介绍和统计快照。npm 页面中的静态正文随版本发布更新,上方动态统计徽标则直接读取 Registry,可在不发布新 npm 版本时保持实时数量一致。
|
|
228
234
|
|
|
229
|
-
<!-- generated:version -->当前公开版本为 [`dsh-mcp-connector@0.2.
|
|
235
|
+
<!-- generated:version -->当前公开版本为 [`dsh-mcp-connector@0.2.87`](https://www.npmjs.com/package/dsh-mcp-connector),对应 [GitHub Release v0.2.87](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.87)。<!-- /generated:version -->
|
|
230
236
|
|
|
231
237
|
版本能力与变更记录见 [CHANGELOG.md](CHANGELOG.md)。
|
|
232
238
|
Desktop 发版回归见 [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md)。
|
|
@@ -64,3 +64,13 @@ Desktop 和 Web 使用同一个 Host API:
|
|
|
64
64
|
- `action=rollback`:使用预览时的 `expectedRevision` 恢复指定 `rollbackRevision`。
|
|
65
65
|
|
|
66
66
|
页面和对话工具调用同一 API 门面与 Host 控制器,Desktop 与 `dsh web` 没有另外的前端作用域实现。
|
|
67
|
+
|
|
68
|
+
## 6. 多工作区选择(#199,0.2.87)
|
|
69
|
+
|
|
70
|
+
在「已安装 → 修改连接范围」选择「指定工作区(多选)」,勾选一个或多个工作区,再预览并应用。此操作替换原有范围,并取消原先的全局可见;选择「所有项目(全局)」时勾选项不生效。首次连接仍可选择单个工作区,连接后可在范围管理中改为多选。
|
|
71
|
+
|
|
72
|
+
连接及凭据不会复制,MCP 服务不会按工作区重复启动。列表去重后保存,最多接受 100 项;空选、无效或已删除的工作区整批拒绝。预览版本过期或另一次保存尚未完成时,需重新预览,不能覆盖正在写入的数据。保存失败保留原范围,历史回滚保留完整工作区列表。
|
|
73
|
+
|
|
74
|
+
API 的 `previewConnectionScope` / `applyConnectionScope` 支持 `targetScope: 'project'` 和 `targetWorkspaceIds: ['id-a', 'id-b']`;与旧 `targetWorkspaceId` 互斥。UI 使用 `mode: 'move'` 替换范围。旧 API `copy` 仍表示追加,**不会清除已有全局权限**。`expectedRevision` 仍必须来自预览。现有治理、会话控制和 Host 审批边界不变。
|
|
75
|
+
|
|
76
|
+
开发验证不等于 Windows Desktop 实机验收;未获得实机反馈前不据此关闭 #199。
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# 产品截图与演示的来源及更新
|
|
2
2
|
|
|
3
|
-
<!-- generated:media -->本组
|
|
3
|
+
<!-- generated:media -->本组 8 张截图和 GIF 均从 v0.2.87 于 2026-10-31 重新采集,未修改截图中的版本文字。<!-- /generated:media -->
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
前七张素材由真实产品 UI 的无凭据 Mock harness 渲染:1280×720 浏览器视口、800px 产品面板、桌面两列卡片。顶部保留“无凭据 Mock”标识;目录数、连接数与工具数是演示夹具,不代表生产统计或真实授权、业务验收。不会读取用户 profile、调用服务商或上传业务数据。
|
|
6
6
|
|
|
7
|
-
根目录 [screenshots.json](../../screenshots.json) 保持外部市场兼容的
|
|
7
|
+
根目录 [screenshots.json](../../screenshots.json) 保持外部市场兼容的 8 张图片路径与顺序;[assets.json](assets.json) 是采集版本、日期、源码指纹、SHA-256、尺寸和 GIF 时长的唯一记录。
|
|
8
8
|
|
|
9
9
|
| 文件 | 内容 |
|
|
10
10
|
|---|---|
|
|
@@ -15,9 +15,12 @@
|
|
|
15
15
|
| 05-unified-tool-search.png | 跨连接工具查询 |
|
|
16
16
|
| 06-tool-parameters.png | 参数结构详情 |
|
|
17
17
|
| 07-connection-diagnostics.png | 模拟发现失败与诊断 |
|
|
18
|
+
| 08-ten-recommendations.jpg | 全部十张推荐长图 |
|
|
18
19
|
|
|
19
20
|
`docs/demo.gif` 由当前截图状态顺序编码,仅缩放和调色,不修改版本号或连接状态。旧素材可通过 Git 历史查看,不继续用作当前产品首屏。
|
|
20
21
|
|
|
22
|
+
第八张为 1280×1400 的完整推荐长图,Mock 面板高度扩展为 1280px,宽度与卡片尺寸不变;这是素材画布,不修改产品布局。采集固定读取 `scripts/fixtures/storefront-catalog.json` 的公开目录快照,与内置目录合并。快照变化纳入源码指纹检查。
|
|
23
|
+
|
|
21
24
|
## 更新与发布
|
|
22
25
|
|
|
23
26
|
GitHub Markdown 不执行变量。`package.json.version` 是版本唯一源,运行 `npm run docs:sync` 生成有标记的当前版本文案;历史 Changelog、验收日期、最低支持版本和已发布文章记录不作全局替换。
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"capture": {
|
|
4
4
|
"capturedOn": "2026-10-31",
|
|
5
|
-
"sourceVersion": "0.2.
|
|
6
|
-
"sourceFingerprint": "
|
|
5
|
+
"sourceVersion": "0.2.87",
|
|
6
|
+
"sourceFingerprint": "0c188bd14a4b53c5887aba84592a79537ce52786b401301b8a848723868f10c9",
|
|
7
7
|
"browserViewport": {
|
|
8
8
|
"width": 1280,
|
|
9
9
|
"height": 720
|
|
@@ -16,68 +16,81 @@
|
|
|
16
16
|
"screenshots": [
|
|
17
17
|
{
|
|
18
18
|
"path": "docs/screenshots/01-market-overview.jpg",
|
|
19
|
-
"sha256": "
|
|
19
|
+
"sha256": "5e1451f833b1cad9d6d9c5a6047946f6240b534013513abf28acc5247ffd9d80",
|
|
20
20
|
"width": 1280,
|
|
21
21
|
"height": 720,
|
|
22
22
|
"capturedOn": "2026-10-31",
|
|
23
|
-
"sourceVersion": "0.2.
|
|
23
|
+
"sourceVersion": "0.2.87"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"path": "docs/screenshots/02-connector-detail.jpg",
|
|
27
|
-
"sha256": "
|
|
27
|
+
"sha256": "3a6f6857fb40797b62f5facc1026dfa7669709809eb385a809f0d0ae7ac2730f",
|
|
28
28
|
"width": 1280,
|
|
29
29
|
"height": 720,
|
|
30
30
|
"capturedOn": "2026-10-31",
|
|
31
|
-
"sourceVersion": "0.2.
|
|
31
|
+
"sourceVersion": "0.2.87"
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"path": "docs/screenshots/03-tool-discovery.jpg",
|
|
35
|
-
"sha256": "
|
|
35
|
+
"sha256": "76600cd9e42a9b0259b80471d9a5699903d87b658f2ab7318b7c8f6d80c46d51",
|
|
36
36
|
"width": 1280,
|
|
37
37
|
"height": 720,
|
|
38
38
|
"capturedOn": "2026-10-31",
|
|
39
|
-
"sourceVersion": "0.2.
|
|
39
|
+
"sourceVersion": "0.2.87"
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"path": "docs/screenshots/04-json-import.jpg",
|
|
43
|
-
"sha256": "
|
|
43
|
+
"sha256": "82cf3875913d98be1e33d0d7fca120f0453005c08e8cfb205df1f6afb95e9473",
|
|
44
44
|
"width": 1280,
|
|
45
45
|
"height": 720,
|
|
46
46
|
"capturedOn": "2026-10-31",
|
|
47
|
-
"sourceVersion": "0.2.
|
|
47
|
+
"sourceVersion": "0.2.87"
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
"path": "docs/screenshots/05-unified-tool-search.png",
|
|
51
|
-
"sha256": "
|
|
51
|
+
"sha256": "4dddc7318f886b50a4f22c624c0f22e98e8977eebfaea33f9a81a4cfcc36c87f",
|
|
52
52
|
"width": 1280,
|
|
53
53
|
"height": 720,
|
|
54
54
|
"capturedOn": "2026-10-31",
|
|
55
|
-
"sourceVersion": "0.2.
|
|
55
|
+
"sourceVersion": "0.2.87"
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"path": "docs/screenshots/06-tool-parameters.png",
|
|
59
|
-
"sha256": "
|
|
59
|
+
"sha256": "ac493dbcb1d5246f1d788910003d614095be2544650416c4c9f854e0c576c9ca",
|
|
60
60
|
"width": 1280,
|
|
61
61
|
"height": 720,
|
|
62
62
|
"capturedOn": "2026-10-31",
|
|
63
|
-
"sourceVersion": "0.2.
|
|
63
|
+
"sourceVersion": "0.2.87"
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
"path": "docs/screenshots/07-connection-diagnostics.png",
|
|
67
|
-
"sha256": "
|
|
67
|
+
"sha256": "dca2602fd7152b30b7d2caa19a9934bc0db899bd1a5f2a4cf7711ce3428e35e4",
|
|
68
68
|
"width": 1280,
|
|
69
69
|
"height": 720,
|
|
70
70
|
"capturedOn": "2026-10-31",
|
|
71
|
-
"sourceVersion": "0.2.
|
|
71
|
+
"sourceVersion": "0.2.87"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"path": "docs/screenshots/08-ten-recommendations.jpg",
|
|
75
|
+
"sha256": "69ab7fdba137fb1fce5933b5634eab18a1d6705fb161c625f46d12b68d1c38f2",
|
|
76
|
+
"width": 1280,
|
|
77
|
+
"height": 1400,
|
|
78
|
+
"browserViewport": {
|
|
79
|
+
"width": 1280,
|
|
80
|
+
"height": 1400
|
|
81
|
+
},
|
|
82
|
+
"panelHeight": 1280,
|
|
83
|
+
"capturedOn": "2026-10-31",
|
|
84
|
+
"sourceVersion": "0.2.87"
|
|
72
85
|
}
|
|
73
86
|
],
|
|
74
87
|
"demo": {
|
|
75
88
|
"path": "docs/demo.gif",
|
|
76
|
-
"sha256": "
|
|
89
|
+
"sha256": "fffcd1134deae1bf65c605f9535177cb2828f11086f5fc7705b9dba7dacb7148",
|
|
77
90
|
"width": 960,
|
|
78
91
|
"height": 540,
|
|
79
92
|
"capturedOn": "2026-10-31",
|
|
80
|
-
"sourceVersion": "0.2.
|
|
93
|
+
"sourceVersion": "0.2.87",
|
|
81
94
|
"durationSeconds": 36
|
|
82
95
|
}
|
|
83
96
|
}
|
|
@@ -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.87`<!-- /generated:version -->;当前 Workspace;企查查 OAuth 可用;测试账号具有目标企业数据权限 |
|
|
12
12
|
| 权限/管理员 | 账号权限、组织授权和可见字段由服务商控制;企业组织可能需要管理员开通,当前文档不能替代审批 |
|
|
13
13
|
| 费用 | 可能受套餐、次数或字段权限影响;MCP连接器无法确认本次费用,调用前在服务商侧核对 |
|
|
14
14
|
| 运行/数据去向 | 远程 MCP Server;企业名称、查询参数和调用结果经 DSH Host 发送到/返回自 `agent.qcc.com` |
|
package/lib/connection-scopes.js
CHANGED
|
@@ -30,6 +30,15 @@ export function normalizeScopeTarget(input) {
|
|
|
30
30
|
const scope = typeof input?.scope === 'string' ? input.scope.trim() : '';
|
|
31
31
|
if (!CONNECTION_SCOPE_TYPES.includes(scope)) throw new Error(`不支持的连接作用域: ${scope || '(空)'}`);
|
|
32
32
|
if (scope === 'global') return { scope: 'global' };
|
|
33
|
+
if (input.workspaceIds !== undefined) {
|
|
34
|
+
if (input.workspaceId !== undefined) throw new Error('workspaceId 与 workspaceIds 不能同时指定');
|
|
35
|
+
if (!Array.isArray(input.workspaceIds) || input.workspaceIds.length === 0
|
|
36
|
+
|| input.workspaceIds.length > 100
|
|
37
|
+
|| input.workspaceIds.some((id) => typeof id !== 'string' || !id.trim())) {
|
|
38
|
+
throw new Error('workspaceIds 必须包含 1–100 个有效 Workspace id');
|
|
39
|
+
}
|
|
40
|
+
return { scope: 'project', workspaceIds: normalizeProjects(input.workspaceIds) };
|
|
41
|
+
}
|
|
33
42
|
const workspaceId = typeof input?.workspaceId === 'string' ? input.workspaceId.trim() : '';
|
|
34
43
|
if (!workspaceId) throw new Error('project 作用域必须指定 workspaceId');
|
|
35
44
|
return { scope: 'project', workspaceId };
|
|
@@ -111,14 +120,14 @@ export function mutateScopeBinding(binding, { mode, target }) {
|
|
|
111
120
|
return normalizeScopeBinding({
|
|
112
121
|
connectionKey: normalized.connectionKey,
|
|
113
122
|
global: nextTarget.scope === 'global',
|
|
114
|
-
projects: nextTarget.scope === 'project' ? [nextTarget.workspaceId] : [],
|
|
123
|
+
projects: nextTarget.scope === 'project' ? (nextTarget.workspaceIds ?? [nextTarget.workspaceId]) : [],
|
|
115
124
|
});
|
|
116
125
|
}
|
|
117
126
|
return normalizeScopeBinding({
|
|
118
127
|
connectionKey: normalized.connectionKey,
|
|
119
128
|
global: normalized.global || nextTarget.scope === 'global',
|
|
120
129
|
projects: nextTarget.scope === 'project'
|
|
121
|
-
? [...normalized.projects, nextTarget.workspaceId]
|
|
130
|
+
? [...normalized.projects, ...(nextTarget.workspaceIds ?? [nextTarget.workspaceId])]
|
|
122
131
|
: normalized.projects,
|
|
123
132
|
});
|
|
124
133
|
}
|
|
@@ -220,6 +229,7 @@ export class ConnectionScopeService {
|
|
|
220
229
|
}
|
|
221
230
|
|
|
222
231
|
async commitBindings(bindings) {
|
|
232
|
+
if (this.writing) throw new Error('连接作用域正在保存,请重新预览后重试');
|
|
223
233
|
const now = this.now();
|
|
224
234
|
const previousRevision = this.document.revision;
|
|
225
235
|
const history = [...this.document.history, {
|
|
@@ -234,9 +244,14 @@ export class ConnectionScopeService {
|
|
|
234
244
|
bindings,
|
|
235
245
|
history,
|
|
236
246
|
});
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
247
|
+
this.writing = true;
|
|
248
|
+
try {
|
|
249
|
+
await this.store.put(next);
|
|
250
|
+
this.document = next;
|
|
251
|
+
return { changed: true, previousRevision, document: this.snapshot() };
|
|
252
|
+
} finally {
|
|
253
|
+
this.writing = false;
|
|
254
|
+
}
|
|
240
255
|
}
|
|
241
256
|
}
|
|
242
257
|
|
package/lib/index.js
CHANGED
|
@@ -248,13 +248,16 @@ export async function apply(ctx, config) {
|
|
|
248
248
|
const target = normalizeScopeTarget({
|
|
249
249
|
scope: input.scope ?? 'global',
|
|
250
250
|
workspaceId: input.workspaceId,
|
|
251
|
+
workspaceIds: input.workspaceIds,
|
|
251
252
|
});
|
|
252
253
|
if (target.scope === 'project') {
|
|
253
254
|
if (!hostScopes.capabilities().executionGuard) {
|
|
254
255
|
throw new Error('当前 DSH Host 不支持 tools.guard,不能安全启用 project 作用域');
|
|
255
256
|
}
|
|
256
|
-
const
|
|
257
|
-
|
|
257
|
+
for (const id of target.workspaceIds ?? [target.workspaceId]) {
|
|
258
|
+
const workspace = ctx.workspaceRegistry?.get?.(id);
|
|
259
|
+
if (!workspace) throw new Error(`Workspace "${id}" 不存在,请重新选择项目`);
|
|
260
|
+
}
|
|
258
261
|
}
|
|
259
262
|
return target;
|
|
260
263
|
}
|
|
@@ -1734,7 +1737,7 @@ export async function apply(ctx, config) {
|
|
|
1734
1737
|
const key = String(input.key ?? '').trim();
|
|
1735
1738
|
const record = state.connections.get(key);
|
|
1736
1739
|
if (!record) throw new Error(`连接 "${key}" 不存在`);
|
|
1737
|
-
const target = validateScopeTarget({ scope: input.targetScope, workspaceId: input.targetWorkspaceId });
|
|
1740
|
+
const target = validateScopeTarget({ scope: input.targetScope, workspaceId: input.targetWorkspaceId, workspaceIds: input.targetWorkspaceIds });
|
|
1738
1741
|
const mode = String(input.mode ?? 'move');
|
|
1739
1742
|
const preview = connectionScopes.preview({ connectionKey: key, mode, target });
|
|
1740
1743
|
const conflicts = scopeConflicts([record], new Set([record.key]));
|
|
@@ -1772,7 +1775,7 @@ export async function apply(ctx, config) {
|
|
|
1772
1775
|
if (!Number.isInteger(input.expectedRevision) || input.expectedRevision < 0) {
|
|
1773
1776
|
throw new Error('必须使用作用域预览返回的 expectedRevision 提交');
|
|
1774
1777
|
}
|
|
1775
|
-
const target =
|
|
1778
|
+
const target = validateScopeTarget({ scope: input.targetScope, workspaceId: input.targetWorkspaceId, workspaceIds: input.targetWorkspaceIds });
|
|
1776
1779
|
const result = await connectionScopes.apply({
|
|
1777
1780
|
connectionKey: previewResult.detail.key,
|
|
1778
1781
|
mode: previewResult.detail.mode,
|
package/lib/tools.js
CHANGED
|
@@ -372,9 +372,10 @@ export function registerTools(ctx, api, { compact = false } = {}) {
|
|
|
372
372
|
properties: {
|
|
373
373
|
action: { type: 'string', enum: ['context', 'preview', 'apply', 'preview-rollback', 'rollback'] },
|
|
374
374
|
key: { type: 'string', description: '连接 key(来自 status)' },
|
|
375
|
-
mode: { type: 'string', enum: ['copy', 'move'], description: 'copy
|
|
375
|
+
mode: { type: 'string', enum: ['copy', 'move'], description: 'copy 增加目标范围(保留原全局权限);move 替换全部范围,project 时取消全局可见' },
|
|
376
376
|
targetScope: { type: 'string', enum: ['global', 'project'] },
|
|
377
377
|
targetWorkspaceId: { type: 'string' },
|
|
378
|
+
targetWorkspaceIds: { type: 'array', items: { type: 'string', minLength: 1 }, minItems: 1, maxItems: 100, description: 'project 多选工作区,与 targetWorkspaceId 互斥' },
|
|
378
379
|
workspaceId: { type: 'string', description: 'context 的当前 Workspace(可选)' },
|
|
379
380
|
expectedRevision: { type: 'integer', minimum: 0 },
|
|
380
381
|
rollbackRevision: { type: 'integer', minimum: 0 },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mcp-connector",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.87",
|
|
4
4
|
"description": "DeepSeek Harness MCP Connector: connect servers, search tools across active connections, and troubleshoot discovery. Includes a continuously updated catalog; supports OAuth 2.0 PKCE, API keys, Streamable HTTP/stdio, and mcpServers JSON import.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
package/screenshots.json
CHANGED
|
@@ -5,5 +5,6 @@
|
|
|
5
5
|
"docs/screenshots/04-json-import.jpg",
|
|
6
6
|
"docs/screenshots/05-unified-tool-search.png",
|
|
7
7
|
"docs/screenshots/06-tool-parameters.png",
|
|
8
|
-
"docs/screenshots/07-connection-diagnostics.png"
|
|
8
|
+
"docs/screenshots/07-connection-diagnostics.png",
|
|
9
|
+
"docs/screenshots/08-ten-recommendations.jpg"
|
|
9
10
|
]
|
package/scripts/ui-harness.mjs
CHANGED
|
@@ -38,6 +38,7 @@ const scopeService = new ConnectionScopeService({
|
|
|
38
38
|
});
|
|
39
39
|
await scopeService.load();
|
|
40
40
|
const mockWorkspace = { workspaceId: 'workspace-mock', title: '无凭据验收项目' };
|
|
41
|
+
const mockWorkspaces = [mockWorkspace, { workspaceId: 'workspace-second', title: '第二验收项目' }];
|
|
41
42
|
const bundledAssets = new Map([
|
|
42
43
|
['qcc-logo.svg', 'image/svg+xml'],
|
|
43
44
|
['pkulaw-logo.png', 'image/png'],
|
|
@@ -161,7 +162,8 @@ function captureShell() {
|
|
|
161
162
|
if (event.data?.type === 'mcp-connector:workspace-context-request') {
|
|
162
163
|
frame.contentWindow.postMessage({
|
|
163
164
|
type: 'mcp-connector:workspace-context',
|
|
164
|
-
workspace: ${JSON.stringify(mockWorkspace)}
|
|
165
|
+
workspace: ${JSON.stringify(mockWorkspace)},
|
|
166
|
+
workspaces: ${JSON.stringify(mockWorkspaces)}
|
|
165
167
|
}, window.location.origin);
|
|
166
168
|
}
|
|
167
169
|
});
|
|
@@ -242,6 +244,7 @@ const server = createServer(async (req, res) => {
|
|
|
242
244
|
const scopeDocument = scopeService.snapshot();
|
|
243
245
|
json(res, { ok: true, detail: { items, scope: {
|
|
244
246
|
revision: scopeDocument.revision,
|
|
247
|
+
workspaces: mockWorkspaces,
|
|
245
248
|
history: scopeDocument.history.map((item) => ({ revision: item.revision, createdAt: item.createdAt, bindingCount: item.bindings.length })),
|
|
246
249
|
} } }); return;
|
|
247
250
|
}
|
|
@@ -311,7 +314,7 @@ const server = createServer(async (req, res) => {
|
|
|
311
314
|
const document = scopeService.snapshot();
|
|
312
315
|
json(res, { ok: true, message: `Mock 连接作用域 revision=${document.revision}`, detail: {
|
|
313
316
|
revision: document.revision,
|
|
314
|
-
workspaces:
|
|
317
|
+
workspaces: mockWorkspaces,
|
|
315
318
|
history: document.history.map((item) => ({ revision: item.revision, createdAt: item.createdAt, bindingCount: item.bindings.length })),
|
|
316
319
|
credentialsStoredInScopeDocument: false,
|
|
317
320
|
} }); return;
|
|
@@ -319,7 +322,7 @@ const server = createServer(async (req, res) => {
|
|
|
319
322
|
if (method === 'previewConnectionScope') {
|
|
320
323
|
try {
|
|
321
324
|
const target = params.targetScope === 'project'
|
|
322
|
-
? { scope: 'project', workspaceId: params.targetWorkspaceId }
|
|
325
|
+
? { scope: 'project', workspaceId: params.targetWorkspaceId, workspaceIds: params.targetWorkspaceIds }
|
|
323
326
|
: { scope: 'global' };
|
|
324
327
|
const preview = scopeService.preview({ connectionKey: params.key, mode: params.mode, target });
|
|
325
328
|
const serverName = catalog.flatMap((item) => item.servers).find((server) => params.key.endsWith(`:${server.serverKey}`))?.serverName ?? params.key;
|
|
@@ -338,7 +341,7 @@ const server = createServer(async (req, res) => {
|
|
|
338
341
|
if (method === 'applyConnectionScope') {
|
|
339
342
|
try {
|
|
340
343
|
const target = params.targetScope === 'project'
|
|
341
|
-
? { scope: 'project', workspaceId: params.targetWorkspaceId }
|
|
344
|
+
? { scope: 'project', workspaceId: params.targetWorkspaceId, workspaceIds: params.targetWorkspaceIds }
|
|
342
345
|
: { scope: 'global' };
|
|
343
346
|
const result = await scopeService.apply({ connectionKey: params.key, mode: params.mode, target }, { expectedRevision: params.expectedRevision });
|
|
344
347
|
json(res, { ok: true, message: `Mock 连接作用域已更新(revision=${result.document.revision})`, detail: {
|
package/ui/index.html
CHANGED
|
@@ -1890,10 +1890,13 @@
|
|
|
1890
1890
|
const item = installedItems.find((candidate) => candidate.key === key);
|
|
1891
1891
|
if (!item) { showToast('连接不存在,请刷新后重试', false); return; }
|
|
1892
1892
|
pendingScopeKey = key;
|
|
1893
|
+
const binding = item.scope?.binding || { global: true, projects: [] };
|
|
1894
|
+
const choices = availableWorkspaces.map((workspace) => `<label style="display:flex;align-items:center;gap:8px"><input type="checkbox" style="width:auto" data-scope-workspace value="${esc(workspace.workspaceId)}" ${binding.projects.includes(workspace.workspaceId) ? 'checked' : ''}>${esc(workspace.title)}</label>`).join('');
|
|
1893
1895
|
openModal(`连接范围 · ${item.name}`, `
|
|
1894
1896
|
<div class="form-note"><strong>当前:${esc(item.scope?.label || '全局')}</strong>变更前会预览受影响的 Server 和已知工具;连接配置、OAuth Grant 和凭据不会被复制。</div>
|
|
1895
|
-
<label for="scope-change-
|
|
1896
|
-
|
|
1897
|
+
<label for="scope-change-target">替换连接范围</label><select id="scope-change-target"><option value="global" ${binding.global ? 'selected' : ''}>所有项目(全局)</option><option value="project" ${!binding.global ? 'selected' : ''}>指定工作区(多选)</option></select>
|
|
1898
|
+
<div role="group" aria-label="指定工作区" style="max-height:240px;overflow:auto">${choices || '<p>暂无可用 Workspace,请刷新后重试。</p>'}</div>
|
|
1899
|
+
<div class="field-help">选择指定工作区后,至少勾选一项;应用会替换原有范围并取消全局可见。全局模式下勾选项不生效。首次连接后可在此设置多个工作区。</div>
|
|
1897
1900
|
<div class="inline-error" id="modal-error" tabindex="-1"></div>
|
|
1898
1901
|
<div class="m-actions"><button class="btn ghost" type="button" onclick="window.__mcp.closeModal()">取消</button><button class="btn" type="button" onclick="window.__mcp.submitScopeChange()">预览并应用</button></div>`);
|
|
1899
1902
|
}
|
|
@@ -2127,31 +2130,39 @@
|
|
|
2127
2130
|
},
|
|
2128
2131
|
async submitScopeChange() {
|
|
2129
2132
|
if (!pendingScopeKey) return;
|
|
2133
|
+
const key = pendingScopeKey;
|
|
2130
2134
|
let target;
|
|
2131
|
-
try {
|
|
2135
|
+
try {
|
|
2136
|
+
const scope = $('#scope-change-target')?.value;
|
|
2137
|
+
if (!['global', 'project'].includes(scope)) throw new Error('请选择连接范围');
|
|
2138
|
+
const workspaceIds = [...document.querySelectorAll('[data-scope-workspace]:checked')].map((input) => input.value);
|
|
2139
|
+
if (scope === 'project' && !workspaceIds.length) throw new Error('请至少选择一个 Workspace');
|
|
2140
|
+
target = { scope, ...(scope === 'project' ? { workspaceIds } : {}) };
|
|
2141
|
+
}
|
|
2132
2142
|
catch (error) { showModalError(error.message); return; }
|
|
2133
|
-
const mode =
|
|
2143
|
+
const mode = 'move';
|
|
2134
2144
|
setModalBusy(true, '正在预览影响…');
|
|
2135
2145
|
const preview = await call('previewConnectionScope', {
|
|
2136
|
-
key
|
|
2146
|
+
key,
|
|
2137
2147
|
mode,
|
|
2138
2148
|
targetScope: target.scope,
|
|
2139
|
-
|
|
2149
|
+
targetWorkspaceIds: target.workspaceIds,
|
|
2140
2150
|
});
|
|
2141
2151
|
setModalBusy(false);
|
|
2142
2152
|
if (!preview.ok || !preview.detail?.canApply) { showModalError(preview.message); return; }
|
|
2143
2153
|
const affected = scopeAffectedText(preview.detail.impact?.servers);
|
|
2144
2154
|
if (!await confirmDialog({
|
|
2145
2155
|
title: '变更连接范围',
|
|
2146
|
-
message: `${preview.message}\n${affected}\n\n
|
|
2156
|
+
message: `${preview.message}\n${affected}\n\n目标:${target.scope === 'global' ? '所有项目(全局)' : target.workspaceIds.map((id) => availableWorkspaces.find((w) => w.workspaceId === id)?.title || id).join('、')}\n确认替换原有范围?${target.scope === 'project' ? '应用后取消全局可见。' : ''}`,
|
|
2147
2157
|
confirmLabel: '应用',
|
|
2148
2158
|
})) return;
|
|
2159
|
+
if (pendingScopeKey !== key) return;
|
|
2149
2160
|
setModalBusy(true, '正在应用范围…');
|
|
2150
2161
|
const result = await call('applyConnectionScope', {
|
|
2151
|
-
key
|
|
2162
|
+
key,
|
|
2152
2163
|
mode,
|
|
2153
2164
|
targetScope: target.scope,
|
|
2154
|
-
|
|
2165
|
+
targetWorkspaceIds: target.workspaceIds,
|
|
2155
2166
|
expectedRevision: preview.detail.baseRevision,
|
|
2156
2167
|
});
|
|
2157
2168
|
setModalBusy(false);
|