mcp-ssh-remote
mcp-ssh-remote
An MCP (Model Context Protocol) server that wraps the system ssh binary to execute commands on remote hosts — with full support for ProxyCommand, bastion hosts, jump hosts, and any configuration in ~/.ssh/config.
Built for workflows where your GPU/HPC server is behind a bastion host, has no internet access, and you want to develop locally with Claude Code while running jobs remotely.
Why this exists
Most SSH-based MCP servers (e.g. @fangjunjie/ssh-mcp-server) use Node's ssh2 library internally, which does not support ProxyCommand. If your remote server is behind a bastion host or requires a custom proxy setup defined in ~/.ssh/config, those servers simply cannot connect.
This server has no SSH implementation of its own — it calls the system ssh binary directly, so it inherits everything your shell SSH already supports: ProxyCommand, ProxyJump, identity files, ControlMaster, port forwarding, and so on.
Features
Works with any
~/.ssh/configsetup — ProxyCommand, ProxyJump, magic-user auto-forward bastionsOptional SSH ControlMaster multiplexing — opt in with
MCP_SSH_MULTIPLEX=1for hosts where it works (off by default; see SSH multiplexing)Login shell wrapping — commands run via
bash -lso your full environment (conda, Slurm, modules) is always availableSlurm integration — submit, cancel, monitor jobs and read logs directly
rsync support — sync local directories to the remote server through the bastion
Safe file operations — large file writes piped via stdin (no shell arg limits), edit files with find-and-replace
SSH multiplexing
Multiplexing is off by default. Many jump hosts — especially magic-user auto-forward bastions (e.g. user/target_ip/target_user) — permit only one session per TCP connection. Every follow-up call then fails with Session open refused by peer, leaks stderr into the response, and flakes under load.
With multiplexing off, each call opens a fresh SSH connection. Slightly slower per call, but correct and reliable.
For hosts where multiplexing works (plain direct SSH, standard ProxyJump over a jumphost that supports session forwarding), opt in via env var:
{
"mcpServers": {
"ssh-remote": {
"type": "stdio",
"command": "node",
"args": ["/path/to/mcp-ssh-remote/index.js", "--host", "myserver"],
"env": {"MCP_SSH_MULTIPLEX": "1"}
}
}
}Requirements
Node.js >= 14
System
sshandrsyncinstalled (openssh)The target host must be reachable via
ssh <hostname>from your terminal
Installation
Via npx (no install needed):
npx mcp-ssh-remote --host myserverOr clone and run directly:
git clone https://github.com/JasonLinjc/mcp-ssh-remote.git
node mcp-ssh-remote/index.js --host myserverClaude Code Configuration
Add to your ~/.claude.json under mcpServers:
{
"mcpServers": {
"ssh-remote": {
"type": "stdio",
"command": "node",
"args": ["/path/to/mcp-ssh-remote/index.js", "--host", "myserver"],
"env": {}
}
}
}Or with npx:
{
"mcpServers": {
"ssh-remote": {
"type": "stdio",
"command": "npx",
"args": ["mcp-ssh-remote", "--host", "myserver"],
"env": {}
}
}
}You can also add it via the Claude Code CLI:
claude mcp add ssh-remote -- node /path/to/mcp-ssh-remote/index.js --host myserverBastion / ProxyCommand example
If ~/.ssh/config contains:
Host myserver
HostName 10.0.0.5
User alice
ProxyCommand ssh bastion nc %h %pThen just pass --host myserver — the ProxyCommand is followed automatically.
Tools
File Operations
Tool | Description |
| Run any shell command (configurable timeout, up to 10 min) |
| Read a remote file (supports |
| Write content to a remote file (creates parent dirs, handles large files) |
| Find-and-replace a unique string in a remote file |
| List files in a remote directory ( |
| Search file contents with regex (recursive, with file filtering) |
| Find files by glob pattern |
Slurm Job Management
Tool | Description |
| Show job queue (current user or all users) |
| Submit a batch job (from script path or inline script content) |
| Cancel a job by ID |
| Get detailed job info ( |
| Tail stdout/stderr logs of a running or completed job |
| Concise summary of an array job: completed/running/pending/failed counts, failed task IDs |
| Identify failed tasks in an array job and resubmit only those |
Sync & Utilities
Tool | Description |
| Rsync a local directory to the remote host (with exclude patterns, dry-run, delete) |
| Rsync a remote directory to local (pull results back) |
| Pull latest git changes in a remote directory |
| Read the last N lines of a remote file (useful for monitoring logs) |
| Check disk usage of a file or directory (with optional depth) |
Typical Workflow
1. Edit code locally → Claude Code's native Edit/Write tools
2. Sync to remote → rsync_to_remote (quick) or git push + git_pull_remote (committed)
3. Submit a Slurm job → slurm_submit
4. Monitor training → slurm_status + slurm_log
5. Read results → read_file, grep_filesExample conversation:
You: "Change the learning rate to 1e-4 in train.py"
Claude: [edits local file]
You: "Sync and submit on gpu31 with 4 GPUs"
Claude: [rsync_to_remote] → [slurm_submit -p gpu31 --gres=gpu:4]
You: "How's it going?"
Claude: [slurm_status] → [slurm_log]Usage
node index.js --host <hostname><hostname> must match a host you can reach with ssh <hostname> — an IP, a hostname, or a Host alias from ~/.ssh/config.
License
MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/JasonLinjc/mcp-ssh-remote'
If you have feedback or need assistance with the MCP directory API, please join our Discord server