download_file
Download a file from a remote server via SFTP to a local directory, with safety checks preventing overwrites and path traversal.
Instructions
Download a file from a remote server via SFTP.
Args:
server: Server name (e.g. 'pro-dicentra').
remote_path: Path to the remote file — normally absolute, though a
relative path is not rejected, just resolved by the remote SFTP
server against the SSH login directory. Must be a regular file —
symlinks, devices, FIFOs, and other non-regular remote
files are refused. Rejected if it contains .. anywhere or
matches the same sensitive-path denylist upload_file enforces.
Size is NOT capped here (upload's 100 MiB limit has no download
counterpart) — an oversized transfer only logs a warning, after
the bytes are already on disk.
local_path: Destination path, RELATIVE to the configured
transfer_root (see [settings] in servers.toml, or the
SSH_MCP_TRANSFER_ROOT environment variable). Absolute
paths, .., . components and embedded NUL bytes are
rejected, as is a symlink at any component of the path.
Sub-directories are allowed,
but every intermediate directory must already exist under
transfer_root. NO-CLOBBER: if a file already exists at
the destination, the download fails rather than silently
overwriting it — remove or rename the existing file first.
A failed or cancelled download unlinks the partial file it
created, so a retry is not blocked by its own leftovers.
Returns: Confirmation message with file size.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| server | Yes | ||
| local_path | Yes | ||
| remote_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |