remote-ssh-mcp
Connects an MCP client to a remote Linux/Unix host over SSH, enabling remote shell commands, file access, port forwarding, and VS Code Remote-SSH URI generation.
README
remote-ssh-mcp
Generic MCP server for connecting an MCP client to a remote Linux or Unix host over SSH.
It provides remote shell commands, directory listing, text and binary file access, SSH
port forwarding, and VS Code Remote-SSH URI generation. The server runs locally and
reuses the OpenSSH installation, configuration, keys, agents, and ProxyJump settings
already available on the user's machine.
Network Model
This MCP server is useful when the remote server cannot access the internet, or when you do not want the remote server to use its own outbound network connection.
The MCP client and remote-ssh-mcp process run on your local computer. Requests are
sent from the local computer to the remote server through SSH, so the remote server
does not need internet access for MCP communication. The only network requirement is
that your local computer can reach the server's SSH address and port.
This does not give remote commands internet access. Commands such as curl, wget,
git clone, npm install, or pip install still run on the remote server and require
network access from that server. To fetch files or data through the local computer,
download them locally first and then use remote_ssh_write_file_base64, or use an SSH
port forward where appropriate.
Quick Setup
Clone the repository, install dependencies, and run the interactive setup wizard:
git clone https://github.com/bbt567/remote-ssh-mcp.git
cd remote-ssh-mcp
npm ci
npm run setup
The wizard:
- Lists saved server profiles or creates a new profile.
- Asks for the server IP/hostname, SSH user, port, and private-key path.
- Detects an existing SSH key or generates an Ed25519 key.
- Tests public-key authentication.
- Offers to install the public key on the server. OpenSSH may request the server password once; the wizard never reads or stores it.
- Saves the profile in
~/.remote-ssh-mcp/profiles.json. - Installs a profile-specific MCP entry into Codex Desktop/CLI and/or Claude Code.
- Generates a profile-specific JSON config as a portable backup.
Restart the selected clients after setup. Codex Desktop and Codex CLI share the same
~/.codex/config.toml, so installing into either Codex surface enables both.
Chinese instructions are available in docs/SETUP.zh-CN.md.
Multiple Servers
Run npm run setup again to add another server. Saved profiles are displayed before
the connection questions, so an existing server can be selected without re-entering
its address, user, port, or key path.
The default profile is installed as remote-ssh. Other profiles use distinct MCP
server names:
default -> remote-ssh
production -> remote-ssh-production
staging -> remote-ssh-staging
List saved profiles:
npm run profiles
Remove a local profile:
npm run profiles -- remove staging
Removing a profile does not remove its Codex or Claude Code MCP entry.
Requirements
- Node.js 20 or newer
- OpenSSH client available as
ssh - SSH public-key authentication configured for the target host
- A local MCP client that supports stdio servers
Verify SSH before configuring the MCP client:
ssh 192.0.2.10 "hostname && whoami && pwd"
If your SSH setup needs a username or a non-default port, use the environment variables
shown below or configure them in ~/.ssh/config.
Install From Source
git clone https://github.com/bbt567/remote-ssh-mcp.git
cd remote-ssh-mcp
npm ci
npm run setup
The repository does not store SSH passwords, private keys, or tokens.
MCP Client Configuration
The setup wizard installs clients using a profile name and profiles file:
{
"mcpServers": {
"remote-ssh": {
"command": "node",
"args": [
"C:\\path\\to\\remote-ssh-mcp\\dist\\index.js"
],
"env": {
"REMOTE_SSH_PROFILE": "production",
"REMOTE_SSH_PROFILES_FILE": "C:\\Users\\your-name\\.remote-ssh-mcp\\profiles.json"
}
}
}
}
Direct SSH_HOST, SSH_USER, SSH_PORT, and SSH_IDENTITY_FILE configuration remains
supported for compatibility. Explicit environment variables override profile values.
REMOTE_SSH_* variables are supported as the explicit namespaced equivalents. When
both forms are present, REMOTE_SSH_* takes precedence.
Tools
remote_ssh_check: Check the SSH connection and return remote identity details.remote_ssh_local_diagnostics: Inspect the local OpenSSH environment and connection.remote_ssh_exec: Run a shell command with optional working directory and environment.remote_ssh_list_dir: List a remote directory withls -la.remote_ssh_read_text: Read a remote text file with a byte limit.remote_ssh_read_file_base64: Read a small remote binary file as base64.remote_ssh_write_text: Write UTF-8 text to a remote file.remote_ssh_write_file_base64: Decode base64 and write a remote file.remote_ssh_start_port_forward: Start a local SSH-Lport forward.remote_ssh_list_port_forwards: List port forwards created by this process.remote_ssh_stop_port_forward: Stop a port forward created by this process.remote_ssh_uri: Generate a VS Code Remote-SSH URI and CLI command.
Every remote tool accepts an optional host field that overrides the configured target
for that call. The command and file-write tools are intentionally powerful; review
tool calls before approving them in your MCP client.
Environment Variables
| Variable | Default | Description |
|---|---|---|
REMOTE_SSH_PROFILE |
none | Saved profile to load |
REMOTE_SSH_PROFILES_FILE |
~/.remote-ssh-mcp/profiles.json |
Local profiles file |
SSH_HOST |
none | Default hostname, alias, or IP address |
SSH_USER |
OpenSSH default | Username added to SSH_HOST when it has no @ |
SSH_PORT |
OpenSSH default | SSH TCP port |
SSH_BIN |
platform OpenSSH | SSH executable path |
SSH_IDENTITY_FILE |
OpenSSH default | Private-key path passed to OpenSSH |
REMOTE_SSH_HOST |
none | Namespaced equivalent of SSH_HOST |
REMOTE_SSH_USER |
OpenSSH default | Namespaced equivalent of SSH_USER |
REMOTE_SSH_PORT |
OpenSSH default | Namespaced equivalent of SSH_PORT |
REMOTE_SSH_BIN |
platform OpenSSH | Namespaced equivalent of SSH_BIN |
REMOTE_SSH_IDENTITY_FILE |
OpenSSH default | Namespaced equivalent of SSH_IDENTITY_FILE |
REMOTE_SSH_TIMEOUT_MS |
60000 |
Default command timeout |
REMOTE_SSH_MAX_OUTPUT_BYTES |
1048576 |
Default captured bytes per output stream |
Development
npm run typecheck
npm run build
npm run dev
npm run setup
npm run profiles
The MCP server uses stdio. Logs are written to stderr so the MCP protocol stream remains clean.
License
MIT. See LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。