ssh-hosts-mcp
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., "@ssh-hosts-mcp run df -h on my-host"
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.
ssh-hosts-mcp
Unified SSH MCP server with a host registry — one host_id per call instead of IPs, users and key paths.
Overview
ssh-hosts-mcp is a Model Context Protocol server that gives LLM clients access to SSH hosts through a named registry. The agent calls ssh_exec with host_id — addresses, users, ports and private keys stay in a local config file and never enter the model context.
Three transports are supported:
Transport | Implementation | Tools |
|
| exec, read, SFTP write (base64-exec fallback) |
| spawns the | exec, read, base64-exec write (≤48 KB) |
| WSL | exec only |
Related MCP server: MCP SSH Server
Features
Host registry —
host_idabstraction; the agent never guesses IP/user/keyThree transports — direct
ssh2,ssh3(QUIC over UDP), WSL-proxied SSHHost-key pinning —
trustedHostKey(sha256) verified on every direct connection; unpinned hosts are flagged inssh_list_hosts; ssh3 pins via TOFUknown_hostsCommand policy — built-in never-allowed denylist (
rm -rf /,mkfs,dd of=/dev/*,curl|sh, …) plus per-host/defaultspolicy.deny/policy.allowregex lists; deny wins, whitelist mode is fail-closed (RouterOS pipes exempt)Path confinement — optional
allowedPaths(read/write prefixes), absolute POSIX paths only,..traversal rejectedOutput & time limits — per-host
maxOutputBytestruncation with an explicit marker; per-hosttimeoutMs(per-call overrides)Paged file reads —
ssh_read_filereturns a byte range (default 64 KB) withnextOffsetfor continuationHealth snapshots —
ssh_server_status: CPU/mem/disk/uptime in one call, busybox/OpenWrt and RouterOS variantsWSL idle wake —
"wake": "wsl"ssh3 hosts auto-revive a shut-down WSL distro before calls (idle shutdown otherwise kills inbound QUIC)File transfer — SFTP with automatic base64-exec fallback for hosts without sftp-server (OpenWrt/dropbear), written bytes verified
RouterOS-aware — MikroTik hosts flagged with
"shell": "routeros"Server instructions —
docs/INSTRUCTIONS.mdis served to the MCP client automaticallyAgent Skills — a ready SKILL.md for skill-aware clients (copy to the client's
skills/directory)Safety rails — rejects literal
undefined/nullfile paths, propagates remote exit codes (incl. win32 unsigned 32-bit fixup)Local-first config — real addresses live in a gitignored
hosts.local.json; the repository ships an anonymized template
Tools
Tool | Purpose |
| List configured hosts and metadata (incl. |
| Run a remote command (policy-checked, output capped) |
| Read a byte-range of a remote file (default 64 KB, continue via |
| Write a remote file (SFTP on direct hosts, base64-exec on ssh3; ≤48 KB) |
| CPU/mem/disk/uptime snapshot |
Installation
git clone https://github.com/nagual2/ssh-hosts-mcp.git
cd ssh-hosts-mcp
npm install
npm testMCP configuration
Generic mcpServers entry (Claude Desktop, Cursor, ZCode, …):
{
"mcpServers": {
"ssh": {
"command": "node",
"args": ["/path/to/ssh-hosts-mcp/index.mjs"],
"env": {
"SSH_HOSTS_CONFIG": "/path/to/hosts.local.json"
}
}
}
}Config precedence: SSH_HOSTS_CONFIG env override → hosts.local.json (real addresses, gitignored) → hosts.json (anonymized template, safe to publish).
Host configuration
{
"version": 1,
"defaults": {
"maxOutputBytes": 262144,
"policy": { "deny": ["^reboot"] }
},
"hosts": {
"my-host": {
"label": "Linux box",
"transport": "direct",
"host": "192.0.2.10",
"user": "root",
"port": 22,
"privateKeyPath": "~/.ssh/id_ed25519",
"trustedHostKey": "SHA256:…"
},
"my-ssh3-host": {
"label": "Same box over ssh3",
"transport": "ssh3",
"host": "server.example.lan",
"port": 443,
"urlPath": "/ssh3-term",
"user": "user",
"privateKeyPath": "~/.ssh/id_ed25519",
"clientPath": "ssh3-client"
},
"my-proxy-host": {
"label": "Reachable only through a proxy",
"transport": "wsl",
"wslHost": "alias-from-ssh-config",
"user": "coder"
}
}
}Transports in detail
direct— Nodessh2from the MCP host machine;~inprivateKeyPathis expanded to the home directory.ssh3— spawns the ssh3 client (clientPath, defaultssh3-clienton PATH); all flags go before the positionaluser@host:port/urlPathtarget. The server certificate must be pinned in~/.ssh3/known_hosts(TOFU) or"insecure": trueset (dev only). Requires ssh3 server ≥ 0.1.8 — use thenagual2/ssh3fork, which adds the-privkeyflag.wsl— runswsl bash -lc 'ssh -o BatchMode=yes <wslHost> <command>'; onlyssh_execis supported (usecat/tar|sshfor files).
Full field reference: hosts.json and docs/INSTRUCTIONS.md.
Design notes
48 KB base64-exec limit — remote writes are embedded as
echo <base64> | base64 -d > file; an ARG_MAX-safe ceiling, with the written size verified viawc -c.Exit codes — Go clients surface unsigned 32-bit codes on win32;
normalizeExitCodemaps them back to signed values.filePath, notpath— the write schema usesfilePath; a literal"undefined"/"null"path is rejected before touching the remote host.
Testing
npm test # node --test test/lib.test.mjs — pure helpers, no networkWSL access comparison (ssh3-MCP vs wsl.exe)
test/e2e-wsl-compare.mjs measures both access paths against a live WSL ssh3 host: channel A spawns the real MCP stdio server, channel B calls wsl.exe directly. Results (2026-10-17, LAN, median of 5):
Check | ssh3 (MCP) | wsl.exe |
| 75 ms (63–93) | 205 ms |
exit-code propagation ( | 42 ✓, 63 ms | 42 ✓, 215 ms |
4 KB write + read-back | byte-exact | — |
1 MB output volume | 1000000 ✓, 120 ms | 1000000 ✓, 243 ms |
after 35 s idle | alive with | wakes the distro in 0.3–5 s |
| ✓ | — |
Takeaway: ssh3 is ~3× faster on the hot path and byte-accurate; an idle WSL distro shuts down (~30 s) and kills inbound QUIC — hosts with "wake": "wsl" self-heal.
License
MIT © 2026 nagual2
Available Tools
4 toolsssh_execB
Execute a command on a configured host by host_id
Inputs: command (required), host_id (required), timeoutMs.
ssh_list_hostsA
List configured SSH hosts (use host_id with ssh_exec)
Inputs: no named parameters.
ssh_read_fileB
Read a remote file (direct hosts only; uses cat)
Inputs: host_id (required), filePath (required), timeoutMs.
ssh_write_fileA
Write remote file via SFTP (base64-exec fallback). Param is filePath (not path). direct hosts only.
Inputs: content (required), host_id (required), filePath (required), mode, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clear, unique purpose: listing hosts, executing commands, reading files, and writing files. There is no overlap or ambiguity between the tools, and the descriptions clarify any caveats like 'direct hosts only'.
All tools follow a consistent 'ssh_' prefix followed by a verb_noun pattern: list_hosts, exec, read_file, write_file. The naming is predictable and uniform, making it easy for an agent to infer functionality.
Four tools is a well-scoped number for an SSH host management server. It covers the essential operations without unnecessary bloat, and each tool clearly earns its place.
The tool set covers the core lifecycle of SSH host interaction: listing, executing, reading, and writing. While operations like deleting files or managing host configurations are missing, the common workflows are fully supported, leaving only minor gaps.
Maintenance
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Use your own Windows, Mac or Linux computer from ChatGPT, Claude, Cursor or Gemini CLI: run commands, read, write and search files, run long processes. Your computer only makes an outgoing connection (no open ports or VPN). Read-only mode, allowed folders, blocked commands and an action log keep you in control. Free plan available.
Connect AI assistants to explicitly paired computers, servers, and VMs for permitted remote actions.
Remote MCP access to user-authorized Linux, Windows and Intel Mac devices for AI assistants.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables LLMs to interact with remote servers via SSH, supporting command execution, file upload/download, and directory listing.7MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to execute commands and transfer files on remote servers over SSH connections.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to securely execute commands, transfer files, and manage port forwarding on remote servers via SSH.114 npm38Apache 2.0
- FlicenseNot gradedqualityDmaintenanceEnables AI to execute commands on remote hosts via SSH, supporting password and key authentication.-