The best SSH MCP servers in 2026

Updated November 15, 2026By HostCrust9 tools compared17 min read

Safest: ssh-mcp-guard (ours), the only one of the nine we reviewed whose rules the server itself enforces, with a signed, single-use approval for every change.

Most capable with guardrails: tufantunc/ssh-mcp, which classifies every command and asks before destructive or sudo ones. Best for read-only troubleshooting: ShellGuard, which parses each command against a default-deny allowlist.

Most SSH MCP servers check commands on your own machine. In our test, the same key used with plain ssh deleted a file with no prompt, so give the agent its own key and restrict that key on the server.

Our top picks

Compare at a glance

ToolBest forPricingOpen sourceDeploymentTested by us
ssh-mcp-guard Ourschanges that must wait for an approval the server checksFreeYesSelf-hosted MCP server plus a server-side gateYes
ssh-mcp (tufantunc)free-form commands with a strict policy and approval promptsFreeYesSelf-hosted MCP server (npm package; stdio or HTTP)Yes
ShellGuardread-only troubleshooting with a parsed allowlistFreeYesSelf-hosted MCP server (single Go binary)Docs only
ssh-mcp-prostrict defaults without extra setupFreeYesSelf-hosted MCP server (npm package; stdio or HTTP)Docs only
MCP SSH Managerthe most features, with approvals in a desktop appFreeYesSelf-hosted MCP server (npm package) with an optional desktop or browser control appDocs only
Safe SSH MCP Serverfixed read-only diagnostics with no free-form commandsFreeYesSelf-hosted MCP server (PyPI package)Docs only
ssh-mcp-server (classfang)simple setups with a regex whitelistFreeYesSelf-hosted MCP server (npm package; stdio or HTTP)Docs only
MCP SSH Agent (AiondaDotCom)reusing your SSH config through the system ssh clientFreeYesSelf-hosted MCP server (npm package or Claude Desktop extension)Docs only
ssh-mcp (Yaw Labs)fixing broken SSH in AI tools on your laptopFreeYesSelf-hosted MCP server (npm package)Docs only

The full ranking

ssh-mcp-guard Ours

Best for: changes that must wait for an approval the server checks

It ranks first on one objective criterion: of the nine we reviewed, it's the only one whose policy the server enforces. The agent's key is pinned to hc-gate with command= and restrict in authorized_keys, so plain ssh with that key reaches the same policy. Reads run at once; restarts, patches and reboots need a single-use approval signed with your own SSH key, and every request goes into a hash-chained receipt log on the server. The costs are real: setup on every server, a fixed catalog of 11 actions with no file transfer, OpenSSH 8.1+ for approvals (AlmaLinux and Rocky 8 stay read-only), and version 0.9.0 hasn't had an outside review. Need arbitrary commands? Pick tufantunc/ssh-mcp.

Pricing
Free (checked November 15, 2026, source)
License
Open source (Apache-2.0)
Deployment
Self-hosted MCP server plus a server-side gate
Runs on
Linux servers with OpenSSH 8.1+; the MCP server runs on macOS or Linux

Pros

  • The only one reviewed whose rules sshd enforces on the server, so the agent can't route around them with that key
  • Every change needs a signed, single-use approval bound to one server, action and parameter set
  • Hash-chained receipts on the server, checkable offline with ssh-mcp-guard-verify

Cons

  • Fixed catalog of 11 actions; no file transfer and no free-form commands unless you turn on shell.run
  • Needs a user, a sudoers line and a restricted key on every server
  • Approvals need OpenSSH 8.1+, so AlmaLinux and Rocky 8 are read-only
  • Version 0.9.0, new and not yet independently reviewed

Tested by us: Ours, and run end to end on our Debian 12 and AlmaLinux 9.8 test servers (14 Nov 2026, UTC): signed restart and patch, refused critical and never-started units, refused replays and a missing nonce store. No independent review of the code yet.

ssh-mcp (tufantunc)

Best for: free-form commands with a strict policy and approval prompts

