ssh_write_file
Write content to a file on a remote host via SFTP.
How to use it
Project documentation lists ssh_write_file for the Ssh MCP MCP server. Add the server to your MCP client (Claude Desktop, Cursor, Windsurf and others), then check which tools your installed version makes available. Tool availability can depend on configuration and credentials. A server handshake does not verify this tool’s behavior. See the full listing for setup details.
Install Ssh MCP
npx -y @yawlabs/ssh-mcp@latestOther tools in Ssh MCP (21)
When any remote operation fails, ssh-mcp automatically runs diagnostics and includes the results in the error response. Your agent doesn't need to call sshdiagnose separately — it gets told what's wrong and how to fix it right in the error message.
Ensure ssh-agent is running. Starts one if needed and sets env vars for the session.
Resolve the effective SSH config for a host (hostname, user, port, proxy, identity files).
Delete a file or empty directory via SFTP. Auto-dispatches unlink vs rmdir based on the path's own type (lstat), so a symlink is always unlinked — never followed — including a dangling one or one pointing at a directory. Recursive directory delete is intentionally NOT supported -- use sshexec rm -rf
Full SSH environment diagnostic. Checks agent, keys, config, knownhosts, and connectivity. Returns exact fix commands for every failure.
Download a file from a remote host to local filesystem.
Execute a command on a remote host. Returns stdout, stderr, and exit code (or [signal: NAME] and code: -1 when the channel closed signal-only). Optional env param sets per-call environment variables (POSIX-safe prefix, works regardless of sshd's AcceptEnv). Subject to command policy if configured.
Search for files remotely with structured parameters (name, type, size, depth, newer — match files modified more recently than a reference path).
Test Git-over-SSH auth to GitHub, GitLab, Bitbucket, etc.
List all SSH keys in ~/.ssh/ with type, fingerprint, and agent status.
Load a key into the running agent. Ensures the agent is started first.
Remove a stale host key and re-scan. Fixes "host key verification failed" errors.
List files in a directory on a remote host.
Create a directory via SFTP. Set recursive: true for mkdir -p behavior. Unlike the other SFTP tools, the path may be relative — it resolves against the SFTP working directory (normally the remote user's home). ~ is not expanded; SFTP has no shell.
Run a command on multiple hosts in parallel. Returns results per host. Optional env param sets per-call environment variables (same POSIX-safe prefix as sshexec, applied once and sent to every host). Subject to command policy if configured (policy is checked once, against the env-prefixed command, b
Read a file from a remote host via SFTP.
Check systemd service status (active, PID, uptime, description). Flags isError only when the unit could not be found / queried, not when an existing unit is intentionally stopped.
Get metadata for a file or directory (size, mode in octal, uid/gid, mtime/atime, isFile/isDirectory/isSymbolicLink). Use instead of parsing ls -la.
Read the last N lines of a file, optionally filtered by a grep pattern.
Quick connectivity test with timing and actionable error details.
Upload a local file to a remote host via SFTP.