dsh-mcp-connector 0.2.115 → 0.2.116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.116 - 2026-11-19
4
+
5
+ - 市场卡片支持 HTTP 多凭据配置,可分别填写亿欧 Client ID 与 Client Secret;凭据绑定到声明的 Header,缺值和非法头值在联网前拒绝。
6
+ - 公开目录只保存字段引用,状态、日志与脱敏导出不包含真实凭据;保留单凭据、stdio 和已有 JSON 导入连接行为。新版字段兼容旧版目录读取,新卡片配置需升级。
7
+ - 同步当前版本中英文无凭据 Mock 截图和生成文档;未追加厂商业务调用。
8
+ - Support multiple HTTP credentials in market cards with explicit header bindings, preflight validation and redacted exports. Existing single-key and stdio connections remain compatible.
9
+
3
10
  ## 0.2.115 - 2026-11-19
4
11
 
5
12
  打开「MCP 连接器」后,面板会自动检查插件版本。发现新版时,标题旁会同时显示当前版本和可更新的版本。首次检查失败时,可以点击「重新检查」。
package/README.en.md CHANGED
@@ -163,7 +163,7 @@ As of 2026-11-19, the public Registry publishes 120 connector descriptors. After
163
163
  | Connection diagnostics and last-success cache | |
164
164
  | ![Connection diagnostics](https://raw.githubusercontent.com/duhu2000/dsh-mcp-connector/main/docs/screenshots/en/07-connection-diagnostics.png) | |
165
165
 
166
- <!-- generated:media -->English UI screenshots and GIF were captured from v0.2.115 (2026-11-19), 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 -->
166
+ <!-- generated:media -->English UI screenshots and GIF were captured from v0.2.116 (2026-11-19), 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 -->
167
167
 
168
168
  ## Installation
169
169
 
@@ -305,7 +305,7 @@ npm run dev:ui
305
305
 
306
306
  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.
307
307
 
308
- <!-- generated:version -->The current public version is [`dsh-mcp-connector@0.2.115`](https://www.npmjs.com/package/dsh-mcp-connector), with [GitHub Release v0.2.115](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.115).<!-- /generated:version -->
308
+ <!-- generated:version -->The current public version is [`dsh-mcp-connector@0.2.116`](https://www.npmjs.com/package/dsh-mcp-connector), with [GitHub Release v0.2.116](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.116).<!-- /generated:version -->
309
309
 
310
310
  See [CHANGELOG.md](CHANGELOG.md) for version history and [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md) for the Desktop release checklist.
311
311
 
package/README.md CHANGED
@@ -177,7 +177,7 @@ Desktop 需要完全退出并重新启动应用;Web 需要停止原 `dsh web`
177
177
  | 连接诊断与最后成功缓存 | |
178
178
  | ![连接诊断](https://raw.githubusercontent.com/duhu2000/dsh-mcp-connector/main/docs/screenshots/07-connection-diagnostics.png) | |
179
179
 
180
- <!-- generated:media -->截图与 GIF 采集自 v0.2.115(2026-11-19)无凭据 Mock 页面,展示界面而非真实业务验收;市场数量是测试夹具。来源与更新方法见 [素材说明](docs/screenshots/README.md)。<!-- /generated:media -->
180
+ <!-- generated:media -->截图与 GIF 采集自 v0.2.116(2026-11-19)无凭据 Mock 页面,展示界面而非真实业务验收;市场数量是测试夹具。来源与更新方法见 [素材说明](docs/screenshots/README.md)。<!-- /generated:media -->
181
181
 
182
182
  ## 安装
183
183
 
@@ -312,7 +312,7 @@ npm run dev:ui
312
312
 
313
313
  公共 Registry 每次合并后会生成 `catalog-stats.json`;本仓库的定时工作流每小时同步中英文介绍和统计快照。npm 页面中的静态正文随版本发布更新,上方动态统计徽标则直接读取 Registry,可在不发布新 npm 版本时保持实时数量一致。
314
314
 
315
- <!-- generated:version -->当前公开版本为 [`dsh-mcp-connector@0.2.115`](https://www.npmjs.com/package/dsh-mcp-connector),对应 [GitHub Release v0.2.115](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.115)。<!-- /generated:version -->
315
+ <!-- generated:version -->当前公开版本为 [`dsh-mcp-connector@0.2.116`](https://www.npmjs.com/package/dsh-mcp-connector),对应 [GitHub Release v0.2.116](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.116)。<!-- /generated:version -->
316
316
 
317
317
  版本能力与变更记录见 [CHANGELOG.md](CHANGELOG.md)。
318
318
  Desktop 发版回归见 [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md)。
@@ -456,3 +456,9 @@ Windows 下 `.cmd` / `.bat` 是脚本包装器,不等同于可直接启动的
456
456
  自动授权适用于支持 Authorization Code、PKCE S256 和公共客户端动态注册的服务。需要预登记客户端、API Key 或自定义认证 Header 的服务仍需按服务商说明配置;403、网络故障不会被当作 OAuth 授权提示。已有凭据不会被自动替换。自定义授权只绑定所填写的资源,不自动开通同一服务商的其他 MCP Server。
457
457
 
458
458
  授权在运行 DSH 的主机上发起,回调使用该主机的本地地址。远程访问 DSH 时,浏览器必须能访问该回调主机;本功能不会自动建立隧道。凭据沿用插件的本机存储与刷新机制,待授权配置不会注册可调用工具。
459
+
460
+ ### HTTP 多凭据卡片(v0.2.116 起)
461
+
462
+ 亿欧等服务需要 Client ID 和 Client Secret 两项凭据。市场卡片会分别显示两个密码输入框,填写后点击连接即可,不需要编辑 JSON 或手工设置 Header。凭据只保存在本机连接中,目录与脱敏备份不包含真实值。若仅看到一个 API Key 输入框,请升级插件再连接;已有 JSON 导入连接仍可继续使用。
463
+
464
+ 描述符维护者使用 `auth.headerCredentialFields` 声明字段、`servers[].headerCredentialBindings` 声明 Header 名到字段 key 的映射。仅用于 HTTP/SSE API Key 连接;Header 值原样注入,不自动添加 Bearer。未知引用、重复 Header、协议控制头和缺失必填值会被拒绝。旧版客户端可继续加载目录,但不能配置这种双凭据卡片。
Binary file
@@ -1,6 +1,6 @@
1
1
  # 产品截图与演示的来源及更新
2
2
 
3
- <!-- generated:media -->本组 8 张截图和 GIF 均从 v0.2.115 于 2026-11-19 重新采集,未修改截图中的版本文字。<!-- /generated:media -->
3
+ <!-- generated:media -->本组 8 张截图和 GIF 均从 v0.2.116 于 2026-11-19 重新采集,未修改截图中的版本文字。<!-- /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-19",
6
- "sourceVersion": "0.2.115",
7
- "sourceFingerprint": "e59bccf7afa9c5fde7b87e2f68c8eda78e02037bda47c01758b70b43633ba3ba",
6
+ "sourceVersion": "0.2.116",
7
+ "sourceFingerprint": "95108b3dd7262d07a074a6d508beebb16f13b65ecd9fa730a5189b1a1285941f",
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": "fce8d326c49ee94fcbfbd6419ff9ee74311b818c8f3d62965a189aca3c1a66ea",
20
+ "sha256": "f04cee2b4952efeb8c3541be788bb834018c0f363a350f5d8e68e92be9d6be36",
21
21
  "width": 1280,
22
22
  "height": 720,
23
23
  "capturedOn": "2026-11-19",
24
- "sourceVersion": "0.2.115"
24
+ "sourceVersion": "0.2.116"
25
25
  },
26
26
  {
27
27
  "path": "docs/screenshots/02-connector-detail.jpg",
28
- "sha256": "e4916f156086c40e071251d9c90161f3c05bb21744ecec7416103154af70d9fa",
28
+ "sha256": "625568eebb54db837bd679f7b359502321adef5011c10516a050fb5aa0c52ef3",
29
29
  "width": 1280,
30
30
  "height": 720,
31
31
  "capturedOn": "2026-11-19",
32
- "sourceVersion": "0.2.115"
32
+ "sourceVersion": "0.2.116"
33
33
  },
34
34
  {
35
35
  "path": "docs/screenshots/03-tool-discovery.jpg",
36
- "sha256": "e9ff7f9f7fda1c52bf32551ea1cbe5106dd7e5bec73b36254cc42bac801b90ff",
36
+ "sha256": "e7f3b7b47f8b01ecadfefffcf7f2650edd042ddb32b173fd01c7d68ed9721675",
37
37
  "width": 1280,
38
38
  "height": 720,
39
39
  "capturedOn": "2026-11-19",
40
- "sourceVersion": "0.2.115"
40
+ "sourceVersion": "0.2.116"
41
41
  },
42
42
  {
43
43
  "path": "docs/screenshots/04-json-import.jpg",
44
- "sha256": "b592671fd21ec7334c3658083b1e4ff5213bb02c67bd5fdc284a07bbbde24b74",
44
+ "sha256": "66c7269937ff16ec19fbaa882622dfb85cd1b6d1e02f26c1a36bf5c7fd495f6b",
45
45
  "width": 1280,
46
46
  "height": 720,
47
47
  "capturedOn": "2026-11-19",
48
- "sourceVersion": "0.2.115"
48
+ "sourceVersion": "0.2.116"
49
49
  },
50
50
  {
51
51
  "path": "docs/screenshots/05-unified-tool-search.png",
52
- "sha256": "f3a7d7e2ff00ab458c7def796d11ed04e9d0ca2c39d25cc171a008d46b4dc30e",
52
+ "sha256": "990d0f2678373ccc3fca4e11b14ebc98859ca89e5b63f75d8f7402fc59195670",
53
53
  "width": 1280,
54
54
  "height": 720,
55
55
  "capturedOn": "2026-11-19",
56
- "sourceVersion": "0.2.115"
56
+ "sourceVersion": "0.2.116"
57
57
  },
58
58
  {
59
59
  "path": "docs/screenshots/06-tool-parameters.png",
60
- "sha256": "6fd38c60b8e9ae3896f287f61c87eec4c688746c763a0d99f2fc30239f152d73",
60
+ "sha256": "676ee0f4bd2a956bbbf2cc77a9eb96ff8c11086d17b5be2479c5472a5b22ef21",
61
61
  "width": 1280,
62
62
  "height": 720,
63
63
  "capturedOn": "2026-11-19",
64
- "sourceVersion": "0.2.115"
64
+ "sourceVersion": "0.2.116"
65
65
  },
66
66
  {
67
67
  "path": "docs/screenshots/07-connection-diagnostics.png",
68
- "sha256": "c1bc0d6eb50480f81191f8bad759fa46696345bdc5e406906047c14990c9f4a7",
68
+ "sha256": "2ef5cf330f6b8cfc9921cf04afa4f8e94b6a61a26bdff52c868e0dd8adaddf55",
69
69
  "width": 1280,
70
70
  "height": 720,
71
71
  "capturedOn": "2026-11-19",
72
- "sourceVersion": "0.2.115"
72
+ "sourceVersion": "0.2.116"
73
73
  },
74
74
  {
75
75
  "path": "docs/screenshots/08-ten-recommendations.jpg",
76
- "sha256": "79b66c49ee627966298d77e4fa9a548b66d8793505b00aab8eada81107ed9bbe",
76
+ "sha256": "4a2111ac681b8c505618a7fc4fbaf7502093a8fc05f18beef4017b02bd42b418",
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-19",
85
- "sourceVersion": "0.2.115"
85
+ "sourceVersion": "0.2.116"
86
86
  }
87
87
  ],
88
88
  "demo": {
89
89
  "path": "docs/demo.gif",
90
- "sha256": "0c0cc3acc353d23da02ae09da5668fd29429111933b2e3ab1af853361e118428",
90
+ "sha256": "9d853349882135ed02cb9ee6cf20c0acb3f22d284b23c591b3312375adb87e9c",
91
91
  "width": 960,
92
92
  "height": 540,
93
93
  "capturedOn": "2026-11-19",
94
- "sourceVersion": "0.2.115",
94
+ "sourceVersion": "0.2.116",
95
95
  "durationSeconds": 36
96
96
  }
97
97
  }
@@ -3,8 +3,8 @@
3
3
  "capture": {
4
4
  "locale": "en",
5
5
  "capturedOn": "2026-11-19",
6
- "sourceVersion": "0.2.115",
7
- "sourceFingerprint": "e59bccf7afa9c5fde7b87e2f68c8eda78e02037bda47c01758b70b43633ba3ba",
6
+ "sourceVersion": "0.2.116",
7
+ "sourceFingerprint": "95108b3dd7262d07a074a6d508beebb16f13b65ecd9fa730a5189b1a1285941f",
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": "bd49377f91e3ec28d30c21ff0037a7ac44ab39ef26ce673cf762294302fc4298",
20
+ "sha256": "ce3861692137954448592e1c9177de26558cc0d7b2ed80e25b8d7802911cf0e2",
21
21
  "width": 1280,
22
22
  "height": 720,
23
23
  "capturedOn": "2026-11-19",
24
- "sourceVersion": "0.2.115"
24
+ "sourceVersion": "0.2.116"
25
25
  },
26
26
  {
27
27
  "path": "docs/screenshots/en/02-connector-detail.jpg",
28
- "sha256": "7bee0ed0a01c59b6bec9733349b0a01a329db5610c8433931a5121d41b59403a",
28
+ "sha256": "69789aef639c9e4ad5d21d9786c28486af93fc12b9792e628bd8a4866896d183",
29
29
  "width": 1280,
30
30
  "height": 720,
31
31
  "capturedOn": "2026-11-19",
32
- "sourceVersion": "0.2.115"
32
+ "sourceVersion": "0.2.116"
33
33
  },
34
34
  {
35
35
  "path": "docs/screenshots/en/03-tool-discovery.jpg",
36
- "sha256": "1ab517e2fae693a448b841f8534d59e44db3d1c68c6642e8fb5d02c84a7848a0",
36
+ "sha256": "e3b6c0f4adebfad82e35f4869a84bcffb6a83d5f5076f35d05067f1c8eb18871",
37
37
  "width": 1280,
38
38
  "height": 720,
39
39
  "capturedOn": "2026-11-19",
40
- "sourceVersion": "0.2.115"
40
+ "sourceVersion": "0.2.116"
41
41
  },
42
42
  {
43
43
  "path": "docs/screenshots/en/04-json-import.jpg",
44
- "sha256": "ed78625cac603bc5bbb6b7f23f1ac5526a7639faeb540bb0b696f8d0c5cf684c",
44
+ "sha256": "751a57df855d605ae53b485764099e97511ca1da666eb95281e8cafe7a7e3005",
45
45
  "width": 1280,
46
46
  "height": 720,
47
47
  "capturedOn": "2026-11-19",
48
- "sourceVersion": "0.2.115"
48
+ "sourceVersion": "0.2.116"
49
49
  },
50
50
  {
51
51
  "path": "docs/screenshots/en/05-unified-tool-search.png",
52
- "sha256": "fbec6ec1daef84f4074823186d0c8f02f5beff567349e4f237c379ad7f9112dc",
52
+ "sha256": "bd8c73a205169add585cee97093db2cb247026f5e32a1aac252c1b4b07ae8edd",
53
53
  "width": 1280,
54
54
  "height": 720,
55
55
  "capturedOn": "2026-11-19",
56
- "sourceVersion": "0.2.115"
56
+ "sourceVersion": "0.2.116"
57
57
  },
58
58
  {
59
59
  "path": "docs/screenshots/en/06-tool-parameters.png",
60
- "sha256": "cebd97cd53ee1b67b79e19eeae8111dacdc90a27fef0400770f8e7084e4fd23d",
60
+ "sha256": "e7cfe3bfa8e093b08e322050b23e87f68165ed84f3bcab19f1c938ccdaa5e1ef",
61
61
  "width": 1280,
62
62
  "height": 720,
63
63
  "capturedOn": "2026-11-19",
64
- "sourceVersion": "0.2.115"
64
+ "sourceVersion": "0.2.116"
65
65
  },
66
66
  {
67
67
  "path": "docs/screenshots/en/07-connection-diagnostics.png",
68
- "sha256": "9acda276dfb24fa337db482dcb21b84ca49370530b6d8c6d06a657373dc5eec7",
68
+ "sha256": "ce960f5662b3d133b05d52b241d26b2d4806c1ad205c39db1b0651f39ee1e0c5",
69
69
  "width": 1280,
70
70
  "height": 720,
71
71
  "capturedOn": "2026-11-19",
72
- "sourceVersion": "0.2.115"
72
+ "sourceVersion": "0.2.116"
73
73
  },
74
74
  {
75
75
  "path": "docs/screenshots/en/08-ten-recommendations.jpg",
76
- "sha256": "18eb233bab59bf6f2dad9546855e1fb698f1c6b392a17f7ee6c73de14733c38d",
76
+ "sha256": "3280dc0e36eae403498c404a659bfed6de4e66030a26b73bec3c67a58ab827d0",
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-19",
85
- "sourceVersion": "0.2.115"
85
+ "sourceVersion": "0.2.116"
86
86
  }
87
87
  ],
88
88
  "demo": {
89
89
  "path": "docs/screenshots/en/demo.gif",
90
- "sha256": "10bf5b87214c2686f8a6b21687fd9534c7b9abba260de5d1db358a7ebda2c7e1",
90
+ "sha256": "091f496f2be73b3d82253f857b17bb60d4d8cea27e20f4823a8c960f279f0a3c",
91
91
  "width": 960,
92
92
  "height": 540,
93
93
  "capturedOn": "2026-11-19",
94
- "sourceVersion": "0.2.115",
94
+ "sourceVersion": "0.2.116",
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.115`<!-- /generated:version -->;当前 Workspace;企查查 OAuth 可用;测试账号具有目标企业数据权限 |
11
+ | 前提 | <!-- generated:version -->正式 `dsh-mcp-connector@0.2.116`<!-- /generated:version -->;当前 Workspace;企查查 OAuth 可用;测试账号具有目标企业数据权限 |
12
12
  | 权限/管理员 | 账号权限、组织授权和可见字段由服务商控制;企业组织可能需要管理员开通,当前文档不能替代审批 |
13
13
  | 费用 | 可能受套餐、次数或字段权限影响;MCP连接器无法确认本次费用,调用前在服务商侧核对 |
14
14
  | 运行/数据去向 | 远程 MCP Server;企业名称、查询参数和调用结果经 DSH Host 发送到/返回自 `agent.qcc.com` |
package/lib/catalog.js CHANGED
@@ -23,9 +23,9 @@ export function auditRawDescriptor(raw, path = 'connector', { t = tZh } = {}) {
23
23
  const fieldPath = `${path}.${key}`;
24
24
  // credentialBindings 的 key 是待注入的环境变量名,value 只能是凭据字段引用;
25
25
  // 真实值会在本机表单提交后写入 ConnectionRecord,不允许出现在目录中。
26
- if (key === 'credentialBindings') continue;
26
+ if (key === 'credentialBindings' || key === 'headerCredentialBindings') continue;
27
27
  // credentialFields[].secret 只是“以密码框显示”的布尔声明,不是密钥值。
28
- if (key === 'secret' && typeof value === 'boolean' && /\.auth\.credentialFields\.\d+\.secret$/.test(fieldPath)) continue;
28
+ if (key === 'secret' && typeof value === 'boolean' && /\.auth\.(?:credentialFields|headerCredentialFields)\.\d+\.secret$/.test(fieldPath)) continue;
29
29
  if (SECRET_KEY_RE.test(key) && value !== undefined && value !== null && String(value).trim() !== '') {
30
30
  throw new Error(t('{fieldPath} 禁止携带凭证或密钥', { fieldPath }));
31
31
  }
@@ -74,6 +74,23 @@ export function auditDescriptor(descriptor, { t = tZh } = {}) {
74
74
  }
75
75
  const referencedCredentials = new Set();
76
76
  for (const server of descriptor.servers) {
77
+ const headerBindings = server.headerCredentialBindings ?? {};
78
+ if (Object.keys(headerBindings).length) {
79
+ if (server.transport === 'stdio' || descriptor.auth.mode !== 'api-key') {
80
+ throw new Error('headerCredentialBindings requires an HTTP API Key connector');
81
+ }
82
+ const headerNames = new Set(Object.keys(server.headers ?? {}).map(name => name.toLowerCase()));
83
+ for (const [name, key] of Object.entries(headerBindings)) {
84
+ assertSafeHeaderName(name);
85
+ if (/^(host|cookie|set-cookie|proxy-authorization|content-length|transfer-encoding|connection|content-type|accept|origin|referer|mcp-session-id|mcp-protocol-version)$/i.test(name)) {
86
+ throw new Error('headerCredentialBindings cannot bind protocol or routing headers');
87
+ }
88
+ if (headerNames.has(name.toLowerCase())) throw new Error('duplicate credential header');
89
+ if (!credentialKeys.has(key)) throw new Error('unknown header credential field');
90
+ headerNames.add(name.toLowerCase());
91
+ referencedCredentials.add(key);
92
+ }
93
+ }
77
94
  if (server.transport === 'stdio') {
78
95
  for (const name of Object.keys(server.env ?? {})) {
79
96
  if (SECRET_ENV_RE.test(name)) {
@@ -150,7 +167,7 @@ export function auditDescriptor(descriptor, { t = tZh } = {}) {
150
167
  }
151
168
  if (['bearer', 'api-key'].includes(descriptor.auth.mode)) {
152
169
  const httpServers = descriptor.servers.filter((server) => ['streamable-http', 'sse'].includes(server.transport));
153
- if (httpServers.length > 0 && credentialFields[0]) referencedCredentials.add(credentialFields[0].key);
170
+ if (httpServers.some(server => !Object.keys(server.headerCredentialBindings ?? {}).length) && credentialFields[0]) referencedCredentials.add(credentialFields[0].key);
154
171
  for (const field of credentialFields) {
155
172
  if (field.required && !referencedCredentials.has(field.key)) {
156
173
  throw new Error(t('connector "{id}" 必填凭据字段未被 HTTP 或 stdio 使用: {key}', { id: descriptor.id, key: field.key }));
package/lib/index.js CHANGED
@@ -1536,6 +1536,18 @@ export async function apply(ctx, config) {
1536
1536
  return env;
1537
1537
  }
1538
1538
 
1539
+ function bindHeaderCredentials(server, values) {
1540
+ const headers = { ...(server.headers ?? {}) };
1541
+ for (const [name, key] of Object.entries(server.headerCredentialBindings ?? {})) {
1542
+ const value = values[key];
1543
+ if (value === undefined || value === '') continue;
1544
+ // Reject before networking; never echo the supplied credential in an error.
1545
+ if (/[^\x20-\x7e\x80-\xff]/.test(value)) throw new Error('Invalid credential header value');
1546
+ headers[name] = value;
1547
+ }
1548
+ return headers;
1549
+ }
1550
+
1539
1551
  /* ───────────────────────── OAuth Grant 共享 ───────────────────────── */
1540
1552
 
1541
1553
  function canonicalIssuer(value) {
@@ -2285,6 +2297,7 @@ export async function apply(ctx, config) {
2285
2297
  command: s.command,
2286
2298
  args: s.args,
2287
2299
  credentialBindings: s.credentialBindings,
2300
+ headerCredentialBindings: s.headerCredentialBindings,
2288
2301
  oauthResource: s.oauthResource,
2289
2302
  oauthTokenEnv: s.oauthTokenEnv,
2290
2303
  transport: s.transport,
@@ -2517,8 +2530,8 @@ export async function apply(ctx, config) {
2517
2530
  args: server.args,
2518
2531
  envJson: server.transport === 'stdio' ? bindStdioCredentials(server, credentialValues) : undefined,
2519
2532
  cwd: server.cwd,
2520
- headersJson: server.headers,
2521
- authMode: server.transport === 'stdio' ? 'none' : connector.auth.mode,
2533
+ headersJson: bindHeaderCredentials(server, credentialValues),
2534
+ authMode: server.transport === 'stdio' || Object.keys(server.headerCredentialBindings ?? {}).length ? 'none' : connector.auth.mode,
2522
2535
  bearerToken: params.bearerToken ?? primaryCredential,
2523
2536
  apiKeyHeader: params.apiKeyHeader || connector.auth.apiKeyHeader,
2524
2537
  apiKeyValue: params.apiKeyValue ?? primaryCredential,
package/lib/schema.js CHANGED
@@ -29,6 +29,7 @@ export const serverRefSchema = z.object({
29
29
  args: z.array(z.string()).optional(),
30
30
  env: z.record(z.string(), z.string()).optional(),
31
31
  credentialBindings: z.record(z.string(), z.string()).optional(),
32
+ headerCredentialBindings: z.record(z.string(), z.string()).optional(),
32
33
  oauthResource: z.string().min(1).optional(),
33
34
  oauthTokenEnv: z.string().min(1).optional(),
34
35
  cwd: z.string().optional(),
@@ -111,6 +112,7 @@ export const connectorDescriptorSchema = z.object({
111
112
  credentialHelpLabel: z.string().optional(),
112
113
  credentialHelpUrl: z.union([z.literal(''), z.string().url().refine((url) => url.startsWith('https://'), 'HTTPS required')]).optional(),
113
114
  credentialFields: z.array(credentialFieldSchema).optional(),
115
+ headerCredentialFields: z.array(credentialFieldSchema).min(1).optional(),
114
116
  })
115
117
  .optional(),
116
118
  servers: z.array(serverRefSchema).min(1),
@@ -292,6 +294,7 @@ export function normalizeConnectorDescriptor(raw, { t = tZh } = {}) {
292
294
  args: transport === 'stdio' ? (s.args ?? []) : undefined,
293
295
  env: transport === 'stdio' ? (s.env ?? {}) : undefined,
294
296
  credentialBindings: transport === 'stdio' ? (s.credentialBindings ?? {}) : undefined,
297
+ headerCredentialBindings: s.headerCredentialBindings,
295
298
  // OAuth 资源标识对 HTTP 与 stdio 都有效:HTTP 用它解耦「实际请求 URL(可带查询参数)」
296
299
  // 与「OAuth resource 标识」,避免把 `?tools=` 之类的查询串写进 authorizedResources。
297
300
  // oauthTokenEnv 仅 stdio 有意义,这里不做静默丢弃,交给 auditDescriptor 显式报错。
@@ -306,8 +309,15 @@ export function normalizeConnectorDescriptor(raw, { t = tZh } = {}) {
306
309
  const authMode = c.auth?.mode ?? 'none';
307
310
  const fallbackCredentialLabel = c.auth?.credentialName
308
311
  || (authMode === 'bearer' ? 'Bearer Token' : authMode === 'api-key' ? 'API Key' : t(SCHEMA_MSGIDS.credentialFallbackLabel));
309
- const credentialFields = c.auth?.credentialFields?.length
310
- ? c.auth.credentialFields.map((field) => ({
312
+ // Dedicated HTTP extension keeps older clients able to read the whole catalog.
313
+ // They retain the single-key fallback; the card must disclose its minimum version.
314
+ if (c.auth?.headerCredentialFields && (authMode !== 'api-key'
315
+ || !servers.some(server => Object.keys(server.headerCredentialBindings ?? {}).length))) {
316
+ throw new Error('headerCredentialFields requires HTTP API Key bindings');
317
+ }
318
+ const declaredCredentialFields = c.auth?.headerCredentialFields ?? c.auth?.credentialFields;
319
+ const credentialFields = declaredCredentialFields?.length
320
+ ? declaredCredentialFields.map((field) => ({
311
321
  key: field.key,
312
322
  label: field.label,
313
323
  placeholder: field.placeholder ?? '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mcp-connector",
3
- "version": "0.2.115",
3
+ "version": "0.2.116",
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",
@@ -38,6 +38,7 @@
38
38
  "credentialDescription": { "type": "string" },
39
39
  "credentialHelpLabel": { "type": "string" },
40
40
  "credentialHelpUrl": { "type": "string", "format": "uri", "pattern": "^https://" },
41
+ "headerCredentialFields": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/credentialField" } },
41
42
  "credentialFields": {
42
43
  "type": "array",
43
44
  "items": { "$ref": "#/$defs/credentialField" }
@@ -57,6 +58,7 @@
57
58
  "command": { "type": "string", "minLength": 1 },
58
59
  "args": { "type": "array", "items": { "type": "string" } },
59
60
  "env": { "type": "object", "additionalProperties": { "type": "string" } },
61
+ "headerCredentialBindings": { "type": "object", "additionalProperties": { "type": "string" } },
60
62
  "credentialBindings": { "type": "object", "additionalProperties": { "type": "string" } },
61
63
  "oauthResource": { "type": "string", "minLength": 1 },
62
64
  "oauthTokenEnv": { "type": "string", "minLength": 1, "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" },
package/ui/index.html CHANGED
@@ -2771,7 +2771,7 @@
2771
2771
  const id = `cfg-credential-${field.key}`;
2772
2772
  return `<label for="${esc(id)}">${esc(field.label)}${t(field.required === false ? '(可选)' : '(必填)')}</label><input id="${esc(id)}" data-credential-key="${esc(field.key)}" type="${field.secret === false ? 'text' : 'password'}" autocomplete="off" placeholder="${esc(field.placeholder || t('仅保存在 DSH 本机'))}" />${field.description ? `<div class="field-help">${esc(field.description)}</div>` : ''}`;
2773
2773
  }).join('');
2774
- const credentialFields = usesStdio
2774
+ const credentialFields = (usesStdio || servers.some(server => Object.keys(server.headerCredentialBindings || {}).length))
2775
2775
  ? stdioCredentialFields
2776
2776
  : authMode === 'bearer'
2777
2777
  ? `<label for="cfg-token">${esc(credentialName)}${t('(必填)')}</label><input id="cfg-token" type="password" autocomplete="off" placeholder="${esc(credentialPlaceholder)}" /><div class="field-help">${esc(credentialDescription)}</div>`