@yawlabs/ssh-mcp 0.14.1 → 0.15.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/README.md +313 -291
- package/dist/diagnose.d.ts +33 -0
- package/dist/env.d.ts +87 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +990 -673
- package/dist/ops.d.ts +54 -0
- package/dist/policy.d.ts +22 -0
- package/dist/pool.d.ts +34 -0
- package/dist/server.d.ts +17 -223
- package/dist/server.js +989 -672
- package/dist/ssh-config.d.ts +4 -0
- package/dist/ssh.d.ts +217 -0
- package/dist/tools.d.ts +3 -0
- package/package.json +21 -9
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface DiagnosticResult {
|
|
2
|
+
status: "ok" | "warning" | "error";
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
5
|
+
export interface DiagnosticReport {
|
|
6
|
+
overall: "ok" | "warning" | "error";
|
|
7
|
+
checks: Array<{
|
|
8
|
+
name: string;
|
|
9
|
+
} & DiagnosticResult>;
|
|
10
|
+
suggestions: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare const SSH_NON_KEY_FILES: ReadonlySet<string>;
|
|
13
|
+
export declare function isValidHostname(host: string): boolean;
|
|
14
|
+
export declare function runArgs(cmd: string, args: string[]): {
|
|
15
|
+
stdout: string;
|
|
16
|
+
ok: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare function checkSshAgent(): DiagnosticResult;
|
|
19
|
+
export declare function checkSshKeys(): DiagnosticResult;
|
|
20
|
+
export declare function checkKnownHosts(host: string): DiagnosticResult;
|
|
21
|
+
export type SshProbeOutcome = "ok" | "permission-denied" | "connection-refused" | "timed-out" | "host-key-mismatch" | "dns-failure" | "unknown";
|
|
22
|
+
export interface SshProbeResult {
|
|
23
|
+
outcome: SshProbeOutcome;
|
|
24
|
+
/** Combined stdout+stderr from ssh, for the fall-through "unknown" message. */
|
|
25
|
+
output: string;
|
|
26
|
+
/** Wall time of the ssh invocation. Only `testConnection` surfaces this. */
|
|
27
|
+
elapsedMs: number;
|
|
28
|
+
}
|
|
29
|
+
export declare function classifySshProbe(ok: boolean, output: string): SshProbeOutcome;
|
|
30
|
+
export declare function probeSshConnection(host: string, port: number): SshProbeResult;
|
|
31
|
+
export declare function checkConnectivity(host: string, port?: number): DiagnosticResult;
|
|
32
|
+
export declare function checkSshConfig(host: string): DiagnosticResult;
|
|
33
|
+
export declare function diagnose(host: string, port?: number): DiagnosticReport;
|
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export interface KeyInfo {
|
|
2
|
+
name: string;
|
|
3
|
+
path: string;
|
|
4
|
+
type: string;
|
|
5
|
+
fingerprint?: string;
|
|
6
|
+
loadedInAgent: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface AgentResult {
|
|
9
|
+
running: boolean;
|
|
10
|
+
reachable: boolean;
|
|
11
|
+
socket?: string;
|
|
12
|
+
keys: string[];
|
|
13
|
+
started: boolean;
|
|
14
|
+
env?: {
|
|
15
|
+
SSH_AUTH_SOCK?: string;
|
|
16
|
+
SSH_AGENT_PID?: string;
|
|
17
|
+
};
|
|
18
|
+
message: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function killStartedAgent(): void;
|
|
21
|
+
export declare function ensureAgent(): AgentResult;
|
|
22
|
+
/**
|
|
23
|
+
* Outcome of a ~/.ssh scan. An empty `keys` array on its own is ambiguous -- it is what
|
|
24
|
+
* "there is no ~/.ssh", "~/.ssh could not be read" and "~/.ssh holds no private keys" all
|
|
25
|
+
* produce -- and only the last of those is remediated by generating a key. `status` is the
|
|
26
|
+
* discriminator that tells them apart:
|
|
27
|
+
*
|
|
28
|
+
* "ok" the directory was read; `keys` is what it holds (possibly nothing)
|
|
29
|
+
* "no-dir" ~/.ssh does not exist (a fresh machine -- ssh-keygen will create it)
|
|
30
|
+
* "unreadable" readdir threw: permission denied, or a non-directory at that path.
|
|
31
|
+
* `reason` carries the underlying errno message.
|
|
32
|
+
*
|
|
33
|
+
* `keys` is always present and always empty for the two non-"ok" statuses, so a caller that
|
|
34
|
+
* only wants the keys can read it without narrowing first.
|
|
35
|
+
*/
|
|
36
|
+
export type SshKeyListing = {
|
|
37
|
+
status: "ok";
|
|
38
|
+
dir: string;
|
|
39
|
+
keys: KeyInfo[];
|
|
40
|
+
} | {
|
|
41
|
+
status: "no-dir";
|
|
42
|
+
dir: string;
|
|
43
|
+
keys: KeyInfo[];
|
|
44
|
+
} | {
|
|
45
|
+
status: "unreadable";
|
|
46
|
+
dir: string;
|
|
47
|
+
keys: KeyInfo[];
|
|
48
|
+
reason: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Thin wrapper kept for every caller that only needs the keys: it discards the reason a
|
|
52
|
+
* scan came back empty. Prefer listSshKeysDetailed when an empty result has to be
|
|
53
|
+
* explained to a human or an agent -- see the type above for why.
|
|
54
|
+
*/
|
|
55
|
+
export declare function listSshKeys(): KeyInfo[];
|
|
56
|
+
export declare function listSshKeysDetailed(): SshKeyListing;
|
|
57
|
+
export declare function loadKey(keyPath: string): {
|
|
58
|
+
status: "ok" | "error";
|
|
59
|
+
message: string;
|
|
60
|
+
};
|
|
61
|
+
export interface ConfigLookupResult {
|
|
62
|
+
hostname: string;
|
|
63
|
+
user: string;
|
|
64
|
+
port: string;
|
|
65
|
+
identityFile: string[];
|
|
66
|
+
proxyJump?: string;
|
|
67
|
+
proxyCommand?: string;
|
|
68
|
+
all: Record<string, string>;
|
|
69
|
+
raw: string;
|
|
70
|
+
}
|
|
71
|
+
export declare function configLookup(host: string): ConfigLookupResult | {
|
|
72
|
+
error: string;
|
|
73
|
+
};
|
|
74
|
+
export declare function fixKnownHosts(host: string, port?: number): {
|
|
75
|
+
status: "ok" | "error";
|
|
76
|
+
message: string;
|
|
77
|
+
actions: string[];
|
|
78
|
+
};
|
|
79
|
+
export declare function checkGitSsh(host?: string, user?: string): {
|
|
80
|
+
status: "ok" | "error";
|
|
81
|
+
message: string;
|
|
82
|
+
authenticatedAs?: string;
|
|
83
|
+
};
|
|
84
|
+
export declare function testConnection(host: string, port?: number): {
|
|
85
|
+
status: "ok" | "warning" | "error";
|
|
86
|
+
message: string;
|
|
87
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|