@yawlabs/ssh-mcp 0.1.0 → 0.4.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/dist/server.d.ts CHANGED
@@ -1,7 +1,49 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import { Client } from 'ssh2';
2
+ import { Client, ConnectConfig } from 'ssh2';
3
3
 
4
- declare function registerTools(server: McpServer): void;
4
+ interface SSHConfig {
5
+ host: string;
6
+ port?: number;
7
+ username?: string;
8
+ privateKeyPath?: string;
9
+ password?: string;
10
+ agent?: string;
11
+ }
12
+ interface ExecResult {
13
+ stdout: string;
14
+ stderr: string;
15
+ code: number;
16
+ }
17
+ declare function resolveConfig(config: SSHConfig): ConnectConfig;
18
+ declare function connectRaw(connectConfig: ConnectConfig): Promise<Client>;
19
+ declare function connect(config: SSHConfig): Promise<Client>;
20
+ declare function exec(client: Client, command: string, timeoutMs?: number): Promise<ExecResult>;
21
+ declare function readFile(client: Client, remotePath: string): Promise<string>;
22
+ declare function writeFile(client: Client, remotePath: string, content: string): Promise<void>;
23
+ declare function uploadFile(client: Client, localPath: string, remotePath: string): Promise<void>;
24
+ declare function downloadFile(client: Client, remotePath: string, localPath: string): Promise<void>;
25
+ declare function listDir(client: Client, remotePath: string): Promise<string[]>;
26
+
27
+ interface PoolOptions {
28
+ /** Milliseconds before an idle connection is closed. Default: 60000 (60s) */
29
+ idleTtlMs?: number;
30
+ }
31
+ declare class ConnectionPool {
32
+ private entries;
33
+ private idleTtlMs;
34
+ constructor(options?: PoolOptions);
35
+ acquire(config: SSHConfig): Promise<Client>;
36
+ release(client: Client): void;
37
+ withConnection<T>(config: SSHConfig, fn: (client: Client) => Promise<T>): Promise<T>;
38
+ drain(): void;
39
+ get size(): number;
40
+ get stats(): {
41
+ active: number;
42
+ idle: number;
43
+ };
44
+ }
45
+
46
+ declare function registerTools(server: McpServer, pool?: ConnectionPool): void;
5
47
 
6
48
  interface DiagnosticResult {
7
49
  status: "ok" | "warning" | "error";
@@ -21,27 +63,59 @@ declare function checkConnectivity(host: string, port?: number): DiagnosticResul
21
63
  declare function checkSshConfig(host: string): DiagnosticResult;
22
64
  declare function diagnose(host: string, port?: number): DiagnosticReport;
23
65
 
24
- interface SSHConfig {
25
- host: string;
26
- port?: number;
27
- username?: string;
28
- privateKeyPath?: string;
29
- password?: string;
30
- agent?: string;
66
+ interface KeyInfo {
67
+ name: string;
68
+ path: string;
69
+ type: string;
70
+ fingerprint?: string;
71
+ loadedInAgent: boolean;
31
72
  }
32
- interface ExecResult {
33
- stdout: string;
34
- stderr: string;
35
- code: number;
73
+ interface AgentResult {
74
+ running: boolean;
75
+ reachable: boolean;
76
+ socket?: string;
77
+ keys: string[];
78
+ started: boolean;
79
+ env?: {
80
+ SSH_AUTH_SOCK?: string;
81
+ SSH_AGENT_PID?: string;
82
+ };
83
+ message: string;
36
84
  }
37
- declare function connect(config: SSHConfig): Promise<Client>;
38
- declare function exec(client: Client, command: string, timeoutMs?: number): Promise<ExecResult>;
39
- declare function readFile(client: Client, remotePath: string): Promise<string>;
40
- declare function writeFile(client: Client, remotePath: string, content: string): Promise<void>;
41
- declare function uploadFile(client: Client, localPath: string, remotePath: string): Promise<void>;
42
- declare function downloadFile(client: Client, remotePath: string, localPath: string): Promise<void>;
43
- declare function listDir(client: Client, remotePath: string): Promise<string[]>;
85
+ declare function ensureAgent(): AgentResult;
86
+ declare function listSshKeys(): KeyInfo[];
87
+ declare function loadKey(keyPath: string): {
88
+ status: "ok" | "error";
89
+ message: string;
90
+ };
91
+ interface ConfigLookupResult {
92
+ hostname: string;
93
+ user: string;
94
+ port: string;
95
+ identityFile: string[];
96
+ proxyJump?: string;
97
+ proxyCommand?: string;
98
+ all: Record<string, string>;
99
+ raw: string;
100
+ }
101
+ declare function configLookup(host: string): ConfigLookupResult | {
102
+ error: string;
103
+ };
104
+ declare function fixKnownHosts(host: string, port?: number): {
105
+ status: "ok" | "error";
106
+ message: string;
107
+ actions: string[];
108
+ };
109
+ declare function checkGitSsh(host?: string, user?: string): {
110
+ status: "ok" | "error";
111
+ message: string;
112
+ authenticatedAs?: string;
113
+ };
114
+ declare function testConnection(host: string, port?: number): {
115
+ status: "ok" | "warning" | "error";
116
+ message: string;
117
+ };
44
118
 
45
- declare function createServer(): McpServer;
119
+ declare function createServer(pool?: ConnectionPool): McpServer;
46
120
 
47
- export { checkConnectivity, checkKnownHosts, checkSshAgent, checkSshConfig, checkSshKeys, connect, createServer, diagnose, downloadFile, exec, listDir, readFile, registerTools, uploadFile, writeFile };
121
+ export { type AgentResult, type ConfigLookupResult, ConnectionPool, type DiagnosticReport, type DiagnosticResult, type ExecResult, type KeyInfo, type PoolOptions, type SSHConfig, checkConnectivity, checkGitSsh, checkKnownHosts, checkSshAgent, checkSshConfig, checkSshKeys, configLookup, connect, connectRaw, createServer, diagnose, downloadFile, ensureAgent, exec, fixKnownHosts, listDir, listSshKeys, loadKey, readFile, registerTools, resolveConfig, testConnection, uploadFile, writeFile };