Skip to main content
Glama

ssh_download

Download files from remote SSH servers to local systems using secure connections. Specify server name, remote file path, and local destination path for file transfers.

Instructions

Download file from remote SSH server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serverYesServer name
remotePathYesRemote file path
localPathYesLocal destination path

Implementation Reference

  • Registration of 'ssh_download' as part of the essential core SSH operations tool group in the centralized TOOL_GROUPS export.
    core: [ 'ssh_list_servers', 'ssh_execute', 'ssh_upload', 'ssh_download', 'ssh_sync' ],
  • Core file download implementation in SSHManager class. Downloads file from remotePath to localPath using SFTP fastGet, with automatic ~ home directory expansion and error handling. This executes the core logic of the ssh_download tool.
    async getFile(localPath, remotePath) { // SFTP doesn't resolve ~ automatically, we need to get the real path let resolvedRemotePath = remotePath; if (remotePath.includes('~')) { try { const homeDir = await this.resolveHomePath(); // Replace ~ with the actual home directory // Handle both ~/path and ~ alone if (remotePath === '~') { resolvedRemotePath = homeDir; } else if (remotePath.startsWith('~/')) { resolvedRemotePath = homeDir + remotePath.substring(1); } else { // If ~ is not at the beginning, don't replace it resolvedRemotePath = remotePath; } } catch (err) { // If we can't resolve home, throw a more descriptive error throw new Error(`Failed to resolve home directory for path: ${remotePath}. ${err.message}`); } } const sftp = await this.getSFTP(); return new Promise((resolve, reject) => { sftp.fastGet(resolvedRemotePath, localPath, (err) => { if (err) reject(err); else resolve(); }); }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bvisible/mcp-ssh-manager'

If you have feedback or need assistance with the MCP directory API, please join our Discord server