dsh-project-mcp-manager 0.7.1 → 0.7.2
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.md +21 -2
- package/docs/README.zh.md +18 -2
- package/docs/design/proposal-runtime-robustness-and-json-interop.md +3 -1
- package/docs/guide/service.md +95 -0
- package/docs/guide/service.zh.md +88 -0
- package/docs/releases/v0.7.2.md +37 -0
- package/lib/cli.d.ts +42 -0
- package/lib/dsh-paths.d.ts +42 -0
- package/lib/index.d.ts +24 -0
- package/lib/index.js +1 -1
- package/lib/json-file.d.ts +111 -0
- package/lib/json-write.d.ts +32 -0
- package/lib/mcp-file.d.ts +46 -0
- package/lib/model.d.ts +277 -0
- package/lib/project-root.d.ts +4 -0
- package/lib/registry.d.ts +439 -0
- package/lib/registry.js +17 -0
- package/lib/service.d.ts +41 -0
- package/lib/service.js +5 -0
- package/lib/status.d.ts +20 -0
- package/package.json +6 -2
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const MCP_BLOCK_BEGIN = "# >>> dsh-project-mcp-manager:mcp:begin";
|
|
2
|
+
export declare const MCP_BLOCK_END = "# <<< dsh-project-mcp-manager:mcp:end";
|
|
3
|
+
export declare const MCP_PLUGIN_NAME = "@deepseek-ai/dsh-mcp-client";
|
|
4
|
+
/** 兼容 dsh-skill-mcp-panel 的受管行 id 前缀(其项目文件行可直接装载)。 */
|
|
5
|
+
export declare const MANAGED_ROW_ID_PREFIX = "panel-mcp-";
|
|
6
|
+
/** Loader patch 行(宽松形状;受管块只包含 insert 列表)。 */
|
|
7
|
+
export interface PatchRow {
|
|
8
|
+
id?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
config?: Record<string, unknown>;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
/** 读取 patch 文件;缺失/读失败统一带路径报错。 */
|
|
15
|
+
export declare function readPatchFile(path: string): Promise<string>;
|
|
16
|
+
/** 校验整份 patch 文本:可解析且顶层是数组。不解出/写回任何值。 */
|
|
17
|
+
export declare function validatePatchText(raw: string): Promise<void>;
|
|
18
|
+
/** 提取 begin/end 标记之间的受管行;无标记返回空数组。 */
|
|
19
|
+
export declare function extractManagedRows(raw: string): PatchRow[];
|
|
20
|
+
/** 生成受管块文本(无行时为空字符串)。 */
|
|
21
|
+
export declare function generateManagedBlock(rows: PatchRow[]): string;
|
|
22
|
+
/**
|
|
23
|
+
* 替换受管块;无标记且要写入行时追加到文件末尾。标记之外的所有字节原样保留。
|
|
24
|
+
*/
|
|
25
|
+
export declare function replaceManagedBlock(raw: string, rows: PatchRow[]): string;
|
|
26
|
+
/** 同目录临时文件 + rename 原子写;Windows 上 rename 覆盖失败时退化为 rm+rename。 */
|
|
27
|
+
export declare function writeFileAtomic(path: string, content: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* 以 `<path>.mcp-project.lock` 为锁执行 fn。锁文件记录 pid + 时间;超过 30 秒
|
|
30
|
+
* 视为陈旧锁自动清理。获取超时 5 秒。
|
|
31
|
+
*/
|
|
32
|
+
export declare function withPatchLock<T>(path: string, fn: () => Promise<T> | T): Promise<T>;
|
|
33
|
+
export declare function updateManagedRows(path: string, mutate: (rows: PatchRow[]) => PatchRow[], options?: {
|
|
34
|
+
createIfMissing?: boolean;
|
|
35
|
+
}): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* 整体替换受管行(读取、替换受管块、校验、加锁原子写回)。
|
|
38
|
+
* 调用方已持有完整目标行集合时用它;需要「基于现有行改一改」请用
|
|
39
|
+
* updateManagedRows(锁内读-改-写,并发安全)。
|
|
40
|
+
* createIfMissing 时文件缺失(或父目录缺失)按空文件处理:用于项目级
|
|
41
|
+
* <projectRoot>/.dsh/mcp.yml 的首次写入。
|
|
42
|
+
* 返回写回后的完整文本。
|
|
43
|
+
*/
|
|
44
|
+
export declare function writeManagedRows(path: string, rows: PatchRow[], options?: {
|
|
45
|
+
createIfMissing?: boolean;
|
|
46
|
+
}): Promise<string>;
|
package/lib/model.d.ts
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-project-mcp-manager —— MCP 服务器配置模型(纯函数)。
|
|
3
|
+
*
|
|
4
|
+
* 模型本身不含 scope:scope 是配置所在文件(profile cordis.patch.yml =
|
|
5
|
+
* 全局,<projectRoot>/.dsh/mcp.yml = 项目)的属性。env/headers 的 null 是
|
|
6
|
+
* 编辑语义:string = 覆盖该 key,null = 删除该 key,不出现 = 保留旧值。
|
|
7
|
+
*/
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import { type PatchRow } from "./mcp-file.js";
|
|
10
|
+
export declare const SERVER_NAME_RE: RegExp;
|
|
11
|
+
/** url 字段允许合法 URL 或含 `${VAR}` 占位的串(整值与串内插值同待):装载前
|
|
12
|
+
* 一律放行占位串,展开后的真实合法性由 mount 复验兜底(env-invalid 诊断)。 */
|
|
13
|
+
export declare function isUrlOrEnvRef(value: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* 字符串数组比较器:UTF-16 码元序,与 `Array#sort` 默认行为逐字节等价。
|
|
16
|
+
* 全仓凡排序结果 wire 可见(诊断/快照键集、告警门控签名、list 输出序)都必须
|
|
17
|
+
* 用显式比较器写死这个口径——默认序不经 locale collator,不随宿主区域设置漂移。
|
|
18
|
+
*/
|
|
19
|
+
export declare function byCodeUnit(a: string, b: string): number;
|
|
20
|
+
/**
|
|
21
|
+
* glob → 正则:`*` 不跨 `/`,`**` 跨段,`?` 单字符,`[abc]` / `[!abc]` 字符类。
|
|
22
|
+
* 工具名通常不含 `/`,`*` 与 `**` 对裸名等价,完整 `mcp__…__…` 路径才用得上 `**`。
|
|
23
|
+
*/
|
|
24
|
+
export declare function globToRegExp(pattern: string): RegExp;
|
|
25
|
+
export declare function matchToolGlob(pattern: string, name: string): boolean;
|
|
26
|
+
/** 非法字符类等会导致 `RegExp` 抛错的 glob;合法则返回 undefined。 */
|
|
27
|
+
export declare function toolGlobCompileError(pattern: string): string | undefined;
|
|
28
|
+
/** 过滤里无法编译的 glob 原文(去重);调用方记条目警告,匹配仍跳过该模式。 */
|
|
29
|
+
export declare function invalidToolGlobs(filter: ToolFilter | undefined): string[];
|
|
30
|
+
export interface ToolFilter {
|
|
31
|
+
allow?: string[];
|
|
32
|
+
deny?: string[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 条目级工具过滤:`allow` 缺省全开;`deny` 优先。只返回当前已注册的完整工具名
|
|
36
|
+
* (`mcp__<effective>__<tool>`),供 `tools.restrict` 使用。
|
|
37
|
+
*/
|
|
38
|
+
export declare function deniedToolsForFilter(effectiveName: string, filter: ToolFilter | undefined, registeredToolIds: string[]): string[];
|
|
39
|
+
export declare function toolFilterFromConfig(config: Record<string, unknown> | undefined): ToolFilter | undefined;
|
|
40
|
+
export declare const DEFAULT_TOOL_CALL_TIMEOUT_MS = 60000;
|
|
41
|
+
export declare const DEFAULT_RECONNECT: {
|
|
42
|
+
readonly enabled: true;
|
|
43
|
+
readonly initialDelayMs: 500;
|
|
44
|
+
readonly maxDelayMs: 30000;
|
|
45
|
+
readonly maxAttempts: 10;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* 与官方 dsh-mcp-client 的 reconnect 上限一致(@deepseek-ai/dsh-mcp-client
|
|
49
|
+
* lib/index.js:734-735);2147483647 = MAX_TIMER_DELAY_MS(@deepseek-ai/
|
|
50
|
+
* dsh-timeout,Node 不钳制的最大 timer 延迟)。上限不镜像的话越界值会绕过
|
|
51
|
+
* 本地校验、到 ctx.plugin 装载时才以 plugin-throw 爆错,归因更晚更难查。
|
|
52
|
+
*/
|
|
53
|
+
export declare const MAX_TIMER_DELAY_MS = 2147483647;
|
|
54
|
+
/**
|
|
55
|
+
* 官方 `@deepseek-ai/dsh-mcp-client` 0.2.0-rc.2 支持的 MCP 传输集合
|
|
56
|
+
* (config.transport 判别联合:`stdio` | `streamable-http`)。本插件不实现
|
|
57
|
+
* 传输,只负责表达;schema / CLI / JSON 读取器 / 报错文案全部从这里派生。
|
|
58
|
+
* 官方新增传输时:常量加值 + 一条 CLI/JSON 别名映射 + 文档 + 测试,不要再
|
|
59
|
+
* 加判定分支。性质与 `MAX_TIMER_DELAY_MS` 相同。
|
|
60
|
+
*/
|
|
61
|
+
export declare const SUPPORTED_MCP_TRANSPORTS: readonly ["stdio", "streamable-http"];
|
|
62
|
+
export type SupportedMcpTransport = (typeof SUPPORTED_MCP_TRANSPORTS)[number];
|
|
63
|
+
/** JSON/CLI 用户面写法 → 官方 transport。`http` 是 Cursor/CC 通行别名。 */
|
|
64
|
+
export declare const MCP_TRANSPORT_ALIASES: Record<string, SupportedMcpTransport>;
|
|
65
|
+
/**
|
|
66
|
+
* 已知但不被装载后端支持的传输。走统一报错路径,不隐式回退、不静默跳过。
|
|
67
|
+
* 官方若日后支持其中某一项:从本表删掉、加入 `SUPPORTED_MCP_TRANSPORTS` 与别名即可。
|
|
68
|
+
*/
|
|
69
|
+
export declare const UNSUPPORTED_MCP_TRANSPORTS: readonly ["sse"];
|
|
70
|
+
/** 官方 transport → JSON 方言 `type`(Cursor/CC 写 `http` 而非 `streamable-http`)。 */
|
|
71
|
+
export declare function jsonTypeOfTransport(transport: SupportedMcpTransport): "stdio" | "http";
|
|
72
|
+
export declare function isSupportedMcpTransport(value: string): value is SupportedMcpTransport;
|
|
73
|
+
export declare function isUnsupportedMcpTransport(value: string): boolean;
|
|
74
|
+
export declare function supportedTransportsLabel(separator?: string): string;
|
|
75
|
+
/** 未知/不受支持传输的报错(CLI 与 JSON 读取器共用)。 */
|
|
76
|
+
export declare function unsupportedTransportMessage(value: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* 用户面传输值(CLI `--transport`、JSON `type`/`transport`)→ 官方 transport。
|
|
79
|
+
* 别名命中则映射;其余一律报错(含 `UNSUPPORTED_MCP_TRANSPORTS` 与完全陌生的值)。
|
|
80
|
+
*/
|
|
81
|
+
export declare function resolveMcpTransport(raw: string): {
|
|
82
|
+
transport: SupportedMcpTransport;
|
|
83
|
+
} | {
|
|
84
|
+
error: string;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* CLI `--transport`:官方名与 `http` 别名;内部仍用 `stdio` | `http`
|
|
88
|
+
* (`add` 的用户面口径,与 `jsonTypeOfTransport` 一致)。
|
|
89
|
+
* 已知不支持值走 `unsupportedTransportMessage`;完全陌生的值提示合法集合。
|
|
90
|
+
*/
|
|
91
|
+
export declare function parseCliTransport(value: string): {
|
|
92
|
+
transport: "stdio" | "http";
|
|
93
|
+
} | {
|
|
94
|
+
error: string;
|
|
95
|
+
};
|
|
96
|
+
export declare const stdioServerSchema: z.ZodObject<{
|
|
97
|
+
serverName: z.ZodString;
|
|
98
|
+
transport: z.ZodLiteral<"stdio">;
|
|
99
|
+
command: z.ZodString;
|
|
100
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
101
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
|
|
102
|
+
cwd: z.ZodDefault<z.ZodString>;
|
|
103
|
+
toolCallTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
104
|
+
failOnStartupError: z.ZodDefault<z.ZodBoolean>;
|
|
105
|
+
maxInstructionBytes: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
reconnect: z.ZodDefault<z.ZodObject<{
|
|
107
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
108
|
+
initialDelayMs: z.ZodDefault<z.ZodNumber>;
|
|
109
|
+
maxDelayMs: z.ZodDefault<z.ZodNumber>;
|
|
110
|
+
maxAttempts: z.ZodDefault<z.ZodNumber>;
|
|
111
|
+
}, z.core.$strip>>;
|
|
112
|
+
tools: z.ZodOptional<z.ZodObject<{
|
|
113
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
114
|
+
deny: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
115
|
+
}, z.core.$strip>>;
|
|
116
|
+
}, z.core.$strip>;
|
|
117
|
+
export declare const httpServerSchema: z.ZodObject<{
|
|
118
|
+
serverName: z.ZodString;
|
|
119
|
+
transport: z.ZodLiteral<"streamable-http">;
|
|
120
|
+
url: z.ZodString;
|
|
121
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
|
|
122
|
+
toolCallTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
123
|
+
failOnStartupError: z.ZodDefault<z.ZodBoolean>;
|
|
124
|
+
maxInstructionBytes: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
reconnect: z.ZodDefault<z.ZodObject<{
|
|
126
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
127
|
+
initialDelayMs: z.ZodDefault<z.ZodNumber>;
|
|
128
|
+
maxDelayMs: z.ZodDefault<z.ZodNumber>;
|
|
129
|
+
maxAttempts: z.ZodDefault<z.ZodNumber>;
|
|
130
|
+
}, z.core.$strip>>;
|
|
131
|
+
tools: z.ZodOptional<z.ZodObject<{
|
|
132
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
133
|
+
deny: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
134
|
+
}, z.core.$strip>>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
export declare const mcpServerInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
137
|
+
serverName: z.ZodString;
|
|
138
|
+
transport: z.ZodLiteral<"stdio">;
|
|
139
|
+
command: z.ZodString;
|
|
140
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
141
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
|
|
142
|
+
cwd: z.ZodDefault<z.ZodString>;
|
|
143
|
+
toolCallTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
144
|
+
failOnStartupError: z.ZodDefault<z.ZodBoolean>;
|
|
145
|
+
maxInstructionBytes: z.ZodOptional<z.ZodNumber>;
|
|
146
|
+
reconnect: z.ZodDefault<z.ZodObject<{
|
|
147
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
148
|
+
initialDelayMs: z.ZodDefault<z.ZodNumber>;
|
|
149
|
+
maxDelayMs: z.ZodDefault<z.ZodNumber>;
|
|
150
|
+
maxAttempts: z.ZodDefault<z.ZodNumber>;
|
|
151
|
+
}, z.core.$strip>>;
|
|
152
|
+
tools: z.ZodOptional<z.ZodObject<{
|
|
153
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
154
|
+
deny: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
155
|
+
}, z.core.$strip>>;
|
|
156
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
157
|
+
serverName: z.ZodString;
|
|
158
|
+
transport: z.ZodLiteral<"streamable-http">;
|
|
159
|
+
url: z.ZodString;
|
|
160
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
|
|
161
|
+
toolCallTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
162
|
+
failOnStartupError: z.ZodDefault<z.ZodBoolean>;
|
|
163
|
+
maxInstructionBytes: z.ZodOptional<z.ZodNumber>;
|
|
164
|
+
reconnect: z.ZodDefault<z.ZodObject<{
|
|
165
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
166
|
+
initialDelayMs: z.ZodDefault<z.ZodNumber>;
|
|
167
|
+
maxDelayMs: z.ZodDefault<z.ZodNumber>;
|
|
168
|
+
maxAttempts: z.ZodDefault<z.ZodNumber>;
|
|
169
|
+
}, z.core.$strip>>;
|
|
170
|
+
tools: z.ZodOptional<z.ZodObject<{
|
|
171
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
172
|
+
deny: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
173
|
+
}, z.core.$strip>>;
|
|
174
|
+
}, z.core.$strip>], "transport">;
|
|
175
|
+
export type McpServerInput = z.infer<typeof mcpServerInputSchema>;
|
|
176
|
+
export type McpTransport = McpServerInput["transport"];
|
|
177
|
+
export interface ReconnectConfig {
|
|
178
|
+
enabled: boolean;
|
|
179
|
+
initialDelayMs: number;
|
|
180
|
+
maxDelayMs: number;
|
|
181
|
+
maxAttempts: number;
|
|
182
|
+
}
|
|
183
|
+
export type SecretPatch = Record<string, string | null> | undefined;
|
|
184
|
+
/** 服务器所在作用域:全局(profile patch)或工作区(项目根路径)。 */
|
|
185
|
+
export interface McpScopeInfo {
|
|
186
|
+
kind: "global" | "workspace";
|
|
187
|
+
path?: string;
|
|
188
|
+
label?: string;
|
|
189
|
+
}
|
|
190
|
+
/** 项目根的规范化键(Windows 大小写不敏感),作 Map 键用。 */
|
|
191
|
+
export declare function projectKeyOf(projectRoot: string): string;
|
|
192
|
+
/**
|
|
193
|
+
* 冲突时的命名空间生效名:`p<sha256(projectKeyOf(projectRoot))前6位hex>_<原始名>`,
|
|
194
|
+
* 截断到 32 字符(保持 SERVER_NAME_RE 合法)。确定性,与装载顺序、路径大小写
|
|
195
|
+
* 写法无关。
|
|
196
|
+
*/
|
|
197
|
+
export declare function namespacedServerName(projectRoot: string, name: string): string;
|
|
198
|
+
/** 一个项目的原始 serverName 目录(供生效名计算)。 */
|
|
199
|
+
export interface ProjectServerCatalogEntry {
|
|
200
|
+
projectRoot: string;
|
|
201
|
+
names: string[];
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* 计算全部 (projectRoot, 原始名) → 生效名的映射:
|
|
205
|
+
* 原始名在整个目录(全局行 + 所有项目行)中唯一时保持原名;否则该名的
|
|
206
|
+
* 每个项目拥有者都改用 namespacedServerName(全局行参与占用判定但不改名)。
|
|
207
|
+
* 键 = projectKeyOf(projectRoot) + "\0" + 原始名。
|
|
208
|
+
*/
|
|
209
|
+
export declare function effectiveServerNames(projects: ProjectServerCatalogEntry[], globalNames?: string[]): Map<string, string>;
|
|
210
|
+
/**
|
|
211
|
+
* 会话可见性:某会话项目应 deny 的生效名 = 全部已装载项目服务器 − 本会话
|
|
212
|
+
* 项目的。sessionProject 为 undefined(无 cwd / 未知项目)时 deny 全部。
|
|
213
|
+
*/
|
|
214
|
+
export declare function denySetFor(sessionProject: string | undefined, mounted: {
|
|
215
|
+
projectRoot: string;
|
|
216
|
+
effectiveNames: string[];
|
|
217
|
+
}[]): string[];
|
|
218
|
+
/** 兼容 dsh-skill-mcp-panel 的行 id ↔ serverName。 */
|
|
219
|
+
export declare function rowIdForServerName(serverName: string): string;
|
|
220
|
+
/**
|
|
221
|
+
* 行的原始 serverName:**受管行 id 优先**,其次 `config.serverName`。
|
|
222
|
+
* 装载(registry)与 CLI 判重/删除必须同口径——反向优先(config 优先)会在
|
|
223
|
+
* `id: panel-mcp-a` + `config.serverName: b` 这类不一致行上认成另一个名字,
|
|
224
|
+
* 于是 CLI 删不掉装载器实际装载的那条。
|
|
225
|
+
*/
|
|
226
|
+
export declare function rowNameOf(row: PatchRow): string | undefined;
|
|
227
|
+
export declare function serverNameFromRowId(id: string | undefined): string | undefined;
|
|
228
|
+
/** null = 删除,string = 覆盖;缺省 key 保留旧值。 */
|
|
229
|
+
export declare function mergeSecretPatch(previous: Record<string, string> | undefined, patch: SecretPatch): Record<string, string>;
|
|
230
|
+
export type ExpandEnvRefsResult = {
|
|
231
|
+
ok: true;
|
|
232
|
+
input: McpServerInput;
|
|
233
|
+
} | {
|
|
234
|
+
ok: false;
|
|
235
|
+
missingVar: string;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* 运行时展开 command、args[*]、env/headers 值、url、cwd 中的 `${VAR}` 引用,
|
|
239
|
+
* 支持串内插值(`Bearer ${TOKEN}` 与整值 `${TOKEN}` 都会展开),对齐 CC 的
|
|
240
|
+
* 写法习惯。纯函数:环境经参数注入(宿主传 process.env),便于测试。
|
|
241
|
+
* 任一被引用的变量缺失或为空串即整体失败(ok:false + 变量名,调用方据此
|
|
242
|
+
* 跳过该条目装载)——空 token 与缺失同样危险,宁可 spawn 前拒绝。诊断
|
|
243
|
+
* 消息只含变量名不含值。`$VAR` 裸形与 `${9bad}` 非法名保持字面量。
|
|
244
|
+
*/
|
|
245
|
+
export declare function expandEnvRefs(input: McpServerInput, env: NodeJS.ProcessEnv): ExpandEnvRefsResult;
|
|
246
|
+
/** 面板输入 → 官方 @deepseek-ai/dsh-mcp-client 配置。 */
|
|
247
|
+
export declare function toOfficialConfig(input: McpServerInput): Record<string, unknown>;
|
|
248
|
+
/** 输入 → cordis.patch.yml / 项目 mcp.yml 行。 */
|
|
249
|
+
export declare function toPatchRow(input: McpServerInput, enabled?: boolean): PatchRow;
|
|
250
|
+
/** 读取 patch 行中的 config(宽松,坏行返回 undefined)。 */
|
|
251
|
+
export declare function configFromPatchRow(row: PatchRow | undefined): Record<string, unknown> | undefined;
|
|
252
|
+
export interface McpServerView {
|
|
253
|
+
serverName: string;
|
|
254
|
+
transport: McpTransport | "unknown";
|
|
255
|
+
enabled: boolean;
|
|
256
|
+
entryId: string | undefined;
|
|
257
|
+
/** 行所属作用域与装载时生效名(与 serverName 不同仅当发生命名冲突)。 */
|
|
258
|
+
scope?: McpScopeInfo;
|
|
259
|
+
effectiveServerName?: string;
|
|
260
|
+
command?: string;
|
|
261
|
+
args?: string[];
|
|
262
|
+
envKeys: string[];
|
|
263
|
+
cwd?: string;
|
|
264
|
+
url?: string;
|
|
265
|
+
headerKeys: string[];
|
|
266
|
+
/** 条目级工具过滤(模式原文,不含密钥)。 */
|
|
267
|
+
tools?: ToolFilter;
|
|
268
|
+
toolCallTimeoutMs: number;
|
|
269
|
+
failOnStartupError: boolean;
|
|
270
|
+
/** 仅当配置行显式写出时出现;缺省表示沿用官方 32768。 */
|
|
271
|
+
maxInstructionBytes?: number;
|
|
272
|
+
reconnect: ReconnectConfig;
|
|
273
|
+
}
|
|
274
|
+
/** patch 行 → 脱敏 view。密钥值不返回。scope/effectiveServerName 由调用方给出。 */
|
|
275
|
+
export declare function patchRowToView(row: PatchRow, scope?: McpScopeInfo, effectiveServerName?: string): McpServerView | undefined;
|
|
276
|
+
/** 从 patch 行读取完整输入(含 secret 值,仅供本机装载/测试使用,不跨 RPC)。 */
|
|
277
|
+
export declare function inputFromPatchRow(row: PatchRow): McpServerInput;
|