mcp-ssh
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., "@mcp-ssh check how much disk space is left on web1"
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.
mcp-ssh
An MCP server that gives AI agents SSH access to remote hosts.
An agent with a shell can already run ssh host "command". This server adds what that lacks:
Pooled connections. One connection per host stays open between tool calls, so a call costs milliseconds instead of a new handshake. Dropped connections re-open on the next call.
Bounded output. Command output is capped, keeping the start and end and dropping the middle, so a large log cannot flood the model's context.
Credential isolation. The model refers to hosts by name. Keys, passwords and passphrases never appear in tool input or output, and cannot be placed in the config file.
Strict host key checking. A host must match a pinned fingerprint or your
known_hosts. The model has no way to accept a new key.File operations over SFTP. Reading and writing files does not depend on shell quoting, and writes are atomic.
Status: early development (
0.1.0-dev). The tools below work and are tested. See Roadmap for what is not built yet.
Tools
Tool | What it does |
| Lists configured hosts and whether each is connected. |
| Runs a non-interactive command. Returns exit code, stdout and stderr. Takes |
| Reads a file, or a byte range of one. |
| Creates or replaces a file atomically, keeping an existing file's permissions. |
| Lists a directory with type, size and modification time. |
Related MCP server: SSH MCP Server
Setup
Requires Node.js 20 or later.
git clone https://github.com/jiwonchang/mcp-ssh.git
cd mcp-ssh
npm install
npm run build1. Describe your hosts
Create ~/.mcp-ssh/hosts.json (or point the MCP_SSH_CONFIG environment variable at another path). See examples/hosts.example.json.
{
"hosts": {
"web1": {
"host": "192.0.2.10",
"username": "deploy",
"description": "Production web server"
}
}
}Field | Default | Meaning |
| required | Hostname or IP address. |
| required | Login user. |
|
| SSH port. |
|
| How to authenticate (below). |
| none | Pins the host key, e.g. |
| none | Shown to the model by |
Authentication methods:
{ "type": "agent" }uses your SSH agent (SSH_AUTH_SOCK, or the OpenSSH agent service on Windows).{ "type": "key", "path": "~/.ssh/id_ed25519", "passphraseEnv": "VAR" }reads a private key file.passphraseEnvis optional and names an environment variable.{ "type": "password", "env": "VAR" }reads the password from an environment variable.
2. Trust each host key
The server connects only when the host key is trusted. Either:
connect once yourself with
ssh user@hostso the key is recorded in~/.ssh/known_hosts, orset
hostKeyFingerprintfor the host.
Plain and hashed known_hosts entries are supported. Wildcard patterns and @cert-authority lines are not.
3. Register the server with your MCP client
The server speaks MCP over stdio: the client starts it on demand, so there is nothing to host or keep running.
Claude Code:
claude mcp add ssh -- node /absolute/path/to/mcp-ssh/dist/index.jsOther clients (Claude Desktop and similar) take an entry like this in their MCP configuration:
{
"mcpServers": {
"ssh": {
"command": "node",
"args": ["/absolute/path/to/mcp-ssh/dist/index.js"],
"env": { "LAB_PASSWORD": "..." }
}
}
}Security model
This server lets a model run commands on your machines. Treat it accordingly.
The model can run any command the configured user can run. There is no command filtering yet. Use a least-privilege account on each host.
Only hosts in the config file are reachable. The model cannot supply an address, user or credential.
Secrets are read from the SSH agent, key files or environment variables. The config schema rejects unknown fields, so a password cannot be stored in it by mistake.
Host keys are always verified. An unknown or changed key refuses the connection and tells the model to ask you.
Keep your MCP client's per-call approval on for
ssh_execandssh_write_fileunless you fully trust the task.
Roadmap
Background jobs: start, poll, tail and stop long-running commands that survive a disconnect.
Interactive sessions (PTY) for prompts and REPLs.
Per-host policy: read-only mode, command allow and deny lists.
Audit log of every command and file change.
Jump hosts and port forwarding.
Line-based file reads and in-place string edits.
Reading hosts from
~/.ssh/config.Streamable HTTP transport for remote clients.
Development
npm run typecheck # type-check src and test
npm test # build, then run all testsTests start a real SSH server in-process (using ssh2) and drive the built MCP server over stdio with the official MCP client, so no external host is needed. The test server has no SFTP subsystem, so the three file tools are not covered by automated tests yet.
See CLAUDE.md for the code layout, Docs/Changelog.md for changes, and Docs/Conventions for versioning and workflow.
License
Available Tools
5 toolsssh_execRun a remote commandADestructive
Runs a shell command on a host and returns its exit code, stdout and stderr. The command gets no stdin and no terminal, so it must be non-interactive. Each call starts a fresh shell: use cwd, or chain with &&, instead of relying on an earlier cd. Large output is truncated in the middle; narrow it with grep, head or tail.
Inputs: host (required), command (required), cwd, timeoutSec, +1 more.
ssh_list_dirList a remote directoryARead-only
Lists the entries of a directory on a host over SFTP, with type, size and modification time.
Inputs: host (required), path (required).
ssh_list_hostsList SSH hostsARead-only
Lists the hosts this server can connect to. Other tools take one of these names.
Inputs: no named parameters.
ssh_read_fileRead a remote fileARead-only
Reads a text file from a host over SFTP. Returns at most maxBytes starting at byte offset; the first line of the result says how much of the file was returned.
Inputs: host (required), path (required), offset, maxBytes.
ssh_write_fileWrite a remote fileADestructiveIdempotent
Creates or replaces a text file on a host over SFTP. The whole file is replaced with content. An existing file keeps its permission bits. The parent directory must exist.
Inputs: host (required), path (required), content (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clear primary purpose: host listing, command execution, file read, file write, and directory listing. The only overlap is that ssh_exec can perform many of the same file and directory operations as the SFTP tools, but the descriptions make the intended boundaries reasonably clear.
All tools use the same ssh_ prefix and snake_case verb-based naming. The pattern is predictable across list, exec, read, write, and list operations.
Five tools is well-scoped for an SSH/SFTP server and each tool earns its place. There is no redundant or obviously unnecessary tool.
The surface covers host discovery, command execution, file read/write, and directory listing, which supports most core workflows. It lacks explicit SFTP operations such as delete, rename, or mkdir, though ssh_exec can work around those gaps.
Maintenance
Related MCP Connectors
- browser-sshDeprecatedcom.browserssh
Scoped, audited SSH exec, sessions, and SFTP on your saved servers without exposing credentials
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Let AI operate servers without SSH. Choose actions, approve risky changes, and audit every step.
Manage remote servers, SSH terminals, files, databases and proxies with scoped access and approvals.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to securely execute remote SSH commands, perform file transfers, and monitor system status through a standardized interface. It features robust security controls including command whitelisting, blacklisting, and credential isolation to prevent unauthorized operations.1020 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to securely execute commands, transfer files, and manage port forwarding on remote servers via SSH.114 npm38Apache 2.0
- 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