@sunshaobei/dsh-mcp-manager 3.2.1 → 3.3.0
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/README.en.md +33 -27
- package/README.md +32 -26
- package/lib/client/core/constants.d.ts +1 -0
- package/lib/client/core/state.d.ts +2 -0
- package/lib/client/embed/panel.d.ts +14 -0
- package/lib/client/embed/view.d.ts +20 -0
- package/lib/client/embed/workspaces.d.ts +18 -0
- package/lib/client/float/import-file.d.ts +18 -0
- package/lib/client/locales.d.ts +8 -0
- package/lib/client.js +469 -16
- package/lib/index.js +59 -8
- package/lib/server/api/routes-controllers.d.ts +7 -0
- package/lib/server/config/impl/ui/type.d.ts +6 -0
- package/lib/server/connection/interface.d.ts +6 -0
- package/lib/server/connection/orchestrator/manager.d.ts +6 -0
- package/lib/shared/dto.d.ts +6 -0
- package/lib/shared/routes.d.ts +3 -2
- package/package.json +4 -4
package/README.en.md
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
# dsh-mcp-manager
|
|
2
|
-
[](https://www.npmjs.com/package/dsh-mcp-manager)
|
|
3
|
-
[: a floating
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
# @sunshaobei/dsh-mcp-manager
|
|
2
|
+
[](https://www.npmjs.com/package/@sunshaobei/dsh-mcp-manager)
|
|
3
|
+
[](https://github.com/sunshaobei/dsh-mcp-manager/releases)
|
|
4
|
+
|
|
5
|
+
A **MCP server management plugin** for DSH (DeepSeek Harness): a top-right floating pill,
|
|
6
|
+
a left-sidebar entry, and a settings-page entry (each independently switchable); the full
|
|
7
|
+
panel can pick a workspace; quick onboarding supports pasted `mcpServers` JSON and
|
|
8
|
+
**one-click import from a local mcp.json file (merged with existing content)**, with
|
|
9
|
+
**no servers preconfigured**. Connection and protocol come from the host's own MCP client
|
|
10
|
+
(mounted by name through the cordis loader, resolved to the copy inside the DSH
|
|
11
|
+
installation); this plugin keeps only the configuration surface and the model-visible
|
|
12
|
+
surface. The client is not redistributed with this package, and nothing extra needs to be
|
|
13
|
+
installed.
|
|
12
14
|
|
|
13
15
|
The model surface carries exactly four atomic tools (`ws_mcp_list` / `ws_mcp_detail` /
|
|
14
16
|
`ws_mcp_search` / `ws_mcp_call`): project-level, global and runtime-injected
|
|
@@ -32,7 +34,7 @@ them has no effect, and this plugin never rewrites your config file.)
|
|
|
32
34
|
## Quick install
|
|
33
35
|
|
|
34
36
|
```sh
|
|
35
|
-
dsh plugin --profile web add dsh-mcp-manager
|
|
37
|
+
dsh plugin --profile web add @sunshaobei/dsh-mcp-manager
|
|
36
38
|
```
|
|
37
39
|
|
|
38
40
|
> After install / uninstall / update, **restart `dsh web` once** (bundle layers are only composed at startup) for changes to take effect.
|
|
@@ -73,19 +75,19 @@ without a global install, see "Without a global dsh install" below).
|
|
|
73
75
|
### Install plugins (add)
|
|
74
76
|
|
|
75
77
|
```sh
|
|
76
|
-
dsh plugin --profile web add dsh-mcp-manager
|
|
78
|
+
dsh plugin --profile web add @sunshaobei/dsh-mcp-manager
|
|
77
79
|
```
|
|
78
80
|
|
|
79
81
|
### Uninstall plugins (remove)
|
|
80
82
|
|
|
81
83
|
```sh
|
|
82
|
-
dsh plugin --profile web remove dsh-mcp-manager
|
|
84
|
+
dsh plugin --profile web remove @sunshaobei/dsh-mcp-manager
|
|
83
85
|
```
|
|
84
86
|
|
|
85
87
|
### Update plugins (update)
|
|
86
88
|
|
|
87
89
|
```sh
|
|
88
|
-
dsh plugin --profile web update dsh-mcp-manager
|
|
90
|
+
dsh plugin --profile web update @sunshaobei/dsh-mcp-manager
|
|
89
91
|
```
|
|
90
92
|
|
|
91
93
|
> After install / uninstall / update, **restart `dsh web` once** (bundle layers are only
|
|
@@ -96,7 +98,7 @@ dsh plugin --profile web update dsh-mcp-manager
|
|
|
96
98
|
Omitting `@version` installs the default latest (recommended). Only when the registry has not synced the latest yet, or the latest has issues in your environment, append `@version` to the package name:
|
|
97
99
|
|
|
98
100
|
```sh
|
|
99
|
-
dsh plugin --profile web add dsh-mcp-manager@<version>
|
|
101
|
+
dsh plugin --profile web add @sunshaobei/dsh-mcp-manager@<version>
|
|
100
102
|
```
|
|
101
103
|
|
|
102
104
|
### Without a global dsh install
|
|
@@ -105,9 +107,9 @@ If there is no global `dsh` command on the machine, use `npx` to run it on the f
|
|
|
105
107
|
calls `pnpm` under the hood, so `pnpm` and `Node.js` must still be installed locally):
|
|
106
108
|
|
|
107
109
|
```sh
|
|
108
|
-
npx @deepseek-ai/dsh plugin --profile web add dsh-mcp-manager
|
|
109
|
-
npx @deepseek-ai/dsh plugin --profile web remove dsh-mcp-manager
|
|
110
|
-
npx @deepseek-ai/dsh plugin --profile web update dsh-mcp-manager
|
|
110
|
+
npx @deepseek-ai/dsh plugin --profile web add @sunshaobei/dsh-mcp-manager
|
|
111
|
+
npx @deepseek-ai/dsh plugin --profile web remove @sunshaobei/dsh-mcp-manager
|
|
112
|
+
npx @deepseek-ai/dsh plugin --profile web update @sunshaobei/dsh-mcp-manager
|
|
111
113
|
```
|
|
112
114
|
|
|
113
115
|
## Capabilities
|
|
@@ -119,7 +121,7 @@ npx @deepseek-ai/dsh plugin --profile web update dsh-mcp-manager
|
|
|
119
121
|
| Tiered display | Running / Connecting / Reconnecting / Disconnected / Disabled / Failed; each server shows transport, endpoint, and tool count |
|
|
120
122
|
| Server management | CRUD (project-level/global optional), connect / disconnect / reconnect; versioned JSON config, atomic write |
|
|
121
123
|
| Two transports | stdio (local subprocess, env supports `${ENV}` references) and streamable-http (remote, header supports `${ENV}` references, auto-echoes `Mcp-Session-Id`) |
|
|
122
|
-
| JSON import | Paste `mcpServers` JSON text to import
|
|
124
|
+
| JSON import | Paste `mcpServers` JSON text to import; each mcp.json source on Quick add has an **Import** button that reads a local JSON file and merges it (same-name keeps existing, new names are appended, other top-level keys preserved) |
|
|
123
125
|
| Model tools | Every server (project-level / global / runtime-injected) goes through the same four atomic middleware tools: `ws_mcp_list` / `ws_mcp_detail` / `ws_mcp_search` / `ws_mcp_call`, so workspaces never clash; the host registration name `mcp__<id>__<tool>` (`id` allocated at random per (workspace, server), stable within one assembly, opaque; names still obey the 64-char / `[A-Za-z0-9_-]` / hashed-suffix-on-conflict rules) is internal only — it is removed from the model's tool list and must never be called directly |
|
|
124
126
|
| Workspace isolation | The middleware routes by the calling session's cwd to the matching workspace connection pool; server full-name consistency checks (`@<root>/<server>`) prevent cross-workspace crosstalk |
|
|
125
127
|
| Reconnection | Exponential backoff (starts at 500ms, caps at 30s, gives up after 10 attempts and deregisters the tools) |
|
|
@@ -133,7 +135,7 @@ Configuration page: **Plugin Manager → dsh-mcp-manager → Configure**. The fl
|
|
|
133
135
|
(MCP pill) position and offsets (`position` / `offset`) are saved there through the plugin's
|
|
134
136
|
own `Config`; no config-file editing is needed.
|
|
135
137
|
|
|
136
|
-
> Non-loopback LAN origins (for example `192.168.*:3081`) intentionally do not expose a persistent settings surface, so the Configure control is hidden by DSH's security policy. Manage settings from `127.0.0.1:3080` / `127.0.0.1:3081` or an SSH loopback tunnel.
|
|
138
|
+
> Non-loopback LAN origins (for example `192.168.*:3081`) intentionally do not expose a persistent settings surface, so the Configure control is hidden by DSH's security policy. Manage settings from `127.0.0.1:3080` / `127.0.0.1:3081` or an SSH loopback tunnel.
|
|
137
139
|
|
|
138
140
|
| Key | Allowed values | Default |
|
|
139
141
|
| --- | --- | --- |
|
|
@@ -142,6 +144,14 @@ own `Config`; no config-file editing is needed.
|
|
|
142
144
|
| `offset.y` | Non-negative integer (vertical offset, px) | `8` |
|
|
143
145
|
| `offset.blankY` | Non-negative integer (blank-session vertical offset, px) | `40` |
|
|
144
146
|
| `zIndexBase` | Integer, clamped to 1-9000 (floating window z-index base; **the pill and the main panel opened on click both use this same config value**; the modal manager panel is unaffected) | `10` |
|
|
147
|
+
| `showFloat` | Top-right floating pill (follows the current session workspace) | `true` |
|
|
148
|
+
| `showSidebar` | Left-sidebar entry (full manager panel) | `false` |
|
|
149
|
+
| `showSettings` | Settings-page entry (full manager panel) | `false` |
|
|
150
|
+
|
|
151
|
+
The three switches are independent: the floating pill follows the current session
|
|
152
|
+
workspace, while the sidebar/settings panels carry a **workspace selector** ("global only"
|
|
153
|
+
plus registered workspaces) and do not follow the session. Unchecking a switch disposes the
|
|
154
|
+
corresponding slot registration (not a hidden DOM); changes apply immediately over SSE.
|
|
145
155
|
|
|
146
156
|
#### Settings namespace
|
|
147
157
|
|
|
@@ -162,12 +172,8 @@ the viewport in JS (safe-area semantics: the host has no `viewport-fit=cover`, s
|
|
|
162
172
|
the on-screen keyboard is followed via `visualViewport` resize, and orientation changes
|
|
163
173
|
recompute on the next frame.
|
|
164
174
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
dsh-provider-usage's usage capsule relies on that default position with `offsetY: 48`
|
|
168
|
-
to sit right below it (no overlap by default). Changing this plugin's default anchor /
|
|
169
|
-
vertical offsets breaks that avoidance — treat it as a cross-package behavioral contract
|
|
170
|
-
and adjust provider-usage defaults in lockstep before reverting.
|
|
175
|
+
The pill defaults to `top-right`, 8px from the top; both anchor and offsets are editable
|
|
176
|
+
in the settings page and do not depend on any other plugin's convention.
|
|
171
177
|
|
|
172
178
|
Saving in the settings page takes effect immediately, **without restarting dsh web** and
|
|
173
179
|
without manually refreshing the page: the host pushes a frame over the existing SSE events
|
package/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
# dsh-mcp-manager
|
|
2
|
-
[](https://www.npmjs.com/package/dsh-mcp-manager)
|
|
3
|
-
[](https://www.npmjs.com/package/@sunshaobei/dsh-mcp-manager)
|
|
3
|
+
[](https://github.com/sunshaobei/dsh-mcp-manager/releases)
|
|
4
4
|
|
|
5
|
-
DSH(DeepSeek Harness)的 **MCP
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
DSH(DeepSeek Harness)的 **MCP 服务器管理插件**:右上角浮窗、左侧导航入口、设置页入口
|
|
6
|
+
三选多开(各自可关);完整管理面板可选工作区;快速接入支持 JSON 文本粘贴与
|
|
7
|
+
**本地 mcp.json 文件一键导入(与已有内容合并)**,**不预设任何服务器**。
|
|
8
|
+
连接与协议交宿主自带的 MCP 客户端(cordis loader 按包名装载到 dsh 安装内的副本),
|
|
9
|
+
本插件只留配置面与模型可见面;客户端不随包分发,也无需额外安装。
|
|
8
10
|
|
|
9
11
|
模型可见面只有四个原子工具(`ws_mcp_list` / `ws_mcp_detail` / `ws_mcp_search` /
|
|
10
12
|
`ws_mcp_call`):项目级、全局级与运行时注入的封装定义条目**一律经中间层访问**,两级发现
|
|
@@ -22,7 +24,7 @@ root `@global`。宿主仍按 `mcp__<id>__<tool>` 注册工具(`id` 是本次
|
|
|
22
24
|
## 一键安装
|
|
23
25
|
|
|
24
26
|
```sh
|
|
25
|
-
dsh plugin --profile web add dsh-mcp-manager
|
|
27
|
+
dsh plugin --profile web add @sunshaobei/dsh-mcp-manager
|
|
26
28
|
```
|
|
27
29
|
|
|
28
30
|
> 安装 / 卸载 / 更新后都需**重启一次** `dsh web`(bundle 层只在启动时组合)生效。
|
|
@@ -54,19 +56,19 @@ dsh plugin --profile web add dsh-mcp-manager
|
|
|
54
56
|
### 安装插件(add)
|
|
55
57
|
|
|
56
58
|
```sh
|
|
57
|
-
dsh plugin --profile web add dsh-mcp-manager
|
|
59
|
+
dsh plugin --profile web add @sunshaobei/dsh-mcp-manager
|
|
58
60
|
```
|
|
59
61
|
|
|
60
62
|
### 卸载插件(remove)
|
|
61
63
|
|
|
62
64
|
```sh
|
|
63
|
-
dsh plugin --profile web remove dsh-mcp-manager
|
|
65
|
+
dsh plugin --profile web remove @sunshaobei/dsh-mcp-manager
|
|
64
66
|
```
|
|
65
67
|
|
|
66
68
|
### 更新插件(update)
|
|
67
69
|
|
|
68
70
|
```sh
|
|
69
|
-
dsh plugin --profile web update dsh-mcp-manager
|
|
71
|
+
dsh plugin --profile web update @sunshaobei/dsh-mcp-manager
|
|
70
72
|
```
|
|
71
73
|
|
|
72
74
|
> 安装 / 卸载 / 更新后都需**重启一次** `dsh web`(bundle 层只在启动时组合)生效。
|
|
@@ -76,7 +78,7 @@ dsh plugin --profile web update dsh-mcp-manager
|
|
|
76
78
|
省略 `@版本号` 即安装默认 latest(推荐)。仅当 registry 尚未同步到最新、或最新版在你的环境有问题时,在包名后追加 `@版本号`:
|
|
77
79
|
|
|
78
80
|
```sh
|
|
79
|
-
dsh plugin --profile web add dsh-mcp-manager@<版本号>
|
|
81
|
+
dsh plugin --profile web add @sunshaobei/dsh-mcp-manager@<版本号>
|
|
80
82
|
```
|
|
81
83
|
|
|
82
84
|
### 未全局安装 dsh
|
|
@@ -84,9 +86,9 @@ dsh plugin --profile web add dsh-mcp-manager@<版本号>
|
|
|
84
86
|
若本机没有全局 `dsh` 命令,用 `npx` 临时拉起(底层调用 `pnpm`,仍需本机装好 `pnpm` 与 `Node.js`):
|
|
85
87
|
|
|
86
88
|
```sh
|
|
87
|
-
npx @deepseek-ai/dsh plugin --profile web add dsh-mcp-manager
|
|
88
|
-
npx @deepseek-ai/dsh plugin --profile web remove dsh-mcp-manager
|
|
89
|
-
npx @deepseek-ai/dsh plugin --profile web update dsh-mcp-manager
|
|
89
|
+
npx @deepseek-ai/dsh plugin --profile web add @sunshaobei/dsh-mcp-manager
|
|
90
|
+
npx @deepseek-ai/dsh plugin --profile web remove @sunshaobei/dsh-mcp-manager
|
|
91
|
+
npx @deepseek-ai/dsh plugin --profile web update @sunshaobei/dsh-mcp-manager
|
|
90
92
|
```
|
|
91
93
|
|
|
92
94
|
## 能力
|
|
@@ -98,7 +100,7 @@ npx @deepseek-ai/dsh plugin --profile web update dsh-mcp-manager
|
|
|
98
100
|
| 分级展示 | 运行中 / 连接中 / 重连中 / 未连接 / 已停用 / 失败;每台显示传输、端点、工具数;客户端未知状态按「未连接」投影、不丢卡(C13 统一口径) |
|
|
99
101
|
| 服务器管理 | 增删改查(可选项目级/全局)、连接 / 断开 / 重连;配置版本化 JSON,原子写入 |
|
|
100
102
|
| 两种传输 | stdio(本地子进程,env 支持 `${ENV}` 引用)与 streamable-http(远程,header 支持 `${ENV}` 引用,自动回传 `Mcp-Session-Id`) |
|
|
101
|
-
| JSON 导入 | 粘贴 mcpServers JSON
|
|
103
|
+
| JSON 导入 | 粘贴 mcpServers JSON 文本导入;快速接入每个 mcp.json 来源新增「导入」按钮,选择本地 JSON 文件后与已有内容合并(同名保留已有,新名追加,保留其它顶层键) |
|
|
102
104
|
| 模型工具 | 全部服务器(项目级 / 全局 / runtime 注入)一律经中间层四个原子工具访问:`ws_mcp_list` / `ws_mcp_detail` / `ws_mcp_search` / `ws_mcp_call`,不同工作空间互不冲突;宿主注册名 `mcp__<id>__<tool>`(`id` 按 (工作空间, 服务器名) 随机分配、同一次装配内稳定、不透明;工具名仍受 64 字符 / `[A-Za-z0-9_-]` / 冲突哈希后缀约束)会被从模型工具列表摘除——模型不可见、不得直呼 |
|
|
103
105
|
| 工作空间隔离 | 中间层按调用方会话当前 cwd 路由到对应工作空间的连接池;server 全名 `@<root>/<server>` 一致性校验防跨空间串台 |
|
|
104
106
|
| 断线重连 | 有界指数退避(500ms 起、30s 上限、10 次后停止后台重试;用户手动连接或 ws_mcp_call 触发可再试) |
|
|
@@ -110,7 +112,7 @@ npx @deepseek-ai/dsh plugin --profile web update dsh-mcp-manager
|
|
|
110
112
|
|
|
111
113
|
配置页入口:**Plugin Manager → dsh-mcp-manager → Configure**。浮窗按钮(MCP 胶囊)的位置与偏移(`position` / `offset`)在此保存,canonical row id 为 `dsh-mcp-manager`,settings namespace 为 `dsh-mcp-manager`,保存后即时生效。
|
|
112
114
|
|
|
113
|
-
> 非回环 LAN
|
|
115
|
+
> 非回环 LAN 地址默认不提供持久化设置面,Configure 按钮按 DSH 安全策略隐藏;请从 `127.0.0.1:3080` / `127.0.0.1:3081` 或 SSH 回环隧道管理。
|
|
114
116
|
|
|
115
117
|
| 键 | 值域 | 默认 |
|
|
116
118
|
| --- | --- | --- |
|
|
@@ -119,6 +121,13 @@ npx @deepseek-ai/dsh plugin --profile web update dsh-mcp-manager
|
|
|
119
121
|
| `offset.y` | 非负整数(垂直偏移,单位 px) | `8` |
|
|
120
122
|
| `offset.blankY` | 非负整数(空白会话垂直偏移,单位 px) | `40` |
|
|
121
123
|
| `zIndexBase` | 整数,clamp 到 1–9000(浮窗层级基准;**胶囊与点击后弹出的主面板同取该配置值**,模态管理面板不受影响) | `10` |
|
|
124
|
+
| `showFloat` | 右上角浮窗胶囊(跟随当前会话工作区) | `true` |
|
|
125
|
+
| `showSidebar` | 左侧主导航入口(完整管理面板) | `false` |
|
|
126
|
+
| `showSettings` | 设置页入口(完整管理面板) | `false` |
|
|
127
|
+
|
|
128
|
+
三个开关相互独立:浮窗跟随当前会话工作区;左侧导航/设置页面板顶部有**工作区下拉**
|
|
129
|
+
(「仅全局」+ 已登记工作区),不跟随会话,显式选择要管理的项目级配置。取消勾选会
|
|
130
|
+
真正注销对应入口(不是隐藏 DOM),保存后经 SSE 即时生效。
|
|
122
131
|
|
|
123
132
|
#### Settings namespace
|
|
124
133
|
|
|
@@ -134,10 +143,7 @@ DSH 官方 importer 会按同名 section 直接导入 `dsh-mcp-manager`;本插
|
|
|
134
143
|
`env(safe-area-inset-*)` 恒 0 时自然退化为普通 clamp);软键盘弹出经
|
|
135
144
|
`visualViewport` resize 跟随,横竖屏切换后下一帧重算。
|
|
136
145
|
|
|
137
|
-
|
|
138
|
-
8px、高约 26px;dsh-provider-usage 用量胶囊依赖这一默认位置以 `offsetY: 48`
|
|
139
|
-
在其正下方让位(两胶囊默认互不重叠)。修改本插件默认锚点 / 垂直偏移会使该避让
|
|
140
|
-
失效,属跨包行为契约,回退前须同步调整 provider-usage 默认值。
|
|
146
|
+
浮窗默认 `top-right`、距顶 8px;位置与偏移都可在设置页调整,不依赖其它插件约定。
|
|
141
147
|
|
|
142
148
|
在设置页保存后即时生效,**无需重启 dsh web**、也无需手动刷新页面:宿主端经既有
|
|
143
149
|
SSE events 通道推送一变,客户端自动重新拉取 `/api/dsh-mcp/config` 并就地更新浮窗位置。
|
|
@@ -381,10 +387,10 @@ pnpm --filter dsh-mcp-manager test
|
|
|
381
387
|
|
|
382
388
|
MIT
|
|
383
389
|
|
|
384
|
-
##
|
|
390
|
+
## 3.3.0 变更摘要
|
|
385
391
|
|
|
386
|
-
-
|
|
387
|
-
-
|
|
388
|
-
-
|
|
389
|
-
-
|
|
390
|
-
-
|
|
392
|
+
- 新增三个独立入口开关:浮窗 / 左侧导航 / 设置页;浮窗跟随会话,另两个面板可选工作区
|
|
393
|
+
- 新增 `GET /api/dsh-mcp/workspaces`,嵌入面板顶部提供工作区下拉
|
|
394
|
+
- 快速接入的每个 mcp.json 来源新增「导入」:选择本地 JSON 文件,与已有内容合并(同名保留已有)
|
|
395
|
+
- 新增 `showFloat` / `showSidebar` / `showSettings` 配置键;旧配置缺省时按默认值运行
|
|
396
|
+
- 面板头/标签/内容区间距调整;监听 locale 注册失败时继续绑定并回落到自带中文
|
|
@@ -24,6 +24,8 @@ export interface McpState {
|
|
|
24
24
|
card: HTMLElement | undefined;
|
|
25
25
|
/** 模态面板 body 容器。 */
|
|
26
26
|
bodyEl: HTMLElement | undefined;
|
|
27
|
+
/** 当前视图的计数徽标(嵌入面板与模态面板各自持有,避免全局 querySelector 串台)。 */
|
|
28
|
+
countsEl: HTMLElement | undefined;
|
|
27
29
|
/** 模态面板是否打开。 */
|
|
28
30
|
open: boolean;
|
|
29
31
|
/** 打开面板时的焦点归属(R6 关还焦:close 时恢复;非元素/已卸载则跳过)。 */
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-mcp-manager — 左侧导航 / 设置页的完整管理面板(React 外壳 + 命令式视图)。
|
|
3
|
+
*
|
|
4
|
+
* 外壳只负责「拉工作区列表 + 挂载/卸载视图」;服务器列表、连接控制、快速接入
|
|
5
|
+
* 全部复用 float/ 下的现有实现(见 embed/view.ts)。与浮窗的差别只有一点:
|
|
6
|
+
* 这里的工作区由下拉显式选择,不跟随当前会话。
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import type { McpState } from "../core/state.js";
|
|
10
|
+
export declare function EmbeddedMcpPanel({ baseState }: {
|
|
11
|
+
baseState: McpState;
|
|
12
|
+
}): React.ReactElement;
|
|
13
|
+
/** 左侧导航的 MCP 图标(16px 线性网络节点)。 */
|
|
14
|
+
export declare function McpNavIcon(): React.ReactElement;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-mcp-manager — 嵌入面板(左侧导航 / 设置页)的命令式视图装配。
|
|
3
|
+
*
|
|
4
|
+
* 复用现有管理 UI(renderServers / buildQuickAdd / switchTab / refresh),
|
|
5
|
+
* 只是把「模态壳」换成「页面内嵌壳」:头部 + 标签 + body,没有遮罩/关闭按钮。
|
|
6
|
+
* 每个嵌入视图持有自己的 McpState(currentCwd 来自工作区下拉),与浮窗/模态
|
|
7
|
+
* 的会话绑定状态互不串台。
|
|
8
|
+
*/
|
|
9
|
+
import type { McpState, UiActions } from "../core/state.js";
|
|
10
|
+
import type { WorkspaceOption } from "./workspaces.js";
|
|
11
|
+
/** 视图状态:只复用 API/UI 配置与列表字段,不挂浮窗/遮罩。 */
|
|
12
|
+
export declare function createEmbeddedState(base: McpState, cwd: string): McpState;
|
|
13
|
+
/** 为嵌入视图构造动作面:refresh/switchTab 都落回本视图状态。 */
|
|
14
|
+
export declare function createEmbeddedActions(state: McpState, base: UiActions): UiActions;
|
|
15
|
+
/** 构建嵌入视图 DOM;返回清理函数。 */
|
|
16
|
+
export declare function mountManagerView(container: HTMLElement, state: McpState, actions: UiActions, options: {
|
|
17
|
+
workspaces: WorkspaceOption[];
|
|
18
|
+
onWorkspaceChange?: (path: string) => void;
|
|
19
|
+
showClose?: () => void;
|
|
20
|
+
}): () => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-mcp-manager — 嵌入面板的工作区下拉数据源。
|
|
3
|
+
*
|
|
4
|
+
* 宿主 `/api/dsh-mcp/workspaces` 返回 durable workspace registry 的只读投影;
|
|
5
|
+
* 老宿主/夹具没有该路由时回落空数组,客户端只展示「仅全局 + 当前会话」。
|
|
6
|
+
*/
|
|
7
|
+
/** 一个可选工作区(path 是项目级 MCP 配置的路由键)。 */
|
|
8
|
+
export interface WorkspaceOption {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
path: string;
|
|
12
|
+
}
|
|
13
|
+
/** 拉取工作区列表;失败返回空数组(不阻塞面板渲染)。 */
|
|
14
|
+
export declare function loadWorkspaces(): Promise<WorkspaceOption[]>;
|
|
15
|
+
/** 默认选中项:当前会话 cwd 命中 registry 时用它,否则「仅全局」。 */
|
|
16
|
+
export declare function defaultWorkspacePath(currentCwd: string | undefined): string;
|
|
17
|
+
/** 合并当前会话 cwd 到下拉选项(不在 registry 里的目录也要能选中)。 */
|
|
18
|
+
export declare function withCurrentWorkspace(workspaces: WorkspaceOption[], currentCwd: string | undefined): WorkspaceOption[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-mcp-manager — 从文件导入 mcpServers JSON 并合并到已有配置文本。
|
|
3
|
+
*
|
|
4
|
+
* 合并规则(用户契约):
|
|
5
|
+
* - 已有内容必须能解析;不能解析直接报错,不覆盖。
|
|
6
|
+
* - 导入内容接受 `{ mcpServers: { ... } }` 或裸的 `{ name: config }` 映射。
|
|
7
|
+
* - 同名服务器保留**已有**配置,计入 skipped;不同名追加。
|
|
8
|
+
* - 保留已有文件的其它顶层键(如 $schema),只重写 mcpServers。
|
|
9
|
+
*/
|
|
10
|
+
export interface MergeImportResult {
|
|
11
|
+
ok: boolean;
|
|
12
|
+
text?: string;
|
|
13
|
+
added: number;
|
|
14
|
+
skipped: number;
|
|
15
|
+
error?: string;
|
|
16
|
+
}
|
|
17
|
+
/** 合并导入文本;不改磁盘、不发请求(纯函数,单测直测)。 */
|
|
18
|
+
export declare function mergeMcpServersJson(existingText: string | null | undefined, importedText: string): MergeImportResult;
|
package/lib/client/locales.d.ts
CHANGED
|
@@ -50,6 +50,11 @@ export declare const zh: {
|
|
|
50
50
|
readonly floatEmptyTitle: "还没有 MCP 服务器";
|
|
51
51
|
readonly floatEmptyCta: "去添加";
|
|
52
52
|
readonly panelTitle: "MCP 管理器";
|
|
53
|
+
readonly workspaceLabel: "工作区";
|
|
54
|
+
readonly workspaceGlobal: "仅全局";
|
|
55
|
+
readonly settingsShowFloat: "右上角浮窗(跟随当前工作区)";
|
|
56
|
+
readonly settingsShowSidebar: "左侧导航入口";
|
|
57
|
+
readonly settingsShowSettings: "设置页入口";
|
|
53
58
|
readonly tabServers: "服务器";
|
|
54
59
|
readonly tabQuickAdd: "快速接入";
|
|
55
60
|
readonly countsConnected: "运行中 {n}";
|
|
@@ -86,6 +91,9 @@ export declare const zh: {
|
|
|
86
91
|
readonly srcUngrouped: "其他(未声明来源)";
|
|
87
92
|
readonly srcQuickSetup: "快速配置该来源";
|
|
88
93
|
readonly srcEdit: "编辑";
|
|
94
|
+
readonly srcImport: "导入";
|
|
95
|
+
readonly importDone: "导入完成:新增 {added} 台,跳过 {skipped} 台同名";
|
|
96
|
+
readonly importNoNew: "没有新增:{skipped} 台同名已存在";
|
|
89
97
|
readonly srcSave: "保存并同步";
|
|
90
98
|
readonly srcSavedOk: "已保存并同步:{names}";
|
|
91
99
|
readonly srcMutexRemoved: "互斥移除同名:{names}";
|