The most complete policy we found, and the one we ran. Each command is classified as read-only, safe, destructive or privileged using a grammar for each binary's arguments, then checked against a role-by-host-group matrix; destructive and sudo commands trigger an MCP approval prompt that fails closed when the client can't show one. A never-allowed list blocks commands such as rm -rf /, and writes to any user's authorized_keys through redirects, tee, cp, mv or an upload, whatever the role or approval policy; its README notes that other ways of writing, such as sed -i, fall to the command classes and approvals instead. The limits: it all runs on your machine, ordinary writes don't prompt, host keys are trusted on first use for the life of one process unless you pin trustedHostKey, and the hash-chained audit log is off by default. Read-only work only? ShellGuard is narrower.

Pricing
Free (checked November 15, 2026, source)
License
Open source (MIT)
Deployment
Self-hosted MCP server (npm package; stdio or HTTP)
Runs on
macOS, Linux or Windows with Node.js 18.19+ or 20.6+; manages Linux and Windows hosts over SSH

Pros

  • Classifies every command by its arguments, not just the program name
  • Approval prompts for destructive and sudo commands, refused if the client can't ask you
  • Roles per host group (prod, staging, dev), a daily command quota and optional OPA rules
  • Signed npm provenance; passwords never accepted on the command line

Cons

  • Enforced in the MCP process: plain ssh with the same key skips it
  • Ordinary writes and service restarts run without a prompt under the default mode
  • Host keys are trusted on first use per process unless pinned
  • A large configuration surface to get right

Tested by us: ssh-mcp 2.26.0 from npm, on a Mac against web-01 (Debian 12.15), 14 Nov 2026 (UTC): read-only, ordinary, destructive, sudo and never-allowed commands through the MCP tools, then the same key with plain ssh

ShellGuard

Best for: read-only troubleshooting with a parsed allowlist

Built for looking, not changing. Each command is parsed, checked against a default-deny allowlist (84 commands allowed and 95 explicitly denied, per its SECURITY.md, with flags checked per command), then rebuilt with fresh quoting, so ;, redirections and $(...) are refused before anything is sent. It refuses commands that change a server, which is why it ranks above tools that allow them. Its own SECURITY.md calls it a guardrail against mistakes and prompt injection, not protection against a determined attacker, and lists two accepted risks by design: allowed commands can read secrets (printenv, cat), and curl GET requests can reach internal addresses. It will connect to any host your keys open; provision copies rg, jq and yq to the server and download_file fetches files over SFTP, and both can be turned off. Need to fix things too? Pick tufantunc/ssh-mcp.

Pricing
Free (checked November 15, 2026, source)
License
Open source (Apache-2.0)
Deployment
Self-hosted MCP server (single Go binary)
Runs on
macOS or Linux (Homebrew, release binary or go install); connects to Linux servers over SSH

Pros

  • Default-deny: commands, flags and arguments must be on the allowlist
  • Shell syntax such as ; > and $(...) is rejected at parse time
  • Single Go binary; native or system-ssh mode for bastions

Cons

  • Read-only only: no way to approve a fix
  • By design, per its SECURITY.md, allowed commands can read secrets and make GET requests to internal endpoints
  • No host allowlist and no documented audit log
  • Enforced in the MCP process

Not tested by us yet: based on the vendor's documentation.

ssh-mcp-pro

Best for: strict defaults without extra setup

The strictest defaults among the general-purpose servers. Out of the box it requires the host key to already be in known_hosts, refuses root logins, turns raw sudo off, and blocks commands that match its destructive patterns (rm -rf /, mkfs, shutdown, curl | sh and more) unless you allow them. File tools can't touch /etc/shadow, /etc/passwd, /etc/sudoers, /boot, /dev or /proc by default, and destructive file operations are allowed only under /tmp, /var/tmp and home directories. What it lacks is any approval prompt: a command passes policy or it doesn't. Its audit log is a 500-event buffer in memory that's gone when the process exits, and the project also ships a hosted connector mode, which widens what you have to read. Want prompts? Pick tufantunc/ssh-mcp.

Pricing
Free (checked November 15, 2026, source)
License
Open source (MIT)
Deployment
Self-hosted MCP server (npm package; stdio or HTTP)
Runs on
macOS, Linux or Windows with Node.js 22+; manages hosts over SSH

Pros

  • Strict host-key checking, no root login and no raw sudo by default
  • Destructive commands and file operations blocked unless policy allows them
  • Host, command and path allow and deny lists

Cons

  • No approval step for changes
  • The destructive-command check is a pattern list, so other spellings can pass
  • Audit events kept in memory only (500 by default)
  • Enforced in the MCP process

