dsh-mcp-connector 0.2.37 → 0.2.38

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
@@ -4,6 +4,22 @@
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.2.38] - 2026-09-08
8
+
9
+ ### Added
10
+
11
+ - 在 `设置 → 插件 → 插件配置` 新增“MCP连接器”卡片,可按当前 DSH profile 显示或隐藏侧边栏入口。
12
+ - 设置卡片新增“打开 MCP连接器”快捷动作;入口隐藏后仍可随时打开、连接和管理 MCP Server,关闭弹框后返回原操作位置。
13
+
14
+ ### Changed
15
+
16
+ - 侧边栏可见性保存后即时生效;仅隐藏入口,不影响插件、连接、工具、后台刷新或对话内调用。
17
+ - Settings Host 与客户端服务均采用可选注入;旧版 DSH 或服务暂不可用时安全回退为显示侧边栏,避免升级后失去入口。
18
+
19
+ ### Verification
20
+
21
+ - 205 项自动测试、lint、版本/营销元数据/商店截图门禁和 npm 发布包白名单/敏感内容扫描全部通过;新增覆盖 Host 设置注册、客户端持久化、快捷打开、隐藏态零挂载、键盘焦点恢复和兼容回退。
22
+
7
23
  ## [0.2.37] - 2026-09-06
8
24
 
9
25
  ### Changed
@@ -580,7 +596,8 @@
580
596
  - 外部 URL 与导入 Header 执行安全校验。
581
597
  - iframe 消息校验同源和消息来源。
582
598
 
583
- [Unreleased]: https://github.com/duhu2000/dsh-mcp-connector/compare/v0.2.37...HEAD
599
+ [Unreleased]: https://github.com/duhu2000/dsh-mcp-connector/compare/v0.2.38...HEAD
600
+ [0.2.38]: https://github.com/duhu2000/dsh-mcp-connector/compare/v0.2.37...v0.2.38
584
601
  [0.2.37]: https://github.com/duhu2000/dsh-mcp-connector/compare/v0.2.36...v0.2.37
585
602
  [0.2.36]: https://github.com/duhu2000/dsh-mcp-connector/compare/v0.2.35...v0.2.36
586
603
  [0.2.35]: https://github.com/duhu2000/dsh-mcp-connector/compare/v0.2.34...v0.2.35
package/README.en.md CHANGED
@@ -26,7 +26,7 @@ Manage MCP connections from different providers in one place inside DeepSeek Har
26
26
  dsh plugin --profile web add dsh-mcp-connector
27
27
  ```
28
28
 
29
- Fully restart DeepSeek Harness Desktop or `dsh web` after installation or upgrade, then open **MCP Connector** in the primary sidebar.
29
+ Fully restart DeepSeek Harness Desktop or `dsh web` after installation or upgrade, then open **MCP Connector** in the primary sidebar, or open it directly from **Settings → Plugins → Plugin Configuration → MCP Connector**.
30
30
 
31
31
  ![16-second MCP Connector walkthrough](https://raw.githubusercontent.com/duhu2000/dsh-mcp-connector/main/docs/demo.gif)
32
32
 
@@ -49,6 +49,7 @@ If the plugin helps you connect an MCP server faster, consider [starring the rep
49
49
  ## Features
50
50
 
51
51
  - A primary sidebar entry below New Conversation and above workspaces/conversations, with a public footer-slot fallback for incompatible DSH DOM versions.
52
+ - A profile-wide sidebar visibility preference; even when the shortcut is hidden, the existing connector dialog remains available from **Settings → Plugins → Plugin Configuration → MCP Connector**.
52
53
  - Searchable Marketplace and Installed views; the default Marketplace groups cards into Featured plus nine business-category sections, previews four cards per section, keeps the category bar visible while scrolling, and shows every card when a single category is selected.
53
54
  - OAuth 2.0 Authorization Code with PKCE, including DCR public clients and `client_secret_post` / `client_secret_basic`; API key/Bearer/unauthenticated HTTP configuration, stdio local-process configuration, and `mcpServers` JSON import.
54
55
  - Installation from a credential-free connector descriptor URL.
@@ -97,7 +98,7 @@ Run the same command again to upgrade. Fully quit and restart DeepSeek Harness D
97
98
 
98
99
  ## Usage
99
100
 
100
- 1. Select **MCP Connector** in the primary sidebar.
101
+ 1. Select **MCP Connector** in the primary sidebar, or choose **Open MCP Connector** from **Settings → Plugins → Plugin Configuration → MCP Connector**.
101
102
  2. Choose a connector, confirm **Current project** or **All projects (global)**, and complete authorization or configuration.
102
103
  3. Open its details to inspect tools or send an example prompt to a new conversation draft.
103
104
  4. Use Installed or the conversation tools to enable, disable, inspect, or disconnect a connection.
@@ -139,10 +140,13 @@ The default bundle configuration is in `cordis.patch.yml`:
139
140
  entryPrefix: mcp
140
141
  refreshSkewMs: 300000
141
142
  openBrowser: true
143
+ showSidebarEntry: true
142
144
  ```
