dsh-mcp-connector 0.2.83 → 0.2.85

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,32 @@
2
2
 
3
3
  本项目遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/);首个公开版本从 `0.1.0` 开始。
4
4
 
5
+ ## [0.2.85] - 2026-10-30
6
+
7
+ ### Changed
8
+
9
+ - 首页推荐按固定顺序展示企查查·企业工商、腾讯文档、飞书开放平台、Notion、GitHub、Playwright、Wind·股票数据、企查查·法律数据。
10
+ - 推荐区默认展开全部可用推荐卡片,不再限制为四张;已连接状态不改变推荐顺序。
11
+ - 保留现有卡片大小、分类预览、标题、边框及接入条件提示。
12
+ - 同步版本文档及无凭据 Mock 产品截图;素材不代表真实授权或业务调用验收。
13
+
14
+ ## [0.2.84] - 2026-10-29
15
+
16
+ ### Added
17
+
18
+ - PR #195:已安装页增加本机连接统计,以当前 profile 成功连接过的目录卡片为单位,明确区分历史基线与近 30 天首次连接的新卡片。
19
+ - 统计不包含社区总量、独立用户数或业务调用成功数,不上传数据。
20
+
21
+ ### Fixed
22
+
23
+ - 统计写入改为后台串行队列,增加超时、队列上限和释放保护;存储异常不阻塞连接返回或启动基线初始化。
24
+ - 撤回社区上报、汇总、参与开关与热门排序实验;本版本不部署统计后端。
25
+
26
+ ### Verification
27
+
28
+ - 自动化覆盖去重、持久化恢复、基线、统计失败/挂起/晚到、队列上限、API 范围与 UI 文案。
29
+ - 发行素材使用无凭据 Mock 重新采集;CI、Mock 与 macOS 测试不代替 Windows Desktop 实机验收。
30
+
5
31
  ## [0.2.83] - 2026-10-26
6
32
 
7
33
  ### Fixed
package/README.en.md CHANGED
@@ -106,7 +106,7 @@ As of 2026-10-24, the public Registry publishes 112 connector descriptors. After
106
106
  | Connection diagnostics and last-success cache | |
