ssh-remote-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ssh-remote-mcp check disk usage on prod-web-01"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ssh-remote-mcp
Production-grade SSH MCP server for coding agents (Antigravity, Claude Code, Cursor, etc.).
Connects your coding agent to multiple remote Linux/Unix (Bash, Zsh, POSIX sh, Alpine, BusyBox, OpenWrt) and Windows (PowerShell 7 / Windows PowerShell 5.1) servers over persistent SSH connections, without leaking file contents or secrets into the LLM context.
Key Features
Multi-host connection pool: Explicit
targeton every tool call (safe under parallel tool calls, zero hidden-host drift) with automatic idle cleanup.Zero hidden
cwdstate: File tools require explicit absolute or~paths;ssh_execandssh_bg_startrequire explicitcwd(use"~"for system-wide commands) and abort cleanly ifcwddoes not exist.Production file safety: Atomic same-directory temp-file writes,
overwrite: falseby default, CRLF/LF & permission preservation,ssh_editwithexpected_sha256optimistic lock anddry_rununified diff preview, binary detection, and remote line-range slicing for large files (>2 MiB).High-throughput SFTP upload / download: Direct local disk ↔ remote disk transfers (never touches LLM context) using pipelined
ssh2fastPut/fastGet(32 concurrent 32 KiB chunks), 60-second inactivity/stall watchdog (no arbitrary wall-clock cap on healthy large transfers), MCPnotifications/progressstreaming, cleanAbortSignalcancellation with temp-file cleanup, automatic SSH pipe fallback for hosts withoutsftp-server, recursive directories withexclude, path-traversal protection, and SHA-256 verification.Dual transport engine: Persistent
ssh2primary (resolving~/.ssh/configviassh -G, multi-hopProxyJump, strictknown_hosts, OpenSSH Agent, encrypted key passphrases, and local password credentials) with automatic OpenSSH CLI fallback forProxyCommand,CertificateFile, hardware keys, etc.Detached remote background jobs: Survive SSH disconnects (
setsidon Unix, hidden detached PowerShell on Windows), support incremental log tailing (byte_offset), and terminate the full remote process group / process tree cleanly.Zero-LLM-secret policy, error diagnostics & audit log: Passwords and passphrases live strictly in local config/env vars (never in MCP tool parameters), optional per-host
readOnly: true/allowHosts/denyHosts, structured error categories (VALIDATION_ERROR,POLICY_BLOCKED,CONFLICT,AUTH_OR_HOSTKEY_ERROR,TRANSPORT_LOST_IN_FLIGHT,REMOTE_ERROR,MCP_INTERNAL_ERROR) withreq-xxxxxxcorrelation IDs, safe single-retry pre-flight reconnect on stale half-open sockets, and rotating redacted JSONL audit logs (10 MiB rotation).
Related MCP server: fast-mcp-ssh
Requirements
Node.js >= 20
System OpenSSH client (
ssh/ssh.exeandssh-keygen) onPATH
Quick Start
Antigravity (~/.gemini/config/mcp_config.json)
{
"mcpServers": {
"ssh-remote": {
"command": "npx",
"args": ["-y", "ssh-remote-mcp"],
"timeoutSeconds": -1
}
}
}Why
"timeoutSeconds": -1? Antigravity's default 180s MCP tool timeout can cut off healthy long-running commands (ssh_execsupports up to 600s) or large SFTP transfers. Every tool inssh-remote-mcpenforces its own strict server-side timeout (or 60s stall watchdog for SFTP transfers), so settingtimeoutSeconds: -1lets large transfers finish while hung operations still abort cleanly.
Claude Code
claude mcp add ssh-remote -- npx -y ssh-remote-mcpOr add to .mcp.json:
{
"mcpServers": {
"ssh-remote": {
"command": "npx",
"args": ["-y", "ssh-remote-mcp"]
}
}
}Cursor (.cursor/mcp.json)
{
"mcpServers": {
"ssh-remote": {
"command": "npx",
"args": ["-y", "ssh-remote-mcp"]
}
}
}Build from Source
git clone https://github.com/wcbup/ssh-remote-mcp.git
cd ssh-remote-mcp
npm install
npm run build
npm testThen point your MCP client to the compiled entry point:
{
"mcpServers": {
"ssh-remote": {
"command": "node",
"args": ["/path/to/ssh-remote-mcp/dist/index.js"]
}
}
}Authentication & Host Policy
1. Zero-config with ~/.ssh/config + SSH Keys / Agent
Any host alias configured in ~/.ssh/config (including Include, Match, Port, IdentityFile, ProxyJump) works out of the box. On Windows, the OpenSSH Authentication Agent (\\.\pipe\openssh-ssh-agent) is used automatically when running.
Host key verification is strict by default. Before connecting to a new server, connect once manually with
ssh <target>to verify its fingerprint and record it inknown_hosts.
2. Passwords, Encrypted Key Passphrases & Production Guardrails (hosts.json / secrets.json)
Default config location:
Linux / macOS:
~/.config/ssh-remote-mcp/hosts.jsonWindows:
%USERPROFILE%\.config\ssh-remote-mcp\hosts.json
Override with SSH_REMOTE_MCP_CONFIG. See hosts.example.json for a starter template:
{
"defaultSshConfig": "~/.ssh/config",
"defaultTransport": "auto",
"idleTimeoutSeconds": 900,
"auditLogPath": "~/.config/ssh-remote-mcp/audit.jsonl",
"allowHosts": [],
"denyHosts": [],
"hosts": {
"prod-db": {
"description": "Production PostgreSQL primary (read-only inspection)",
"readOnly": true,
"transport": "ssh2"
},
"legacy-box": {
"description": "Password-authenticated appliance",
"password": "env:LEGACY_BOX_SSH_PASS"
},
"cf-tunnel-host": {
"description": "Uses ProxyCommand cloudflared",
"transport": "openssh"
}
}
}Optional separate secrets.json (same directory, override with SSH_REMOTE_MCP_SECRETS; on Linux/macOS must be chmod 600):
{
"hosts": {
"deploy@10.0.0.5:2201": {
"password": "env:DEPLOY_SSH_PASS",
"passphrase": "env:DEPLOY_KEY_PASSPHRASE"
}
}
}You can also pass credentials purely via environment variables using the naming convention:
SSH_REMOTE_MCP_PASSWORD_<ALIAS>(e.g.SSH_REMOTE_MCP_PASSWORD_LEGACY_BOX)SSH_REMOTE_MCP_PASSPHRASE_<ALIAS>
Passwords and passphrases are never accepted as MCP tool arguments and are automatically redacted from error messages and audit logs.
Environment Variables
Variable | Purpose |
| Custom path to |
| Custom path to |
| Override default OpenSSH config file ( |
| Custom audit JSONL path, or |
| Set to |
Tool Reference (15 Tools)
Group | Tool | Summary |
Connection |
| List |
| Explicitly connect, reconnect, or health-probe a target | |
| Close one target's pooled connection or all connections | |
Files |
| Read remote text file with line numbers, EOL, SHA-256 (slices files >2 MiB remotely; rejects binary) |
| Atomic temp-file write ( | |
| Exact-match multi-edit with | |
Search |
| List remote directory entries with type, size, mode, and mtime |
| Find remote files by glob (excludes | |
| Regex/literal content search across remote files (prefers | |
Shell |
| Synchronous remote command execution; requires explicit |
Transfer |
| Pipelined SFTP upload (with pipe fallback, 60s stall watchdog, progress notifications, |
| Pipelined SFTP download (path-traversal safe, 60s stall watchdog, progress notifications, | |
Background |
| Start detached remote job ( |
| List jobs or inspect live status, exit code, and tail/incremental logs ( | |
| Signal remote process group (Unix) or validated process tree (Windows |
Acknowledgments
Special thanks to @99percentpeople and @99percentpeople/pi-ssh-remote (MIT License). Portions of this project's ssh2 / OpenSSH dual-transport architecture, ssh -G config and ProxyJump resolution, strict known_hosts verification, and remote Unix/Windows shell adapter patterns were adapted from or inspired by pi-ssh-remote.
License
MIT © 2026 wcbup
Available Tools
15 toolsssh_bg_killSignal or Terminate Remote Background JobADestructive
Deliver a signal to a remote background job's real process group (Unix) or validated process tree (Windows taskkill /T /F), and optionally clean up its remote temp log directory.
Inputs: job_id (required), signal, cleanup.
ssh_bg_startStart Detached Remote Background JobADestructive
Start a non-interactive detached background command on a remote Unix or Windows server. Output is logged to a private remote temp file so the job and logs survive SSH disconnects. Requires explicit cwd.
Inputs: cwd (required), target (required), command (required), label, +1 more.
ssh_bg_statusCheck Remote Background Job Status and LogsARead-onlyIdempotent
Check live running status, exit code, and tail/incremental logs of a background job by job_id. Omit job_id to list all tracked background jobs.
Inputs: job_id, target, max_bytes, tail_lines, +1 more.
ssh_connectConnect or Probe SSH TargetARead-only
Explicitly establish, reconnect, or health-probe a pooled SSH connection. Returns remote OS platform, shell, home directory, active transport, read-only status, and latency. Note: other SSH tools also auto-connect lazily.
Inputs: target (required), shell, reconnect, transport, +1 more.
ssh_disconnectDisconnect Pooled SSH ConnectionsAIdempotent
Close and remove a specific target's pooled SSH connection, or omit target to close all pooled connections.
Inputs: target.
ssh_downloadDownload Remote File or Directory to LocalA
Stream a remote file or directory directly to the local filesystem without passing file bytes through the LLM context. Uses SFTP with automatic pipe fallback, defends against path traversal/symlinks, defaults to overwrite=false, and verifies SHA-256 on single files. Permitted even on read-only targets.
Inputs: target (required), local_path (required), remote_path (required), exclude, +3 more.
ssh_editSurgical Edit Remote FileADestructive
Apply one or more exact-match text replacements atomically on a remote file, preserving original permissions and CRLF/LF line endings. Supports expected_sha256 optimistic concurrency lock and dry_run diff preview.
Inputs: path (required), edits (required), target (required), dry_run, +1 more.
ssh_execExecute Remote CommandADestructive
Execute a command synchronously on a remote Unix (bash/zsh/sh) or Windows (pwsh/powershell) host. Requires an explicit cwd (absolute path or '~'); aborts cleanly if cwd does not exist. Kills the remote process tree on timeout or cancellation.
Inputs: cwd (required), target (required), command (required), shell, +2 more.
ssh_findFind Remote FilesARead-onlyIdempotent
Find files/directories matching a glob pattern under a remote directory. Automatically excludes .git and node_modules; prefers ripgrep (rg) on Unix when installed.
Inputs: path (required), target (required), pattern (required), max_results.
ssh_grepSearch Remote File ContentsARead-onlyIdempotent
Search text across remote files or a single file using regex or literal matching. Excludes .git and node_modules; uses ripgrep (rg) on Unix when installed.
Inputs: path (required), target (required), pattern (required), glob, +3 more.
ssh_hostsList SSH Hosts and Active ConnectionsARead-onlyIdempotent
List SSH host aliases from ~/.ssh/config, local policy entries (read-only flags, descriptions, whether credentials are configured), and currently active pooled connections.
Inputs: ssh_config.
ssh_lsList Remote DirectoryARead-onlyIdempotent
List files and directories at an explicit remote path with type, size, permissions, and modified time.
Inputs: path (required), target (required), max_entries, show_hidden.
ssh_readRead Remote Text FileARead-onlyIdempotent
Read a remote text file with line numbers, EOL detection, and SHA-256 content hash (for optimistic locking in ssh_edit). Large files (>2 MiB) are sliced on the remote host without downloading the entire file. Binary files are rejected (use ssh_download instead).
Inputs: path (required), target (required), end_line, max_lines, +1 more.
ssh_uploadUpload Local File or Directory to RemoteADestructive
Stream a local file or directory directly to a remote host without passing file bytes through the LLM context. Uses SFTP over the pooled connection with automatic pipe fallback for hosts without sftp-server. Defaults to overwrite=false and verifies SHA-256 on single files.
Inputs: target (required), local_path (required), remote_path (required), exclude, +4 more.
ssh_writeAtomically Write Remote FileADestructive
Atomically write a remote file via a same-directory temp file and rename. Defaults to overwrite=false to protect production files; pass overwrite=true explicitly to replace an existing file.
Inputs: path (required), target (required), content (required), eol, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Most tools target clearly distinct resource+action pairs (read vs grep vs find, connect vs disconnect, bg_start vs bg_status vs bg_kill). The only mild overlaps are ssh_read vs ssh_download (text vs binary/streaming) and ssh_write vs ssh_upload (content vs streaming), but the descriptions explicitly disambiguate these ('binary rejected, use ssh_download', 'without passing bytes through LLM context').
Every tool follows the ssh_ prefix + verb_noun pattern in consistent snake_case, including the grouped ssh_bg_start/ssh_bg_status/ssh_bg_kill family. No mixing of conventions.
15 tools is a well-scoped set that maps cleanly onto the domain's facets: connection management, file I/O, search, exec, and background jobs. Each tool earns its place with no obvious redundancy.
File read/write/edit/list/find/grep/upload/download, exec, connection lifecycle, and full background-job lifecycle are covered. The main gap is a dedicated delete/move/mkdir operation, though these are workable via ssh_exec (rm/mv/mkdir).
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Use your own Windows, Mac or Linux computer from ChatGPT, Claude, Cursor or Gemini CLI: run commands, read, write and search files, run long processes. Your computer only makes an outgoing connection (no open ports or VPN). Read-only mode, allowed folders, blocked commands and an action log keep you in control. Free plan available.
- browser-sshDeprecatedcom.browserssh
Scoped, audited SSH exec, sessions, and SFTP on your saved servers without exposing credentials
Give your AI hands on every computer you own. Remote control of your Windows, Mac and Linux machines from one ChatGPT, Claude or Cursor chat — even from your phone. Ask it to find out why the office server is crawling, update every PC in the house, sort out your mom's laptop from another city, or ship the site from your work machine while you're on a train. It runs commands and reads and writes files; screenshots are a beta you can request. You decide what each computer allows, and you can cut any of them off in a second.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI agents to execute SSH commands, read files, and list directories on remote hosts with a configurable command-safety policy.5MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to securely execute commands on remote hosts via SSH and SFTP, with persistent shells, file transfers, screenshots, and an audit log.5MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to manage remote servers via SSH, including command execution, multi-host batch operations, SFTP file transfer, background job handling, DevOps diagnostics, port tunneling, and safety guardrails like high-risk command blocking and read-only mode.MIT
- AlicenseBqualityBmaintenanceEnables LLMs and automation agents to securely connect to and operate Linux/Unix hosts over standard OpenSSH, including command execution, interactive PTY sessions, SFTP file management, and dynamic multi-host connection handling. It also includes safety rules that block dangerous commands and truncates large outputs to protect model context.3165 npm1Apache 2.0