Persistent stateful remote SSH sessions for AI agents via MCP + OpenSSH.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent โ or use 1-click editor setup below.
๐ก Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Persistent, stateful remote Bash sessions for AI agents
via the Model Context Protocol
Why ยท Features ยท How it works ยท Tools ยท Quick start ยท Config ยท Security ยท ็ฎไฝไธญๆ
Most agents reach remote machines like this:
Every call pays the same tax:
| Pain | What happens |
|---|---|
| ๐ Token waste | Banners, MOTD, login noise, and pwd / whoami probes flood the context |
| ๐ง Lost state | cwd, export, venv activation, and shell side effects vanish |
| ๐ Unstable | Fresh connects hit timeouts, host-key prompts, ProxyJump, and auth jitter |
| ๐ Error spiral | The model compensates with longer probe commands โ more tokens |
Remote SSH MCP turns a long-lived remote Bash into first-class MCP tools. One session ID keeps working directory, environment variables, and shell side effects. Open a new session when you need a clean environment.
ssh in bash?Concrete gains for agent workflows (multi-step remote work: deploy, debug, build, inspect logs):
| Dimension | One-shot ssh host "โฆ" | Remote SSH MCP |
|---|---|---|
| ๐ฐ Tokens | Each step re-pays connect noise + state probes; models often re-cd / re-pwd | Pay once on ssh_open; later ssh_run returns mostly command output. Structured tools + head/tail caps cut tool-result bloat. In multi-step sessions this commonly cuts remote-tool context by ~50โ80% vs reconnect-every-time (exact savings depend on MOTD size and how chatty the model is). |
| โ Success rate | N steps โ N handshakes โ N chances to fail (timeout, jump, agent, host key) | One handshake per session; subsequent commands ride a live shell. Long jobs use running + ssh_peek instead of killing the tool call and restarting. Fewer reconnects โ far fewer false โSSH failedโ loops mid-task. |
| ๐งณ Portability | Remote needs nothing extra โ but every agent machine reimplements the same brittle ssh โฆ patterns | Install once on the machine that runs Claude / Cursor / Grok / etc. Remote hosts install nothing (no Node, no MCP daemon, no agent). Only a normal shell account + tools already required for SSH (bash, base64, stty, โฆ). Keys and jump hosts stay in local ~/.ssh/config. |
| ๐ง Model ergonomics | Model invents ssh strings, escapes, and recovery | Stable tools: open โ run โ peek โ close. Session id is the only handle. |
| ๐ Trust boundary | Easy to over-expose keys or prompt for passwords in-band | OpenSSH client only; tools never accept passwords or private-key material |
Portability in one line: put the MCP on your dev box / AI host; every server already in your SSH config is reachable โ zero package install on the remote fleet.
Token sketch (illustrative multi-step remote debug):
It does not reimplement SSH. Your system OpenSSH client stays in charge โ so ~/.ssh/config, known hosts, the SSH agent, ProxyJump routes, and hardware keys keep working exactly as they already do.
cwd and environment survive across ssh_run callsmaxSessions)ssh binary โ no custom crypto stack~/.ssh/config, Include, agent sockets, and ProxyJumpBatchMode=yes and StrictHostKeyChecking=yesssh_run waits up to wait_sec (default 10s), then returns status: "running" while the remote command continuesssh_peek(wait_sec=...) long-poll instead of busy-loopingtimeout_sec sends Ctrl-C; no automatic kill by defaultdocker pull, builds, downloads, and deploys that must not block the tool call foreverssh_config + optional config / env overrides*, ?, or ! are ignored0600) with hashed commandsstdout / stderr streamsTERM=dumb, NO_COLOR, bracketed-paste off โ less junk at the sourcestderr, false truncation flags, and request-echo fields so dual content + structuredContent stays cheapssh_hosts returns only safe metadata: alias, hostname, user, port, proxy_jumpIdentityFile, certificates, agent sockets, or ProxyCommandTypical agent flow
No reviews yet โ be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/remote-ssh-mcp)<a href="https://allmcps.com/mcp/remote-ssh-mcp"><img src="https://allmcps.com/api/badge/remote-ssh-mcp?style=directory" alt="Remote Ssh MCP on AllMCPs" /></a>