107
107
  | ![Connection diagnostics](https://raw.githubusercontent.com/duhu2000/dsh-mcp-connector/main/docs/screenshots/07-connection-diagnostics.png) | |
108
108
 
109
- <!-- generated:media -->Screenshots and GIF were captured from v0.2.83 (2026-10-26), 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 -->
109
+ <!-- generated:media -->Screenshots and GIF were captured from v0.2.85 (2026-10-30), 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
110
 
111
111
  ## Installation
112
112
 
@@ -231,7 +231,7 @@ npm run dev:ui
231
231
 
232
232
  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
233
 
234
- <!-- generated:version -->The current public version is [`dsh-mcp-connector@0.2.83`](https://www.npmjs.com/package/dsh-mcp-connector), with [GitHub Release v0.2.83](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.83).<!-- /generated:version -->
234
+ <!-- generated:version -->The current public version is [`dsh-mcp-connector@0.2.85`](https://www.npmjs.com/package/dsh-mcp-connector), with [GitHub Release v0.2.85](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.85).<!-- /generated:version -->
235
235
 
236
236
  See [CHANGELOG.md](CHANGELOG.md) for version history and [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md) for the Desktop release checklist.
237
237
 
package/README.md CHANGED
@@ -108,7 +108,7 @@ Desktop 需要完全退出并重新启动应用;Web 需要停止原 `dsh web`
108
108
  | 连接诊断与最后成功缓存 | |
109
109
  | ![连接诊断](https://raw.githubusercontent.com/duhu2000/dsh-mcp-connector/main/docs/screenshots/07-connection-diagnostics.png) | |
110
110
 
111
- <!-- generated:media -->截图与 GIF 采集自 v0.2.83(2026-10-26)无凭据 Mock 页面,展示界面而非真实业务验收;市场数量是测试夹具。来源与更新方法见 [素材说明](docs/screenshots/README.md)。<!-- /generated:media -->
111
+ <!-- generated:media -->截图与 GIF 采集自 v0.2.85(2026-10-30)无凭据 Mock 页面,展示界面而非真实业务验收;市场数量是测试夹具。来源与更新方法见 [素材说明](docs/screenshots/README.md)。<!-- /generated:media -->
112
112
 
113
113
  ## 安装
114
114
 
@@ -226,7 +226,7 @@ npm run dev:ui
226
226
 
227
227
  公共 Registry 每次合并后会生成 `catalog-stats.json`;本仓库的定时工作流每小时同步中英文介绍和统计快照。npm 页面中的静态正文随版本发布更新,上方动态统计徽标则直接读取 Registry,可在不发布新 npm 版本时保持实时数量一致。
228
228
 
229
- <!-- generated:version -->当前公开版本为 [`dsh-mcp-connector@0.2.83`](https://www.npmjs.com/package/dsh-mcp-connector),对应 [GitHub Release v0.2.83](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.83)。<!-- /generated:version -->
229
+ <!-- generated:version -->当前公开版本为 [`dsh-mcp-connector@0.2.85`](https://www.npmjs.com/package/dsh-mcp-connector),对应 [GitHub Release v0.2.85](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.85)。<!-- /generated:version -->
230
230
 
231
231
  版本能力与变更记录见 [CHANGELOG.md](CHANGELOG.md)。
232
232
  Desktop 发版回归见 [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md)。
Binary file
@@ -1,6 +1,6 @@
1
1
  # 产品截图与演示的来源及更新
2
2
 
3
- <!-- generated:media -->本组 7 张截图和 GIF 均从 v0.2.83 于 2026-10-26 重新采集,未修改截图中的版本文字。<!-- /generated:media -->
3
+ <!-- generated:media -->本组 7 张截图和 GIF 均从 v0.2.85 于 2026-10-30 重新采集,未修改截图中的版本文字。<!-- /generated:media -->
4
4
 
5
5
  全部素材由真实产品 UI 的无凭据 Mock harness 渲染:1280×720 浏览器视口、800px 产品面板、桌面两列卡片。顶部保留“无凭据 Mock”标识;目录数、连接数与工具数是演示夹具,不代表生产统计或真实授权、业务验收。不会读取用户 profile、调用服务商或上传业务数据。
6
6
 
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "capture": {
4
- "capturedOn": "2026-10-26",
5
- "sourceVersion": "0.2.83",
6
- "sourceFingerprint": "4a677c677d57b6389199d2bf6dfd5b376182444dd1105ba7afd34c335eb3b29e",
4
+ "capturedOn": "2026-10-30",
5
+ "sourceVersion": "0.2.85",
6
+ "sourceFingerprint": "3ffe4c58e91525ee01b71d5bb0022f811392ee6a9592c36c0f8e0327288c2df9",
7
7
  "browserViewport": {
8
8
  "width": 1280,
9
9
  "height": 720
@@ -16,68 +16,68 @@
16
16
  "screenshots": [
17
17
  {
18
18
  "path": "docs/screenshots/01-market-overview.jpg",
19
- "sha256": "97265e2142b290c8ffdf75a402e65da6c1c34939adaba28ea4175d834a4252fa",
19
+ "sha256": "d02cda69320b2f1b0046286c59a15d648ddf41c16b6bf96ea5d9292c4d3fb8d0",
20
20
  "width": 1280,
21
21
  "height": 720,
22
- "capturedOn": "2026-10-26",
23
- "sourceVersion": "0.2.83"
22
+ "capturedOn": "2026-10-30",
23
+ "sourceVersion": "0.2.85"
24
24
  },
25
25
  {
26
26
  "path": "docs/screenshots/02-connector-detail.jpg",
27
- "sha256": "5c4433afc32d5ff629f3ce13c546ac8ed0ee7a09cfa321dadb691aae980192db",
27
+ "sha256": "8025a1e41e8c43be2d4c14020974a57139edcabd065d4dd253c540162aa0a824",
28
28
  "width": 1280,
29
29
  "height": 720,
30
- "capturedOn": "2026-10-26",
31
- "sourceVersion": "0.2.83"
30
+ "capturedOn": "2026-10-30",
31
+ "sourceVersion": "0.2.85"
32
32
  },
33
33
  {
34
34
  "path": "docs/screenshots/03-tool-discovery.jpg",
35
- "sha256": "058f5aea7d11845677fb77937af82b4ad2957db363fde412e45aa9e579d7b586",
35
+ "sha256": "6f3425f6484bf34df2adbb2a7430102de30b000c4d1d6af9ac64a793421b5105",
36
36
  "width": 1280,
37
37
  "height": 720,
38
- "capturedOn": "2026-10-26",
39
- "sourceVersion": "0.2.83"
38
+ "capturedOn": "2026-10-30",
39
+ "sourceVersion": "0.2.85"
40
40
  },
41
41
  {
42
42
  "path": "docs/screenshots/04-json-import.jpg",
43
- "sha256": "1d40f4d02b0338c192419f7f71dbf420faa8c92d4d0a5fd9f7676b7822bfcdb8",
43
+ "sha256": "ac2c0b5fcb2e58ac44adce96f0baefe9b750a9090596b304b4ff200d69ea69ed",
44
44
  "width": 1280,
45
45
  "height": 720,
46
- "capturedOn": "2026-10-26",
47
- "sourceVersion": "0.2.83"
46
+ "capturedOn": "2026-10-30",
47
+ "sourceVersion": "0.2.85"
48
48
  },
49
49
  {
50
50
  "path": "docs/screenshots/05-unified-tool-search.png",
51
- "sha256": "e172da60d9abcf77639287180a4fd6b4b5dca1a95ba0f3967d7d36488fdae795",
51
+ "sha256": "50d58a5b3bb95733d1e67ad579c6a9045fdaab89b839261698b38107c98d9366",
52
52
  "width": 1280,
53
53
  "height": 720,
54
- "capturedOn": "2026-10-26",
55
- "sourceVersion": "0.2.83"
54
+ "capturedOn": "2026-10-30",
55
+ "sourceVersion": "0.2.85"
56
56
  },
57
57
  {
58
58
  "path": "docs/screenshots/06-tool-parameters.png",
59
- "sha256": "f09f04513af0f3ee40c455df5c537b1635ae42e83073c455bfd25db0e35625b7",
59
+ "sha256": "73ffc92ce34ee2fd6f56ca0a305adc3b24041d253686f53c1b85985be67499e3",
60
60
  "width": 1280,
61
61
  "height": 720,
62
- "capturedOn": "2026-10-26",
63
- "sourceVersion": "0.2.83"
62
+ "capturedOn": "2026-10-30",
63
+ "sourceVersion": "0.2.85"
64
64
  },
65
65
  {
66
66
  "path": "docs/screenshots/07-connection-diagnostics.png",
67
- "sha256": "457898c3a256c06f613cc602dcd69193f54fcc59b5ca278228e66fc31a7e32cc",
67
+ "sha256": "d8ad4d0876b0bf17dd8c2b1e3a5c7418788c740cd16f66fca82a1084d3839462",
68
68
  "width": 1280,
69
69
  "height": 720,
70
- "capturedOn": "2026-10-26",
71
- "sourceVersion": "0.2.83"
70
+ "capturedOn": "2026-10-30",
71
+ "sourceVersion": "0.2.85"
72
72
  }
73
73
  ],
74
74
  "demo": {
75
75
  "path": "docs/demo.gif",
76
- "sha256": "7501018e2e32d565a309473c666f1cf02601746ce78e04d2452a4368f851c1f1",
76
+ "sha256": "01db7b37189a80efe3dff2a7ca80a96e78040614505481e682e181c08175e92b",
77
77
  "width": 960,
78
78
  "height": 540,
79
- "capturedOn": "2026-10-26",
80
- "sourceVersion": "0.2.83",
79
+ "capturedOn": "2026-10-30",
80
+ "sourceVersion": "0.2.85",
81
81
  "durationSeconds": 36
82
82
  }
83
83
  }
@@ -8,7 +8,7 @@
8
8
 
9
9
  | 项目 | 验收要求 |
10
10
  |---|---|
11
- | 前提 | <!-- generated:version -->正式 `dsh-mcp-connector@0.2.83`<!-- /generated:version -->;当前 Workspace;企查查 OAuth 可用;测试账号具有目标企业数据权限 |
11
+ | 前提 | <!-- generated:version -->正式 `dsh-mcp-connector@0.2.85`<!-- /generated:version -->;当前 Workspace;企查查 OAuth 可用;测试账号具有目标企业数据权限 |
12
12
  | 权限/管理员 | 账号权限、组织授权和可见字段由服务商控制;企业组织可能需要管理员开通,当前文档不能替代审批 |
13
13
  | 费用 | 可能受套餐、次数或字段权限影响;MCP连接器无法确认本次费用,调用前在服务商侧核对 |
14
14
  | 运行/数据去向 | 远程 MCP Server;企业名称、查询参数和调用结果经 DSH Host 发送到/返回自 `agent.qcc.com` |
@@ -0,0 +1,111 @@
1
+ /** Local, profile-scoped facts. No network, account IDs, credentials or business data. */
2
+ import { z } from 'zod';
3
+ export const connectionStatisticSchema = z.object({
4
+ connectorId: z.string().min(1).max(256),
5
+ firstObservedAt: z.number().int().nonnegative(),
6
+ baseline: z.boolean(),
7
+ firstSuccessAt: z.number().int().nonnegative().nullable(),
8
+ });
9
+ export class ConnectionStatistics {
10
+ constructor(table, { now = Date.now, timeoutMs = 1000, maxPending = 128 } = {}) {
11
+ this.table = table;
12
+ this.now = now;
13
+ this.records = new Map();
14
+ this.queue = Promise.resolve();
15
+ this.available = true;
16
+ this.timeoutMs = timeoutMs;
17
+ this.maxPending = maxPending;
18
+ this.pending = 0;
19
+ }
20
+ async load() {
21
+ for (const [key, raw] of this.table.entries()) {
22
+ const result = connectionStatisticSchema.safeParse(raw);
23
+ if (!result.success || key !== result.data.connectorId) throw Error('Invalid connection statistics');
24
+ this.records.set(key, result.data);
25
+ }
26
+ }
27
+ write(action) {
28
+ if (!this.available) return Promise.resolve();
29
+ if (this.pending >= this.maxPending) {
30
+ this.available = false;
31
+ return Promise.reject(Error('Statistics queue full'));
32
+ }
33
+ this.pending++;
34
+ const pending = this.queue.catch(() => {}).then(async () => {
35
+ if (!this.available) return;
36
+ let timer;
37
+ try {
38
+ await Promise.race([
39
+ Promise.resolve().then(action),
40
+ new Promise((_, reject) => {
41
+ timer = setTimeout(() => reject(Error('Statistics timeout')), this.timeoutMs);
42
+ }),
43
+ ]);
44
+ } catch (error) {
45
+ this.available = false;
46
+ throw error;
47
+ } finally {
48
+ clearTimeout(timer);
49
+ }
50
+ }).finally(() => { this.pending--; });
51
+ this.queue = pending;
52
+ return pending;
53
+ }
54
+ dispose() { this.available = false; }
55
+ async put(record) {
56
+ // Publish memory only after durable storage succeeds.
57
+ const safe = connectionStatisticSchema.parse(record);
58
+ await this.table.put(safe.connectorId, safe);
59
+ if (this.available) this.records.set(safe.connectorId, safe);
60
+ }
61
+ baseline(ids) {
62
+ return this.write(async () => {
63
+ for (const id of new Set(ids)) {
64
+ if (!this.available) return;
65
+ if (!this.records.has(id)) await this.put({ connectorId: id, firstObservedAt: this.now(), baseline: true, firstSuccessAt: null });
66
+ }
67
+ });
68
+ }
69
+ success(id) {
70
+ return this.write(async () => {
71
+ const existing = this.records.get(id);
72
+ if (existing?.firstSuccessAt != null) return;
73
+ await this.put({ connectorId: id, firstObservedAt: existing?.firstObservedAt ?? this.now(), baseline: existing?.baseline ?? false, firstSuccessAt: this.now() });
74
+ });
75
+ }
76
+ snapshot() {
77
+ const cutoff = this.now() - 30 * 86400000;
78
+ const items = [...this.records.values()].map(r => ({
79
+ connectorId: r.connectorId,
80
+ cumulativeSuccessfulConnections: r.firstSuccessAt == null ? 0 : 1,
81
+ newSuccessfulConnections30d: !r.baseline && r.firstSuccessAt != null && r.firstSuccessAt >= cutoff ? 1 : 0,
82
+ historicalBaseline: r.baseline,
83
+ }));
84
+ return { scope: 'local-profile', reportingEnabled: false, available: this.available,
85
+ cumulativeSuccessfulConnections: items.reduce((n, r) => n + r.cumulativeSuccessfulConnections, 0),
86
+ newSuccessfulConnections30d: items.reduce((n, r) => n + r.newSuccessfulConnections30d, 0),
87
+ historicalBaseline: items.filter(r => r.historicalBaseline).length, items };
88
+ }
89
+ }
90
+
91
+ /** Wrap final outcomes, not saves: rollback, cancelled OAuth and validation errors never count. */
92
+ export function observeConnectionSuccess(api, statistics, { known, onError = () => {} }) {
93
+ let warned = false;
94
+ const report = () => {
95
+ if (warned) return;
96
+ warned = true;
97
+ try { onError(); } catch { /* Diagnostics must never break connections. */ }
98
+ };
99
+ for (const method of ['connect', 'configure']) {
100
+ const action = api[method];
101
+ api[method] = async function (...args) {
102
+ const id = method === 'connect' ? args[0] : args[0]?.connectorId;
103
+ const result = await action.apply(this, args);
104
+ if (statistics.available && result?.ok === true && typeof id === 'string' && known(id)) {
105
+ // Optional bookkeeping must not delay the successful connection response.
106
+ void statistics.success(id).catch(report);
107
+ }
108
+ return result;
109
+ };
110
+ }
111
+ }
package/lib/index.js CHANGED
@@ -11,6 +11,7 @@
11
11
  * export_config / snapshots / install_from_url / status / rename / set_enabled /
12
12
  * disconnect / refresh_catalog / publish / tools_list / tool_search / tool_detail
13
13
  */
14
+ import { ConnectionStatistics, observeConnectionSuccess } from './connection-statistics.js';
14
15
  import { randomUUID } from 'node:crypto';
15
16
  import z from '@deepseek-ai/schemastery';
16
17
  import {
@@ -155,6 +156,13 @@ export async function apply(ctx, config) {
155
156
  });
156
157
 
157
158
  const connectionStore = new ConnectionStore(domain);
159
+ const statisticTable = config.persistSecrets ? domain.tables.get('connection_statistics') : new Map();
160
+ const connectionStatistics = new ConnectionStatistics(config.persistSecrets ? statisticTable : {
161
+ entries: () => statisticTable.entries(), put: async (key, value) => statisticTable.set(key, value),
162
+ });
163
+ const statisticsError = () => logger.warn('Local connection statistics unavailable; connection behavior is unchanged');
164
+ try { await connectionStatistics.load(); }
165
+ catch { connectionStatistics.available = false; statisticsError(); }
158
166
  const grantStore = new GrantStore(domain, {
159
167
  // 只有真实持久化模式才启用跨进程 Grant journal。测试可通过内部字段
160
168
  // 传入临时目录,不让 fake storage 触碰用户真实 $DSH_HOME。
@@ -1689,6 +1697,9 @@ export async function apply(ctx, config) {
1689
1697
  /* ───────────────────────── api 门面 ───────────────────────── */
1690
1698
 
1691
1699
  const api = {
1700
+ async connectionStatistics() {
1701
+ return { ok: true, detail: { ...connectionStatistics.snapshot(), persistent: config.persistSecrets === true }, message: '本 profile 成功连接过的卡片数;不是连接次数或社区总量,不上传数据' };
1702
+ },
1692
1703
  async versionStatus(force = false) {
1693
1704
  const detail = versionStatusService.status({ force });
1694
1705
  let message = `当前版本 v${detail.installedVersion}`;
@@ -3375,6 +3386,9 @@ export async function apply(ctx, config) {
3375
3386
  logger.warn(`skip invalid stored connection "${key}": ${error.message}`);
3376
3387
  }
3377
3388
  }
3389
+ if (connectionStatistics.available) void connectionStatistics.baseline([...state.connections.values()]
3390
+ .map(record => record.connectorId).filter(id => state.merged.some(d => d.id === id)))
3391
+ .catch(() => { statisticsError(); });
3378
3392
  if (config.persistSecrets) {
3379
3393
  for (const [key, cached] of await toolCatalogStore.entries().catch(() => [])) {
3380
3394
  const record = state.connections.get(key);
@@ -3528,6 +3542,10 @@ export async function apply(ctx, config) {
3528
3542
  return result;
3529
3543
  };
3530
3544
  } });
3545
+ observeConnectionSuccess(api, connectionStatistics, {
3546
+ known: id => state.merged.some(d => d.id === id) && !state.dynamic.has(id),
3547
+ onError: statisticsError,
3548
+ });
3531
3549
  const observableApi = observeStatusEvents(discoveryApi, statusEvents);
3532
3550
  scheduleDiscovery();
3533
3551
  const discoveryInterval = setInterval(() => {
@@ -3551,6 +3569,7 @@ export async function apply(ctx, config) {
3551
3569
  }
3552
3570
 
3553
3571
  ctx.effect(() => () => {
3572
+ connectionStatistics.dispose();
3554
3573
  discoveryDisposed = true;
3555
3574
  clearTimeout(discoveryTimer);
3556
3575
  clearInterval(discoveryInterval);
package/lib/stores.js CHANGED
@@ -4,6 +4,7 @@
4
4
  * OAuth grant 同步写入本机受限权限 journal,防止多 Host 的整文件
5
5
  * last-write-wins 覆盖新轮换 Token;凭证不进入 loader 配置树或日志。
6
6
  */
7
+ import { connectionStatisticSchema } from './connection-statistics.js';
7
8
  import { defineDomain, domainTable } from '@deepseek-ai/dsh-storage-domain';
8
9
  import { connectionRecordSchema, connectionScopeDocumentSchema, connectionSnapshotSchema, governancePolicySchema, grantRecordSchema, catalogRecordSchema, toolCatalogRecordSchema } from './schema.js';
9
10
  import { DEFAULT_ACCOUNT } from './constants.js';
@@ -23,6 +24,7 @@ export function defineConnectorDomain() {
23
24
  governance: domainTable(governancePolicySchema),
24
25
  connection_scopes: domainTable(connectionScopeDocumentSchema),
25
26
  tool_catalog: domainTable(toolCatalogRecordSchema),
27
+ connection_statistics: domainTable(connectionStatisticSchema),
26
28
  },
27
29
  });
28
30
  }
package/lib/web.js CHANGED
@@ -35,6 +35,7 @@ const API_WHITELIST = new Map([
35
35
  ['applyConnectionScope', (api, p) => api.applyConnectionScope(p ?? {})],
36
36
  ['previewConnectionScopeRollback', (api, p) => api.previewConnectionScopeRollback(p?.rollbackRevision)],
37
37
  ['rollbackConnectionScope', (api, p) => api.rollbackConnectionScope(p?.rollbackRevision, p?.expectedRevision)],
38
+ ['connectionStatistics', (api) => api.connectionStatistics()],
38
39
  ['catalog', (api, p) => api.catalog(p ?? {})],
39
40
  ['templateCatalogReferences', (api) => api.templateCatalogReferences()],
40
41
  ['status', (api, p) => api.status(p ?? {})],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mcp-connector",
3
- "version": "0.2.83",
3
+ "version": "0.2.85",
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/ui/index.html CHANGED
@@ -1473,9 +1473,18 @@
1473
1473
  };
1474
1474
  function normalizeCategory(c) { return CATEGORY_MAP[c] || '其他'; }
1475
1475
 
1476
+ const RECOMMENDED_CONNECTOR_IDS = [
1477
+ 'qcc-company', 'tencent-docs', 'feishu', 'notion',
1478
+ 'github', 'playwright', 'wind-stock-data', 'qcc-legal',
1479
+ ];
1480
+ function recommendedConnectors(items) {
1481
+ const byId = new Map(items.map(item => [item.id, item]));
1482
+ return RECOMMENDED_CONNECTOR_IDS.map(id => byId.get(id)).filter(Boolean);
1483
+ }
1484
+
1476
1485
  function matchesMarketFilters(d) {
1477
1486
  if (!matchesSearch(d)) return false;
1478
- if (marketCategory === 'recommended' && !d.featured) return false;
1487
+ if (marketCategory === 'recommended' && !RECOMMENDED_CONNECTOR_IDS.includes(d.id)) return false;
1479
1488
  if (marketCategory && marketCategory !== 'recommended' && normalizeCategory(d.category) !== marketCategory) return false;
1480
1489
  return true;
1481
1490
  }
@@ -1514,9 +1523,9 @@
1514
1523
 
1515
1524
  function marketSectionHtml(value, label, items) {
1516
1525
  if (!items.length) return '';
1517
- const expanded = expandedMarketSections.has(value);
1526
+ const expanded = value === 'recommended' || expandedMarketSections.has(value);
1518
1527
  const visible = expanded ? items : items.slice(0, MARKET_SECTION_PREVIEW_LIMIT);
1519
- const toggle = items.length > MARKET_SECTION_PREVIEW_LIMIT
1528
+ const toggle = value !== 'recommended' && items.length > MARKET_SECTION_PREVIEW_LIMIT
1520
1529
  ? `<button class="market-section-toggle" type="button" data-section-toggle="${esc(value)}" aria-expanded="${expanded ? 'true' : 'false'}">${expanded ? '收起' : `查看全部 ${items.length} 个`}</button>`
1521
1530
  : '';
1522
1531
  return `<section class="market-section" data-market-section="${esc(value)}"><div class="market-section-head"><h2 class="market-section-title">${esc(label)}<span class="market-section-count">${items.length} 个</span></h2>${toggle}</div><div class="grid">${visible.map(cardHtml).join('')}</div></section>`;
@@ -1525,7 +1534,7 @@
1525
1534
  function groupedMarketHtml(items) {
1526
1535
  const searchable = items.filter(matchesSearch);
1527
1536
  const sections = [
1528
- { value: 'recommended', label: '推荐', items: searchable.filter((item) => item.featured) },
1537
+ { value: 'recommended', label: '推荐', items: recommendedConnectors(searchable) },
1529
1538
  ...CATEGORIES.filter((category) => category.value && category.value !== 'recommended').map((category) => ({
1530
1539
  ...category,
1531
1540
  items: searchable.filter((item) => normalizeCategory(item.category) === category.value),
@@ -1553,7 +1562,9 @@
1553
1562
  if (!items.length) { main.innerHTML = '<div class="empty">暂无已上架的连接器</div>'; return; }
1554
1563
  marketItems = {};
1555
1564
  items.forEach((d) => { marketItems[d.id] = d; });
1556
- const filtered = items.filter(matchesMarketFilters);
1565
+ const filtered = marketCategory === 'recommended'
1566
+ ? recommendedConnectors(items).filter(matchesMarketFilters)
1567
+ : items.filter(matchesMarketFilters);
1557
1568
  const resultHtml = !marketCategory
1558
1569
  ? groupedMarketHtml(items)
1559
1570
  : filtered.length > 0
@@ -1720,14 +1731,14 @@
1720
1731
  const pendingMigration = migration.ok ? migration.detail?.pendingCount || 0 : 0;
1721
1732
  const migrationHtml = pendingMigration > 0 ? `<div class="migration-banner"><div class="copy"><strong>发现旧企查查 MCP 授权</strong>可安全复制 ${pendingMigration} 组授权到 MCP连接器;不会删除旧插件或原凭据。</div><button class="btn" type="button" onclick="window.__mcp.migrateLegacy()">迁移</button></div>` : '';
1722
1733
  if (!items.length) {
1723
- main.innerHTML = `${migrationHtml}<div class="stats"><span class="count">可从旧企查查 OAuth 插件复制已有授权</span><button class="btn ghost" id="config-backup" type="button" onclick="window.__mcp.openConfigBackup()">配置备份</button><button class="btn ghost" type="button" title="扫描企查查旧 OAuth 插件;不会删除旧插件或原凭据" onclick="window.__mcp.scanLegacy()">检测企查查旧授权</button></div><div class="empty">还没有连接任何 MCP · 到「市场」里连接一个吧</div>`;
1734
+ main.innerHTML = `${migrationHtml}<div class="stats"><span class="count">可从旧企查查 OAuth 插件复制已有授权</span><button class="btn ghost" type="button" onclick="window.__mcp.openConnectionStatistics()">本机连接统计</button><button class="btn ghost" id="config-backup" type="button" onclick="window.__mcp.openConfigBackup()">配置备份</button><button class="btn ghost" type="button" title="扫描企查查旧 OAuth 插件;不会删除旧插件或原凭据" onclick="window.__mcp.scanLegacy()">检测企查查旧授权</button></div><div class="empty">还没有连接任何 MCP · 到「市场」里连接一个吧</div>`;
1724
1735
  if (preserveScroll) main.scrollTop = previousScrollTop;
1725
1736
  return;
1726
1737
  }
1727
1738
  markCommunityCtaEligible();
1728
1739
  const filtered = items.filter(matchesSearch);
1729
1740
  const rollbackDisabled = scopeRollbackRevision === null ? 'disabled' : '';
1730
- main.innerHTML = `${migrationHtml}<div class="stats"><span class="count">共 <strong>${filtered.length}</strong> 条连接${searchQuery ? ` · 搜索「${esc(searchQuery)}」` : ''} · 作用域 revision=${scopeRevision}</span><button class="btn ghost" id="scope-rollback" type="button" ${rollbackDisabled} onclick="window.__mcp.rollbackScope()">回滚上次范围变更</button><button class="btn ghost" id="config-backup" type="button" onclick="window.__mcp.openConfigBackup()">配置备份</button><button class="btn ghost" type="button" title="扫描企查查旧 OAuth 插件;不会删除旧插件或原凭据" onclick="window.__mcp.scanLegacy()">检测企查查旧授权</button></div><div class="rows">${filtered.map(rowHtml).join('')}</div>${communityCtaHtml()}`;
1741
+ main.innerHTML = `${migrationHtml}<div class="stats"><span class="count">共 <strong>${filtered.length}</strong> 条连接${searchQuery ? ` · 搜索「${esc(searchQuery)}」` : ''} · 作用域 revision=${scopeRevision}</span><button class="btn ghost" id="scope-rollback" type="button" ${rollbackDisabled} onclick="window.__mcp.rollbackScope()">回滚上次范围变更</button><button class="btn ghost" type="button" onclick="window.__mcp.openConnectionStatistics()">本机连接统计</button><button class="btn ghost" id="config-backup" type="button" onclick="window.__mcp.openConfigBackup()">配置备份</button><button class="btn ghost" type="button" title="扫描企查查旧 OAuth 插件;不会删除旧插件或原凭据" onclick="window.__mcp.scanLegacy()">检测企查查旧授权</button></div><div class="rows">${filtered.map(rowHtml).join('')}</div>${communityCtaHtml()}`;
1731
1742
  if (preserveScroll) main.scrollTop = previousScrollTop;
1732
1743
  } finally { finishViewRender(render); }
1733
1744
  }
@@ -2206,6 +2217,20 @@
2206
2217
  },
2207
2218
  openAdd(mode) { openAddConnection(mode); },
2208
2219
  openConfig(connectorId) { openAddConnection('manual', marketItems[connectorId] || {}); },
2220
+ async openConnectionStatistics() {
2221
+ openModal('本机连接统计', '<p>正在读取本机记录…</p>');
2222
+ const r = await call('connectionStatistics', {});
2223
+ const d = r.detail;
2224
+ if (!r.ok || !d?.available) {
2225
+ openModal('本机连接统计', '<p>统计暂不可用,不影响连接。请检查 Host 日志。</p>');
2226
+ return;
2227
+ }
2228
+ openModal('本机连接统计', `<div class="form-note">仅统计当前 profile,不是社区总量或独立用户数。数据保存在本机,不向外上传。${d.persistent ? '' : '当前未启用持久化,重启后计数清空。'}</div>
2229
+ <p>成功连接过的卡片数 <strong>${esc(d.cumulativeSuccessfulConnections)}</strong> · 近 30 天首次连接的新卡片 <strong>${esc(d.newSuccessfulConnections30d)}</strong></p>
2230
+ <p>历史已有连接基线:${esc(d.historicalBaseline)} 张卡片,未验证前不计成功,验证后也不计新增。</p>
2231
+ <p>同一卡片只计一次;重启、升级、重新授权和重连不重复增加,断开不扣减。此处成功指连接流程完成,不代表业务调用成功。</p>
2232
+ <div>${(d.items || []).map(x => `<p><strong>${esc(x.connectorId)}</strong>:${x.cumulativeSuccessfulConnections ? '已记录成功' : '历史配置,待验证'}${x.historicalBaseline ? ' · 历史基线' : ''}</p>`).join('') || '尚无统计记录。'}</div>`);
2233
+ },
2209
2234
  async openConfigBackup() { await openConfigBackup(); },
2210
2235
  async copyBackup() {
2211
2236
  const text = $('#backup-json')?.value || '';