143
145
 
144
146
  Set `catalogUrl` to an empty string for an explicitly offline/private setup. A custom non-default URL is used as-is and does not fall back to the public registry.
145
147
 
148
+ `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.
149
+
146
150
  ## Compatibility and responsibility boundary
147
151
 
148
152
  | Area | Current boundary |
@@ -171,7 +175,7 @@ npm run dev:ui
171
175
 
172
176
  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.
173
177
 
174
- The current public version is [`dsh-mcp-connector@0.2.37`](https://www.npmjs.com/package/dsh-mcp-connector), with [GitHub Release v0.2.37](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.37).
178
+ The current public version is [`dsh-mcp-connector@0.2.38`](https://www.npmjs.com/package/dsh-mcp-connector), with [GitHub Release v0.2.38](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.38).
175
179
 
176
180
  See [CHANGELOG.md](CHANGELOG.md) for version history and [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md) for the Desktop release checklist.
177
181
 
package/README.md CHANGED
@@ -26,7 +26,7 @@
26
26
  dsh plugin --profile web add dsh-mcp-connector
27
27
  ```
28
28
 
29
- 安装或升级后完全重启 DeepSeek Harness Desktop 或 `dsh web`,然后打开左侧「🧩 MCP连接器」。
29
+ 安装或升级后完全重启 DeepSeek Harness Desktop 或 `dsh web`,然后打开左侧「🧩 MCP连接器」;也可从“设置 → 插件 → 插件配置 → MCP连接器”直接打开。
30
30
 
