UNPKG

@wonderwhy-er/desktop-commander

Version:

MCP server for terminal operations and file editing

83 lines (82 loc) 2.6 kB
/** * Client-side utility for SSH interactions */ interface ApiClient { executeCommand: (command: string, params?: any) => Promise<any>; } interface SSHSession { host: string; username?: string; pid: number; createdAt: Date; lastActivity: Date; } interface SSHOptions { username?: string; port?: number; identity?: string; password?: string; timeout?: number; stopOnError?: boolean; } export declare class SSHClient { private apiClient; private activeSessions; constructor(apiClient: ApiClient); /** * Connect to an SSH server * @param host - SSH host to connect to * @param options - Connection options * @returns Connection information */ connect(host: string, options?: SSHOptions): Promise<any>; /** * Execute a command on the remote server * @param pid - Process ID of the SSH session * @param command - Command to execute * @param options - Execution options * @returns Command results */ executeCommand(pid: number | string, command: string, options?: SSHOptions): Promise<any>; /** * Execute a command on a specific host (creates session if needed) * @param host - SSH host * @param command - Command to execute * @param options - Connection and execution options * @returns Command results */ executeCommandOnHost(host: string, command: string, options?: SSHOptions): Promise<any>; /** * Execute multiple commands in sequence * @param pid - Process ID of the SSH session * @param commands - List of commands to execute * @param options - Execution options * @returns Results for each command */ executeSequence(pid: number | string, commands: string[], options?: SSHOptions): Promise<any>; /** * Execute a multi-line script as separate commands * @param pid - Process ID of the SSH session * @param script - Multi-line script * @param options - Execution options * @returns Script execution results */ executeScript(pid: number | string, script: string, options?: SSHOptions): Promise<any>; /** * Close an SSH session * @param pid - Process ID to close * @returns Result indicating success */ disconnect(pid: number | string): Promise<any>; /** * List all active SSH sessions * @returns List of active sessions */ listSessions(): SSHSession[]; /** * Close all SSH sessions * @returns Result with number of closed sessions */ disconnectAll(): Promise<any>; } export {};