downloadFile
Transfer files securely from a remote SSH host to a local destination using MCP SSH Agent. Specify the host, remote file path, and local destination to download files efficiently.
Instructions
Downloads a file from an SSH host
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hostAlias | Yes | Alias or hostname of the SSH host | |
| localPath | Yes | Path to the local destination | |
| remotePath | Yes | Path on the remote host |
Implementation Reference
- src/ssh-client.ts:105-117 (handler)The downloadFile handler method in the SSHClient class. It connects to the specified SSH host using hostAlias, then uses the node-ssh library's getFile method to download the file from remotePath to localPath on the local machine. Returns true on success, false on error.async downloadFile(hostAlias: string, remotePath: string, localPath: string): Promise<boolean> { try { await this.connectToHost(hostAlias); await this.ssh.getFile(localPath, remotePath); this.ssh.dispose(); return true; } catch (error) { console.error(`Error downloading file from ${hostAlias}:`, error); return false; } }