31
31
  ![MCP 连接器 16 秒演示](https://raw.githubusercontent.com/duhu2000/dsh-mcp-connector/main/docs/demo.gif)
32
32
 
@@ -49,6 +49,7 @@ dsh plugin --profile web add dsh-mcp-connector
49
49
  ## 功能
50
50
 
51
51
  - 左侧主导航入口:目标位置为“新会话”下方、“工作区/会话列表”上方;若 DSH DOM 结构不兼容,自动回退到底部公开插槽。
52
+ - 侧边栏入口可按当前 profile 隐藏;隐藏后仍可从“设置 → 插件 → 插件配置 → MCP连接器”临时打开现有连接器弹框,用完即关。
52
53
  - 图形化市场:默认“全部”按推荐与 9 类业务分类分章节展示,每章先展示 4 张并可展开;分类栏固定可见,单分类页展示全部卡片。
53
54
  - 图形化添加:手动 HTTP/stdio、`mcpServers` JSON、连接器描述 URL 三种入口,失败时保留表单并给出修复建议。
54
55
  - 连接器详情:精选 Prompt 优先展示,点击可带入 DSH 新会话;工具按 Server 分组,支持描述、搜索和独立滚动。
@@ -99,7 +100,7 @@ bash <(curl -fsSL https://raw.githubusercontent.com/duhu2000/dsh-mcp-connector/m
99
100
 
100
101
  ## 使用
101
102
 
102
- 1. 点击左侧“🧩 MCP连接器”。
103
+ 1. 点击左侧“🧩 MCP连接器”,或从“设置 → 插件 → 插件配置 → MCP连接器”点击“打开 MCP连接器”。
103
104
  2. 在市场中选择连接器,确认“当前项目”或“所有项目(全局)”,再完成授权或配置。
104
105
  3. 打开卡片详情,可点击示例 Prompt 的发送按钮,在当前工作区创建/复用空白会话并写入草稿。
105
106
  4. 在“已安装”或对话工具中查看、停用、恢复或断开连接。
@@ -135,10 +136,13 @@ Bundle 默认配置位于 `cordis.patch.yml`:
135
136
  entryPrefix: mcp
136
137
  refreshSkewMs: 300000
137
138
  openBrowser: true
139
+ showSidebarEntry: true
138
140
  ```
139
141
 
140
142
  `catalogUrl` 默认通过 jsDelivr CDN 读取公共 [dsh-mcp-connector-registry](https://github.com/duhu2000/dsh-mcp-connector-registry),支持 ETag/TTL 缓存;主源失败时自动尝试 GitHub raw 备用源,再回退到上次缓存或随包内置目录。jsDelivr 的分支 URL 可能存在缓存延迟,因此 Registry 合并后的新卡片不保证秒级出现。需要离线/私有模式时可将 `catalogUrl` 显式设为空字符串;显式配置其他目录 URL 时不会自动切换到公共备用源。
141
143
 
144
+ `showSidebarEntry` 默认为 `true`。用户可在 DSH 插件配置页覆盖该值;关闭后只隐藏侧边栏快捷入口,不停用连接器、已连接 MCP Server 或工具。
145
+
142
146
  ## 兼容性与责任边界
143
147
 
144
148
  | 项目 | 当前边界 |
@@ -167,7 +171,7 @@ npm run dev:ui
167
171
 
168
172
  公共 Registry 每次合并后会生成 `catalog-stats.json`;本仓库的定时工作流每小时同步中英文介绍和统计快照。npm 页面中的静态正文随版本发布更新,上方动态统计徽标则直接读取 Registry,可在不发布新 npm 版本时保持实时数量一致。
169
173
 
170
- 当前公开版本为 [`dsh-mcp-connector@0.2.37`](https://www.npmjs.com/package/dsh-mcp-connector),对应 [GitHub Release v0.2.37](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.37)。
174
+ 当前公开版本为 [`dsh-mcp-connector@0.2.38`](https://www.npmjs.com/package/dsh-mcp-connector),对应 [GitHub Release v0.2.38](https://github.com/duhu2000/dsh-mcp-connector/releases/tag/v0.2.38)。
171
175
 
172
176
  版本能力与变更记录见 [CHANGELOG.md](CHANGELOG.md)。
173
177
  Desktop 发版回归见 [docs/DESKTOP-E2E.md](docs/DESKTOP-E2E.md)。
package/cordis.patch.yml CHANGED
@@ -10,3 +10,4 @@
10
10
  entryPrefix: 'mcp'
11
11
  refreshSkewMs: 300000
12
12
  openBrowser: true
13
+ showSidebarEntry: true
@@ -34,7 +34,12 @@ dsh web
34
34
 
35
35
  ## 2. 打开 MCP连接器
36
36
 
37
- 重启后,在 DSH 左侧主导航点击“🧩 MCP连接器”。入口通常位于“新会话”下方、工作区/会话列表上方;如果当前 DSH 版本没有对应的公开插槽,入口会回退到左侧底部。
37
+ 重启后,可以用以下任一方式打开:
38
+
39
+ - 在 DSH 左侧主导航点击“🧩 MCP连接器”。入口通常位于“新会话”下方、工作区/会话列表上方;如果当前 DSH 版本没有对应的公开插槽,入口会回退到左侧底部。
40
+ - 打开“设置 → 插件 → 插件配置 → MCP连接器”,展开卡片并点击“打开 MCP连接器”。该按钮直接复用同一个连接器弹框,不要求侧边栏入口可见;关闭弹框后仍回到设置页。
41
+
42
+ 如需腾出侧边栏空间,可在同一配置卡片关闭“在侧边栏显示 MCP连接器”。该偏好作用于当前 DSH profile,并在重启后保留;它只隐藏快捷入口,不停用插件、已连接 MCP Server 或工具。隐藏后可以随时从该配置卡片直接打开连接器,或重新开启入口。旧版 DSH 没有 Settings 能力时,插件保持入口可见,不会因设置功能进入 Safe Mode。
38
43
 
39
44
  页面顶部提供:
40
45
 
package/lib/client.js CHANGED
@@ -23,6 +23,8 @@ window.__ModuleLoader__.load({
23
23
  const VERSION_CHECK_RETRY_MS = 5 * 60 * 1e3;
24
24
  const NPM_PACKAGE_URL = "https://www.npmjs.com/package/dsh-mcp-connector";
25
25
  const PLUGIN_PACKAGE_NAME = "dsh-mcp-connector";
26
+ const CONNECTOR_SETTINGS_NAMESPACE = "mcp-connector";
27
+ const SHOW_SIDEBAR_ENTRY_FIELD = "showSidebarEntry";
26
28
  const UPDATE_PROVIDER_OPERATION_POLL_MS = 1e3;
27
29
  const UPDATE_PROVIDER_ADAPTERS = Object.freeze([
28
30
  createHttpUpdateProviderAdapter({
@@ -110,6 +112,9 @@ window.__ModuleLoader__.load({
110
112
  .mcpConnectorTopEntry[data-wide="false"] .mcpConnectorLauncher {
111
113
  margin: 0 0 8px;
112
114
  }
115
+ `;
116
+ const OVERLAY_STYLE_ID = "dsh-mcp-connector-overlay";
117
+ const overlayCss = `
113
118
 
114
119
  .mcpConnectorMarketPanel { background: #ffffff; color: #111827; }
115
120
  .mcpConnectorMarketHeader { border-color: #e5e7eb; }
@@ -218,19 +223,189 @@ window.__ModuleLoader__.load({
218
223
  .mcpConnectorMarketClose:hover,
219
224
  .mcpConnectorMarketClose:focus-visible { background: #30343d !important; color: #ffffff; }
220
225
  }
226
+ `;
227
+ const SETTINGS_STYLE_ID = "dsh-mcp-connector-settings";
228
+ const settingsCss = `
229
+ .mcpConnectorSettingsCard {
230
+ border: 1px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.28));
231
+ background: var(--dsw-alias-bg-layer-3, transparent);
232
+ border-radius: 12px;
233
+ list-style: none;
234
+ }
235
+ .mcpConnectorSettingsCard[data-open="true"] {
236
+ background: var(--dsw-alias-bg-layer-2, rgba(127, 127, 127, 0.06));
237
+ border-color: var(--dsw-alias-label-dimmed, rgba(127, 127, 127, 0.5));
238
+ }
239
+ .mcpConnectorSettingsHeader {
240
+ appearance: none;
241
+ display: flex;
242
+ align-items: center;
243
+ gap: 12px;
244
+ width: 100%;
245
+ padding: 14px 16px;
246
+ border: 0;
247
+ border-radius: 12px;
248
+ color: inherit;
249
+ background: transparent;
250
+ font: inherit;
251
+ text-align: left;
252
+ cursor: pointer;
253
+ }
254
+ .mcpConnectorSettingsHeader:focus-visible,
255
+ .mcpConnectorSettingsButton:focus-visible,
256
+ .mcpConnectorSettingsSwitch:focus-visible {
257
+ outline: 2px solid var(--dsw-alias-brand-primary, currentColor);
258
+ outline-offset: 2px;
259
+ }
260
+ .mcpConnectorSettingsHeadText {
261
+ display: flex;
262
+ flex: 1;
263
+ flex-direction: column;
264
+ gap: 4px;
265
+ min-width: 0;
266
+ }
267
+ .mcpConnectorSettingsName {
268
+ color: var(--dsw-alias-label-primary, inherit);
269
+ font-size: 15px;
270
+ font-weight: 600;
271
+ line-height: 1.4;
272
+ }
273
+ .mcpConnectorSettingsDescription,
274
+ .mcpConnectorSettingsHint,
275
+ .mcpConnectorSettingsState {
276
+ color: var(--dsw-alias-label-tertiary, rgba(127, 127, 127, 0.9));
277
+ font-size: 13px;
278
+ line-height: 1.5;
279
+ }
280
+ .mcpConnectorSettingsChevron {
281
+ flex: none;
282
+ color: var(--dsw-alias-label-tertiary, currentColor);
283
+ font-size: 16px;
284
+ transition: transform 0.16s;
285
+ }
286
+ .mcpConnectorSettingsCard[data-open="true"] .mcpConnectorSettingsChevron {
287
+ transform: rotate(180deg);
288
+ }
289
+ .mcpConnectorSettingsBody {
290
+ margin: 0 16px;
291
+ padding: 14px 0 10px;
292
+ border-top: 1px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.28));
293
+ }
294
+ .mcpConnectorSettingsRow {
295
+ display: grid;
296
+ grid-template-columns: minmax(0, 1fr) auto;
297
+ align-items: center;
298
+ gap: 18px;
299
+ }
300
+ .mcpConnectorSettingsLabel {
301
+ display: block;
302
+ color: var(--dsw-alias-label-primary, inherit);
303
+ font-size: 14px;
304
+ font-weight: 600;
305
+ }
306
+ .mcpConnectorSettingsHint {
307
+ display: block;
308
+ margin-top: 5px;
309
+ }
310
+ .mcpConnectorSettingsSwitch {
311
+ position: relative;
312
+ appearance: none;
313
+ width: 42px;
314
+ height: 24px;
315
+ margin: 0;
316
+ border: 0;
317
+ border-radius: 999px;
318
+ background: var(--dsw-alias-fill-secondary, rgba(127, 127, 127, 0.35));
319
+ cursor: pointer;
320
+ transition: background 0.16s;
321
+ }
322
+ .mcpConnectorSettingsSwitch::after {
323
+ position: absolute;
324
+ top: 3px;
325
+ left: 3px;
326
+ width: 18px;
327
+ height: 18px;
328
+ border-radius: 50%;
329
+ background: #ffffff;
330
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
331
+ content: "";
332
+ transition: transform 0.16s;
333
+ }
334
+ .mcpConnectorSettingsSwitch:checked {
335
+ background: var(--dsw-alias-state-success, #16a34a);
336
+ }
337
+ .mcpConnectorSettingsSwitch:checked::after {
338
+ transform: translateX(18px);
339
+ }
340
+ .mcpConnectorSettingsSwitch:disabled {
341
+ cursor: default;
342
+ opacity: 0.55;
343
+ }
344
+ .mcpConnectorSettingsFooter {
345
+ display: flex;
346
+ align-items: center;
347
+ flex-wrap: wrap;
348
+ gap: 8px;
349
+ margin-top: 14px;
350
+ padding-top: 12px;
351
+ border-top: 1px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.28));
352
+ }
353
+ .mcpConnectorSettingsState {
354
+ flex: 1 1 210px;
355
+ margin: 0;
356
+ }
357
+ .mcpConnectorSettingsState[data-tone="error"] {
358
+ color: var(--dsw-alias-label-error, #b91c1c);
359
+ }
360
+ .mcpConnectorSettingsButton {
361
+ appearance: none;
362
+ padding: 6px 12px;
363
+ border: 1px solid var(--dsw-alias-border-l2, rgba(127, 127, 127, 0.28));
364
+ border-radius: 8px;
365
+ color: var(--dsw-alias-label-secondary, inherit);
366
+ background: transparent;
367
+ font: inherit;
368
+ font-size: 13px;
369
+ cursor: pointer;
370
+ }
371
+ .mcpConnectorSettingsButton[data-primary="true"] {
372
+ border-color: transparent;
373
+ color: var(--dsw-alias-bg-layer-3, #ffffff);
374
+ background: var(--dsw-alias-label-primary, #111827);
375
+ }
376
+ .mcpConnectorSettingsButton:disabled {
377
+ cursor: default;
378
+ opacity: 0.45;
379
+ }
380
+ @media (max-width: 520px) {
381
+ .mcpConnectorSettingsRow { grid-template-columns: 1fr; }
382
+ .mcpConnectorSettingsFooter .mcpConnectorSettingsButton { flex: 1 1 140px; }
383
+ }
221
384
  `;
222
385
  const SIDEBAR_WORKSPACES_SELECTOR = '[data-slot="sidebar.workspaces"]';
223
386
  const TOP_MOUNT_SELECTOR = '[data-mcp-connector-top-mount="true"]';
224
387
 
225
- function installSidebarStyles() {
226
- if (document.querySelector(`style[data-plugin="${SIDEBAR_STYLE_ID}"]`) !== null) return () => {};
388
+ function installStyles(id, css) {
389
+ if (document.querySelector(`style[data-plugin="${id}"]`) !== null) return () => {};
227
390
  const style = document.createElement("style");
228
- style.dataset.plugin = SIDEBAR_STYLE_ID;
229
- style.textContent = sidebarCss;
391
+ style.dataset.plugin = id;
392
+ style.textContent = css;
230
393
  document.head.append(style);
231
394
  return () => { style.remove(); };
232
395
  }
233
396
 
397
+ function installSidebarStyles() {
398
+ return installStyles(SIDEBAR_STYLE_ID, sidebarCss);
399
+ }
400
+
401
+ function installOverlayStyles() {
402
+ return installStyles(OVERLAY_STYLE_ID, overlayCss);
403
+ }
404
+
405
+ function installSettingsStyles() {
406
+ return installStyles(SETTINGS_STYLE_ID, settingsCss);
407
+ }
408
+
234
409
  /**
235
410
  * DSH rc.7 没有公开的「新会话与工作区之间」插槽。插件仍注册在公开的
236
411
  * footer list slot 中保证生命周期与降级可用,再把实际按钮 Portal 到
@@ -548,17 +723,24 @@ window.__ModuleLoader__.load({
548
723
  * 包名或客户端模块到达顺序让整个 Desktop 进入 Safe Mode。
549
724
  */
550
725
  function createMarketViewStore() {
726
+ let sidebarVisible = true;
727
+ const liveActions = new Set();
551
728
  const spec = {
552
- init: () => ({ open: false, detailOpen: false }),
729
+ init: () => ({ open: false, detailOpen: false, sidebarVisible }),
553
730
  actions: {
554
731
  open: (draft) => { draft.open = true; },
555
732
  close: (draft) => { draft.open = false; draft.detailOpen = false; },
556
733
  detailOpened: (draft) => { draft.detailOpen = true; },
557
- detailClosed: (draft) => { draft.detailOpen = false; }
734
+ detailClosed: (draft) => { draft.detailOpen = false; },
735
+ setSidebarVisible: (draft, visible) => { draft.sidebarVisible = visible !== false; }
558
736
  }
559
737
  };
560
738
  return {
561
739
  spec,
740
+ syncSidebarVisible(visible) {
741
+ sidebarVisible = visible !== false;
742
+ for (const actions of liveActions) actions.setSidebarVisible(sidebarVisible);
743
+ },
562
744
  create() {
563
745
  let state = spec.init();
564
746
  const listeners = new Set();
@@ -571,6 +753,7 @@ window.__ModuleLoader__.load({
571
753
  for (const listener of listeners) listener();
572
754
  };
573
755
  }
756
+ liveActions.add(actions);
574
757
  return {
575
758
  actions,
576
759
  getSnapshot: () => state,
@@ -578,12 +761,216 @@ window.__ModuleLoader__.load({
578
761
  listeners.add(listener);
579
762
  return () => { listeners.delete(listener); };
580
763
  },
581
- clearPersisted() {}
764
+ clearPersisted() {
765
+ liveActions.delete(actions);
766
+ listeners.clear();
767
+ }
582
768
  };
583
769
  }
584
770
  };
585
771
  }
586
772
 
773
+ function resolveSidebarVisible(snapshot) {
774
+ return snapshot?.status === "ready"
775
+ ? snapshot.value?.[SHOW_SIDEBAR_ENTRY_FIELD] !== false
776
+ : true;
777
+ }
778
+
779
+ function connectorSettingsCopy() {
780
+ const language = document.documentElement?.lang || window.navigator?.language || "zh";
781
+ if (String(language).toLowerCase().startsWith("en")) {
782
+ return {
783
+ title: "MCP Connector",
784
+ description: "Control how the MCP Connector is opened.",
785
+ show: "Show MCP Connector in the sidebar",
786
+ hint: "Turning this off only hides the shortcut. Connected MCP servers and tools remain available.",
787
+ visible: "The sidebar shortcut is visible.",
788
+ hidden: "The shortcut is hidden. You can still open MCP Connector here.",
789
+ readOnly: "This settings page is read-only.",
790
+ saving: "Saving…",
791
+ failed: "The setting was not saved. Please try again.",
792
+ reset: "Reset",
793
+ open: "Open MCP Connector",
794
+ expand: "Expand MCP Connector settings",
795
+ collapse: "Collapse MCP Connector settings"
796
+ };
797
+ }
798
+ return {
799
+ title: "MCP连接器",
800
+ description: "控制侧边栏入口和快捷打开方式。",
801
+ show: "在侧边栏显示 MCP连接器",
802
+ hint: "关闭后只隐藏入口,不影响已连接的 MCP Server 和工具。",
803
+ visible: "侧边栏入口当前显示。",
804
+ hidden: "入口已隐藏,仍可从这里打开 MCP连接器。",
805
+ readOnly: "当前设置页只读。",
806
+ saving: "正在保存…",
807
+ failed: "设置未保存,请重试。",
808
+ reset: "恢复默认",
809
+ open: "打开 MCP连接器",
810
+ expand: "展开 MCP连接器设置",
811
+ collapse: "收起 MCP连接器设置"
812
+ };
813
+ }
814
+
815
+ function ConnectorSettingsCard(props) {
816
+ const { settingsScope, actions } = props;
817
+ const copy = connectorSettingsCopy();
818
+ const snapshot = (0, react.useSyncExternalStore)(
819
+ (listener) => settingsScope.subscribe(listener),
820
+ () => settingsScope.getSnapshot()
821
+ );
822
+ const [open, setOpen] = (0, react.useState)(false);
823
+ const [saving, setSaving] = (0, react.useState)(false);
824
+ const [failed, setFailed] = (0, react.useState)(false);
825
+ if (snapshot.status !== "ready") return null;
826
+ const visible = resolveSidebarVisible(snapshot);
827
+ const writable = snapshot.writable === true;
828
+ const overridden = snapshot.user !== null
829
+ && typeof snapshot.user === "object"
830
+ && Object.prototype.hasOwnProperty.call(snapshot.user, SHOW_SIDEBAR_ENTRY_FIELD);
831
+
832
+ const save = async (next) => {
833
+ setSaving(true);
834
+ setFailed(false);
835
+ try {
836
+ await settingsScope.set(SHOW_SIDEBAR_ENTRY_FIELD, next);
837
+ const confirmed = settingsScope.getSnapshot();
838
+ setFailed(confirmed.status !== "ready" || resolveSidebarVisible(confirmed) !== next);
839
+ } catch (error) {
840
+ console.error("[mcp-connector] sidebar setting update failed:", error);
841
+ setFailed(true);
842
+ } finally {
843
+ setSaving(false);
844
+ }
845
+ };
846
+
847
+ const reset = async () => {
848
+ setSaving(true);
849
+ setFailed(false);
850
+ try {
851
+ await settingsScope.unset(SHOW_SIDEBAR_ENTRY_FIELD);
852
+ const confirmed = settingsScope.getSnapshot();
853
+ const stillOverridden = confirmed.user !== null
854
+ && typeof confirmed.user === "object"
855
+ && Object.prototype.hasOwnProperty.call(confirmed.user, SHOW_SIDEBAR_ENTRY_FIELD);
856
+ setFailed(confirmed.status !== "ready" || stillOverridden);
857
+ } catch (error) {
858
+ console.error("[mcp-connector] sidebar setting reset failed:", error);
859
+ setFailed(true);
860
+ } finally {
861
+ setSaving(false);
862
+ }
863
+ };
864
+
865
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
866
+ className: "mcpConnectorSettingsCard",
867
+ "data-open": open,
868
+ children: [
869
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
870
+ type: "button",
871
+ className: "mcpConnectorSettingsHeader",
872
+ "aria-expanded": open,
873
+ "aria-label": open ? copy.collapse : copy.expand,
874
+ onClick: () => { setOpen(!open); },
875
+ children: [
876
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
877
+ className: "mcpConnectorSettingsHeadText",
878
+ children: [
879
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "mcpConnectorSettingsName", children: copy.title }),
880
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "mcpConnectorSettingsDescription", children: copy.description })
881
+ ]
882
+ }),
883
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "mcpConnectorSettingsChevron", "aria-hidden": true, children: "⌄" })
884
+ ]
885
+ }),
886
+ open ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
887
+ className: "mcpConnectorSettingsBody",
888
+ children: [
889
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
890
+ className: "mcpConnectorSettingsRow",
891
+ children: [
892
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
893
+ htmlFor: "mcp-connector-show-sidebar-entry",
894
+ children: [
895
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "mcpConnectorSettingsLabel", children: copy.show }),
896
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "mcpConnectorSettingsHint", children: copy.hint })
897
+ ]
898
+ }),
899
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
900
+ id: "mcp-connector-show-sidebar-entry",
901
+ className: "mcpConnectorSettingsSwitch",
902
+ type: "checkbox",
903
+ role: "switch",
904
+ "aria-checked": visible,
905
+ checked: visible,
906
+ disabled: !writable || saving,
907
+ onChange: (event) => { void save(event.target.checked); }
908
+ })
909
+ ]
910
+ }),
911
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
912
+ className: "mcpConnectorSettingsFooter",
913
+ children: [
914
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
915
+ className: "mcpConnectorSettingsState",
916
+ "data-tone": failed ? "error" : "normal",
917
+ role: failed ? "alert" : "status",
918
+ children: failed ? copy.failed : saving ? copy.saving : !writable ? copy.readOnly : visible ? copy.visible : copy.hidden
919
+ }),
920
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
921
+ type: "button",
922
+ className: "mcpConnectorSettingsButton",
923
+ disabled: !writable || saving || !overridden,
924
+ onClick: () => { void reset(); },
925
+ children: copy.reset
926
+ }),
927
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
928
+ type: "button",
929
+ className: "mcpConnectorSettingsButton",
930
+ "data-primary": true,
931
+ "aria-haspopup": "dialog",
932
+ onClick: () => { actions.open(); },
933
+ children: copy.open
934
+ })
935
+ ]
936
+ })
937
+ ]
938
+ }) : null
939
+ ]
940
+ });
941
+ }
942
+
943
+ function installClientSettings(ctx, marketView) {
944
+ if (typeof ctx.inject !== "function") return;
945
+ ctx.inject(["settingsScope"], (settingsCtx) => {
946
+ const settingsScope = settingsCtx.settingsScope.bind({
947
+ namespace: CONNECTOR_SETTINGS_NAMESPACE,
948
+ decode(value) {
949
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
950
+ return typeof value[SHOW_SIDEBAR_ENTRY_FIELD] === "boolean"
951
+ ? { [SHOW_SIDEBAR_ENTRY_FIELD]: value[SHOW_SIDEBAR_ENTRY_FIELD] }
952
+ : void 0;
953
+ }
954
+ });
955
+ settingsCtx.effect(() => {
956
+ const sync = () => { marketView.syncSidebarVisible(resolveSidebarVisible(settingsScope.getSnapshot())); };
957
+ sync();
958
+ const unsubscribe = settingsScope.subscribe(sync);
959
+ return () => {
960
+ unsubscribe();
961
+ marketView.syncSidebarVisible(true);
962
+ };
963
+ }, "mcp-connector: sidebar visibility setting");
964
+ settingsCtx.effect(() => installSettingsStyles(), "mcp-connector: settings styles");
965
+ settingsCtx.slots.inject("settings.plugin.item", () => settingsCtx.slots.register({
966
+ name: "settings.plugin.item",
967
+ key: CONNECTOR_SETTINGS_NAMESPACE,
968
+ store: marketView,
969
+ inject: () => ({ settingsScope })
970
+ }, ConnectorSettingsCard));
971
+ });
972
+ }
973
+
587
974
  /**
588
975
  * 用 DSH 自身的工作区/会话/输入机把示例 Prompt 带入新会话。
589
976
  * connectWorkspace 与 DSH 的「新会话」按钮同源:优先复用当前工作区的
@@ -815,10 +1202,14 @@ window.__ModuleLoader__.load({
815
1202
  }, [open, updateOperation?.operationId, updateProviderSelection?.provider?.id, expectedUpdateVersion]);
816
1203
  (0, react.useEffect)(() => {
817
1204
  if (!open) return void 0;
1205
+ const opener = document.activeElement;
818
1206
  closeRef.current?.focus?.();
819
1207
  const onKeyDown = (event) => { if (event.key === "Escape") actions.close(); };
820
1208
  window.addEventListener("keydown", onKeyDown);
821
- return () => { window.removeEventListener("keydown", onKeyDown); };
1209
+ return () => {
1210
+ window.removeEventListener("keydown", onKeyDown);
1211
+ if (opener?.isConnected !== false) opener?.focus?.();
1212
+ };
822
1213
  }, [open, actions]);
823
1214
  if (!open) return null;
824
1215
  const updateRunning = updateStarting || updateOperation !== null && ["queued", "running"].includes(updateOperation.state);
@@ -1188,8 +1579,14 @@ window.__ModuleLoader__.load({
1188
1579
  function SidebarEntry(props) {
1189
1580
  const { wide, useStore, actions } = props;
1190
1581
  const open = useStore((state) => state.open);
1582
+ const visible = useStore((state) => state.sidebarVisible !== false);
1191
1583
  const [topMount, setTopMount] = (0, react.useState)(null);
1192
1584
  (0, react.useEffect)(() => {
1585
+ if (!visible) {
1586
+ setTopMount(null);
1587
+ return void 0;
1588
+ }
1589
+ const removeStyles = installSidebarStyles();
1193
1590
  let disposed = false;
1194
1591
  const ownedMounts = new Set();
1195
1592
  const syncMount = () => {
@@ -1208,8 +1605,10 @@ window.__ModuleLoader__.load({
1208
1605
  disposed = true;
1209
1606
  observer?.disconnect();
1210
1607
  for (const mount of ownedMounts) mount.remove();
1608
+ removeStyles();
1211
1609
  };
1212
- }, []);
1610
+ }, [visible]);
1611
+ if (!visible) return null;
1213
1612
  const launcher = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1214
1613
  type: "button",
1215
1614
  className: "mcpConnectorLauncher",
@@ -1232,7 +1631,8 @@ window.__ModuleLoader__.load({
1232
1631
  console.log('[mcp-connector] client apply() called');
1233
1632
  try {
1234
1633
  const marketView = createMarketViewStore();
1235
- ctx.effect(() => installSidebarStyles(), "mcp-connector: sidebar styles");
1634
+ ctx.effect(() => installOverlayStyles(), "mcp-connector: overlay styles");
1635
+ installClientSettings(ctx, marketView);
1236
1636
 
1237
1637
  // 弹框:注册到 shell.overlay(类似社区插件市场)
1238
1638
  ctx.slots.inject("shell.overlay", () => {
package/lib/index.js CHANGED
@@ -62,6 +62,7 @@ import {
62
62
  scopeLabel,
63
63
  scopeTargets,
64
64
  } from './connection-scopes.js';
65
+ import { installConnectorSettings } from './settings.js';
65
66
 
66
67
  export const name = 'mcp-connector';
67
68
 
@@ -105,9 +106,12 @@ export const Config = z.object({
105
106
  openBrowser: z.boolean().default(true),
106
107
  /** 授权账号标识(预留多账号) */