Not tested by us yet: based on the vendor's documentation.

MCP SSH Manager

Best for: the most features, with approvals in a desktop app

The broadest tool set: 37 tools for commands, deploys, database queries, backups, tunnels and file sync, an encrypted credential vault, and a desktop or browser control app where you approve waiting commands per server. Safety is opt-in, though. The default mode is unrestricted, approval defaults to never, and the audit log is off until you set a path. Turn on readonly or restricted mode and destructive approval for anything that matters; approvals fail closed when the control app isn't running. Version 3.8.6 (October 2026) fixed six advisories, one of which let a malicious SSH server run a command on your machine, and its docs say regex filtering can be bypassed. Version 4.2.0 adds an opt-in ssh-manager guard hook that stops the agent running raw ssh in its own shell, which its README calls a guard against accidents, not a security boundary. Pick it for breadth, configured carefully.

Pricing
Free (checked November 15, 2026, source)
License
Open source (MIT)
Deployment
Self-hosted MCP server (npm package) with an optional desktop or browser control app
Runs on
macOS, Linux or Windows with Node.js 18+; manages hosts over SSH

Pros

  • Per-server approvals in a desktop or browser app, denied on timeout
  • readonly and restricted modes, checked per command on the line
  • Credentials in an AES-256-GCM vault keyed from the OS keychain
  • Sudo password sent on stdin, not the command line

Cons

  • Unrestricted, with no approvals and no audit log, until you configure them
  • 37 tools add about 43,500 tokens of context, by its own count
  • Recent security fixes; keep it updated
  • Enforced on your machine; its optional guard against raw ssh reads command text only

Not tested by us yet: based on the vendor's documentation.

Safe SSH MCP Server

Best for: fixed read-only diagnostics with no free-form commands

