dsh-mcp-connector 0.2.74 → 0.2.75

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
@@ -2,6 +2,20 @@
2
2
 
3
3
  本项目遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/);首个公开版本从 `0.1.0` 开始。
4
4
 
5
+ ## [0.2.75] - 2026-10-17
6
+
7
+ ### Added
8
+
9
+ - 可选 `compactManagementTools` 精简管理工具模式(#161):开启后将 25 个管理工具收敛为只读发现与原有会话管理两个入口;图形界面功能不变。默认关闭以兼容旧工具名,修改后需重载插件。
10
+ - 统一发现入口仅允许目录、状态、缓存搜索与详情四种操作,保留工作区参数与原有渲染,不提供通用工具调用、凭据变更或授权代理。业务工具可见性、会话确认和 Host 审批沿用原机制。
11
+ - 教程相对 inline Markdown 链接与图片检查(#159 / #156),覆盖 Windows 路径、代码片段排除、标题与括号文件名、越界及不存在的目标;纳入 `npm run check`。不宣称覆盖引用式链接、HTML 或完整 CommonMark。
12
+
13
+ ### Verification scope
14
+
15
+ - 本地完整 `npm run check`:408 项通过、4 项条件跳过、0 失败;88 个发布文件通过白名单与凭据/本机路径扫描。跳过项不计作通过。
16
+ - 新增工具数量、schema 大小、严格分派、结果渲染、参数拒绝、会话上下文、卸载清理和图形 API 集成回归。#163 与 #159 已通过 Node 20/22/24、Windows 和 Zod 4.1.8 CI。真实 DSH Web/Desktop 开关重载及模型调用验收仍需单独完成;#161 保留打开,精简模式默认关闭。
17
+ - #146 本地参数覆盖、#105 Schema 变化提醒、#83 钉钉授权等开发草案不包含在本次发布中;旧企查查凭据不做自动迁移。
18
+
5
19
  ## [0.2.74] - 2026-10-16
6
20
 
7
21
  ### Added
package/README.en.md CHANGED
@@ -167,6 +167,7 @@ The default bundle configuration is in `cordis.patch.yml`:
167
167
  refreshSkewMs: 300000
168
168
  openBrowser: true
169
169
  showSidebarEntry: true
170
+ compactManagementTools: false
170
171
  frameAncestors: ['self']
171
172
  ```
172
173
 
@@ -178,6 +179,15 @@ The proxy variables must be present in the running DSH process. After changing t
178
179
 
179
180
  `showSidebarEntry` defaults to `true`. Users can override it from the DSH plugin configuration page; turning it off hides only the shortcut and does not disable the connector, connected MCP servers, or tools.
180
181
 
182
+ `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:
183
+
184
+ - `mcp_connector_discover`: fixed read-only actions `catalog`, `status`, `search` (requires `query`), and `detail` (requires `toolName`). Example: `{"action":"search","query":"weather","limit":5}`.
185
+ - `mcp_connector_session_tools`: unchanged session activation, confirmation and TTL behavior.
186
+
187
+ Use the connector UI for connection setup, authorization, import, editing, snapshots and migration. There is no arbitrary execution proxy or automatic management-tool loading. Keep this option `false` for conversation-only deployments or workflows that depend on legacy tool names. Set it back to `false` and reload to restore those names; do not run duplicate plugin instances.
188
+
189
+ This setting does not hide downstream business tools, disable connections, migrate credentials, change workspace/governance rules or bypass Host approval. Use the existing session injection mode for downstream tool visibility. Reduced tool count/schema size is not a measured token or cost saving.
190
+
181
191
  `frameAncestors` defaults to `['self']`: the CSP of the panel page (`/mcp-connector/ui/`) only allows same-origin embedding, which is the existing behaviour and is not relaxed by default. When a desktop shell (Tauri/Electron) embeds the panel, the ancestor origin differs from the panel origin, so the browser blocks it with `Framing '...' violates the following Content Security Policy directive: "frame-ancestors 'self'"` and the panel renders blank. Deployers must opt in explicitly:
182
192
 
183
193
  ```yaml
@@ -215,7 +225,7 @@ npm run dev:ui
215
225
 
216
226
  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.
217
227
 
218
- The current public version is [`dsh-mcp-connector@0.2.74`](https://www.npmjs.com/package/dsh-mcp-connector), with [GitHub Release v0.2.74](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.74).
228
+ The current public version is [`dsh-mcp-connector@0.2.75`](https://www.npmjs.com/package/dsh-mcp-connector), with [GitHub Release v0.2.75](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.75).
219
229
 
220
230
  See [CHANGELOG.md](CHANGELOG.md) for version history and [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md) for the Desktop release checklist.
221
231
 
package/README.md CHANGED
@@ -162,6 +162,7 @@ Bundle 默认配置位于 `cordis.patch.yml`:
162
162
  refreshSkewMs: 300000
163
163
  openBrowser: true
164
164
  showSidebarEntry: true
165
+ compactManagementTools: false
165
166
  frameAncestors: ['self']
166
167
  ```
167
168
 
@@ -173,6 +174,14 @@ Bundle 默认配置位于 `cordis.patch.yml`:
173
174
 
174
175
  `showSidebarEntry` 默认为 `true`。用户可在 DSH 插件配置页覆盖该值;关闭后只隐藏侧边栏快捷入口,不停用连接器、已连接 MCP Server 或工具。
175
176
 
177
+ `compactManagementTools` 默认为 `false`,兼容原有对话管理工具。希望降低管理工具上下文开销时,可在插件配置中设为 `true` 并重载插件(必要时重启 DSH),下一次推理使用新工具集:
178
+
179
+ - 只注册 `mcp_connector_discover`(市场、连接状态、缓存工具搜索/详情)和 `mcp_connector_session_tools`(原有会话工具可见性管理)两个入口。
180
+ - 连接、授权、编辑、导入、快照、迁移等管理操作使用 **MCP连接器界面**;精简模式没有任意工具执行代理,也不自动加载全部管理工具。纯对话部署或依赖旧工具名的自动化应保持 `false`。
181
+ - 此开关不减少已连接服务的业务工具数量,不停用连接、不迁移凭据、不修改作用域/治理规则。业务工具需要按需可见时,仍使用原有“按会话启用”。会话确认、TTL 与 Host 审批保持不变。
182
+ - 例如发现入口可用 `{"action":"search","query":"天气","limit":5}`;查询连接状态可用 `{"action":"status"}`。详情使用 `action=detail` 和必填 `toolName`,市场搜索使用 `action=catalog` 与可选 `keyword`。
183
+ - 设回 `false` 并重载插件可恢复旧管理工具名;不要同时运行两份插件。工具数量和 schema 大小的减少不等于实测 token 或费用节省。
184
+
176
185
  `frameAncestors` 默认为 `['self']`,即面板页面(`/mcp-connector/ui/`)的 CSP 只允许同源页面内嵌,是既有行为,不做任何放宽。在桌面壳(Tauri/Electron)里把面板嵌进壳窗口时,祖先源与面板自身不同源,浏览器会以 `Framing '...' violates the following Content Security Policy directive: "frame-ancestors 'self'"` 拦截并导致面板白屏;此时需要由部署方/用户显式追加外壳源:
177
186
 
178
187
  ```yaml
@@ -210,7 +219,7 @@ npm run dev:ui
210
219
 
211
220
  公共 Registry 每次合并后会生成 `catalog-stats.json`;本仓库的定时工作流每小时同步中英文介绍和统计快照。npm 页面中的静态正文随版本发布更新,上方动态统计徽标则直接读取 Registry,可在不发布新 npm 版本时保持实时数量一致。
212
221
 
213
- 当前公开版本为 [`dsh-mcp-connector@0.2.74`](https://www.npmjs.com/package/dsh-mcp-connector),对应 [GitHub Release v0.2.74](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.74)。
222
+ 当前公开版本为 [`dsh-mcp-connector@0.2.75`](https://www.npmjs.com/package/dsh-mcp-connector),对应 [GitHub Release v0.2.75](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.75)。
214
223
 
215
224
  版本能力与变更记录见 [CHANGELOG.md](CHANGELOG.md)。
216
225
  Desktop 发版回归见 [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md)。
package/cordis.patch.yml CHANGED
@@ -11,6 +11,9 @@
11
11
  refreshSkewMs: 300000
12
12
  openBrowser: true
13
13
  showSidebarEntry: true
14
+ # true:仅注册发现与会话两个管理入口;完整连接配置仍在界面操作。
15
+ # 保持 false 兼容已有对话/自动化;更改后重载插件。
16
+ compactManagementTools: false
14
17
  # 面板 CSP frame-ancestors 白名单:默认仅同源可嵌入。
15
18
  # 桌面壳(Tauri/Electron)内嵌面板时需显式追加外壳源,
16
19
  # 例如 ['self', 'http://tauri.localhost', 'tauri://localhost']。
package/lib/index.js CHANGED
@@ -125,6 +125,8 @@ export const Config = z.object({
125
125
  account: z.string().default(DEFAULT_ACCOUNT),
126
126
  /** 是否在 DSH 主侧边栏显示 MCP连接器快捷入口 */
127
127
  showSidebarEntry: z.boolean().default(true),
128
+ /** 精简对话管理工具为发现入口 + 会话入口;旧配置默认保留全量工具。修改后重载插件。 */
129
+ compactManagementTools: z.boolean().default(false),
128
130
  /**
129
131
  * 图形化市场面板(/mcp-connector/ui/)的 CSP `frame-ancestors` 白名单。
130
132
  *
@@ -3442,7 +3444,7 @@ export async function apply(ctx, config) {
3442
3444
  if (statusEvents.clients.size > 0) scheduleDiscovery();
3443
3445
  }, 30_000);
3444
3446
  discoveryInterval.unref?.();
3445
- const disposeTools = registerTools(ctx, observableApi);
3447
+ const disposeTools = registerTools(ctx, observableApi, { compact: config.compactManagementTools === true });
3446
3448
 
3447
3449
  /* ───────────────────────── web 半区(图形化市场)──────────────────────── */
3448
3450
  // webServer + 新版 webStartup 或旧版 webRuntime;纯对话部署不挂载 HTTP 路由。
package/lib/tools.js CHANGED
@@ -169,14 +169,14 @@ export function toLossless(value, seen = new Set()) {
169
169
  return output;
170
170
  }
171
171
 
172
- export function registerTools(ctx, api) {
173
- const disposers = [];
174
- const reg = (def) => disposers.push(ctx.tools.register({
172
+ export function registerTools(ctx, api, { compact = false } = {}) {
173
+ const definitions = [];
174
+ const reg = (def) => definitions.push({
175
175
  ...def,
176
176
  async execute(args, exec) {
177
177
  return toLossless(await def.execute(args, exec));
178
178
  },
179
- }));
179
+ });
180
180
 
181
181
  reg({
182
182
  name: 'mcp_connector_catalog',
@@ -758,7 +758,76 @@ export function registerTools(ctx, api) {
758
758
  },
759
759
  });
760
760
 
761
+ // Keep the original definitions intact: no generic executor, direct API
762
+ // bypass, or change to Host dispatch/approval for downstream MCP tools.
763
+ const selected = compact === true
764
+ ? [createDiscoveryTool(definitions), definitions.find((def) => def.name === 'mcp_connector_session_tools')]
765
+ : definitions;
766
+ const disposers = [];
767
+ try {
768
+ for (const def of selected) disposers.push(ctx.tools.register(def));
769
+ } catch (error) {
770
+ for (const dispose of disposers.reverse()) dispose();
771
+ throw error;
772
+ }
761
773
  return () => {
762
774
  for (const dispose of disposers) dispose();
763
775
  };
764
776
  }
777
+
778
+ /** Fixed read-only routes, never an arbitrary tool name or API method. */
779
+ function createDiscoveryTool(definitions) {
780
+ const routes = Object.fromEntries([
781
+ ['catalog', 'mcp_connector_catalog'],
782
+ ['status', 'mcp_connector_status'],
783
+ ['search', 'mcp_connector_tool_search'],
784
+ ['detail', 'mcp_connector_tool_detail'],
785
+ ].map(([action, name]) => [action, definitions.find((def) => def.name === name)]));
786
+ const failure = (message) => ({ ok: false, message });
787
+ return {
788
+ name: 'mcp_connector_discover',
789
+ description: 'MCP连接器只读发现:catalog 查市场,status 查连接状态,search 搜索已连接服务的缓存工具,detail 查缓存参数。' +
790
+ '不会连接、配置或执行业务工具。连接/授权/编辑/迁移请使用「MCP连接器」界面;' +
791
+ '按会话启用的业务工具使用 mcp_connector_session_tools。其他业务调用仍走 Host 原生工具及审批。',
792
+ parameters: {
793
+ type: 'object',
794
+ properties: {
795
+ action: { type: 'string', enum: Object.keys(routes), description: 'catalog 使用 keyword/category;status 可选 workspaceId;search 必填 query;detail 必填 toolName。仅传当前操作支持的参数。' },
796
+ ...Object.assign({}, ...Object.values(routes).map((def) => def.parameters.properties)),
797
+ },
798
+ required: ['action'],
799
+ additionalProperties: false,
800
+ },
801
+ output: {
802
+ schema: RESULT_SCHEMA,
803
+ render(args, value) {
804
+ const route = Object.hasOwn(routes, value.discoveryAction) ? routes[value.discoveryAction] : null;
805
+ return route ? route.output.render(args, value) : resultOutput.render(args, value);
806
+ },
807
+ },
808
+ async execute(input) {
809
+ if (!input || typeof input !== 'object' || Array.isArray(input) ||
810
+ typeof input.action !== 'string' || !Object.hasOwn(routes, input.action)) {
811
+ return failure('action 必须是 catalog、status、search 或 detail');
812
+ }
813
+ const { action, ...args } = input;
814
+ const route = routes[action];
815
+ // The union-shaped public object cannot express action-specific required
816
+ // fields without provider-incompatible top-level unions. Check them here
817
+ // before invoking any route; do not reflect arbitrary input or secrets.
818
+ for (const key of route.parameters.required ?? []) {
819
+ if (typeof args[key] !== 'string' || !args[key].trim()) return failure(`${action} 缺少必填参数 ${key}`);
820
+ }
821
+ for (const [key, value] of Object.entries(args)) {
822
+ if (!Object.hasOwn(route.parameters.properties, key)) return failure('包含当前 action 不支持的参数');
823
+ const schema = route.parameters.properties[key];
824
+ if (typeof value !== schema.type || (schema.type === 'number' &&
825
+ (!Number.isFinite(value) || value < schema.minimum || value > schema.maximum))) {
826
+ return failure(`${action} 参数 ${key} 类型或范围不正确`);
827
+ }
828
+ }
829
+ const result = await route.execute(args);
830
+ return toLossless({ ...result, discoveryAction: action });
831
+ },
832
+ };
833
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mcp-connector",
3
- "version": "0.2.74",
3
+ "version": "0.2.75",
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",
@@ -46,7 +46,7 @@
46
46
  ],
47
47
  "scripts": {
48
48
  "test": "node --test",
49
- "lint": "node --check lib/discovery-policy.js && node --check lib/index.js && node --check lib/web.js && node --check lib/client.js && node --check lib/settings.js && node --check lib/version-status.js && node --check lib/schema.js && node --check lib/catalog.js && node --check lib/prompts.js && node --check lib/probe.js && node --check lib/diagnostics.js && node --check lib/connection-backup.js && node --check lib/connection-editor.js && node --check lib/connection-scopes.js && node --check lib/governance.js && node --check lib/session-injection.js && node --check lib/tool-catalog-cache.js && node --check lib/status-events.js && node --check lib/mcp-validation.js && node --check lib/mcp-http.js && node --check lib/migration.js && node --check lib/stores.js && node --check lib/grant-journal.js && node --check lib/oauth.js && node --check lib/grant-lifecycle.js && node --check lib/callback-server.js && node --check lib/mcp-provision.js && node --check lib/stdio-startup-guard.js && node --check lib/cli-providers.js && node --check lib/util.js && node --check lib/constants.js && node --check lib/tools.js && node --check lib/connectors/oauth-connector.js && node --check lib/connectors/manual-connector.js && node --check lib/connectors/json-connector.js && node --check scripts/probe-connector.mjs && node --check scripts/cli-bridge.mjs && node --check scripts/build-registry.mjs && node --check scripts/ui-harness.mjs && node --check scripts/check-market-registration.mjs && node --check scripts/check-distribution-sync.mjs && node --check scripts/check-readme-version.mjs && node --check scripts/check-first-use-docs.mjs && node --check scripts/check-marketing-metadata.mjs && node --check scripts/check-storefront-screenshots.mjs && node --check scripts/sync-registry-stats.mjs && node --check scripts/verify-pack.mjs",
49
+ "lint": "node --check lib/discovery-policy.js && node --check lib/index.js && node --check lib/web.js && node --check lib/client.js && node --check lib/settings.js && node --check lib/version-status.js && node --check lib/schema.js && node --check lib/catalog.js && node --check lib/prompts.js && node --check lib/probe.js && node --check lib/diagnostics.js && node --check lib/connection-backup.js && node --check lib/connection-editor.js && node --check lib/connection-scopes.js && node --check lib/governance.js && node --check lib/session-injection.js && node --check lib/tool-catalog-cache.js && node --check lib/status-events.js && node --check lib/mcp-validation.js && node --check lib/mcp-http.js && node --check lib/migration.js && node --check lib/stores.js && node --check lib/grant-journal.js && node --check lib/oauth.js && node --check lib/grant-lifecycle.js && node --check lib/callback-server.js && node --check lib/mcp-provision.js && node --check lib/stdio-startup-guard.js && node --check lib/cli-providers.js && node --check lib/util.js && node --check lib/constants.js && node --check lib/tools.js && node --check lib/connectors/oauth-connector.js && node --check lib/connectors/manual-connector.js && node --check lib/connectors/json-connector.js && node --check scripts/probe-connector.mjs && node --check scripts/cli-bridge.mjs && node --check scripts/build-registry.mjs && node --check scripts/ui-harness.mjs && node --check scripts/check-market-registration.mjs && node --check scripts/check-distribution-sync.mjs && node --check scripts/check-readme-version.mjs && node --check scripts/check-first-use-docs.mjs && node --check scripts/check-marketing-metadata.mjs && node --check scripts/check-storefront-screenshots.mjs && node --check scripts/sync-registry-stats.mjs && node --check scripts/verify-pack.mjs && node --check scripts/check-tutorial-links.mjs",
50
50
  "registry:build": "node scripts/build-registry.mjs",
51
51
  "registry:validate": "node scripts/probe-connector.mjs catalog/catalog.json --validate-only",
52
52
  "dev:ui": "node scripts/ui-harness.mjs",
@@ -61,7 +61,8 @@
61
61
  "marketing:check:live": "node scripts/check-marketing-metadata.mjs --live",
62
62
  "storefront:check": "node scripts/check-storefront-screenshots.mjs",
63
63
  "verify-pack": "node scripts/verify-pack.mjs",
64
- "check": "npm run lint && npm run docs:check && npm run docs:first-use:check && npm run marketing:check && npm run storefront:check && npm test && npm run verify-pack",
64
+ "docs:tutorial-links:check": "node scripts/check-tutorial-links.mjs",
65
+ "check": "npm run lint && npm run docs:check && npm run docs:first-use:check && npm run marketing:check && npm run storefront:check && npm test && npm run verify-pack && npm run docs:tutorial-links:check",
65
66
  "prepublishOnly": "npm run check"
66
67
  },
67
68
  "keywords": [