Is the SSH MCP server safe? What it can reach
What the SSH MCP server can read, write and delete, how it signs in, and how to limit it in Claude Code and Codex.
There is no vendor SSH server, so this covers the community ssh-mcp by tufantunc (906 stars, MIT). It runs locally on stdio, uses your SSH key, agent or password, and acts as the remote account you configure. It can run shell commands and sudo and move files. A role and host-group policy plus approval mode decide what runs without asking, so set approvalMode and never point it at root.
Who maintains it
| Implementation | Kind | Status |
|---|---|---|
| tufantunc/ssh-mcp (community) | Community | active |
It runs as a local process on your machine.
How it signs in
No sign-in to the MCP server itself over stdio. It logs in to each SSH host with a key, SSH agent, password or keychain entry named in your config, so it acts as that remote account. An optional HTTP mode needs a bearer token.
What its tools can do
| Kind | Tools |
|---|---|
| Read | list-connections, list-sessions, read-session-output, read-command, sftp-download, sftp-list |
| Write | open-session, run-command |
| Can’t be undone | close-session, destructive-command, privileged-command, sftp-upload, sftp-upload-file, sftp-download-file, signal-process, reload-config |
run-command can run arbitrary shell commands, so it is listed as a write tool even though the project does not mark it destructive. The project’s classifier decides which commands need approval, and it says ordinary writes, service control and signals do not prompt in the default ask-destructive mode. sftp-upload-file and sftp-download-file are off until defaults.transferRoot is set, and they are not available on Windows.
Built-in limits
| Option | What it does |
|---|---|
approvalMode | Values are auto, ask-destructive (default), ask-all, deny and client-tool. Per-profile approvalPolicy overrides it. The README says never to set auto on a production profile. |
role and group | Roles are viewer, operator and admin, and host groups are prod, staging and dev. An unrecognized profile name resolves to prod, the strictest tier. |
readOnly profile | Set readOnly = true on a profile to confine it to read-only commands. |
[policy].denylist and OPA | Regex deny rules apply to commands and SFTP paths, and an optional external OPA policy engine is supported. |
commandQuotaPerDay | Caps commands per rolling 24 hours per profile, as a circuit breaker for runaway agents. |
trustedHostKey and hostKeyMode | Pin a host key per profile, and use hostKeyMode=strict to accept only pinned hosts. |
The risks
- run-command gives the agent a shell on the remote host, so an injected instruction could read private files, change configs or send data out over the host’s network.
- In ask-destructive mode only commands the classifier marks destructive or privileged prompt, so ordinary writes and service control run without asking.
- sftp-upload replaces the destination file unconditionally, and signal-process can kill any process the account can reach.
- A password or key in your config or environment is the account’s full login, and the README warns against root and against putting passwords in CLI arguments.
- TOFU host key trust lasts only for the life of one process, so pin trustedHostKey on important hosts.
Limit it in Claude Code
Add it from the documented launch settings, at local or user scope so a token never lands in a shared .mcp.json:
claude mcp add --env SSH_MCP_PASSWORD=... --env SSH_AUTH_SOCK=... ssh-mcp -- ssh-mcpClaude Code names MCP tools mcp__ssh-mcp__<tool>. Deny rules win over ask rules, and ask rules over allow rules. Put these in ~/.claude/settings.json or the project’s .claude/settings.json:
{
"permissions": {
"deny": [
"mcp__ssh-mcp__privileged-command",
"mcp__ssh-mcp__signal-process",
"mcp__ssh-mcp__reload-config",
"mcp__ssh-mcp__sftp-upload",
"mcp__ssh-mcp__sftp-upload-file"
],
"ask": [
"mcp__ssh-mcp__run-command",
"mcp__ssh-mcp__open-session",
"mcp__ssh-mcp__destructive-command",
"mcp__ssh-mcp__close-session",
"mcp__ssh-mcp__sftp-download-file"
]
}
}Limit it in Codex
Codex reads MCP servers from ~/.codex/config.toml. disabled_tools removes tools, and enabled_tools keeps only the ones you list:
[mcp_servers.ssh-mcp]
command = "ssh-mcp"
env_vars = ["SSH_MCP_PASSWORD", "SSH_AUTH_SOCK"]
disabled_tools = ["privileged-command", "signal-process", "reload-config", "sftp-upload", "sftp-upload-file"]Checklist
- Create a low-privilege account on the target host, never root, and prefer an SSH agent over a password.
- Set group, role and approvalPolicy = ask-all on any production profile.
- Use readOnly = true for monitoring, and pin trustedHostKey.
- Set commandQuotaPerDay and review the audit log.
- Turn on your client’s tool approval for run-command.
Checked against the vendor documentation on November 25, 2026. tufantunc/ssh-mcp README · ssh-mcp SECURITY.md
What Excellent covers
Excellent doesn’t inspect MCP servers themselves. Its free scan reads supported logs on the Mac (Claude Code, Codex, Grok Build, GitHub Copilot CLI, Gemini CLI and Qwen Code) and reports findings for review, so you can see what an agent did after a session. Run the free scan · See a sample report · How to vet any MCP server
Excellent Pro adds checks before supported actions. Claude Code can display an ask prompt. With Codex, an Excellent “ask” refuses the action and tells the agent to ask you. Pro is US-only for now. Agent coverage · Pricing