SSH MCP Server
Lets your AI agent run commands and transfer files on remote servers over SSH, with policy checks, approvals and an audit log.
856 stars on GitHubby tufantuncLicense MITUpdated 18 days ago
How to install
This MCP is local: it runs on your computer.
It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Codeβ¦). Choose your app:
Paste in the terminal:
claude mcp add ssh -- npx -y ssh-mcp
What to fill in
| Name | What it is | Required |
|---|---|---|
SSH_MCP_PASSWORD | Password for the configured profile; a per-profile SSH_MCP_<PROFILE>_PASSWORD takes precedence. Credentials are never accepted as CLI arguments. | No |
SSH_MCP_KEY | Path to the private key file to authenticate with β the path, not the key material. A per-profile SSH_MCP_<PROFILE>_KEY takes precedence. | No |
SSH_MCP_PASSPHRASE | Passphrase for an encrypted private key. | No |
SSH_MCP_SUDO_PASSWORD | Password the sudo tool escalates with, when the policy in force allows the privileged class. | No |
Ready! Now test it
Restart the app and paste one of these requests in the chat:
Check the disk usage on the dev server.
Tail the application log on the deploy host and tell me about errors.
What it is
SSH MCP gives an AI agent controlled SSH access to remote hosts. Before running a command it classifies it, checks it against a role and host policy, asks a human to approve risky work and records the decision in an audit log. The readme warns that this reduces but does not remove the risk of giving an AI shell access.
What it can do
list-connections: see available hosts and statusread-command: run allowlisted read-only commandsrun-command: run commands, with approval for destructive onesprivileged-command: run with sudo, after approvalopen-sessionandread-session-output: stateful or background sessionssftp-upload,sftp-download,sftp-list: move files with SFTPsftp-upload-fileandsftp-download-file: stream large files without passing them through the modelsignal-process: send INT, TERM or KILL to a process
When to use
- βΊWhen you want your agent to check logs or disk space on a Linux server
- βΊWhen you want a human to approve destructive commands before they run
- βΊWhen you want an audit record of everything the agent did on a host
What you need
Skills that pair well
MCP or skill?
The MCP gives the agent the hands. The skill teaches the right way to use them. Together, the result is better and uses fewer tokens.
ssh-configurationLets your agent configure SSH securely. It manages keys and connections for protected remote access.ssh-penetration-testingHelps your agent test SSH security. It looks for vulnerabilities and tries to exploit them to ensure secure remote access.cross-host-rig-commandsHelps your agent run OpenRig commands against a registered remote host over SSH or HTTP, and read the result of a cross-host command correctly.Frequently asked questions
Is it free and open source?
Yes. It has a license badge and is published on npm.
Is it safe?
It is built to be careful, but the readme says prompt injection has no general fix. Never point it at a root account and never use auto approval on a production profile.
What happens without a config?
The server starts but refuses every tool call until you write config.toml, except reload-config.
Does it work on Windows?
It can target Windows hosts and runs on Windows with config checks, but the file-streaming transfer tools are not available there.
Where is the config file?
On Linux at ~/.config/ssh-mcp/config.toml, on macOS in ~/Library/Application Support/ssh-mcp, on Windows in %APPDATA%\ssh-mcp.
Can the agent upload big files?
Yes with sftp-upload-file, but only after you set defaults.transferRoot, which turns the transfer tools on.
If it does not work
- βΊIf every tool call is refused, create the config.toml at the path for your platform and call reload-config or restart.
- βΊOn Linux and macOS run chmod 700 on the config folder and chmod 600 on the file, or the server will not start.
- βΊUse an SSH agent or key rather than passing passwords on the command line.
5 new skills a week. 1 minute to read.