SSH MCP Server
Enables remote command execution and file management over SSH and SFTP, supporting persistent connection storage and automated discovery for BinaryLane VPS servers.
README
SSH MCP Server
A Model Context Protocol (MCP) server for executing commands and managing files on remote servers via SSH.
Optionally auto-discovers BinaryLane VPS servers so they're available immediately.
Features
- Execute shell commands on remote servers
- Read files and list directories remotely
- Upload and download files via SFTP
- Persistent connections saved to config file across restarts
- BinaryLane auto-discovery of active servers
- Per-connection SSH key configuration
- Multiple connection sources with clear priority
Installation
npm install
npm run build
Configuration
Claude Desktop / Claude Code
Add to your Claude configuration:
{
"mcpServers": {
"ssh": {
"command": "node",
"args": ["/path/to/ssh-mcp/dist/index.js"],
"env": {
"BINARYLANE_API_TOKEN": "your-token-here"
}
}
}
}
The BINARYLANE_API_TOKEN is optional — only needed for auto-discovery of BinaryLane servers.
Config File
On first run, a config file is created at ~/.config/ssh-mcp/connections.json:
{
"defaultPrivateKeyPath": "~/.ssh/id_ed25519",
"binarylane": {
"enabled": true,
"apiToken": "your-token-here",
"defaultUsername": "root",
"defaultPrivateKeyPath": "~/.ssh/id_ed25519"
},
"connections": [
{
"name": "my-server",
"host": "10.0.0.5",
"port": 22,
"username": "deploy",
"privateKeyPath": "~/.ssh/deploy_key"
}
]
}
The BinaryLane API token can be set here or as an environment variable.
Environment Variable (Legacy)
Still supported for backward compatibility:
export SSH_CONNECTIONS='[
{"name": "web1", "host": "192.168.1.10", "port": 22, "username": "root", "privateKeyPath": "~/.ssh/id_rsa"}
]'
Connection Options
| Option | Required | Default | Description |
|---|---|---|---|
name |
Yes | - | Unique identifier for the connection |
host |
Yes | - | Server hostname or IP address |
port |
No | 22 | SSH port |
username |
Yes | - | SSH username |
privateKeyPath |
No | - | Path to SSH private key (supports ~ expansion) |
password |
No | - | SSH password (if not using key auth) |
If neither privateKeyPath nor password is provided, the server will try default SSH key locations (~/.ssh/id_ed25519, ~/.ssh/id_rsa).
Connection Priority
When multiple sources define the same connection name:
- Config file (highest) — manual connections from
~/.config/ssh-mcp/connections.json - Environment variable —
SSH_CONNECTIONS - BinaryLane auto-discovery (lowest) — active servers from the API
Available Tools
Connection Management
list_connections— List all available SSH connections with source infotest_connection— Test connectivity with latency reportingadd_connection— Add a connection (persisted to config file)remove_connection— Remove a manual connection from configrefresh_connections— Re-discover BinaryLane servers and reload all connectionsget_config— Show current configuration (tokens redacted)
Command Execution
run_command— Execute a shell command with configurable timeout
File Operations
read_remote_file— Read file contents via SFTPlist_remote_directory— List directory contents with metadataupload_file— Upload a local file to remote serverdownload_file— Download a remote file to local machine
Example Usage
# List all connections (shows source: config, env, or binarylane)
list_connections
# Test connection
test_connection connection="web1"
# Run a command
run_command connection="web1" command="uptime"
# Add a new persistent connection
add_connection name="staging" host="10.0.0.5" username="deploy" privateKeyPath="~/.ssh/deploy_key"
# Refresh after creating new BinaryLane servers
refresh_connections
Security Notes
- SSH keys are read from your local filesystem and never transmitted or stored by the MCP
- Passwords in config are only held in memory during operation
- The config file should be protected with appropriate filesystem permissions
- Commands are executed with the privileges of the SSH user
- Consider using dedicated SSH keys with limited permissions for automation
Development
npm run dev # Watch mode
npm run build # Compile TypeScript
npm start # Run compiled server
Project Structure
ssh-mcp/
├── src/
│ ├── index.ts # Server entry point
│ ├── ssh-client.ts # SSH connection manager
│ ├── config.ts # Persistent config file management
│ ├── binarylane.ts # BinaryLane auto-discovery
│ ├── tools.ts # MCP tool definitions
│ └── handlers.ts # Tool handler implementations
├── dist/ # Compiled JavaScript
├── package.json
└── tsconfig.json
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。