MCP server for SSH operations with built-in diagnostics
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
One-click editor setup isnβt available for this listing yet β we donβt have a confirmed install command, and weβd rather show nothing than point your editor at the wrong package or host. Follow the projectβs own setup instructions, linked above.
One click adds this to your local Yaw MCP config so it's available in every Yaw Terminal session. Or install manually below.
Make SSH work for AI tools. MCP server that manages your SSH environment, diagnoses what's broken, fixes it, and gives your agent remote access to anything.
Built and maintained by Yaw Labs.
AI CLI tools run in subprocesses where SSH is constantly broken. The agent tries to git pull and gets Permission denied (publickey). It tries to SSH into a server and the agent socket is stale. It tries to deploy and the host key changed because the instance was recreated. Every time, the AI has no idea what's wrong and spirals.
This happens across every situation that needs SSH keys:
npm install, pip install, go get, cargo, composer from private reposssh-mcp fixes this. It manages the SSH agent, loads keys, diagnoses failures with actionable fix commands, and provides remote operations β all as MCP tools your AI agent can call.
Add to your MCP client config:
On Windows wrap with cmd /c since Node 20+ can't spawn .cmd files directly:
The @latest tag makes npx re-resolve against the registry on every spawn, so each MCP session uses the newest published version. Or install globally if you'd rather pin (no auto-update):
Tools that fix your local SSH setup so everything else β git, deploys, tunnels β stops breaking.
| Tool | Description |
|---|---|
ssh_agent_ensure | Ensure ssh-agent is running. Starts one if needed and sets env vars for the session. |
ssh_key_list | List all SSH keys in ~/.ssh/ with type, fingerprint, and agent status. |
ssh_key_load | Load a key into the running agent. Ensures the agent is started first. |
ssh_config_lookup | Resolve the effective SSH config for a host (hostname, user, port, proxy, identity files). |
ssh_known_hosts_fix | Remove a stale host key and re-scan. Fixes "host key verification failed" errors. |
ssh_git_check | Test Git-over-SSH auth to GitHub, GitLab, Bitbucket, etc. |
ssh_test | Quick connectivity test with timing and actionable error details. |
| Tool | Description |
|---|---|
ssh_diagnose | Full SSH environment diagnostic. Checks agent, keys, config, known_hosts, and connectivity. Returns exact fix commands for every failure. |
| Tool | Description |
|---|---|
ssh_exec | 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. |
ssh_read_file | Read a file from a remote host via SFTP. |
ssh_write_file | Write content to a file on a remote host via SFTP. |
ssh_upload | Upload a local file to a remote host via SFTP. |
ssh_download | Download a file from a remote host to local filesystem. |
ssh_ls | List files in a directory on a remote host. |
ssh_stat | Get metadata for a file or directory (size, mode in octal, uid/gid, mtime/atime, isFile/isDirectory/isSymbolicLink). Use instead of parsing ls -la. |
ssh_mkdir | 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. |
ssh_delete | 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 ssh_exec rm -rf if you need it. |
Tools that wrap common patterns agents build with ssh_exec β faster and less error-prone.
| Tool | Description |
|---|---|
ssh_multi_exec | 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 ssh_exec, applied once and sent to every host). Subject to command policy if configured (policy is checked once, against the env-prefixed command, before fan-out). |
ssh_find | Search for files remotely with structured parameters (name, type, size, depth, newer β match files modified more recently than a reference path). |
ssh_tail | Read the last N lines of a file, optionally filtered by a grep pattern. |
ssh_service_status | 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. |
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 ssh_diagnose separately β it gets told what's wrong and how to fix it right in the error message.
Remote operations reuse SSH connections automatically. When your agent makes multiple calls to the same host, the first call opens a connection and subsequent calls reuse it. Connections are kept alive for 60 seconds after the last use, then closed automatically.
The pool caps at 100 connections by default, and a connection still being dialed counts against the cap. When the cap is reached the pool closes an idle connection to make room. If every slot is in use or dialing, a tool call waits for one instead of failing:
ssh_exec, the SFTP tools, ssh_find, ssh_tail, ssh_service_status) waits up to its timeout (30s for the SFTP tools, which have no timeout parameter) and is next in line for the first slot that frees, so an ssh_exec arriving in the middle of a wide ssh_multi_exec runs between two of its hosts rather than being refused for the whole run. It reports Connection pool is full only if it never won a slot in that time.ssh_multi_exec runs at most SSH_MCP_MAX_POOL_SIZE hosts at once (default 100) and works through a longer list as slots free up, so raising the cap raises its parallelism; timeout is per host, not a bound on the whole call. When the pool is full it waits, and gives up only when none of its own hosts holds a slot and a full timeout has passed with none of them starting or finishing. The hosts waiting at that point (up to one per parallel slot) and every host still queued then report Connection pool is full; the queued ones are never attempted.A call reaches Connection pool is full only when other calls β a long ssh_exec, a concurrent ssh_multi_exec β kept every slot from it for a full timeout; a fan-out wider than the cap that has the pool to itself never does, however long it runs. If you see it, rerun once those calls finish (for ssh_multi_exec, the hosts that reported it), or raise the cap with SSH_MCP_MAX_POOL_SIZE=<n> in the server's environment. The error names the variable.
The library's acquire() / withConnection() do not wait by default: they reject at once with a PoolFullError (code: "ERR_SSH_MCP_POOL_FULL", isPoolFullError()) unless you pass { waitForCapacityMs } β see Programmatic usage.
All connections respect your ~/.ssh/config. Host aliases, custom ports, usernames, identity files, and ProxyJump settings are used automatically. If you have Host myserver configured in your SSH config, just pass host: "myserver" β ssh-mcp resolves everything.
ProxyJump / bastion hosts are supported automatically. If your SSH config has ProxyJump bastion for a host, ssh-mcp connects through the bastion transparently. Chained proxies work too.
All remote operations verify the server's host key against ~/.ssh/known_hosts:
known_hosts entry doesn't cover", so a missing ed25519 line doesn't read as an attack.SSH_MCP_STRICT_HOST_KEY=1.No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/ssh-mcp-server-2)<a href="https://allmcps.com/mcp/ssh-mcp-server-2"><img src="https://allmcps.com/api/badge/ssh-mcp-server-2?style=directory" alt="SSH MCP Server on AllMCPs" /></a>