@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/lib/index.js
CHANGED
|
@@ -2329,7 +2329,8 @@ var ROUTES = {
|
|
|
2329
2329
|
sourceActivate: "/api/dsh-mcp/sources/activate",
|
|
2330
2330
|
events: "/api/dsh-mcp/events",
|
|
2331
2331
|
health: "/api/dsh-mcp/health",
|
|
2332
|
-
toolDisable: "/api/dsh-mcp/tool-disable"
|
|
2332
|
+
toolDisable: "/api/dsh-mcp/tool-disable",
|
|
2333
|
+
workspaces: "/api/dsh-mcp/workspaces"
|
|
2333
2334
|
};
|
|
2334
2335
|
var ROUTE_FENCE = {
|
|
2335
2336
|
servers: { guarded: ["GET", "POST", "PATCH", "DELETE"], loopbackExempt: [] },
|
|
@@ -2345,7 +2346,8 @@ var ROUTE_FENCE = {
|
|
|
2345
2346
|
sourceActivate: { guarded: ["POST"], loopbackExempt: [] },
|
|
2346
2347
|
events: { guarded: ["GET"], loopbackExempt: [] },
|
|
2347
2348
|
health: { guarded: ["GET"], loopbackExempt: [] },
|
|
2348
|
-
toolDisable: { guarded: ["PATCH"], loopbackExempt: [] }
|
|
2349
|
+
toolDisable: { guarded: ["PATCH"], loopbackExempt: [] },
|
|
2350
|
+
workspaces: { guarded: ["GET"], loopbackExempt: [] }
|
|
2349
2351
|
};
|
|
2350
2352
|
|
|
2351
2353
|
// lib/shared/constants.js
|
|
@@ -2729,6 +2731,16 @@ var McpManager = class {
|
|
|
2729
2731
|
uiConfig() {
|
|
2730
2732
|
return orchestratorPorts.get().configModel.normalizeUiConfig(this.uiConfigSource());
|
|
2731
2733
|
}
|
|
2734
|
+
/** 工作区列表(嵌入面板的下拉):只读宿主 registry,缺服务时返回空数组。 */
|
|
2735
|
+
listWorkspaces() {
|
|
2736
|
+
const registry = this.ctx.get("workspaceRegistry");
|
|
2737
|
+
const rows = registry?.list?.() ?? [];
|
|
2738
|
+
return rows.map((workspace) => ({
|
|
2739
|
+
id: String(workspace.id ?? workspace.path),
|
|
2740
|
+
name: workspace.title || workspace.path,
|
|
2741
|
+
path: workspace.path
|
|
2742
|
+
}));
|
|
2743
|
+
}
|
|
2732
2744
|
/**
|
|
2733
2745
|
* 写入浮窗 UI 配置(/api/dsh-mcp/config POST)。
|
|
2734
2746
|
* 把客户端扁平形态归一化为 `Config.ui` 嵌套补丁,经设置命名空间持久化
|
|
@@ -3944,7 +3956,10 @@ var UI_CONFIG_KEYS = [
|
|
|
3944
3956
|
"offsetX",
|
|
3945
3957
|
"offsetY",
|
|
3946
3958
|
"blankY",
|
|
3947
|
-
"zIndexBase"
|
|
3959
|
+
"zIndexBase",
|
|
3960
|
+
"showFloat",
|
|
3961
|
+
"showSidebar",
|
|
3962
|
+
"showSettings"
|
|
3948
3963
|
];
|
|
3949
3964
|
function buildConfigRoute(manager, helpers) {
|
|
3950
3965
|
return {
|
|
@@ -3990,6 +4005,21 @@ function buildConfigRoute(manager, helpers) {
|
|
|
3990
4005
|
}
|
|
3991
4006
|
};
|
|
3992
4007
|
}
|
|
4008
|
+
function buildWorkspacesRoute(manager, helpers) {
|
|
4009
|
+
return {
|
|
4010
|
+
kind: "exact",
|
|
4011
|
+
path: ROUTES.workspaces,
|
|
4012
|
+
handler: (req, res) => {
|
|
4013
|
+
if (!guardLoopbackMethod(req, res, ROUTE_FENCE.workspaces.guarded))
|
|
4014
|
+
return;
|
|
4015
|
+
try {
|
|
4016
|
+
writeJson(res, 200, { workspaces: manager.listWorkspaces?.() ?? [] });
|
|
4017
|
+
} catch (error) {
|
|
4018
|
+
helpers.handleError(res, error);
|
|
4019
|
+
}
|
|
4020
|
+
}
|
|
4021
|
+
};
|
|
4022
|
+
}
|
|
3993
4023
|
async function handleServersMutation(method, url, req, res, manager, helpers) {
|
|
3994
4024
|
if (method === "POST") {
|
|
3995
4025
|
await createServer(req, res, manager, helpers);
|
|
@@ -4570,7 +4600,8 @@ function makeRoutes(manager, _cwd = process.cwd(), scoped = false) {
|
|
|
4570
4600
|
buildSourcesRoute(manager, helpers),
|
|
4571
4601
|
buildSourceSaveRoute(manager, helpers),
|
|
4572
4602
|
buildSourceActivateRoute(manager, helpers),
|
|
4573
|
-
buildToolDisableRoute(manager, helpers)
|
|
4603
|
+
buildToolDisableRoute(manager, helpers),
|
|
4604
|
+
buildWorkspacesRoute(manager, helpers)
|
|
4574
4605
|
];
|
|
4575
4606
|
if (scoped || manager.forWorkspace === void 0)
|
|
4576
4607
|
return routes;
|
|
@@ -6002,7 +6033,10 @@ init_interface();
|
|
|
6002
6033
|
var DEFAULT_UI_CONFIG = {
|
|
6003
6034
|
position: "top-right",
|
|
6004
6035
|
offset: { x: 8, y: 8, blankY: 40 },
|
|
6005
|
-
zIndexBase: DEFAULT_Z_INDEX_BASE
|
|
6036
|
+
zIndexBase: DEFAULT_Z_INDEX_BASE,
|
|
6037
|
+
showFloat: true,
|
|
6038
|
+
showSidebar: false,
|
|
6039
|
+
showSettings: false
|
|
6006
6040
|
};
|
|
6007
6041
|
var DebugConfigSchema = import_schemastery.default.object({
|
|
6008
6042
|
callStats: import_schemastery.default.boolean().default(false).description("是否开启 MCP 工具调用统计调试与落盘(默认关闭,仅可通过配置文件开启)"),
|
|
@@ -6026,7 +6060,10 @@ var UiConfigSchema = import_schemastery.default.object({
|
|
|
6026
6060
|
y: import_schemastery.default.number().default(8),
|
|
6027
6061
|
blankY: import_schemastery.default.number().default(40)
|
|
6028
6062
|
}).default({ x: 8, y: 8, blankY: 40 }),
|
|
6029
|
-
zIndexBase: import_schemastery.default.number().default(DEFAULT_UI_CONFIG.zIndexBase).description("浮窗层级基准(1-9000),胶囊与点击后弹出的主面板同取该配置值")
|
|
6063
|
+
zIndexBase: import_schemastery.default.number().default(DEFAULT_UI_CONFIG.zIndexBase).description("浮窗层级基准(1-9000),胶囊与点击后弹出的主面板同取该配置值"),
|
|
6064
|
+
showFloat: import_schemastery.default.boolean().default(true).description("显示右上角浮窗(跟随当前会话工作区)"),
|
|
6065
|
+
showSidebar: import_schemastery.default.boolean().default(false).description("显示左侧导航入口(完整管理面板,可选工作区)"),
|
|
6066
|
+
showSettings: import_schemastery.default.boolean().default(false).description("显示设置页入口(完整管理面板,可选工作区)")
|
|
6030
6067
|
}).extra("volatile", true);
|
|
6031
6068
|
function isConfigBag(value) {
|
|
6032
6069
|
return typeof value === "object" && value !== null;
|
|
@@ -6050,15 +6087,29 @@ function normalizeUiConfig(raw) {
|
|
|
6050
6087
|
const offsetY = clampNum(ui.offsetY ?? offset.y, DEFAULT_UI_CONFIG.offset.y);
|
|
6051
6088
|
const blankY = clampNum(ui.blankY ?? offset.blankY, DEFAULT_UI_CONFIG.offset.blankY);
|
|
6052
6089
|
const zIndexBase = clampZIndexBase(ui.zIndexBase, DEFAULT_UI_CONFIG.zIndexBase);
|
|
6053
|
-
|
|
6090
|
+
const out = { position, offsetX, offsetY, blankY, zIndexBase };
|
|
6091
|
+
if (typeof ui.showFloat === "boolean")
|
|
6092
|
+
out.showFloat = ui.showFloat;
|
|
6093
|
+
if (typeof ui.showSidebar === "boolean")
|
|
6094
|
+
out.showSidebar = ui.showSidebar;
|
|
6095
|
+
if (typeof ui.showSettings === "boolean")
|
|
6096
|
+
out.showSettings = ui.showSettings;
|
|
6097
|
+
return out;
|
|
6054
6098
|
}
|
|
6055
6099
|
function buildConfigUiPatch(raw) {
|
|
6056
6100
|
const cfg = normalizeUiConfig(raw);
|
|
6057
|
-
|
|
6101
|
+
const patch = {
|
|
6058
6102
|
position: cfg.position,
|
|
6059
6103
|
offset: { x: cfg.offsetX, y: cfg.offsetY, blankY: cfg.blankY },
|
|
6060
6104
|
zIndexBase: cfg.zIndexBase
|
|
6061
6105
|
};
|
|
6106
|
+
if (cfg.showFloat !== void 0)
|
|
6107
|
+
patch.showFloat = cfg.showFloat;
|
|
6108
|
+
if (cfg.showSidebar !== void 0)
|
|
6109
|
+
patch.showSidebar = cfg.showSidebar;
|
|
6110
|
+
if (cfg.showSettings !== void 0)
|
|
6111
|
+
patch.showSettings = cfg.showSettings;
|
|
6112
|
+
return patch;
|
|
6062
6113
|
}
|
|
6063
6114
|
var Config = import_schemastery.default.object({
|
|
6064
6115
|
enabled: import_schemastery.default.boolean().default(true).description("是否启用本插件").disabled(true),
|
|
@@ -29,6 +29,13 @@ export interface RouteHelpers {
|
|
|
29
29
|
}
|
|
30
30
|
/** UI 配置读写(GET 豁免 loopback;写操作 loopback-only,未知顶层键 400)。 */
|
|
31
31
|
export declare function buildConfigRoute(manager: RoutesManager, helpers: RouteHelpers): WebRoute;
|
|
32
|
+
/**
|
|
33
|
+
* GET /workspaces:嵌入面板的工作区下拉数据源。
|
|
34
|
+
*
|
|
35
|
+
* 只读、loopback-only。宿主 `workspaceRegistry` 缺席(老宿主 / 夹具)时返回空
|
|
36
|
+
* 数组,客户端回落「仅全局 + 当前会话」,不把缺服务变成错误。
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildWorkspacesRoute(manager: RoutesManager, helpers: RouteHelpers): WebRoute;
|
|
32
39
|
/** 服务器集合 CRUD:GET 快照(纯读)/ POST 添加 / PATCH 更新 / DELETE 删除。 */
|
|
33
40
|
export declare function buildServersRoute(manager: RoutesManager, helpers: RouteHelpers): WebRoute;
|
|
34
41
|
/** 会话切换(跟随会话的项目级 MCP)。 */
|
|
@@ -17,4 +17,10 @@ export interface UiPlacementConfig {
|
|
|
17
17
|
};
|
|
18
18
|
/** 浮窗层级基准(clamp 1–9000;胶囊与点击后弹出的主面板同取该配置值,模态管理面板独立不受影响)。 */
|
|
19
19
|
zIndexBase: number;
|
|
20
|
+
/** 右上角浮窗胶囊(跟随当前会话工作区)。 */
|
|
21
|
+
showFloat?: boolean;
|
|
22
|
+
/** 左侧主导航入口(完整管理面板,工作区可选)。 */
|
|
23
|
+
showSidebar?: boolean;
|
|
24
|
+
/** 设置页入口(完整管理面板,工作区可选)。 */
|
|
25
|
+
showSettings?: boolean;
|
|
20
26
|
}
|
|
@@ -39,6 +39,12 @@ export interface RoutesManager {
|
|
|
39
39
|
refreshFromDisk(): Promise<void>;
|
|
40
40
|
uiConfig(): ClientUiConfig;
|
|
41
41
|
updateUiConfig(raw: unknown): Promise<ClientUiConfig>;
|
|
42
|
+
/** 工作区列表(嵌入面板的工作区下拉;老宿主/夹具缺省时返回空数组)。 */
|
|
43
|
+
listWorkspaces?(): Array<{
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
path: string;
|
|
47
|
+
}>;
|
|
42
48
|
summary(): Record<string, unknown>;
|
|
43
49
|
/** 错误文案脱敏(#770-A2:经 getRedactionServers 全集快照,路由错误边界统一调用)。
|
|
44
50
|
* 可选:旧夹具/外部实现缺省时路由回落原文(自身无秘密可泄);真 manager 恒提供。 */
|
|
@@ -171,6 +171,12 @@ export declare class McpManager {
|
|
|
171
171
|
constructor(ctx: Context, store: McpStore);
|
|
172
172
|
/** 读取 settings 命名空间中的 MCP UI 配置(供 /api/dsh-mcp/config 返回)。 */
|
|
173
173
|
uiConfig(): ClientUiConfig;
|
|
174
|
+
/** 工作区列表(嵌入面板的下拉):只读宿主 registry,缺服务时返回空数组。 */
|
|
175
|
+
listWorkspaces(): Array<{
|
|
176
|
+
id: string;
|
|
177
|
+
name: string;
|
|
178
|
+
path: string;
|
|
179
|
+
}>;
|
|
174
180
|
/**
|
|
175
181
|
* 写入浮窗 UI 配置(/api/dsh-mcp/config POST)。
|
|
176
182
|
* 把客户端扁平形态归一化为 `Config.ui` 嵌套补丁,经设置命名空间持久化
|
package/lib/shared/dto.d.ts
CHANGED
|
@@ -59,4 +59,10 @@ export interface ClientUiConfig {
|
|
|
59
59
|
offsetY: number;
|
|
60
60
|
blankY: number;
|
|
61
61
|
zIndexBase: number;
|
|
62
|
+
/** 右上角浮窗胶囊(跟随当前会话工作区;默认开)。 */
|
|
63
|
+
showFloat?: boolean;
|
|
64
|
+
/** 左侧主导航入口(完整管理面板;默认关)。 */
|
|
65
|
+
showSidebar?: boolean;
|
|
66
|
+
/** 设置页入口(完整管理面板;默认关)。 */
|
|
67
|
+
showSettings?: boolean;
|
|
62
68
|
}
|
package/lib/shared/routes.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dsh-mcp-manager — 跨端路由契约单点(D5,#767 B1.5a)。
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* /api/dsh-mcp/* 路径同时被宿主装配数组与客户端取数面使用,围栏数据(方法白名单
|
|
5
5
|
* 与 loopback 豁免)是宿主唯一执法点;物理定义都只在本文件。
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* 路由路径清单(键序与值均为跨端契约,不得重排或改写)。
|
|
9
9
|
*
|
|
10
10
|
* 刻意不写 as const:ROUTES 是包入口的既有导出,其公开类型必须是 `{ servers: string; … }`
|
|
11
11
|
* (加 as const 会把公开类型收紧成字面量联合,导出面快照立刻判红)——提取常量不该顺带改 ABI。
|
|
@@ -25,6 +25,7 @@ export declare const ROUTES: {
|
|
|
25
25
|
events: string;
|
|
26
26
|
health: string;
|
|
27
27
|
toolDisable: string;
|
|
28
|
+
workspaces: string;
|
|
28
29
|
};
|
|
29
30
|
/** 路由名(ROUTES 的键)。 */
|
|
30
31
|
export type RouteName = keyof typeof ROUTES;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sunshaobei/dsh-mcp-manager",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "Manage MCP servers (stdio / streamable-http) for dsh web;
|
|
3
|
+
"version": "3.3.0",
|
|
4
|
+
"description": "Manage MCP servers (stdio / streamable-http) for dsh web; floating pill, left-sidebar entry and settings-page entry (each switchable), full panel with a workspace picker, and one-click mcp.json file import with merge. DSH MCP 管理器:浮窗 / 左侧导航 / 设置页三个独立入口,完整面板可选工作区,快速接入支持 mcp.json 文件导入合并。已连接服务器的工具一律经中间层工具(ws_mcp_search / ws_mcp_detail / ws_mcp_call / ws_mcp_list)访问。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"scripts": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"catalog": {
|
|
31
31
|
"category": "tool",
|
|
32
32
|
"summary": {
|
|
33
|
-
"en": "Manage MCP servers
|
|
34
|
-
"zh": "DSH MCP
|
|
33
|
+
"en": "Manage MCP servers for dsh web; floating pill, sidebar and settings entries, workspace picker, and mcp.json file import with merge.",
|
|
34
|
+
"zh": "DSH MCP 管理器:浮窗 / 左侧导航 / 设置页三入口,完整面板可选工作区,支持 mcp.json 文件导入合并"
|
|
35
35
|
},
|
|
36
36
|
"capabilities": [
|
|
37
37
|
"connection",
|