smooth-ssh-mcp 0.1.1
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/LICENSE +21 -0
- package/README.en.md +319 -0
- package/README.md +32 -0
- package/README.zh-CN.md +319 -0
- package/bin/smooth-ssh-mcp-codex +43 -0
- package/dist/audit.d.ts +23 -0
- package/dist/audit.js +140 -0
- package/dist/audit.js.map +1 -0
- package/dist/auth.d.ts +8 -0
- package/dist/auth.js +19 -0
- package/dist/auth.js.map +1 -0
- package/dist/doctor.d.ts +27 -0
- package/dist/doctor.js +169 -0
- package/dist/doctor.js.map +1 -0
- package/dist/forwardManager.d.ts +49 -0
- package/dist/forwardManager.js +141 -0
- package/dist/forwardManager.js.map +1 -0
- package/dist/init.d.ts +21 -0
- package/dist/init.js +80 -0
- package/dist/init.js.map +1 -0
- package/dist/inventory.d.ts +4 -0
- package/dist/inventory.js +262 -0
- package/dist/inventory.js.map +1 -0
- package/dist/mcpServer.d.ts +8 -0
- package/dist/mcpServer.js +403 -0
- package/dist/mcpServer.js.map +1 -0
- package/dist/operations.d.ts +167 -0
- package/dist/operations.js +1240 -0
- package/dist/operations.js.map +1 -0
- package/dist/policy.d.ts +21 -0
- package/dist/policy.js +470 -0
- package/dist/policy.js.map +1 -0
- package/dist/redaction.d.ts +2 -0
- package/dist/redaction.js +64 -0
- package/dist/redaction.js.map +1 -0
- package/dist/runner.d.ts +24 -0
- package/dist/runner.js +90 -0
- package/dist/runner.js.map +1 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.js +130 -0
- package/dist/server.js.map +1 -0
- package/dist/sessionManager.d.ts +77 -0
- package/dist/sessionManager.js +195 -0
- package/dist/sessionManager.js.map +1 -0
- package/dist/sshArgs.d.ts +24 -0
- package/dist/sshArgs.js +135 -0
- package/dist/sshArgs.js.map +1 -0
- package/dist/stateStore.d.ts +27 -0
- package/dist/stateStore.js +99 -0
- package/dist/stateStore.js.map +1 -0
- package/dist/types.d.ts +95 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/docs/mcp-client.example.json +15 -0
- package/examples/hosts.example.yaml +79 -0
- package/package.json +58 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const LOCAL_READ_HINT = {
|
|
4
|
+
readOnlyHint: true,
|
|
5
|
+
destructiveHint: false,
|
|
6
|
+
idempotentHint: true,
|
|
7
|
+
openWorldHint: false
|
|
8
|
+
};
|
|
9
|
+
const REMOTE_READ_HINT = {
|
|
10
|
+
readOnlyHint: true,
|
|
11
|
+
destructiveHint: false,
|
|
12
|
+
idempotentHint: false,
|
|
13
|
+
openWorldHint: true
|
|
14
|
+
};
|
|
15
|
+
const CONNECTION_HINT = {
|
|
16
|
+
readOnlyHint: true,
|
|
17
|
+
destructiveHint: false,
|
|
18
|
+
idempotentHint: false,
|
|
19
|
+
openWorldHint: true
|
|
20
|
+
};
|
|
21
|
+
const LOCAL_STATE_HINT = {
|
|
22
|
+
readOnlyHint: false,
|
|
23
|
+
destructiveHint: false,
|
|
24
|
+
idempotentHint: true,
|
|
25
|
+
openWorldHint: false
|
|
26
|
+
};
|
|
27
|
+
const RISK_GATED_REMOTE_HINT = {
|
|
28
|
+
readOnlyHint: false,
|
|
29
|
+
destructiveHint: true,
|
|
30
|
+
idempotentHint: false,
|
|
31
|
+
openWorldHint: true
|
|
32
|
+
};
|
|
33
|
+
export function createMcpServer(operations, options = {}) {
|
|
34
|
+
const server = new McpServer({
|
|
35
|
+
name: "smooth-ssh-mcp",
|
|
36
|
+
version: "0.1.0"
|
|
37
|
+
});
|
|
38
|
+
const toolHandler = createToolHandler(options.auditor);
|
|
39
|
+
server.registerTool("host_list", {
|
|
40
|
+
title: "List SSH hosts",
|
|
41
|
+
description: "List configured host aliases and non-secret metadata.",
|
|
42
|
+
annotations: LOCAL_READ_HINT,
|
|
43
|
+
inputSchema: {}
|
|
44
|
+
}, toolHandler("host_list", async () => ({ hosts: operations.hostList() })));
|
|
45
|
+
server.registerTool("host_get", {
|
|
46
|
+
title: "Get SSH host",
|
|
47
|
+
description: "Get one configured host by alias, including non-secret connection metadata.",
|
|
48
|
+
annotations: LOCAL_READ_HINT,
|
|
49
|
+
inputSchema: {
|
|
50
|
+
hostId: z.string().min(1)
|
|
51
|
+
}
|
|
52
|
+
}, toolHandler("host_get", async ({ hostId }) => operations.hostGet(hostId)));
|
|
53
|
+
server.registerTool("host_select", {
|
|
54
|
+
title: "Select default SSH host",
|
|
55
|
+
description: "Persist the currently selected host id for future Codex sessions. Stores only non-secret host ids and timestamps.",
|
|
56
|
+
annotations: LOCAL_STATE_HINT,
|
|
57
|
+
inputSchema: {
|
|
58
|
+
hostId: z.string().min(1)
|
|
59
|
+
}
|
|
60
|
+
}, toolHandler("host_select", async (input) => operations.hostSelect(input)));
|
|
61
|
+
server.registerTool("host_recent", {
|
|
62
|
+
title: "List recent SSH hosts",
|
|
63
|
+
description: "List the selected host and recently used hosts. Does not include passwords, key paths, or session state.",
|
|
64
|
+
annotations: LOCAL_READ_HINT,
|
|
65
|
+
inputSchema: {}
|
|
66
|
+
}, toolHandler("host_recent", async () => operations.hostRecent()));
|
|
67
|
+
server.registerTool("host_permission_set", {
|
|
68
|
+
title: "Set SSH host permission profile",
|
|
69
|
+
description: "Persist a per-host numeric permission level override: 1 is highest, 2 is confirmed administration, 3 is restricted/read-only.",
|
|
70
|
+
annotations: LOCAL_STATE_HINT,
|
|
71
|
+
inputSchema: {
|
|
72
|
+
hostId: z.string().min(1),
|
|
73
|
+
permissionLevel: z.union([z.literal(1), z.literal(2), z.literal(3)]),
|
|
74
|
+
confirmationToken: z.string().optional()
|
|
75
|
+
}
|
|
76
|
+
}, toolHandler("host_permission_set", async (input) => runWithOptionalChoiceConfirmation(server, input, (confirmedInput) => operations.hostPermissionSet(confirmedInput))));
|
|
77
|
+
server.registerTool("capability_list", {
|
|
78
|
+
title: "List Smooth SSH capabilities",
|
|
79
|
+
description: "List preferred structured capabilities and the shell fallback policy so clients avoid building large shell commands.",
|
|
80
|
+
annotations: LOCAL_READ_HINT,
|
|
81
|
+
inputSchema: {}
|
|
82
|
+
}, toolHandler("capability_list", async () => operations.capabilityList()));
|
|
83
|
+
server.registerTool("host_connect", {
|
|
84
|
+
title: "Connect to SSH host",
|
|
85
|
+
description: "High-level connect flow: use a provided or selected host, probe it, and optionally start an interactive session.",
|
|
86
|
+
annotations: CONNECTION_HINT,
|
|
87
|
+
inputSchema: {
|
|
88
|
+
hostId: z.string().min(1).optional(),
|
|
89
|
+
timeoutMs: z.number().int().min(1000).max(120000).optional(),
|
|
90
|
+
startSession: z.boolean().optional(),
|
|
91
|
+
retryCount: z.number().int().min(0).max(5).optional(),
|
|
92
|
+
retryDelayMs: z.number().int().min(0).max(30000).optional(),
|
|
93
|
+
confirmationToken: z.string().optional()
|
|
94
|
+
}
|
|
95
|
+
}, toolHandler("host_connect", async (input) => runWithOptionalChoiceConfirmation(server, input, (confirmedInput) => operations.hostConnect(confirmedInput))));
|
|
96
|
+
server.registerTool("ssh_probe", {
|
|
97
|
+
title: "Probe SSH host",
|
|
98
|
+
description: "Run a bounded read-only SSH probe and classify basic connection failures.",
|
|
99
|
+
annotations: REMOTE_READ_HINT,
|
|
100
|
+
inputSchema: {
|
|
101
|
+
hostId: z.string().min(1),
|
|
102
|
+
timeoutMs: z.number().int().min(1000).max(120000).optional()
|
|
103
|
+
}
|
|
104
|
+
}, toolHandler("ssh_probe", async (input) => operations.sshProbe(input)));
|
|
105
|
+
server.registerTool("ssh_exec", {
|
|
106
|
+
title: "Run SSH command",
|
|
107
|
+
description: "Shell fallback for bounded remote commands. Prefer ssh_command, task_batch, or capability tools before using shell syntax.",
|
|
108
|
+
annotations: RISK_GATED_REMOTE_HINT,
|
|
109
|
+
inputSchema: {
|
|
110
|
+
hostId: z.string().min(1),
|
|
111
|
+
command: z.string().min(1),
|
|
112
|
+
cwd: z.string().optional(),
|
|
113
|
+
env: z.record(z.string()).optional(),
|
|
114
|
+
sudo: z.enum(["none", "nopasswd"]).optional(),
|
|
115
|
+
timeoutMs: z.number().int().min(1000).max(600000).optional(),
|
|
116
|
+
stdin: z.string().optional(),
|
|
117
|
+
confirmationToken: z.string().optional()
|
|
118
|
+
}
|
|
119
|
+
}, toolHandler("ssh_exec", async (input) => runWithOptionalChoiceConfirmation(server, input, (confirmedInput) => operations.sshExec(confirmedInput))));
|
|
120
|
+
server.registerTool("ssh_command", {
|
|
121
|
+
title: "Run SSH argv command",
|
|
122
|
+
description: "Run one remote program with argv-style arguments. Avoids agent-built shell chains and uses semantic policy checks.",
|
|
123
|
+
annotations: RISK_GATED_REMOTE_HINT,
|
|
124
|
+
inputSchema: {
|
|
125
|
+
hostId: z.string().min(1),
|
|
126
|
+
program: z.string().min(1),
|
|
127
|
+
args: z.array(z.string()).optional(),
|
|
128
|
+
cwd: z.string().optional(),
|
|
129
|
+
env: z.record(z.string()).optional(),
|
|
130
|
+
sudo: z.enum(["none", "nopasswd"]).optional(),
|
|
131
|
+
timeoutMs: z.number().int().min(1000).max(600000).optional(),
|
|
132
|
+
confirmationToken: z.string().optional()
|
|
133
|
+
}
|
|
134
|
+
}, toolHandler("ssh_command", async (input) => runWithOptionalChoiceConfirmation(server, input, (confirmedInput) => operations.sshCommand(confirmedInput))));
|
|
135
|
+
server.registerTool("task_batch", {
|
|
136
|
+
title: "Run SSH task batch",
|
|
137
|
+
description: "Run multiple structured argv tasks one by one. Defaults to compact stdout/stderr previews; use detail=full only when raw output is needed. Stops before tasks that need confirmation instead of building a composite shell command.",
|
|
138
|
+
annotations: RISK_GATED_REMOTE_HINT,
|
|
139
|
+
inputSchema: {
|
|
140
|
+
hostId: z.string().min(1),
|
|
141
|
+
tasks: z.array(z.object({
|
|
142
|
+
id: z.string().optional(),
|
|
143
|
+
program: z.string().min(1),
|
|
144
|
+
args: z.array(z.string()).optional(),
|
|
145
|
+
timeoutMs: z.number().int().min(1000).max(600000).optional()
|
|
146
|
+
})),
|
|
147
|
+
timeoutMs: z.number().int().min(1000).max(600000).optional(),
|
|
148
|
+
detail: z.enum(["compact", "full"]).optional(),
|
|
149
|
+
outputLimitBytes: z.number().int().min(1).max(4096).optional(),
|
|
150
|
+
startAt: z.number().int().min(0).optional(),
|
|
151
|
+
confirmationToken: z.string().optional()
|
|
152
|
+
}
|
|
153
|
+
}, toolHandler("task_batch", async (input) => runWithOptionalChoiceConfirmation(server, input, (confirmedInput) => operations.taskBatch(confirmedInput))));
|
|
154
|
+
server.registerTool("cleanup_paths", {
|
|
155
|
+
title: "Clean remote paths",
|
|
156
|
+
description: "Delete exact remote paths or empty exact remote directories after one path-list confirmation. Does not accept globs.",
|
|
157
|
+
annotations: RISK_GATED_REMOTE_HINT,
|
|
158
|
+
inputSchema: {
|
|
159
|
+
hostId: z.string().min(1),
|
|
160
|
+
targets: z
|
|
161
|
+
.array(z.object({
|
|
162
|
+
path: z.string().min(1),
|
|
163
|
+
mode: z.enum(["delete", "empty-dir"]).optional()
|
|
164
|
+
}))
|
|
165
|
+
.min(1),
|
|
166
|
+
timeoutMs: z.number().int().min(1000).max(600000).optional(),
|
|
167
|
+
confirmationToken: z.string().optional()
|
|
168
|
+
}
|
|
169
|
+
}, toolHandler("cleanup_paths", async (input) => runWithOptionalChoiceConfirmation(server, input, (confirmedInput) => operations.cleanupPaths(confirmedInput))));
|
|
170
|
+
server.registerTool("host_health", {
|
|
171
|
+
title: "Read SSH host health",
|
|
172
|
+
description: "Run a fixed read-only health inspection through structured argv tasks: host, load, memory, disk, services, ports, Docker, and critical logs.",
|
|
173
|
+
annotations: REMOTE_READ_HINT,
|
|
174
|
+
inputSchema: {
|
|
175
|
+
hostId: z.string().min(1),
|
|
176
|
+
timeoutMs: z.number().int().min(1000).max(600000).optional(),
|
|
177
|
+
services: z.array(z.string()).optional(),
|
|
178
|
+
includeRaw: z.boolean().optional(),
|
|
179
|
+
detail: z.enum(["compact", "full"]).optional()
|
|
180
|
+
}
|
|
181
|
+
}, toolHandler("host_health", async (input) => operations.hostHealth(input)));
|
|
182
|
+
server.registerTool("session_start", {
|
|
183
|
+
title: "Start SSH session",
|
|
184
|
+
description: "Start a limited interactive ssh -tt session with TTL, idle timeout, and output ring buffer.",
|
|
185
|
+
annotations: CONNECTION_HINT,
|
|
186
|
+
inputSchema: {
|
|
187
|
+
hostId: z.string().min(1),
|
|
188
|
+
confirmationToken: z.string().optional()
|
|
189
|
+
}
|
|
190
|
+
}, toolHandler("session_start", async (input) => runWithOptionalChoiceConfirmation(server, input, async (confirmedInput) => operations.sessionStart(confirmedInput))));
|
|
191
|
+
server.registerTool("session_send", {
|
|
192
|
+
title: "Send SSH session input",
|
|
193
|
+
description: "Write input to an active interactive SSH session.",
|
|
194
|
+
annotations: RISK_GATED_REMOTE_HINT,
|
|
195
|
+
inputSchema: {
|
|
196
|
+
sessionId: z.string().min(1),
|
|
197
|
+
input: z.string(),
|
|
198
|
+
confirmationToken: z.string().optional()
|
|
199
|
+
}
|
|
200
|
+
}, toolHandler("session_send", async (input) => runWithOptionalChoiceConfirmation(server, input, (confirmedInput) => operations.sessionSend(confirmedInput))));
|
|
201
|
+
server.registerTool("session_read", {
|
|
202
|
+
title: "Read SSH session output",
|
|
203
|
+
description: "Read and clear buffered output from an active SSH session.",
|
|
204
|
+
annotations: CONNECTION_HINT,
|
|
205
|
+
inputSchema: {
|
|
206
|
+
sessionId: z.string().min(1),
|
|
207
|
+
maxBytes: z.number().int().min(1).max(1024 * 1024).optional()
|
|
208
|
+
}
|
|
209
|
+
}, toolHandler("session_read", async (input) => operations.sessionRead(input)));
|
|
210
|
+
server.registerTool("session_stop", {
|
|
211
|
+
title: "Stop SSH session",
|
|
212
|
+
description: "Terminate an active interactive SSH session.",
|
|
213
|
+
annotations: CONNECTION_HINT,
|
|
214
|
+
inputSchema: {
|
|
215
|
+
sessionId: z.string().min(1)
|
|
216
|
+
}
|
|
217
|
+
}, toolHandler("session_stop", async (input) => operations.sessionStop(input)));
|
|
218
|
+
server.registerTool("session_list", {
|
|
219
|
+
title: "List SSH sessions",
|
|
220
|
+
description: "List active managed interactive SSH sessions.",
|
|
221
|
+
annotations: CONNECTION_HINT,
|
|
222
|
+
inputSchema: {}
|
|
223
|
+
}, toolHandler("session_list", async () => ({ sessions: operations.sessionList() })));
|
|
224
|
+
server.registerTool("file_upload", {
|
|
225
|
+
title: "Upload file over SCP",
|
|
226
|
+
description: "Upload a local file to a remote host through scp. Requires host policy and confirmation.",
|
|
227
|
+
annotations: RISK_GATED_REMOTE_HINT,
|
|
228
|
+
inputSchema: {
|
|
229
|
+
hostId: z.string().min(1),
|
|
230
|
+
localPath: z.string().min(1),
|
|
231
|
+
remotePath: z.string().min(1),
|
|
232
|
+
confirmationToken: z.string().optional()
|
|
233
|
+
}
|
|
234
|
+
}, toolHandler("file_upload", async (input) => runWithOptionalChoiceConfirmation(server, input, (confirmedInput) => operations.fileUpload(confirmedInput))));
|
|
235
|
+
server.registerTool("file_download", {
|
|
236
|
+
title: "Download file over SCP",
|
|
237
|
+
description: "Download a remote file through scp. Requires host policy and confirmation.",
|
|
238
|
+
annotations: RISK_GATED_REMOTE_HINT,
|
|
239
|
+
inputSchema: {
|
|
240
|
+
hostId: z.string().min(1),
|
|
241
|
+
localPath: z.string().min(1),
|
|
242
|
+
remotePath: z.string().min(1),
|
|
243
|
+
confirmationToken: z.string().optional()
|
|
244
|
+
}
|
|
245
|
+
}, toolHandler("file_download", async (input) => runWithOptionalChoiceConfirmation(server, input, (confirmedInput) => operations.fileDownload(confirmedInput))));
|
|
246
|
+
server.registerTool("forward_start", {
|
|
247
|
+
title: "Start local SSH port forward",
|
|
248
|
+
description: "Start a managed ssh -N -L local port forward. Always policy checked and normally confirmation gated.",
|
|
249
|
+
annotations: RISK_GATED_REMOTE_HINT,
|
|
250
|
+
inputSchema: {
|
|
251
|
+
hostId: z.string().min(1),
|
|
252
|
+
localHost: z.string().default("127.0.0.1").optional(),
|
|
253
|
+
localPort: z.number().int().min(1).max(65535),
|
|
254
|
+
remoteHost: z.string().min(1),
|
|
255
|
+
remotePort: z.number().int().min(1).max(65535),
|
|
256
|
+
confirmationToken: z.string().optional()
|
|
257
|
+
}
|
|
258
|
+
}, toolHandler("forward_start", async (input) => runWithOptionalChoiceConfirmation(server, input, (confirmedInput) => operations.forwardStart(confirmedInput))));
|
|
259
|
+
server.registerTool("forward_stop", {
|
|
260
|
+
title: "Stop SSH port forward",
|
|
261
|
+
description: "Stop a managed SSH port forward by id.",
|
|
262
|
+
annotations: CONNECTION_HINT,
|
|
263
|
+
inputSchema: {
|
|
264
|
+
forwardId: z.string().min(1)
|
|
265
|
+
}
|
|
266
|
+
}, toolHandler("forward_stop", async (input) => operations.forwardStop(input)));
|
|
267
|
+
server.registerTool("forward_list", {
|
|
268
|
+
title: "List SSH port forwards",
|
|
269
|
+
description: "List active managed SSH port forwards.",
|
|
270
|
+
annotations: CONNECTION_HINT,
|
|
271
|
+
inputSchema: {}
|
|
272
|
+
}, toolHandler("forward_list", async () => ({ forwards: operations.forwardList() })));
|
|
273
|
+
return server;
|
|
274
|
+
}
|
|
275
|
+
function createToolHandler(auditor) {
|
|
276
|
+
return (tool, run) => async (input) => {
|
|
277
|
+
const startedAt = Date.now();
|
|
278
|
+
try {
|
|
279
|
+
const result = await run(input);
|
|
280
|
+
auditor?.recordToolCall({
|
|
281
|
+
tool,
|
|
282
|
+
input,
|
|
283
|
+
result,
|
|
284
|
+
durationMs: Date.now() - startedAt
|
|
285
|
+
});
|
|
286
|
+
return jsonResult(result);
|
|
287
|
+
}
|
|
288
|
+
catch (error) {
|
|
289
|
+
auditor?.recordToolCall({
|
|
290
|
+
tool,
|
|
291
|
+
input,
|
|
292
|
+
result: { error: error instanceof Error ? error.message : String(error) },
|
|
293
|
+
durationMs: Date.now() - startedAt
|
|
294
|
+
});
|
|
295
|
+
throw error;
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
function jsonResult(data) {
|
|
300
|
+
return {
|
|
301
|
+
content: [
|
|
302
|
+
{
|
|
303
|
+
type: "text",
|
|
304
|
+
text: JSON.stringify(data, null, 2)
|
|
305
|
+
}
|
|
306
|
+
],
|
|
307
|
+
structuredContent: data
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
async function runWithOptionalChoiceConfirmation(server, input, run) {
|
|
311
|
+
const result = await run(input);
|
|
312
|
+
const confirmation = confirmationFromResult(result);
|
|
313
|
+
if (!confirmation || input.confirmationToken || !clientSupportsFormElicitation(server)) {
|
|
314
|
+
return result;
|
|
315
|
+
}
|
|
316
|
+
try {
|
|
317
|
+
const choice = await server.server.elicitInput({
|
|
318
|
+
mode: "form",
|
|
319
|
+
message: confirmationMessage(confirmation),
|
|
320
|
+
requestedSchema: {
|
|
321
|
+
type: "object",
|
|
322
|
+
properties: {
|
|
323
|
+
decision: {
|
|
324
|
+
type: "string",
|
|
325
|
+
title: "操作",
|
|
326
|
+
oneOf: [
|
|
327
|
+
{ const: "confirm", title: "确认执行" },
|
|
328
|
+
{ const: "cancel", title: "取消" }
|
|
329
|
+
],
|
|
330
|
+
default: "cancel"
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
required: ["decision"]
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
if (choice.action === "accept" && choice.content?.decision === "confirm") {
|
|
337
|
+
const confirmedInput = {
|
|
338
|
+
...input,
|
|
339
|
+
confirmationToken: confirmation.token
|
|
340
|
+
};
|
|
341
|
+
const resumeFrom = blockedResumeFrom(result);
|
|
342
|
+
if (resumeFrom !== undefined) {
|
|
343
|
+
confirmedInput.startAt = resumeFrom;
|
|
344
|
+
}
|
|
345
|
+
return await run(confirmedInput);
|
|
346
|
+
}
|
|
347
|
+
return {
|
|
348
|
+
cancelled: true,
|
|
349
|
+
hostId: confirmation.hostId,
|
|
350
|
+
operation: confirmation.operation,
|
|
351
|
+
reason: "user cancelled confirmation",
|
|
352
|
+
preview: confirmation.preview
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
catch {
|
|
356
|
+
return result;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
function clientSupportsFormElicitation(server) {
|
|
360
|
+
return Boolean(server.server.getClientCapabilities()?.elicitation?.form);
|
|
361
|
+
}
|
|
362
|
+
function isConfirmationRequired(value) {
|
|
363
|
+
return Boolean(value && typeof value === "object" && value.confirmationRequired === true);
|
|
364
|
+
}
|
|
365
|
+
function confirmationFromResult(value) {
|
|
366
|
+
if (isConfirmationRequired(value))
|
|
367
|
+
return value;
|
|
368
|
+
if (!value || typeof value !== "object")
|
|
369
|
+
return undefined;
|
|
370
|
+
const blocked = value.blocked;
|
|
371
|
+
if (!blocked || typeof blocked !== "object")
|
|
372
|
+
return undefined;
|
|
373
|
+
const blockedResult = blocked.result;
|
|
374
|
+
return isConfirmationRequired(blockedResult) ? blockedResult : undefined;
|
|
375
|
+
}
|
|
376
|
+
function blockedResumeFrom(value) {
|
|
377
|
+
if (!value || typeof value !== "object")
|
|
378
|
+
return undefined;
|
|
379
|
+
const blocked = value.blocked;
|
|
380
|
+
if (!blocked || typeof blocked !== "object")
|
|
381
|
+
return undefined;
|
|
382
|
+
const resumeFrom = blocked.resumeFrom;
|
|
383
|
+
return typeof resumeFrom === "number" ? resumeFrom : undefined;
|
|
384
|
+
}
|
|
385
|
+
function confirmationMessage(confirmation) {
|
|
386
|
+
const preview = [
|
|
387
|
+
confirmation.preview.command ? `command: ${confirmation.preview.command}` : undefined,
|
|
388
|
+
confirmation.preview.localPath ? `localPath: ${confirmation.preview.localPath}` : undefined,
|
|
389
|
+
confirmation.preview.remotePath ? `remotePath: ${confirmation.preview.remotePath}` : undefined,
|
|
390
|
+
confirmation.preview.ports ? `ports: ${confirmation.preview.ports.join(", ")}` : undefined
|
|
391
|
+
]
|
|
392
|
+
.filter(Boolean)
|
|
393
|
+
.join("\n");
|
|
394
|
+
return [
|
|
395
|
+
`确认在 ${confirmation.hostId} 执行高风险操作?`,
|
|
396
|
+
`风险:${confirmation.risk}`,
|
|
397
|
+
`原因:${confirmation.reason}`,
|
|
398
|
+
preview ? `预览:\n${preview}` : undefined
|
|
399
|
+
]
|
|
400
|
+
.filter(Boolean)
|
|
401
|
+
.join("\n");
|
|
402
|
+
}
|
|
403
|
+
//# sourceMappingURL=mcpServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpServer.js","sourceRoot":"","sources":["../src/mcpServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,MAAM,eAAe,GAAoB;IACvC,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,KAAK;IACtB,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,KAAK;CACrB,CAAC;AAEF,MAAM,gBAAgB,GAAoB;IACxC,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,KAAK;IACtB,cAAc,EAAE,KAAK;IACrB,aAAa,EAAE,IAAI;CACpB,CAAC;AAEF,MAAM,eAAe,GAAoB;IACvC,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,KAAK;IACtB,cAAc,EAAE,KAAK;IACrB,aAAa,EAAE,IAAI;CACpB,CAAC;AAEF,MAAM,gBAAgB,GAAoB;IACxC,YAAY,EAAE,KAAK;IACnB,eAAe,EAAE,KAAK;IACtB,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,KAAK;CACrB,CAAC;AAEF,MAAM,sBAAsB,GAAoB;IAC9C,YAAY,EAAE,KAAK;IACnB,eAAe,EAAE,IAAI;IACrB,cAAc,EAAE,KAAK;IACrB,aAAa,EAAE,IAAI;CACpB,CAAC;AAMF,MAAM,UAAU,eAAe,CAAC,UAAyB,EAAE,UAA4B,EAAE;IACvF,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,gBAAgB;QACtB,O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essionManager.js";
|
|
4
|
+
import { StateStore } from "./stateStore.js";
|
|
5
|
+
import type { ConfirmationRequired, ExecResult, Host, Inventory, PermissionLevel, PolicyDecision } from "./types.js";
|
|
6
|
+
type OperationsOptions = {
|
|
7
|
+
inventory: Inventory;
|
|
8
|
+
runner?: Runner;
|
|
9
|
+
controlDir?: string;
|
|
10
|
+
sessionManager?: SessionManager;
|
|
11
|
+
forwardManager?: ForwardManager;
|
|
12
|
+
env?: NodeJS.ProcessEnv;
|
|
13
|
+
stateStore?: StateStore;
|
|
14
|
+
};
|
|
15
|
+
type ExecInput = {
|
|
16
|
+
hostId: string;
|
|
17
|
+
command: string;
|
|
18
|
+
cwd?: string;
|
|
19
|
+
env?: Record<string, string>;
|
|
20
|
+
sudo?: "none" | "nopasswd";
|
|
21
|
+
timeoutMs?: number;
|
|
22
|
+
confirmationToken?: string;
|
|
23
|
+
stdin?: string;
|
|
24
|
+
};
|
|
25
|
+
type CommandInput = {
|
|
26
|
+
hostId: string;
|
|
27
|
+
program: string;
|
|
28
|
+
args?: string[];
|
|
29
|
+
cwd?: string;
|
|
30
|
+
env?: Record<string, string>;
|
|
31
|
+
sudo?: "none" | "nopasswd";
|
|
32
|
+
timeoutMs?: number;
|
|
33
|
+
confirmationToken?: string;
|
|
34
|
+
};
|
|
35
|
+
type BatchTaskInput = {
|
|
36
|
+
id?: string;
|
|
37
|
+
program: string;
|
|
38
|
+
args?: string[];
|
|
39
|
+
timeoutMs?: number;
|
|
40
|
+
};
|
|
41
|
+
type BatchInput = {
|
|
42
|
+
hostId: string;
|
|
43
|
+
tasks: BatchTaskInput[];
|
|
44
|
+
timeoutMs?: number;
|
|
45
|
+
confirmationToken?: string;
|
|
46
|
+
detail?: "compact" | "full";
|
|
47
|
+
outputLimitBytes?: number;
|
|
48
|
+
startAt?: number;
|
|
49
|
+
};
|
|
50
|
+
type CleanupMode = "delete" | "empty-dir";
|
|
51
|
+
type CleanupTargetInput = {
|
|
52
|
+
path: string;
|
|
53
|
+
mode?: CleanupMode;
|
|
54
|
+
};
|
|
55
|
+
type CleanupInput = {
|
|
56
|
+
hostId: string;
|
|
57
|
+
targets: CleanupTargetInput[];
|
|
58
|
+
timeoutMs?: number;
|
|
59
|
+
confirmationToken?: string;
|
|
60
|
+
};
|
|
61
|
+
type HealthInput = {
|
|
62
|
+
hostId: string;
|
|
63
|
+
timeoutMs?: number;
|
|
64
|
+
services?: string[];
|
|
65
|
+
includeRaw?: boolean;
|
|
66
|
+
detail?: "compact" | "full";
|
|
67
|
+
};
|
|
68
|
+
type FileInput = {
|
|
69
|
+
hostId: string;
|
|
70
|
+
localPath: string;
|
|
71
|
+
remotePath: string;
|
|
72
|
+
confirmationToken?: string;
|
|
73
|
+
};
|
|
74
|
+
type HostConnectInput = {
|
|
75
|
+
hostId?: string;
|
|
76
|
+
timeoutMs?: number;
|
|
77
|
+
startSession?: boolean;
|
|
78
|
+
retryCount?: number;
|
|
79
|
+
retryDelayMs?: number;
|
|
80
|
+
confirmationToken?: string;
|
|
81
|
+
};
|
|
82
|
+
export declare class SshOperations {
|
|
83
|
+
private readonly inventory;
|
|
84
|
+
private readonly runner;
|
|
85
|
+
private readonly controlDir;
|
|
86
|
+
private readonly sessions;
|
|
87
|
+
private readonly forwards;
|
|
88
|
+
private readonly env;
|
|
89
|
+
private readonly stateStore;
|
|
90
|
+
private readonly sessionInputBuffers;
|
|
91
|
+
constructor(options: OperationsOptions);
|
|
92
|
+
dispose(): void;
|
|
93
|
+
hostList(): Array<Omit<Host, "identityFile" | "passwordEnv"> & {
|
|
94
|
+
hasIdentityFile: boolean;
|
|
95
|
+
hasPasswordEnv: boolean;
|
|
96
|
+
}>;
|
|
97
|
+
hostGet(hostId: string): Omit<Host, "identityFile" | "passwordEnv"> & {
|
|
98
|
+
hasIdentityFile: boolean;
|
|
99
|
+
hasPasswordEnv: boolean;
|
|
100
|
+
};
|
|
101
|
+
hostSelect(input: {
|
|
102
|
+
hostId: string;
|
|
103
|
+
}): {
|
|
104
|
+
selectedHostId?: string;
|
|
105
|
+
recentHosts: unknown[];
|
|
106
|
+
};
|
|
107
|
+
hostRecent(): {
|
|
108
|
+
selectedHostId?: string;
|
|
109
|
+
recentHosts: unknown[];
|
|
110
|
+
};
|
|
111
|
+
hostPermissionSet(input: {
|
|
112
|
+
hostId: string;
|
|
113
|
+
permissionLevel: PermissionLevel;
|
|
114
|
+
confirmationToken?: string;
|
|
115
|
+
}): {
|
|
116
|
+
hostId: string;
|
|
117
|
+
permissionLevel: PermissionLevel;
|
|
118
|
+
} | ConfirmationRequired;
|
|
119
|
+
capabilityList(): Record<string, unknown>;
|
|
120
|
+
hostConnect(input?: HostConnectInput): Promise<Record<string, unknown>>;
|
|
121
|
+
sshProbe(input: {
|
|
122
|
+
hostId: string;
|
|
123
|
+
timeoutMs?: number;
|
|
124
|
+
}): Promise<Record<string, unknown>>;
|
|
125
|
+
sshExec(input: ExecInput): Promise<ExecResult | ConfirmationRequired | PolicyDecision>;
|
|
126
|
+
sshCommand(input: CommandInput): Promise<ExecResult | ConfirmationRequired | PolicyDecision>;
|
|
127
|
+
taskBatch(input: BatchInput): Promise<Record<string, unknown>>;
|
|
128
|
+
cleanupPaths(input: CleanupInput): Promise<Record<string, unknown> | ConfirmationRequired | PolicyDecision>;
|
|
129
|
+
hostHealth(input: HealthInput): Promise<Record<string, unknown>>;
|
|
130
|
+
private runRemoteCommand;
|
|
131
|
+
fileUpload(input: FileInput): Promise<ExecResult | ConfirmationRequired | PolicyDecision>;
|
|
132
|
+
fileDownload(input: FileInput): Promise<ExecResult | ConfirmationRequired | PolicyDecision>;
|
|
133
|
+
sessionStart(input: {
|
|
134
|
+
hostId: string;
|
|
135
|
+
confirmationToken?: string;
|
|
136
|
+
}): unknown;
|
|
137
|
+
sessionSend(input: {
|
|
138
|
+
sessionId: string;
|
|
139
|
+
input: string;
|
|
140
|
+
confirmationToken?: string;
|
|
141
|
+
}): unknown;
|
|
142
|
+
sessionRead(input: {
|
|
143
|
+
sessionId: string;
|
|
144
|
+
maxBytes?: number;
|
|
145
|
+
}): unknown;
|
|
146
|
+
sessionStop(input: {
|
|
147
|
+
sessionId: string;
|
|
148
|
+
}): unknown;
|
|
149
|
+
sessionList(): unknown;
|
|
150
|
+
private updateSessionInputBuffer;
|
|
151
|
+
forwardStart(input: {
|
|
152
|
+
hostId: string;
|
|
153
|
+
localHost?: string;
|
|
154
|
+
localPort: number;
|
|
155
|
+
remoteHost: string;
|
|
156
|
+
remotePort: number;
|
|
157
|
+
confirmationToken?: string;
|
|
158
|
+
}): Promise<PolicyDecision | ConfirmationRequired | unknown>;
|
|
159
|
+
forwardStop(input: {
|
|
160
|
+
forwardId: string;
|
|
161
|
+
}): unknown;
|
|
162
|
+
forwardList(): unknown;
|
|
163
|
+
private findEffectiveHost;
|
|
164
|
+
private applyStatePolicy;
|
|
165
|
+
private fileTransfer;
|
|
166
|
+
}
|
|
167
|
+
export {};
|