downloadFile
Download files from remote SSH hosts to local destinations using secure SSH connections. Transfer files between systems by specifying host, remote path, and local path.
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 | |
| remotePath | Yes | Path on the remote host | |
| localPath | Yes | Path to the local destination |
Implementation Reference
- src/ssh-client.ts:105-117 (handler)The handler function for the 'downloadFile' MCP tool. It connects to an SSH host using the provided alias, downloads a file from the remote path to the local path using node-ssh's getFile method, handles errors, and returns a boolean indicating success.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; } }