@paretools/remote 0.11.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/LICENSE +21 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/formatters.d.ts +59 -0
- package/dist/lib/formatters.d.ts.map +1 -0
- package/dist/lib/formatters.js +153 -0
- package/dist/lib/formatters.js.map +1 -0
- package/dist/lib/parsers.d.ts +35 -0
- package/dist/lib/parsers.d.ts.map +1 -0
- package/dist/lib/parsers.js +120 -0
- package/dist/lib/parsers.js.map +1 -0
- package/dist/lib/remote-runner.d.ts +8 -0
- package/dist/lib/remote-runner.d.ts.map +1 -0
- package/dist/lib/remote-runner.js +14 -0
- package/dist/lib/remote-runner.js.map +1 -0
- package/dist/schemas/index.d.ts +60 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +56 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +18 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/rsync.d.ts +4 -0
- package/dist/tools/rsync.d.ts.map +1 -0
- package/dist/tools/rsync.js +124 -0
- package/dist/tools/rsync.js.map +1 -0
- package/dist/tools/ssh-keyscan.d.ts +4 -0
- package/dist/tools/ssh-keyscan.d.ts.map +1 -0
- package/dist/tools/ssh-keyscan.js +56 -0
- package/dist/tools/ssh-keyscan.js.map +1 -0
- package/dist/tools/ssh-run.d.ts +4 -0
- package/dist/tools/ssh-run.d.ts.map +1 -0
- package/dist/tools/ssh-run.js +82 -0
- package/dist/tools/ssh-run.js.map +1 -0
- package/dist/tools/ssh-test.d.ts +4 -0
- package/dist/tools/ssh-test.d.ts.map +1 -0
- package/dist/tools/ssh-test.js +71 -0
- package/dist/tools/ssh-test.js.map +1 -0
- package/package.json +71 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dave London
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { registerAllTools } from "./tools/index.js";
|
|
5
|
+
const server = new McpServer({ name: "@paretools/remote", version: "0.1.0" }, {
|
|
6
|
+
instructions: "Structured remote operations (SSH, rsync). Run commands on remote hosts, test connectivity, scan host keys, and sync files. Returns typed JSON.",
|
|
7
|
+
});
|
|
8
|
+
registerAllTools(server);
|
|
9
|
+
const transport = new StdioServerTransport();
|
|
10
|
+
await server.connect(transport);
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,EAAE,EAC/C;IACE,YAAY,EACV,iJAAiJ;CACpJ,CACF,CAAC;AAEF,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAEzB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { SshRunResult, SshTestResult, SshKeyscanResult, RsyncResult } from "../schemas/index.js";
|
|
2
|
+
/** Formats structured ssh run results into human-readable output. */
|
|
3
|
+
export declare function formatSshRun(data: SshRunResult): string;
|
|
4
|
+
/** Formats structured ssh test results into human-readable output. */
|
|
5
|
+
export declare function formatSshTest(data: SshTestResult): string;
|
|
6
|
+
/** Formats structured ssh-keyscan results into human-readable output. */
|
|
7
|
+
export declare function formatSshKeyscan(data: SshKeyscanResult): string;
|
|
8
|
+
/** Formats structured rsync results into human-readable output. */
|
|
9
|
+
export declare function formatRsync(data: RsyncResult): string;
|
|
10
|
+
/** Compact ssh run: drop stdout/stderr. */
|
|
11
|
+
export interface SshRunCompact {
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
host: string;
|
|
14
|
+
user?: string;
|
|
15
|
+
command: string;
|
|
16
|
+
success: boolean;
|
|
17
|
+
exitCode: number;
|
|
18
|
+
duration: number;
|
|
19
|
+
timedOut: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function compactSshRunMap(data: SshRunResult): SshRunCompact;
|
|
22
|
+
export declare function formatSshRunCompact(data: SshRunCompact): string;
|
|
23
|
+
/** Compact ssh test: minimal connectivity info. */
|
|
24
|
+
export interface SshTestCompact {
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
host: string;
|
|
27
|
+
user?: string;
|
|
28
|
+
reachable: boolean;
|
|
29
|
+
duration: number;
|
|
30
|
+
}
|
|
31
|
+
export declare function compactSshTestMap(data: SshTestResult): SshTestCompact;
|
|
32
|
+
export declare function formatSshTestCompact(data: SshTestCompact): string;
|
|
33
|
+
/** Compact keyscan: key count only. */
|
|
34
|
+
export interface SshKeyscanCompact {
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
host: string;
|
|
37
|
+
keyCount: number;
|
|
38
|
+
keyTypes: string[];
|
|
39
|
+
success: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare function compactSshKeyscanMap(data: SshKeyscanResult): SshKeyscanCompact;
|
|
42
|
+
export declare function formatSshKeyscanCompact(data: SshKeyscanCompact): string;
|
|
43
|
+
/** Compact rsync: drop stdout/stderr, keep stats. */
|
|
44
|
+
export interface RsyncCompact {
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
source: string;
|
|
47
|
+
destination: string;
|
|
48
|
+
dryRun: boolean;
|
|
49
|
+
success: boolean;
|
|
50
|
+
exitCode: number;
|
|
51
|
+
filesTransferred?: number;
|
|
52
|
+
totalSize?: string;
|
|
53
|
+
speedup?: string;
|
|
54
|
+
duration: number;
|
|
55
|
+
timedOut: boolean;
|
|
56
|
+
}
|
|
57
|
+
export declare function compactRsyncMap(data: RsyncResult): RsyncCompact;
|
|
58
|
+
export declare function formatRsyncCompact(data: RsyncCompact): string;
|
|
59
|
+
//# sourceMappingURL=formatters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAI7B,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAevD;AAED,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAYzD;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAa/D;AAED,mEAAmE;AACnE,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAoBrD;AAID,2CAA2C;AAC3C,MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,GAAG,aAAa,CAUlE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAO/D;AAED,mDAAmD;AACnD,MAAM,WAAW,cAAc;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,GAAG,cAAc,CAOrE;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAKjE;AAED,uCAAuC;AACvC,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,gBAAgB,GAAG,iBAAiB,CAO9E;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAGvE;AAED,qDAAqD;AACrD,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,YAAY,CAa/D;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAU7D"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// ── Full formatters ──────────────────────────────────────────────────
|
|
2
|
+
/** Formats structured ssh run results into human-readable output. */
|
|
3
|
+
export function formatSshRun(data) {
|
|
4
|
+
const lines = [];
|
|
5
|
+
const target = data.user ? `${data.user}@${data.host}` : data.host;
|
|
6
|
+
if (data.timedOut) {
|
|
7
|
+
lines.push(`ssh ${target}: TIMED OUT after ${data.duration}ms (exit code ${data.exitCode}).`);
|
|
8
|
+
}
|
|
9
|
+
else if (data.success) {
|
|
10
|
+
lines.push(`ssh ${target}: success (${data.duration}ms).`);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
lines.push(`ssh ${target}: exit code ${data.exitCode} (${data.duration}ms).`);
|
|
14
|
+
}
|
|
15
|
+
lines.push(`command: ${data.command}`);
|
|
16
|
+
if (data.stdout)
|
|
17
|
+
lines.push(data.stdout);
|
|
18
|
+
if (data.stderr)
|
|
19
|
+
lines.push(data.stderr);
|
|
20
|
+
return lines.join("\n");
|
|
21
|
+
}
|
|
22
|
+
/** Formats structured ssh test results into human-readable output. */
|
|
23
|
+
export function formatSshTest(data) {
|
|
24
|
+
const lines = [];
|
|
25
|
+
const target = data.user ? `${data.user}@${data.host}` : data.host;
|
|
26
|
+
if (data.reachable) {
|
|
27
|
+
lines.push(`ssh ${target}: reachable (${data.duration}ms).`);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
lines.push(`ssh ${target}: unreachable (exit code ${data.exitCode}, ${data.duration}ms).`);
|
|
31
|
+
}
|
|
32
|
+
if (data.banner)
|
|
33
|
+
lines.push(`banner: ${data.banner}`);
|
|
34
|
+
if (data.error)
|
|
35
|
+
lines.push(`error: ${data.error}`);
|
|
36
|
+
return lines.join("\n");
|
|
37
|
+
}
|
|
38
|
+
/** Formats structured ssh-keyscan results into human-readable output. */
|
|
39
|
+
export function formatSshKeyscan(data) {
|
|
40
|
+
const lines = [];
|
|
41
|
+
if (data.success) {
|
|
42
|
+
lines.push(`ssh-keyscan ${data.host}: ${data.keys.length} keys found.`);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
lines.push(`ssh-keyscan ${data.host}: failed.`);
|
|
46
|
+
}
|
|
47
|
+
for (const key of data.keys) {
|
|
48
|
+
lines.push(` ${key.keyType}: ${key.key.substring(0, 40)}...`);
|
|
49
|
+
}
|
|
50
|
+
if (data.error)
|
|
51
|
+
lines.push(`error: ${data.error}`);
|
|
52
|
+
return lines.join("\n");
|
|
53
|
+
}
|
|
54
|
+
/** Formats structured rsync results into human-readable output. */
|
|
55
|
+
export function formatRsync(data) {
|
|
56
|
+
const lines = [];
|
|
57
|
+
const mode = data.dryRun ? " (dry-run)" : "";
|
|
58
|
+
if (data.timedOut) {
|
|
59
|
+
lines.push(`rsync${mode}: TIMED OUT after ${data.duration}ms (exit code ${data.exitCode}).`);
|
|
60
|
+
}
|
|
61
|
+
else if (data.success) {
|
|
62
|
+
lines.push(`rsync${mode}: success (${data.duration}ms).`);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
lines.push(`rsync${mode}: exit code ${data.exitCode} (${data.duration}ms).`);
|
|
66
|
+
}
|
|
67
|
+
lines.push(`source: ${data.source}`);
|
|
68
|
+
lines.push(`destination: ${data.destination}`);
|
|
69
|
+
if (data.filesTransferred !== undefined)
|
|
70
|
+
lines.push(`files transferred: ${data.filesTransferred}`);
|
|
71
|
+
if (data.totalSize)
|
|
72
|
+
lines.push(`total size: ${data.totalSize}`);
|
|
73
|
+
if (data.speedup)
|
|
74
|
+
lines.push(`speedup: ${data.speedup}`);
|
|
75
|
+
if (data.stdout)
|
|
76
|
+
lines.push(data.stdout);
|
|
77
|
+
if (data.stderr)
|
|
78
|
+
lines.push(data.stderr);
|
|
79
|
+
return lines.join("\n");
|
|
80
|
+
}
|
|
81
|
+
export function compactSshRunMap(data) {
|
|
82
|
+
return {
|
|
83
|
+
host: data.host,
|
|
84
|
+
user: data.user,
|
|
85
|
+
command: data.command,
|
|
86
|
+
success: data.success,
|
|
87
|
+
exitCode: data.exitCode,
|
|
88
|
+
duration: data.duration,
|
|
89
|
+
timedOut: data.timedOut,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export function formatSshRunCompact(data) {
|
|
93
|
+
const target = data.user ? `${data.user}@${data.host}` : data.host;
|
|
94
|
+
if (data.timedOut) {
|
|
95
|
+
return `ssh ${target}: TIMED OUT after ${data.duration}ms (exit code ${data.exitCode}).`;
|
|
96
|
+
}
|
|
97
|
+
if (data.success)
|
|
98
|
+
return `ssh ${target}: success (${data.duration}ms).`;
|
|
99
|
+
return `ssh ${target}: exit code ${data.exitCode} (${data.duration}ms).`;
|
|
100
|
+
}
|
|
101
|
+
export function compactSshTestMap(data) {
|
|
102
|
+
return {
|
|
103
|
+
host: data.host,
|
|
104
|
+
user: data.user,
|
|
105
|
+
reachable: data.reachable,
|
|
106
|
+
duration: data.duration,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export function formatSshTestCompact(data) {
|
|
110
|
+
const target = data.user ? `${data.user}@${data.host}` : data.host;
|
|
111
|
+
return data.reachable
|
|
112
|
+
? `ssh ${target}: reachable (${data.duration}ms).`
|
|
113
|
+
: `ssh ${target}: unreachable (${data.duration}ms).`;
|
|
114
|
+
}
|
|
115
|
+
export function compactSshKeyscanMap(data) {
|
|
116
|
+
return {
|
|
117
|
+
host: data.host,
|
|
118
|
+
keyCount: data.keys.length,
|
|
119
|
+
keyTypes: data.keys.map((k) => k.keyType),
|
|
120
|
+
success: data.success,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
export function formatSshKeyscanCompact(data) {
|
|
124
|
+
if (!data.success)
|
|
125
|
+
return `ssh-keyscan ${data.host}: failed.`;
|
|
126
|
+
return `ssh-keyscan ${data.host}: ${data.keyCount} keys (${data.keyTypes.join(", ")}).`;
|
|
127
|
+
}
|
|
128
|
+
export function compactRsyncMap(data) {
|
|
129
|
+
return {
|
|
130
|
+
source: data.source,
|
|
131
|
+
destination: data.destination,
|
|
132
|
+
dryRun: data.dryRun,
|
|
133
|
+
success: data.success,
|
|
134
|
+
exitCode: data.exitCode,
|
|
135
|
+
filesTransferred: data.filesTransferred,
|
|
136
|
+
totalSize: data.totalSize,
|
|
137
|
+
speedup: data.speedup,
|
|
138
|
+
duration: data.duration,
|
|
139
|
+
timedOut: data.timedOut,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
export function formatRsyncCompact(data) {
|
|
143
|
+
const mode = data.dryRun ? " (dry-run)" : "";
|
|
144
|
+
if (data.timedOut) {
|
|
145
|
+
return `rsync${mode}: TIMED OUT after ${data.duration}ms.`;
|
|
146
|
+
}
|
|
147
|
+
if (data.success) {
|
|
148
|
+
const stats = data.filesTransferred !== undefined ? `, ${data.filesTransferred} files` : "";
|
|
149
|
+
return `rsync${mode}: success (${data.duration}ms${stats}).`;
|
|
150
|
+
}
|
|
151
|
+
return `rsync${mode}: exit code ${data.exitCode} (${data.duration}ms).`;
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAOA,wEAAwE;AAExE,qEAAqE;AACrE,MAAM,UAAU,YAAY,CAAC,IAAkB;IAC7C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IAEnE,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,KAAK,CAAC,IAAI,CAAC,OAAO,MAAM,qBAAqB,IAAI,CAAC,QAAQ,iBAAiB,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC;IAChG,CAAC;SAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,OAAO,MAAM,cAAc,IAAI,CAAC,QAAQ,MAAM,CAAC,CAAC;IAC7D,CAAC;SAAM,CAAC;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AC,CAAC,CAAC,KAAK,IAAI,CAAC,gBAAgB,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5F,OAAO,QAAQ,IAAI,cAAc,IAAI,CAAC,QAAQ,KAAK,KAAK,IAAI,CAAC;IAC/D,CAAC;IACD,OAAO,QAAQ,IAAI,eAAe,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,MAAM,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SshRunResult, SshTestResult, SshKeyscanResult, RsyncResult } from "../schemas/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Parses the output of an ssh remote command execution into structured data.
|
|
4
|
+
*/
|
|
5
|
+
export declare function parseSshRunOutput(host: string, user: string | undefined, command: string, stdout: string, stderr: string, exitCode: number, duration: number, timedOut?: boolean): SshRunResult;
|
|
6
|
+
/**
|
|
7
|
+
* Parses the output of an ssh connectivity test into structured data.
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseSshTestOutput(host: string, user: string | undefined, stdout: string, stderr: string, exitCode: number, duration: number): SshTestResult;
|
|
10
|
+
/**
|
|
11
|
+
* Parses the output of ssh-keyscan into structured host key data.
|
|
12
|
+
*
|
|
13
|
+
* Expected format (one key per line):
|
|
14
|
+
* ```
|
|
15
|
+
* github.com ssh-ed25519 AAAAC3Nza...
|
|
16
|
+
* github.com ssh-rsa AAAAB3Nza...
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Comment lines starting with # are ignored.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseSshKeyscanOutput(host: string, stdout: string, stderr: string, exitCode: number): SshKeyscanResult;
|
|
22
|
+
/**
|
|
23
|
+
* Parses the output of rsync into structured transfer data.
|
|
24
|
+
*
|
|
25
|
+
* When run with --stats, rsync outputs lines like:
|
|
26
|
+
* ```
|
|
27
|
+
* Number of files: 10
|
|
28
|
+
* Number of regular files transferred: 3
|
|
29
|
+
* Total file size: 1,234 bytes
|
|
30
|
+
* ...
|
|
31
|
+
* speedup is 1.23
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseRsyncOutput(source: string, destination: string, dryRun: boolean, stdout: string, stderr: string, exitCode: number, duration: number, timedOut?: boolean): RsyncResult;
|
|
35
|
+
//# sourceMappingURL=parsers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../../src/lib/parsers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAI7B;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,OAAe,GACxB,YAAY,CAYd;AAID;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,aAAa,CAcf;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,gBAAgB,CA0BlB;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,OAAe,GACxB,WAAW,CAuCb"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// ── SSH Run ─────────────────────────────────────────────────────────────
|
|
2
|
+
/**
|
|
3
|
+
* Parses the output of an ssh remote command execution into structured data.
|
|
4
|
+
*/
|
|
5
|
+
export function parseSshRunOutput(host, user, command, stdout, stderr, exitCode, duration, timedOut = false) {
|
|
6
|
+
return {
|
|
7
|
+
host,
|
|
8
|
+
user: user || undefined,
|
|
9
|
+
command,
|
|
10
|
+
success: exitCode === 0 && !timedOut,
|
|
11
|
+
exitCode,
|
|
12
|
+
stdout: stdout.trimEnd() || undefined,
|
|
13
|
+
stderr: stderr.trimEnd() || undefined,
|
|
14
|
+
duration,
|
|
15
|
+
timedOut,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
// ── SSH Test ────────────────────────────────────────────────────────────
|
|
19
|
+
/**
|
|
20
|
+
* Parses the output of an ssh connectivity test into structured data.
|
|
21
|
+
*/
|
|
22
|
+
export function parseSshTestOutput(host, user, stdout, stderr, exitCode, duration) {
|
|
23
|
+
// ssh -T often writes the banner to stderr
|
|
24
|
+
const combined = (stdout + "\n" + stderr).trim();
|
|
25
|
+
const banner = combined || undefined;
|
|
26
|
+
return {
|
|
27
|
+
host,
|
|
28
|
+
user: user || undefined,
|
|
29
|
+
reachable: exitCode === 0,
|
|
30
|
+
exitCode,
|
|
31
|
+
banner,
|
|
32
|
+
error: exitCode !== 0 ? stderr.trimEnd() || undefined : undefined,
|
|
33
|
+
duration,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
// ── SSH Keyscan ─────────────────────────────────────────────────────────
|
|
37
|
+
/**
|
|
38
|
+
* Parses the output of ssh-keyscan into structured host key data.
|
|
39
|
+
*
|
|
40
|
+
* Expected format (one key per line):
|
|
41
|
+
* ```
|
|
42
|
+
* github.com ssh-ed25519 AAAAC3Nza...
|
|
43
|
+
* github.com ssh-rsa AAAAB3Nza...
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* Comment lines starting with # are ignored.
|
|
47
|
+
*/
|
|
48
|
+
export function parseSshKeyscanOutput(host, stdout, stderr, exitCode) {
|
|
49
|
+
const keys = [];
|
|
50
|
+
for (const line of stdout.split("\n")) {
|
|
51
|
+
const trimmed = line.trim();
|
|
52
|
+
if (!trimmed || trimmed.startsWith("#"))
|
|
53
|
+
continue;
|
|
54
|
+
// Format: hostname keytype key
|
|
55
|
+
const parts = trimmed.split(/\s+/, 3);
|
|
56
|
+
if (parts.length === 3) {
|
|
57
|
+
keys.push({
|
|
58
|
+
host: parts[0],
|
|
59
|
+
keyType: parts[1],
|
|
60
|
+
key: parts[2],
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const hasError = exitCode !== 0 || (keys.length === 0 && stderr.trim().length > 0);
|
|
65
|
+
return {
|
|
66
|
+
host,
|
|
67
|
+
keys,
|
|
68
|
+
error: hasError ? stderr.trimEnd() || undefined : undefined,
|
|
69
|
+
success: keys.length > 0,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// ── Rsync ───────────────────────────────────────────────────────────────
|
|
73
|
+
/**
|
|
74
|
+
* Parses the output of rsync into structured transfer data.
|
|
75
|
+
*
|
|
76
|
+
* When run with --stats, rsync outputs lines like:
|
|
77
|
+
* ```
|
|
78
|
+
* Number of files: 10
|
|
79
|
+
* Number of regular files transferred: 3
|
|
80
|
+
* Total file size: 1,234 bytes
|
|
81
|
+
* ...
|
|
82
|
+
* speedup is 1.23
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export function parseRsyncOutput(source, destination, dryRun, stdout, stderr, exitCode, duration, timedOut = false) {
|
|
86
|
+
let filesTransferred;
|
|
87
|
+
let totalSize;
|
|
88
|
+
let speedup;
|
|
89
|
+
// Parse --stats output
|
|
90
|
+
for (const line of stdout.split("\n")) {
|
|
91
|
+
const trimmed = line.trim();
|
|
92
|
+
const transferMatch = trimmed.match(/^Number of (?:regular )?files transferred:\s*([\d,]+)/i);
|
|
93
|
+
if (transferMatch) {
|
|
94
|
+
filesTransferred = parseInt(transferMatch[1].replace(/,/g, ""), 10);
|
|
95
|
+
}
|
|
96
|
+
const sizeMatch = trimmed.match(/^Total file size:\s*(.+?)(?:\s+bytes)?$/i);
|
|
97
|
+
if (sizeMatch) {
|
|
98
|
+
totalSize = sizeMatch[1].trim();
|
|
99
|
+
}
|
|
100
|
+
const speedupMatch = trimmed.match(/speedup is\s+([\d.]+)/i);
|
|
101
|
+
if (speedupMatch) {
|
|
102
|
+
speedup = speedupMatch[1];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
source,
|
|
107
|
+
destination,
|
|
108
|
+
dryRun,
|
|
109
|
+
success: exitCode === 0 && !timedOut,
|
|
110
|
+
exitCode,
|
|
111
|
+
filesTransferred,
|
|
112
|
+
totalSize,
|
|
113
|
+
speedup,
|
|
114
|
+
stdout: stdout.trimEnd() || undefined,
|
|
115
|
+
stderr: stderr.trimEnd() || undefined,
|
|
116
|
+
duration,
|
|
117
|
+
timedOut,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=parsers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../src/lib/parsers.ts"],"names":[],"mappings":"AAOA,2EAA2E;AAE3E;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,IAAY,EACZ,IAAwB,EACxB,OAAe,EACf,MAAc,EACd,MAAc,EACd,QAAgB,EAChB,QAAgB,EAChB,WAAoB,KAAK;IAEzB,OAAO;QACL,IAAI;QACJ,IAAI,EAAE,IAAI,IAAI,SAAS;QACvB,OAAO;QACP,OAAO,EAAE,QAAQ,KAAK,CAAC,IAAI,CAAC,QAAQ;QACpC,QAAQ;QACR,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,SAAS;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,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAClC,CAAC;QAED,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC7D,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,OAAO;QACL,MAAM;QACN,WAAW;QACX,MAAM;QACN,OAAO,EAAE,QAAQ,KAAK,CAAC,IAAI,CAAC,QAAQ;QACpC,QAAQ;QACR,gBAAgB;QAChB,SAAS;QACT,OAAO;QACP,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,SAAS;QACrC,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,SAAS;QACrC,QAAQ;QACR,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type RunResult } from "@paretools/shared";
|
|
2
|
+
/** Runs an `ssh` command with the given arguments. */
|
|
3
|
+
export declare function sshCmd(args: string[], cwd?: string): Promise<RunResult>;
|
|
4
|
+
/** Runs an `ssh-keyscan` command with the given arguments. */
|
|
5
|
+
export declare function sshKeyscanCmd(args: string[], cwd?: string): Promise<RunResult>;
|
|
6
|
+
/** Runs an `rsync` command with the given arguments. */
|
|
7
|
+
export declare function rsyncCmd(args: string[], cwd?: string): Promise<RunResult>;
|
|
8
|
+
//# sourceMappingURL=remote-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-runner.d.ts","sourceRoot":"","sources":["../../src/lib/remote-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAExD,sDAAsD;AACtD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAE7E;AAED,8DAA8D;AAC9D,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAEpF;AAED,wDAAwD;AACxD,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAE/E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { run } from "@paretools/shared";
|
|
2
|
+
/** Runs an `ssh` command with the given arguments. */
|
|
3
|
+
export async function sshCmd(args, cwd) {
|
|
4
|
+
return run("ssh", args, { cwd, timeout: 300_000 });
|
|
5
|
+
}
|
|
6
|
+
/** Runs an `ssh-keyscan` command with the given arguments. */
|
|
7
|
+
export async function sshKeyscanCmd(args, cwd) {
|
|
8
|
+
return run("ssh-keyscan", args, { cwd, timeout: 60_000 });
|
|
9
|
+
}
|
|
10
|
+
/** Runs an `rsync` command with the given arguments. */
|
|
11
|
+
export async function rsyncCmd(args, cwd) {
|
|
12
|
+
return run("rsync", args, { cwd, timeout: 300_000 });
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=remote-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-runner.js","sourceRoot":"","sources":["../../src/lib/remote-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAkB,MAAM,mBAAmB,CAAC;AAExD,sDAAsD;AACtD,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAc,EAAE,GAAY;IACvD,OAAO,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;AACrD,CAAC;AAED,8DAA8D;AAC9D,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAc,EAAE,GAAY;IAC9D,OAAO,GAAG,CAAC,aAAa,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED,wDAAwD;AACxD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAc,EAAE,GAAY;IACzD,OAAO,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Zod schema for structured ssh command execution output. */
|
|
3
|
+
export declare const SshRunResultSchema: z.ZodObject<{
|
|
4
|
+
host: z.ZodString;
|
|
5
|
+
user: z.ZodOptional<z.ZodString>;
|
|
6
|
+
command: z.ZodString;
|
|
7
|
+
success: z.ZodBoolean;
|
|
8
|
+
exitCode: z.ZodNumber;
|
|
9
|
+
stdout: z.ZodOptional<z.ZodString>;
|
|
10
|
+
stderr: z.ZodOptional<z.ZodString>;
|
|
11
|
+
duration: z.ZodNumber;
|
|
12
|
+
timedOut: z.ZodBoolean;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export type SshRunResult = z.infer<typeof SshRunResultSchema>;
|
|
15
|
+
/** Zod schema for structured ssh connectivity test output. */
|
|
16
|
+
export declare const SshTestResultSchema: z.ZodObject<{
|
|
17
|
+
host: z.ZodString;
|
|
18
|
+
user: z.ZodOptional<z.ZodString>;
|
|
19
|
+
reachable: z.ZodBoolean;
|
|
20
|
+
exitCode: z.ZodNumber;
|
|
21
|
+
banner: z.ZodOptional<z.ZodString>;
|
|
22
|
+
error: z.ZodOptional<z.ZodString>;
|
|
23
|
+
duration: z.ZodNumber;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export type SshTestResult = z.infer<typeof SshTestResultSchema>;
|
|
26
|
+
/** Zod schema for a single host key entry. */
|
|
27
|
+
export declare const HostKeySchema: z.ZodObject<{
|
|
28
|
+
host: z.ZodString;
|
|
29
|
+
keyType: z.ZodString;
|
|
30
|
+
key: z.ZodString;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
/** Zod schema for structured ssh-keyscan output. */
|
|
33
|
+
export declare const SshKeyscanResultSchema: z.ZodObject<{
|
|
34
|
+
host: z.ZodString;
|
|
35
|
+
keys: z.ZodArray<z.ZodObject<{
|
|
36
|
+
host: z.ZodString;
|
|
37
|
+
keyType: z.ZodString;
|
|
38
|
+
key: z.ZodString;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
error: z.ZodOptional<z.ZodString>;
|
|
41
|
+
success: z.ZodBoolean;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export type SshKeyscanResult = z.infer<typeof SshKeyscanResultSchema>;
|
|
44
|
+
/** Zod schema for structured rsync transfer output. */
|
|
45
|
+
export declare const RsyncResultSchema: z.ZodObject<{
|
|
46
|
+
source: z.ZodString;
|
|
47
|
+
destination: z.ZodString;
|
|
48
|
+
dryRun: z.ZodBoolean;
|
|
49
|
+
success: z.ZodBoolean;
|
|
50
|
+
exitCode: z.ZodNumber;
|
|
51
|
+
filesTransferred: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
totalSize: z.ZodOptional<z.ZodString>;
|
|
53
|
+
speedup: z.ZodOptional<z.ZodString>;
|
|
54
|
+
stdout: z.ZodOptional<z.ZodString>;
|
|
55
|
+
stderr: z.ZodOptional<z.ZodString>;
|
|
56
|
+
duration: z.ZodNumber;
|
|
57
|
+
timedOut: z.ZodBoolean;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
export type RsyncResult = z.infer<typeof RsyncResultSchema>;
|
|
60
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,8DAA8D;AAC9D,eAAO,MAAM,kBAAkB;;;;;;;;;;iBAU7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAI9D,8DAA8D;AAC9D,eAAO,MAAM,mBAAmB;;;;;;;;iBAQ9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAIhE,8CAA8C;AAC9C,eAAO,MAAM,aAAa;;;;iBAIxB,CAAC;AAEH,oDAAoD;AACpD,eAAO,MAAM,sBAAsB;;;;;;;;;iBAKjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAItE,uDAAuD;AACvD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;iBAa5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// ── SSH Run ─────────────────────────────────────────────────────────────
|
|
3
|
+
/** Zod schema for structured ssh command execution output. */
|
|
4
|
+
export const SshRunResultSchema = z.object({
|
|
5
|
+
host: z.string(),
|
|
6
|
+
user: z.string().optional(),
|
|
7
|
+
command: z.string(),
|
|
8
|
+
success: z.boolean(),
|
|
9
|
+
exitCode: z.number(),
|
|
10
|
+
stdout: z.string().optional(),
|
|
11
|
+
stderr: z.string().optional(),
|
|
12
|
+
duration: z.number(),
|
|
13
|
+
timedOut: z.boolean(),
|
|
14
|
+
});
|
|
15
|
+
// ── SSH Test ────────────────────────────────────────────────────────────
|
|
16
|
+
/** Zod schema for structured ssh connectivity test output. */
|
|
17
|
+
export const SshTestResultSchema = z.object({
|
|
18
|
+
host: z.string(),
|
|
19
|
+
user: z.string().optional(),
|
|
20
|
+
reachable: z.boolean(),
|
|
21
|
+
exitCode: z.number(),
|
|
22
|
+
banner: z.string().optional(),
|
|
23
|
+
error: z.string().optional(),
|
|
24
|
+
duration: z.number(),
|
|
25
|
+
});
|
|
26
|
+
// ── SSH Keyscan ─────────────────────────────────────────────────────────
|
|
27
|
+
/** Zod schema for a single host key entry. */
|
|
28
|
+
export const HostKeySchema = z.object({
|
|
29
|
+
host: z.string(),
|
|
30
|
+
keyType: z.string(),
|
|
31
|
+
key: z.string(),
|
|
32
|
+
});
|
|
33
|
+
/** Zod schema for structured ssh-keyscan output. */
|
|
34
|
+
export const SshKeyscanResultSchema = z.object({
|
|
35
|
+
host: z.string(),
|
|
36
|
+
keys: z.array(HostKeySchema),
|
|
37
|
+
error: z.string().optional(),
|
|
38
|
+
success: z.boolean(),
|
|
39
|
+
});
|
|
40
|
+
// ── Rsync ───────────────────────────────────────────────────────────────
|
|
41
|
+
/** Zod schema for structured rsync transfer output. */
|
|
42
|
+
export const RsyncResultSchema = z.object({
|
|
43
|
+
source: z.string(),
|
|
44
|
+
destination: z.string(),
|
|
45
|
+
dryRun: z.boolean(),
|
|
46
|
+
success: z.boolean(),
|
|
47
|
+
exitCode: z.number(),
|
|
48
|
+
filesTransferred: z.number().optional(),
|
|
49
|
+
totalSize: z.string().optional(),
|
|
50
|
+
speedup: z.string().optional(),
|
|
51
|
+
stdout: z.string().optional(),
|
|
52
|
+
stderr: z.string().optional(),
|
|
53
|
+
duration: z.number(),
|
|
54
|
+
timedOut: z.boolean(),
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,2EAA2E;AAE3E,8DAA8D;AAC9D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC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AAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;IAC5B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC;AAIH,2EAA2E;AAE3E,uDAAuD;AACvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACvC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;CACtB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QAMjD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { shouldRegisterTool } from "@paretools/shared";
|
|
2
|
+
import { registerSshRunTool } from "./ssh-run.js";
|
|
3
|
+
import { registerSshTestTool } from "./ssh-test.js";
|
|
4
|
+
import { registerSshKeyscanTool } from "./ssh-keyscan.js";
|
|
5
|
+
import { registerRsyncTool } from "./rsync.js";
|
|
6
|
+
/** Registers all Remote tools on the given MCP server, filtered by policy. */
|
|
7
|
+
export function registerAllTools(server) {
|
|
8
|
+
const s = (name) => shouldRegisterTool("remote", name);
|
|
9
|
+
if (s("ssh-run"))
|
|
10
|
+
registerSshRunTool(server);
|
|
11
|
+
if (s("ssh-test"))
|
|
12
|
+
registerSshTestTool(server);
|
|
13
|
+
if (s("ssh-keyscan"))
|
|
14
|
+
registerSshKeyscanTool(server);
|
|
15
|
+
if (s("rsync"))
|
|
16
|
+
registerRsyncTool(server);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,8EAA8E;AAC9E,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,MAAM,CAAC,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC/D,IAAI,CAAC,CAAC,SAAS,CAAC;QAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC7C,IAAI,CAAC,CAAC,UAAU,CAAC;QAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC/C,IAAI,CAAC,CAAC,aAAa,CAAC;QAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;IACrD,IAAI,CAAC,CAAC,OAAO,CAAC;QAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rsync.d.ts","sourceRoot":"","sources":["../../src/tools/rsync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAazE,0DAA0D;AAC1D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,QA0JlD"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compactDualOutput, assertNoFlagInjection, INPUT_LIMITS, compactInput, projectPathInput, } from "@paretools/shared";
|
|
3
|
+
import { rsyncCmd } from "../lib/remote-runner.js";
|
|
4
|
+
import { parseRsyncOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatRsync, compactRsyncMap, formatRsyncCompact } from "../lib/formatters.js";
|
|
6
|
+
import { RsyncResultSchema } from "../schemas/index.js";
|
|
7
|
+
/** Registers the `rsync` tool on the given MCP server. */
|
|
8
|
+
export function registerRsyncTool(server) {
|
|
9
|
+
server.registerTool("rsync", {
|
|
10
|
+
title: "Rsync File Sync",
|
|
11
|
+
description: "Syncs files between local and remote locations using rsync. WARNING: Defaults to dry-run mode for safety — set dryRun=false to actually transfer files. Returns structured transfer statistics.",
|
|
12
|
+
inputSchema: {
|
|
13
|
+
source: z
|
|
14
|
+
.string()
|
|
15
|
+
.max(INPUT_LIMITS.STRING_MAX)
|
|
16
|
+
.describe("Source path (local path or remote user@host:path). Use trailing / to sync directory contents."),
|
|
17
|
+
destination: z
|
|
18
|
+
.string()
|
|
19
|
+
.max(INPUT_LIMITS.STRING_MAX)
|
|
20
|
+
.describe("Destination path (local path or remote user@host:path)"),
|
|
21
|
+
dryRun: z
|
|
22
|
+
.boolean()
|
|
23
|
+
.optional()
|
|
24
|
+
.default(true)
|
|
25
|
+
.describe("Preview what would be transferred without making changes (default: true for safety). Set to false to actually transfer."),
|
|
26
|
+
archive: z
|
|
27
|
+
.boolean()
|
|
28
|
+
.optional()
|
|
29
|
+
.default(true)
|
|
30
|
+
.describe("Archive mode: preserves permissions, timestamps, symlinks (rsync -a)"),
|
|
31
|
+
compress: z
|
|
32
|
+
.boolean()
|
|
33
|
+
.optional()
|
|
34
|
+
.default(true)
|
|
35
|
+
.describe("Compress data during transfer (rsync -z)"),
|
|
36
|
+
verbose: z
|
|
37
|
+
.boolean()
|
|
38
|
+
.optional()
|
|
39
|
+
.default(true)
|
|
40
|
+
.describe("Verbose output showing transferred files (rsync -v)"),
|
|
41
|
+
delete: z
|
|
42
|
+
.boolean()
|
|
43
|
+
.optional()
|
|
44
|
+
.describe("Delete files in destination that don't exist in source. Use with caution!"),
|
|
45
|
+
exclude: z
|
|
46
|
+
.array(z.string().max(INPUT_LIMITS.SHORT_STRING_MAX))
|
|
47
|
+
.max(INPUT_LIMITS.ARRAY_MAX)
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("Patterns to exclude from sync (e.g. node_modules, .git)"),
|
|
50
|
+
include: z
|
|
51
|
+
.array(z.string().max(INPUT_LIMITS.SHORT_STRING_MAX))
|
|
52
|
+
.max(INPUT_LIMITS.ARRAY_MAX)
|
|
53
|
+
.optional()
|
|
54
|
+
.describe("Patterns to include in sync"),
|
|
55
|
+
sshPort: z.number().optional().describe("SSH port for remote transfers"),
|
|
56
|
+
identityFile: z
|
|
57
|
+
.string()
|
|
58
|
+
.max(INPUT_LIMITS.PATH_MAX)
|
|
59
|
+
.optional()
|
|
60
|
+
.describe("SSH private key file for remote transfers"),
|
|
61
|
+
path: projectPathInput,
|
|
62
|
+
compact: compactInput,
|
|
63
|
+
},
|
|
64
|
+
outputSchema: RsyncResultSchema,
|
|
65
|
+
}, async ({ source, destination, dryRun, archive, compress, verbose, delete: deleteDest, exclude, include, sshPort, identityFile, path, compact, }) => {
|
|
66
|
+
assertNoFlagInjection(source, "source");
|
|
67
|
+
assertNoFlagInjection(destination, "destination");
|
|
68
|
+
if (identityFile)
|
|
69
|
+
assertNoFlagInjection(identityFile, "identityFile");
|
|
70
|
+
const cwd = path || process.cwd();
|
|
71
|
+
const args = [];
|
|
72
|
+
if (archive)
|
|
73
|
+
args.push("-a");
|
|
74
|
+
if (compress)
|
|
75
|
+
args.push("-z");
|
|
76
|
+
if (verbose)
|
|
77
|
+
args.push("-v");
|
|
78
|
+
if (dryRun)
|
|
79
|
+
args.push("--dry-run");
|
|
80
|
+
if (deleteDest)
|
|
81
|
+
args.push("--delete");
|
|
82
|
+
// Always include --stats for structured output parsing
|
|
83
|
+
args.push("--stats");
|
|
84
|
+
// Exclude patterns
|
|
85
|
+
for (const pattern of exclude || []) {
|
|
86
|
+
args.push("--exclude", pattern);
|
|
87
|
+
}
|
|
88
|
+
// Include patterns
|
|
89
|
+
for (const pattern of include || []) {
|
|
90
|
+
args.push("--include", pattern);
|
|
91
|
+
}
|
|
92
|
+
// SSH options for remote transfers
|
|
93
|
+
if (sshPort !== undefined || identityFile) {
|
|
94
|
+
const sshOpts = ["ssh"];
|
|
95
|
+
if (sshPort !== undefined)
|
|
96
|
+
sshOpts.push(`-p ${sshPort}`);
|
|
97
|
+
if (identityFile)
|
|
98
|
+
sshOpts.push(`-i ${identityFile}`);
|
|
99
|
+
args.push("-e", sshOpts.join(" "));
|
|
100
|
+
}
|
|
101
|
+
args.push(source, destination);
|
|
102
|
+
const start = Date.now();
|
|
103
|
+
let timedOut = false;
|
|
104
|
+
let result;
|
|
105
|
+
try {
|
|
106
|
+
result = await rsyncCmd(args, cwd);
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
110
|
+
if (errMsg.includes("timed out")) {
|
|
111
|
+
timedOut = true;
|
|
112
|
+
result = { exitCode: 124, stdout: "", stderr: errMsg };
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
throw err;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const duration = Date.now() - start;
|
|
119
|
+
const data = parseRsyncOutput(source, destination, dryRun ?? true, result.stdout, result.stderr, result.exitCode, duration, timedOut);
|
|
120
|
+
const rawOutput = (result.stdout + "\n" + result.stderr).trim();
|
|
121
|
+
return compactDualOutput(data, rawOutput, formatRsync, compactRsyncMap, formatRsyncCompact, compact === false);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=rsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rsync.js","sourceRoot":"","sources":["../../src/tools/rsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,0DAA0D;AAC1D,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACjD,MAAM,CAAC,YAAY,CACjB,OAAO,EACP;QACE,KAAK,EAAE,iBAAiB;QACxB,WAAW,EACT,iMAAiM;QACnM,WAAW,EAAE;YACX,MAAM,EAAE,CAAC;iBACN,MAAM,EAAE;iBACR,GAAG,CAAC,YAAY,CAAC,UAAU,CAAC;iBAC5B,QAAQ,CACP,+FAA+F,CAChG;YACH,WAAW,EAAE,CAAC;iBACX,MAAM,EAAE;iBACR,GAAG,CAAC,YAAY,CAAC,UAAU,CAAC;iBAC5B,QAAQ,CAAC,wDAAwD,CAAC;YACrE,MAAM,EAAE,CAAC;iBACN,OAAO,EAAE;iBAC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IAAI,EACd,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,QAAQ,EACf,QAAQ,EACR,QAAQ,CACT,CAAC;QACF,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAChE,OAAO,iBAAiB,CACtB,IAAI,EACJ,SAAS,EACT,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,OAAO,KAAK,KAAK,CAClB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-keyscan.d.ts","sourceRoot":"","sources":["../../src/tools/ssh-keyscan.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgBzE,gEAAgE;AAChE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,QA6DvD"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compactDualOutput, assertNoFlagInjection, INPUT_LIMITS, compactInput, } from "@paretools/shared";
|
|
3
|
+
import { sshKeyscanCmd } from "../lib/remote-runner.js";
|
|
4
|
+
import { parseSshKeyscanOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatSshKeyscan, compactSshKeyscanMap, formatSshKeyscanCompact, } from "../lib/formatters.js";
|
|
6
|
+
import { SshKeyscanResultSchema } from "../schemas/index.js";
|
|
7
|
+
/** Registers the `ssh-keyscan` tool on the given MCP server. */
|
|
8
|
+
export function registerSshKeyscanTool(server) {
|
|
9
|
+
server.registerTool("ssh-keyscan", {
|
|
10
|
+
title: "SSH Keyscan",
|
|
11
|
+
description: "Retrieves public host keys from a remote SSH server using `ssh-keyscan`. Useful for populating known_hosts or verifying host key fingerprints.",
|
|
12
|
+
inputSchema: {
|
|
13
|
+
host: z
|
|
14
|
+
.string()
|
|
15
|
+
.max(INPUT_LIMITS.SHORT_STRING_MAX)
|
|
16
|
+
.describe("Remote host to scan for public keys (hostname or IP address)"),
|
|
17
|
+
port: z.number().optional().describe("SSH port number (default: 22)"),
|
|
18
|
+
keyType: z
|
|
19
|
+
.enum(["rsa", "ecdsa", "ed25519"])
|
|
20
|
+
.optional()
|
|
21
|
+
.describe("Specific key type to request (default: all types)"),
|
|
22
|
+
timeout: z
|
|
23
|
+
.number()
|
|
24
|
+
.optional()
|
|
25
|
+
.describe("Timeout in seconds for the keyscan operation (default: 5)"),
|
|
26
|
+
compact: compactInput,
|
|
27
|
+
},
|
|
28
|
+
outputSchema: SshKeyscanResultSchema,
|
|
29
|
+
}, async ({ host, port, keyType, timeout, compact }) => {
|
|
30
|
+
assertNoFlagInjection(host, "host");
|
|
31
|
+
const args = [];
|
|
32
|
+
if (port !== undefined)
|
|
33
|
+
args.push("-p", String(port));
|
|
34
|
+
if (keyType)
|
|
35
|
+
args.push("-t", keyType);
|
|
36
|
+
if (timeout !== undefined) {
|
|
37
|
+
args.push("-T", String(timeout));
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
args.push("-T", "5");
|
|
41
|
+
}
|
|
42
|
+
args.push(host);
|
|
43
|
+
let result;
|
|
44
|
+
try {
|
|
45
|
+
result = await sshKeyscanCmd(args);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
49
|
+
result = { exitCode: 1, stdout: "", stderr: errMsg };
|
|
50
|
+
}
|
|
51
|
+
const data = parseSshKeyscanOutput(host, result.stdout, result.stderr, result.exitCode);
|
|
52
|
+
const rawOutput = (result.stdout + "\n" + result.stderr).trim();
|
|
53
|
+
return compactDualOutput(data, rawOutput, formatSshKeyscan, compactSshKeyscanMap, formatSshKeyscanCompact, compact === false);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=ssh-keyscan.js.map
|
|
@@ -0,0 +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EACT,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,OAAO,KAAK,KAAK,CAClB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-run.d.ts","sourceRoot":"","sources":["../../src/tools/ssh-run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYzE,4DAA4D;AAC5D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,QA+FnD"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compactDualOutput, assertNoFlagInjection, INPUT_LIMITS, compactInput, } from "@paretools/shared";
|
|
3
|
+
import { sshCmd } from "../lib/remote-runner.js";
|
|
4
|
+
import { parseSshRunOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatSshRun, compactSshRunMap, formatSshRunCompact } from "../lib/formatters.js";
|
|
6
|
+
import { SshRunResultSchema } from "../schemas/index.js";
|
|
7
|
+
/** Registers the `ssh-run` tool on the given MCP server. */
|
|
8
|
+
export function registerSshRunTool(server) {
|
|
9
|
+
server.registerTool("ssh-run", {
|
|
10
|
+
title: "SSH Run Command",
|
|
11
|
+
description: "Executes a command on a remote host via SSH. WARNING: This runs commands on a remote machine. Ensure the host and command are correct before executing. Returns structured output with stdout, stderr, exit code, and duration.",
|
|
12
|
+
inputSchema: {
|
|
13
|
+
host: z
|
|
14
|
+
.string()
|
|
15
|
+
.max(INPUT_LIMITS.SHORT_STRING_MAX)
|
|
16
|
+
.describe("Remote host to connect to (hostname or IP address)"),
|
|
17
|
+
user: z
|
|
18
|
+
.string()
|
|
19
|
+
.max(INPUT_LIMITS.SHORT_STRING_MAX)
|
|
20
|
+
.optional()
|
|
21
|
+
.describe("SSH username (if not specified, uses SSH config default)"),
|
|
22
|
+
command: z
|
|
23
|
+
.string()
|
|
24
|
+
.max(INPUT_LIMITS.STRING_MAX)
|
|
25
|
+
.describe("Command to execute on the remote host"),
|
|
26
|
+
port: z.number().optional().describe("SSH port number (default: 22)"),
|
|
27
|
+
identityFile: z
|
|
28
|
+
.string()
|
|
29
|
+
.max(INPUT_LIMITS.PATH_MAX)
|
|
30
|
+
.optional()
|
|
31
|
+
.describe("Path to SSH private key file"),
|
|
32
|
+
options: z
|
|
33
|
+
.array(z.string().max(INPUT_LIMITS.SHORT_STRING_MAX))
|
|
34
|
+
.max(INPUT_LIMITS.ARRAY_MAX)
|
|
35
|
+
.optional()
|
|
36
|
+
.default([])
|
|
37
|
+
.describe("Additional SSH options as -o key=value pairs (e.g. StrictHostKeyChecking=no)"),
|
|
38
|
+
compact: compactInput,
|
|
39
|
+
},
|
|
40
|
+
outputSchema: SshRunResultSchema,
|
|
41
|
+
}, async ({ host, user, command, port, identityFile, options, compact }) => {
|
|
42
|
+
assertNoFlagInjection(host, "host");
|
|
43
|
+
if (user)
|
|
44
|
+
assertNoFlagInjection(user, "user");
|
|
45
|
+
if (identityFile)
|
|
46
|
+
assertNoFlagInjection(identityFile, "identityFile");
|
|
47
|
+
const args = [];
|
|
48
|
+
// Add options
|
|
49
|
+
for (const opt of options || []) {
|
|
50
|
+
assertNoFlagInjection(opt, "options");
|
|
51
|
+
args.push("-o", opt);
|
|
52
|
+
}
|
|
53
|
+
if (port !== undefined)
|
|
54
|
+
args.push("-p", String(port));
|
|
55
|
+
if (identityFile)
|
|
56
|
+
args.push("-i", identityFile);
|
|
57
|
+
// Build destination
|
|
58
|
+
const destination = user ? `${user}@${host}` : host;
|
|
59
|
+
args.push(destination, command);
|
|
60
|
+
const start = Date.now();
|
|
61
|
+
let timedOut = false;
|
|
62
|
+
let result;
|
|
63
|
+
try {
|
|
64
|
+
result = await sshCmd(args);
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
68
|
+
if (errMsg.includes("timed out")) {
|
|
69
|
+
timedOut = true;
|
|
70
|
+
result = { exitCode: 124, stdout: "", stderr: errMsg };
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
throw err;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const duration = Date.now() - start;
|
|
77
|
+
const data = parseSshRunOutput(host, user, command, result.stdout, result.stderr, result.exitCode, duration, timedOut);
|
|
78
|
+
const rawOutput = (result.stdout + "\n" + result.stderr).trim();
|
|
79
|
+
return compactDualOutput(data, rawOutput, formatSshRun, compactSshRunMap, formatSshRunCompact, compact === false);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=ssh-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-run.js","sourceRoot":"","sources":["../../src/tools/ssh-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,4DAA4D;AAC5D,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,CAAC,YAAY,CACjB,SAAS,EACT;QACE,KAAK,EAAE,iBAAiB;QACxB,WAAW,EACT,iOAAiO;QACnO,WAAW,EAAE;YACX,IAAI,EAAE,CAAC;iBACJ,MAAM,EAAE;iBACR,GAAG,CAAC,YAAY,CAAC,gBAAgB,CAAC;iBAClC,QAAQ,CAAC,oDAAoD,CAAC;YACjE,IAAI,EAAE,CAAC;iBACJ,MAAM,EAAE;iBACR,GAA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M,CAAC,MAAM,EACb,MAAM,CAAC,QAAQ,EACf,QAAQ,EACR,QAAQ,CACT,CAAC;QACF,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAChE,OAAO,iBAAiB,CACtB,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,OAAO,KAAK,KAAK,CAClB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-test.d.ts","sourceRoot":"","sources":["../../src/tools/ssh-test.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYzE,6DAA6D;AAC7D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,QAkFpD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compactDualOutput, assertNoFlagInjection, INPUT_LIMITS, compactInput, } from "@paretools/shared";
|
|
3
|
+
import { sshCmd } from "../lib/remote-runner.js";
|
|
4
|
+
import { parseSshTestOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatSshTest, compactSshTestMap, formatSshTestCompact } from "../lib/formatters.js";
|
|
6
|
+
import { SshTestResultSchema } from "../schemas/index.js";
|
|
7
|
+
/** Registers the `ssh-test` tool on the given MCP server. */
|
|
8
|
+
export function registerSshTestTool(server) {
|
|
9
|
+
server.registerTool("ssh-test", {
|
|
10
|
+
title: "SSH Test Connection",
|
|
11
|
+
description: "Tests SSH connectivity to a remote host using `ssh -T`. Returns whether the host is reachable and any banner message.",
|
|
12
|
+
inputSchema: {
|
|
13
|
+
host: z
|
|
14
|
+
.string()
|
|
15
|
+
.max(INPUT_LIMITS.SHORT_STRING_MAX)
|
|
16
|
+
.describe("Remote host to test connectivity to (hostname or IP address)"),
|
|
17
|
+
user: z
|
|
18
|
+
.string()
|
|
19
|
+
.max(INPUT_LIMITS.SHORT_STRING_MAX)
|
|
20
|
+
.optional()
|
|
21
|
+
.describe("SSH username (if not specified, uses SSH config default)"),
|
|
22
|
+
port: z.number().optional().describe("SSH port number (default: 22)"),
|
|
23
|
+
identityFile: z
|
|
24
|
+
.string()
|
|
25
|
+
.max(INPUT_LIMITS.PATH_MAX)
|
|
26
|
+
.optional()
|
|
27
|
+
.describe("Path to SSH private key file"),
|
|
28
|
+
connectTimeout: z
|
|
29
|
+
.number()
|
|
30
|
+
.optional()
|
|
31
|
+
.describe("Connection timeout in seconds (default: 10)"),
|
|
32
|
+
compact: compactInput,
|
|
33
|
+
},
|
|
34
|
+
outputSchema: SshTestResultSchema,
|
|
35
|
+
}, async ({ host, user, port, identityFile, connectTimeout, compact }) => {
|
|
36
|
+
assertNoFlagInjection(host, "host");
|
|
37
|
+
if (user)
|
|
38
|
+
assertNoFlagInjection(user, "user");
|
|
39
|
+
if (identityFile)
|
|
40
|
+
assertNoFlagInjection(identityFile, "identityFile");
|
|
41
|
+
const args = ["-T"];
|
|
42
|
+
if (port !== undefined)
|
|
43
|
+
args.push("-p", String(port));
|
|
44
|
+
if (identityFile)
|
|
45
|
+
args.push("-i", identityFile);
|
|
46
|
+
if (connectTimeout !== undefined) {
|
|
47
|
+
args.push("-o", `ConnectTimeout=${connectTimeout}`);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
args.push("-o", "ConnectTimeout=10");
|
|
51
|
+
}
|
|
52
|
+
// Disable interactive prompts
|
|
53
|
+
args.push("-o", "BatchMode=yes");
|
|
54
|
+
const destination = user ? `${user}@${host}` : host;
|
|
55
|
+
args.push(destination);
|
|
56
|
+
const start = Date.now();
|
|
57
|
+
let result;
|
|
58
|
+
try {
|
|
59
|
+
result = await sshCmd(args);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
63
|
+
result = { exitCode: 255, stdout: "", stderr: errMsg };
|
|
64
|
+
}
|
|
65
|
+
const duration = Date.now() - start;
|
|
66
|
+
const data = parseSshTestOutput(host, user, result.stdout, result.stderr, result.exitCode, duration);
|
|
67
|
+
const rawOutput = (result.stdout + "\n" + result.stderr).trim();
|
|
68
|
+
return compactDualOutput(data, rawOutput, formatSshTest, compactSshTestMap, formatSshTestCompact, compact === false);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=ssh-test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssh-test.js","sourceRoot":"","sources":["../../src/tools/ssh-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC9F,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,6DAA6D;AAC7D,MAAM,UAAU,mBAAmB,CAAC,MAAiB;IACnD,MAAM,CAAC,YAAY,CACjB,UAAU,EACV;QACE,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EACT,uHAAuH;QACzH,WAAW,EAAE;YACX,IAAI,EAAE,CAAC;iBACJ,MAAM,EAAE;iBACR,GAAG,CAAC,YAAY,CAAC,gBAAgB,CAAC;iBAClC,QAAQ,CAAC,8DAA8D,CAAC;YAC3E,IAAI,EAAE,CAAC;iBACJ,MAAM,EAAE;iBACR,GAAG,CAAC,YAAY,CAAC,gBAAgB,CAAC;iBAClC,QAAQ,EAAE;iBACV,QAAQ,CAAC,0DAA0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
|
+
"description": "MCP server for remote operations (SSH, rsync) with structured, token-efficient output",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"mcp",
|
|
9
|
+
"mcp-server",
|
|
10
|
+
"model-context-protocol",
|
|
11
|
+
"structured-output",
|
|
12
|
+
"ai",
|
|
13
|
+
"ai-agent",
|
|
14
|
+
"claude",
|
|
15
|
+
"cursor",
|
|
16
|
+
"copilot",
|
|
17
|
+
"token-efficient",
|
|
18
|
+
"devtools",
|
|
19
|
+
"cli",
|
|
20
|
+
"ssh",
|
|
21
|
+
"rsync",
|
|
22
|
+
"remote",
|
|
23
|
+
"devops"
|
|
24
|
+
],
|
|
25
|
+
"homepage": "https://github.com/Dave-London/Pare/tree/main/packages/server-remote",
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=20"
|
|
28
|
+
},
|
|
29
|
+
"type": "module",
|
|
30
|
+
"bin": {
|
|
31
|
+
"pare-remote": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"default": "./dist/index.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/Dave-London/Pare.git",
|
|
45
|
+
"directory": "packages/server-remote"
|
|
46
|
+
},
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/Dave-London/Pare/issues"
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"dist"
|
|
52
|
+
],
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
55
|
+
"zod": "^4.3.6",
|
|
56
|
+
"@paretools/shared": "0.11.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/node": "^25.2.3",
|
|
60
|
+
"typescript": "^5.7.0",
|
|
61
|
+
"vitest": "^4.0.18",
|
|
62
|
+
"@paretools/tsconfig": "0.0.0"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsc",
|
|
66
|
+
"test": "vitest run",
|
|
67
|
+
"test:watch": "vitest",
|
|
68
|
+
"coverage": "vitest run --coverage",
|
|
69
|
+
"lint": "eslint src/"
|
|
70
|
+
}
|
|
71
|
+
}
|