ssh_file_transfer
Transfer files between local and remote servers via SFTP, supporting upload, download, list, write, append, delete, mkdir, stat, and server-to-server copy with scp/rsync.
Instructions
Transfer and manage files between local and remote server via SFTP. Supports upload, download, list, write (write content directly to remote file), append, delete, mkdir, stat, and remote_copy (server-to-server direct transfer via scp/rsync, avoiding local relay).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | No | SSH server hostname or IP. Alternative to session_id/name, can override hosts.json entry. | |
| name | No | Use a pre-configured host from hosts.json by name. Alternative to session_id. | |
| port | No | SSH port (used with host). | |
| content | No | Content to write/append to remote file. Required for write/append. | |
| password | No | SSH password (used with host). | |
| username | No | SSH username (used with host). | |
| direction | Yes | Action: upload, download, list, write (content->remote file), append, delete, mkdir, stat, remote_copy (server-to-server direct transfer). | |
| use_rsync | No | remote_copy: Use rsync instead of scp (better for large directories, supports resume). | |
| local_path | No | Local file path. Required for upload/download. | |
| session_id | Yes | Active SSH session ID. If omitted, connects via name/host/env vars. | |
| remote_path | No | Remote file/directory path. Required for all directions. For remote_copy, this is the source path on the connected server. | |
| target_host | No | remote_copy: Target server hostname/IP. | |
| target_path | No | remote_copy: Destination path on target server. | |
| target_port | No | remote_copy: Target SSH port. | |
| target_user | No | remote_copy: Target SSH username. | root |
| target_password | No | remote_copy: Target server password (uses sshpass). If omitted, assumes key-based auth is configured. |