A Python server with no free-form command tool at all: 55 fixed, read-only tools (df, journalctl, ss, docker ps, kubectl logs and so on), each running one hard-coded command with validated parameters (a few run through sudo -n or doas -n where the login user isn't root). That makes it hard to misuse on the host. Two things to watch: the agent supplies the host, user and key path on every call, and a password, if you use one, is a tool argument, so it passes through the model's context. Host keys must already be known unless the agent sets accept_new_hostkey on the call. It's AGPL-3.0 and at version 0.2.0. Prefer a parsed allowlist over fixed tools? Compare ShellGuard.

Pricing
Free (checked November 15, 2026, source)
License
Open source (AGPL-3.0-or-later)
Deployment
Self-hosted MCP server (PyPI package)
Runs on
macOS or Linux with Python 3.11+; reads Linux hosts over SSH

Pros

  • Only fixed, read-only commands; the agent supplies validated parameters, not command text
  • Unknown host keys rejected by default
  • Covers system, logs, network, Docker and Kubernetes checks

Cons

  • Host, user, key path and any password are tool arguments chosen or seen by the model
  • The agent can turn on accept-new host keys per call
  • Early version (0.2.0); AGPL-3.0

Not tested by us yet: based on the vendor's documentation.

ssh-mcp-server (classfang)

Best for: simple setups with a regex whitelist

Popular and simple: one command tool, file upload and download, background jobs, an exec or shell mode for bastions, and many hosts from ~/.ssh/config. Its --whitelist is solid when used: patterns must match the whole command, and with a whitelist on, ;, |, backticks, $() and redirections are refused. But nothing is restricted by default, there's no approval step, the README's first examples log in as root with --password in the arguments, where it shows in the process list, and we found no host-key check in the connection code of version 1.11.0; the ssh2 library it uses accepts any host key when no verifier is set. Use it only with a whitelist and a non-root key.

Pricing
Free (checked November 15, 2026, source)
License
Open source (ISC)
Deployment
Self-hosted MCP server (npm package; stdio or HTTP)
Runs on
macOS, Linux or Windows with Node.js; manages hosts over SSH

Pros

  • Whitelist mode refuses chaining, pipes, substitution and redirection
  • Remote path allowlist for SFTP transfers
  • Shell mode works through bastions and jump hosts

Cons

  • Every command allowed until you add a whitelist
  • No host-key verification found in the source we read
  • Documented password and passphrase options go on the command line
  • No approval step or audit log

Not tested by us yet: based on the vendor's documentation.

MCP SSH Agent (AiondaDotCom)

Best for: reusing your SSH config through the system ssh client

Wraps your system ssh and scp, so ~/.ssh/config, ProxyJump and ssh-agent work as they do for you, and new host keys are accepted on first use (StrictHostKeyChecking=accept-new). Its only boundary is the host list: the agent may use any host in your SSH config or known_hosts, then run any command; there's no command allowlist, read-only mode or approval. Passwords can live in a # @password: comment in ~/.ssh/config, which must be mode 600. Its changelog lists high-severity security fixes in 1.3.5 (April 2026: an option injection through the host name, and a Windows-only shell bug, both of which could run a command on your machine) and in 1.3.9 (August 2026: a chain of tool calls that could plant a ProxyCommand in your ~/.ssh/config, and an scp check that could send a file to a host outside your config). All are fixed in 1.3.9, and its README sets out a threat model that treats the model's tool arguments as untrusted. Fine for a lab; anything ranked above it gives you more control.

Pricing
Free (checked November 15, 2026, source)
License
Open source (MIT)
Deployment
Self-hosted MCP server (npm package or Claude Desktop extension)
Runs on
macOS, Linux or Windows with Node.js 20+ and the OpenSSH client

Pros

  • Uses the real OpenSSH client, so your config, jump hosts and agent just work
  • No shell on your machine: ssh and scp run with argument lists
  • Desktop extension for Claude Desktop

Cons

  • No command restrictions, read-only mode or approvals
  • Any host in your SSH config or known_hosts is reachable
  • High-severity security fixes in 1.3.5 and 1.3.9 (2026); keep it updated

Not tested by us yet: based on the vendor's documentation.

ssh-mcp (Yaw Labs)

Best for: fixing broken SSH in AI tools on your laptop

More a fixer for broken SSH in AI tools than a guarded remote shell: it starts ssh-agent, loads keys, repairs known_hosts and diagnoses auth failures, plus exec, SFTP and multi-host tools. For server safety it ranks last. The agent can name any host, and by default the server offers your ssh-agent and a default key to it. Unknown host keys are accepted on every connection unless you set SSH_MCP_STRICT_HOSTKEYS=1, and the optional regex allow and deny lists cover only ssh_exec and ssh_multi_exec; its README says plainly that the SFTP write and delete tools are not covered. Use it for git and key trouble on your own machine, not as production access.

Pricing
Free (checked November 15, 2026, source)
License
Open source (MIT)
Deployment
Self-hosted MCP server (npm package)
Runs on
macOS, Linux or Windows with Node.js 18+

Pros

  • Good diagnostics for agent, key and known_hosts problems
  • Known host keys are checked; changed keys are rejected
  • Honest README about what its policy doesn't cover

Cons

  • The agent can connect to any host with your agent and default key
  • Unknown host keys accepted unless strict mode is on
  • Command policy is opt-in and skips the SFTP write and delete tools

Not tested by us yet: based on the vendor's documentation.

How we picked and ranked them

On November 15, 2026 we searched npm, the official MCP Registry and GitHub for MCP servers that run commands over SSH, and shortlisted the ones with a 2026 release, a stated license and real use (npm downloads). For each one we read the README and security notes, and the code that connects, checks commands and handles credentials, at the version named in the table below. We ran one of them, tufantunc/ssh-mcp, against a Debian 12 test server. Nobody paid to be listed and we contacted no developers.

We ranked on these criteria, in this order:

  1. Where the rules are enforced: on the server, or only inside the MCP process on your machine.
  2. What it does with no configuration: refuse everything, allow reads only, or allow everything.
  3. Approval for changes: whether a person approves risky commands, and whether a missing answer counts as no.
  4. Host keys and credentials: whether it checks the server's host key, and whether passwords end up in the model's context or the process list.
  5. Audit trail: what's recorded, and where.
  6. Usefulness: free-form commands, file transfer, many hosts and support for Claude Code, Codex and Cursor.

Safety comes first: a server that's easy to misuse costs more than one that takes an hour to set up. Between servers with similar safety, the more useful one ranks higher.

Where are the rules enforced, and why does it matter?

An MCP server is a program on your laptop that the agent calls. If the allowlist, the read-only mode or the approval prompt lives in that program, it only sees commands that go through it. Claude Code, Codex and Cursor can also run shell commands themselves. An agent that can do that, and can read the same private key or use your ssh-agent, can run ssh web-01 '...' directly and skip every rule. Two of these projects say so in their own documentation: MCP SSH Manager describes its Claude Code hook as a guard against accidents rather than a security boundary, and ShellGuard describes itself as a fail-safe for mistakes, not a defense against a determined attacker. The approval prompt is also local: Claude Code can answer elicitation prompts automatically through an Elicitation hook in its settings, so those settings files are part of what you must protect. Client-side rules still stop most accidents and many prompt injections. They just aren't a wall.

The fix is on the server. In authorized_keys, command= makes sshd run one program for that key, whatever the client asks for. ssh-mcp-guard is built on that: its key runs only hc-gate, which checks a root-owned policy and the signature on each approval before anything changes.

What we saw on web-01

We installed ssh-mcp 2.26.0 from npm (registry signatures verified) on a Mac with Node.js 25.4, created a throwaway non-sudo user on a Debian 12.15 test VM (OpenSSH 9.2p1) with its own ed25519 key, pinned the host key, and sent raw MCP requests on November 14, 2026 (UTC). One profile used the operator role with no group set, which the server treats as production; a second used admin on a dev group.

What the agent asked forProfileResult
uptime (read-only tool)operator, prodRan
cat /etc/os-release | head -2 (read-only tool)operator, prodRefused: a pipe makes it more than read-only
mkdir and touch in the user's homeoperator, prodRan, no prompt (an ordinary write)
rm -rf ~/scratchoperator, prodRefused by the role matrix
python3 -c deleting a fileoperator, prodRefused: code it can't read counts as destructive
id through the sudo tooloperator, prodRefused: no sudo for this role on prod
rm -rf /, or appending to authorized_keysoperator, prodRefused by the never-allowed list
rm -rf ~/scratchadmin, devApproval prompt: declined, refused; approved, ran
echo hi > ~/note.txtadmin, devRan, no prompt
rm of that file with plain ssh and the same keynone (not through MCP)Ran: no policy involved

Every call went into a JSON-lines audit log under the Mac user's ~/Library/Logs/ssh-mcp/, readable and writable by that same user. Afterwards we deleted the test user, its home directory and key, and the npm install.

Security review: what each server does by default

Versions and defaults as of November 15, 2026, from each project's code and documentation linked under Sources. "Your machine" means the rule lives in the MCP server process, so it holds only for commands sent through it.

Server (version, date)Rules enforcedWith no extra configAsks before changesHost keysAudit log
ssh-mcp-guard (0.9.0)On the server (sshd forced command)Reads on, changes need approval, shell offYes: signed, single-use, checked by the serverStrict (StrictHostKeyChecking=yes)Hash-chained receipts on the server
tufantunc/ssh-mcp (2.26.0, Nov 12)Your machineEvery tool call refused until you write a configYes, for destructive and sudo commands; fails closedTrusted on first use per process; pin to persistJSON lines on your machine; hash chain optional
ShellGuard (0.9.9, Aug 21)Your machineRead-only allowlist, default denyNo (changes are refused)Trusted on first use, saved to known_hostsNot documented
ssh-mcp-pro (1.7.2, Nov 13)Your machineMost commands allowed; destructive patterns, root and raw sudo blockedNoStrict (known_hosts)In memory, last 500 events
MCP SSH Manager (4.2.0, Nov 13)Your machine, plus a control appUnrestrictedOptional per server; off by defaultTrusted on first use, saved to known_hostsOpt-in JSON lines
Safe SSH MCP Server (0.2.0, Nov 12)Your machine (fixed commands)Read-only tools onlyNo (changes aren't possible)Strict unless the agent sets accept_new_hostkeyNot documented
classfang/ssh-mcp-server (1.11.0, Nov 4)Your machineUnrestrictedNoNo check found in the sourceNot documented
AiondaDotCom/mcp-ssh (1.3.9, Aug 10)Your machineAny command on hosts in your SSH configNoTrusted on first use (OpenSSH accept-new)Not documented
Yaw Labs ssh-mcp (0.18.2, Nov 12)Your machineUnrestricted, any hostNoKnown keys checked; unknown hosts acceptedNot documented

Three findings stand out. Most servers allow every command until you configure them. Host-key checking ranges from strict to none, and a missing check means the agent's key and commands can go to a machine pretending to be your server. And every audit log kept on your own machine sits in a file the agent's own user can edit.

How do you sandbox an SSH MCP server?

These steps work with any server on this page, and they matter more than which one you pick:

  1. A separate user on the server. Never root. If it needs sudo, give it a sudoers line per command, not NOPASSWD: ALL.
  2. A separate key for the agent. Don't let it use your own keys: keep them out of any ssh-agent the agent can reach, or run the agent as a different OS user or in a container that can't read your home directory.
  3. Restrict that key in authorized_keys. restrict turns off port, agent and X11 forwarding, terminal allocation and ~/.ssh/rc; from= limits where the key can be used; expiry-time= retires it; command= forces one program, which receives the requested command in SSH_ORIGINAL_COMMAND.
  4. Pin host keys. Put each server's key in known_hosts before the first connection and use the strict mode the server offers.
  5. Turn on the server's own limits anyway. Read-only mode or an allowlist for production, approvals for changes, a non-default audit log.
  6. Keep the record on the server. sshd and journald log every login there; a log on your laptop can be edited by whatever runs as you.
  7. Treat output as untrusted. A log line or file can carry instructions aimed at the model.
# ~agent/.ssh/authorized_keys on the server: one line per key
restrict,from="203.0.113.7",expiry-time="20270101",command="/usr/local/bin/agent-wrapper" ssh-ed25519 AAAA... agent@laptop

The wrapper should read SSH_ORIGINAL_COMMAND, compare it with a fixed list, and run the match without a shell. Don't write it as sh -c "$SSH_ORIGINAL_COMMAND": that puts the shell back. A command= key also stops SFTP and scp for that key unless the wrapper allows them.

ssh-mcp-guard ships that wrapper (hc-gate), with a policy file, signature checks and receipts, if you'd rather not write your own.

Others we looked at

  • mcp-ssh-gate (@imenam/mcp-ssh-gate): every command waits for you in a web interface and the agent never holds the key, an interesting design. Its documentation is in French only and the repository had no license file on November 15, 2026 (its package.json says ISC), so we left it out of the ranking.
  • rootpilot-ssh-diagnose: 38 fixed read-only commands with secret redaction, a similar idea to Safe SSH MCP Server; it's the open-source part of a commercial product, RootPilot.
  • mixelpixx/SSH-MCP: archived; its author points to a Rust rewrite.
  • sshdo: not an MCP server, but a forced-command allowlist for authorized_keys with a mode that learns the commands you use. Its last tagged release was in 2023.
  • Dozens of smaller packages on npm, many of them forks of classfang/ssh-mcp-server with little use. We skipped single-author projects with no release this year.

Do you need an SSH MCP server at all?

Not always. Claude Code can already run ssh through its Bash tool, and its permission rules can allow or deny commands by their text, which works for a few trusted servers and quick checks. An SSH MCP server earns its place when you want named hosts instead of raw addresses, credentials the model never sees, a policy that understands commands rather than matching strings, a person approving changes, and a log of what ran. For read-only troubleshooting, a read-only server such as ShellGuard plus a restricted key is a sound setup. For changes on production, you want approvals and a boundary on the server, because both Claude Code's rules and an MCP server's rules sit on the same machine as the agent. Whatever you choose, the agent can do anything its SSH user can: start with the account and the key, then pick the server.

How we checked this: ssh-mcp (tufantunc) 2.26.0 from npm (registry signatures verified), run on a Mac with Node.js 25.4 against web-01, a Debian 12.15 test VM with OpenSSH 9.2p1, on 14 Nov 2026 (UTC), as a throwaway non-sudo user with its own key, driven with raw MCP JSON-RPC requests; the user, key and install were removed afterwards. The other eight were reviewed from their source code and documentation at the versions named on this page, not run by us. Anything we didn't run ourselves comes from the official documentation listed under Sources.

Give AI agents SSH with a seatbelt

ssh-mcp-guard lets an AI agent read freely but makes every change wait for a signed human approval, enforced on the server. Free and open source.

About ssh-mcp-guard

FAQ

Can Claude Code SSH into a server?

Yes, in two ways. Claude Code can run ssh itself through its Bash tool, using your keys and gated only by its permission rules, which match command text. Or you add an SSH MCP server with claude mcp add --transport stdio <name> -- <command>, which gives it structured tools, per-host settings and, depending on the server, an allowlist or approval prompts. Either way, the agent acts with whatever the SSH user on the server can do.

What is the safest way to give an AI agent SSH access?

Give the agent its own non-root user and its own key, and restrict that key on the server in authorized_keys: restrict (no forwarding, no terminal), from= your address, and command= pointing at a program that runs only what you allow. Keep your own keys and ssh-agent out of the agent's reach. Then use an MCP server's read-only or allowlist mode on top, with approvals for changes.

Can an AI agent get around an SSH MCP server's allowlist?

If the allowlist lives only in the MCP server and the agent can also run shell commands with a usable key, yes: it can call ssh directly. On our Debian 12 test server, tufantunc/ssh-mcp refused rm -rf for its operator role, but the same key used with plain ssh deleted a file with no prompt. Restricting the key on the server closes that gap.

Which SSH MCP servers ask before running a destructive command?

tufantunc/ssh-mcp asks through an MCP elicitation prompt for destructive and sudo commands by default, and refuses if the client can't show it. MCP SSH Manager can ask in its desktop or browser app, but approval is off (never) until you turn it on per server. ShellGuard and Safe SSH MCP Server never need to ask, because they only allow reads. The others block by pattern or don't check at all.

Do SSH MCP servers send my password or private key to the AI model?

The well-built ones don't: credentials stay in a config file, keychain, environment variable or ssh-agent on your machine, and the model only sees host names. Watch for three patterns: a password passed as a tool argument (Safe SSH MCP Server, and Yaw Labs' optional password field), which goes through the model's context; a password in the server's command-line arguments (classfang's documented --password), which shows in the process list; and servers that offer your ssh-agent to any host the agent names.

Is it safe to let Claude Code run commands on a production server?

Only with limits you'd accept from a new colleague: a non-root account, read-only by default, a person approving each change, and a record of what ran. Treat server output as untrusted too, because a log line can carry instructions that the model may follow. Start with read-only access on production and allow changes on staging first.

Sources

  1. tufantunc/ssh-mcp v2.26.0 README: command classes, approval modes, never-allowed list, CLI flags
  2. tufantunc/ssh-mcp v2.26.0 SECURITY.md: threat model and why host-key trust doesn't survive a restart
  3. tufantunc/ssh-mcp v2.26.0 src/audit/store.ts: where the local audit log is written
  4. ShellGuard v0.9.9 README: tools, parse-validate-reconstruct pipeline, host-key modes
  5. ShellGuard v0.9.9 SECURITY.md: threat model and accepted risks
  6. ssh-mcp-pro README: configuration defaults and security defaults
  7. ssh-mcp-pro src/safety.ts: the destructive-command patterns
  8. MCP SSH Manager v4.2.0 README: control app, approvals, vault, guard hook
  9. MCP SSH Manager v4.2.0 docs/SECURITY_MODES.md: unrestricted, readonly and restricted modes, limitations
  10. MCP SSH Manager v4.2.0 CHANGELOG: the six advisories fixed in 3.8.6
  11. Safe SSH MCP Server mcp_ssh.py: tool signatures and host-key policy
  12. classfang/ssh-mcp-server README_EN.md: options, whitelist rules, security notes
  13. classfang/ssh-mcp-server src/services/ssh-connection-manager.ts: the ssh2 connection settings
  14. npm: @fangjunjie/ssh-mcp-server 1.11.0 (published 4 Nov 2026; the newest GitHub release is v1.10.0)
  15. ssh2 (Node.js) README: hostVerifier auto-accepts host keys when not set
  16. AiondaDotCom/mcp-ssh v1.3.9 CHANGELOG: security fixes
  17. AiondaDotCom/mcp-ssh v1.3.9 src/ssh-client.ts: StrictHostKeyChecking=accept-new, no shell
  18. Yaw Labs ssh-mcp v0.18.2 README: host-key verification, command policy scope, authentication
  19. OpenBSD sshd(8): AUTHORIZED_KEYS FILE FORMAT (command=, restrict, from=, expiry-time)
  20. Claude Code docs: MCP, including elicitation dialogs and the Elicitation hook
  21. Claude Code docs: hooks, including the Elicitation hook that can answer a form request from a script
  22. Official MCP Registry