mcp-ssh-remote
Enables executing commands on remote SSH hosts, with full support for bastion/jump hosts and ~/.ssh/config, plus Slurm job management and rsync.
README
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 bastions - Optional 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 available - Slurm 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 myserver
Or clone and run directly:
git clone https://github.com/JasonLinjc/mcp-ssh-remote.git
node mcp-ssh-remote/index.js --host myserver
Claude 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 myserver
Bastion / ProxyCommand example
If ~/.ssh/config contains:
Host myserver
HostName 10.0.0.5
User alice
ProxyCommand ssh bastion nc %h %p
Then just pass --host myserver — the ProxyCommand is followed automatically.
Tools
File Operations
| Tool | Description |
|---|---|
execute_command |
Run any shell command (configurable timeout, up to 10 min) |
read_file |
Read a remote file (supports offset and limit for large files) |
write_file |
Write content to a remote file (creates parent dirs, handles large files) |
edit_file |
Find-and-replace a unique string in a remote file |
list_directory |
List files in a remote directory (ls -la) |
grep_files |
Search file contents with regex (recursive, with file filtering) |
glob_files |
Find files by glob pattern |
Slurm Job Management
| Tool | Description |
|---|---|
slurm_status |
Show job queue (current user or all users) |
slurm_submit |
Submit a batch job (from script path or inline script content) |
slurm_cancel |
Cancel a job by ID |
slurm_job_info |
Get detailed job info (scontrol show job) |
slurm_log |
Tail stdout/stderr logs of a running or completed job |
slurm_array_summary |
Concise summary of an array job: completed/running/pending/failed counts, failed task IDs |
slurm_resubmit_failed |
Identify failed tasks in an array job and resubmit only those |
Sync & Utilities
| Tool | Description |
|---|---|
rsync_to_remote |
Rsync a local directory to the remote host (with exclude patterns, dry-run, delete) |
rsync_from_remote |
Rsync a remote directory to local (pull results back) |
git_pull_remote |
Pull latest git changes in a remote directory |
tail_file |
Read the last N lines of a remote file (useful for monitoring logs) |
disk_usage |
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_files
Example 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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。