107
108
  account: z.string().default(DEFAULT_ACCOUNT),
109
+ /** 是否在 DSH 主侧边栏显示 MCP连接器快捷入口 */
110
+ showSidebarEntry: z.boolean().default(true),
108
111
  });
109
112
 
110
113
  export async function apply(ctx, config) {
114
+ installConnectorSettings(ctx, config);
111
115
  const logger = ctx.logger('mcp-connector');
112
116
  const versionStatusService = createVersionStatusService({
113
117
  timeoutMs: config.requestTimeoutMs,
@@ -0,0 +1,24 @@
1
+ import z from '@deepseek-ai/schemastery';
2
+
3
+ export const CONNECTOR_SETTINGS_NAMESPACE = 'mcp-connector';
4
+ export const SHOW_SIDEBAR_ENTRY_FIELD = 'showSidebarEntry';
5
+
6
+ export const ConnectorSettings = z.object({
7
+ [SHOW_SIDEBAR_ENTRY_FIELD]: z.boolean().default(true),
8
+ });
9
+
10
+ /**
11
+ * Register the connector's user-facing settings only while a Settings provider
12
+ * is present. The provider owns persistence; older DSH hosts keep the composed
13
+ * config and continue loading the connector normally.
14
+ */
15
+ export function installConnectorSettings(ctx, config = {}) {
16
+ if (typeof ctx.inject !== 'function') return;
17
+ ctx.inject(['settings'], (settingsCtx) => {
18
+ settingsCtx.settings.register(CONNECTOR_SETTINGS_NAMESPACE, ConnectorSettings, {
19
+ base: {
20
+ [SHOW_SIDEBAR_ENTRY_FIELD]: config[SHOW_SIDEBAR_ENTRY_FIELD] !== false,
21
+ },
22
+ });
23
+ });
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mcp-connector",
3
- "version": "0.2.37",
3
+ "version": "0.2.38",
4
4
  "description": "DeepSeek Harness MCP Connector and MCP Server marketplace with over one hundred MCP connectors, continuously updated. Discover, authorize, and manage connections in one place; supports OAuth 2.0 PKCE, API keys, stdio/HTTP, mcpServers JSON import, and tool and prompt discovery. Maintained by Qichacha/QCC.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -41,7 +41,7 @@
41
41
  ],
42
42
  "scripts": {
43
43
  "test": "node --test",
44
- "lint": "node --check lib/index.js && node --check lib/web.js && node --check lib/client.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-scopes.js && node --check lib/governance.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/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/build-registry.mjs && node --check scripts/ui-harness.mjs && node --check scripts/check-market-registration.mjs && node --check scripts/check-readme-version.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",
44
+ "lint": "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-scopes.js && node --check lib/governance.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/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/build-registry.mjs && node --check scripts/ui-harness.mjs && node --check scripts/check-market-registration.mjs && node --check scripts/check-readme-version.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",
45
45
  "registry:build": "node scripts/build-registry.mjs",
46
46
  "registry:validate": "node scripts/probe-connector.mjs catalog/catalog.json --validate-only",
47
47
  "dev:ui": "node scripts/ui-harness.mjs",