mcp-ssh-multi
The mcp-ssh-multi server enables AI assistants to manage multiple SSH servers remotely, offering 11 tools for connection management, command execution, file operations, and system monitoring.
Connection Management: List configured servers with connection status (
ssh_list_servers) and disconnect active sessions (ssh_disconnect).Command Execution: Run shell commands on remote servers (
ssh_execute) with configurable timeout, returning stdout, stderr, and exit code with bounded output.File Operations: Upload (
ssh_upload), download (ssh_download), check existence (ssh_file_exists), list directory contents with pagination (ssh_list_dir), read text files (ssh_read_file), and write files (ssh_write_file).System Monitoring: Tail log files (
ssh_tail_log) and list running processes (ssh_process_list) with optional name filtering.Security & Reliability: Input sanitization to prevent command injection, connection pooling with automatic retry, structured error responses, and MCP tool annotations for destructive/read-only hints.
Resource Exposure: Provides a
ssh://serversresource listing configured SSH servers and their connection status.Deployment: Supports stdio (local) and streamable-http (remote/web) transports, compatible with Cloudflare Tunnel for secure remote access.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-ssh-multi Check uptime on proxmox server."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-ssh-multi
MCP server for managing multiple SSH servers through AI assistants. Provides 11 tools for remote command execution, file operations, and system monitoring.
Current version: 0.4.0
Features
Multi-server management — Configure and manage multiple SSH servers from a single YAML file
Connection pooling — Automatic connection reuse with per-server locks and retry on stale connections
Bounded command output — Streams stdout/stderr with a configurable combined memory limit
Timeout cleanup — Terminates timed-out remote processes and explicitly closes their SSH channels
11 MCP tools — Execute commands, transfer files, read/write files, tail logs, list processes
Two transports — stdio (for local MCP clients) and streamable-http (for web/remote)
Cloudflare Tunnel compatible — Deploy behind a tunnel for remote access
MCP tool annotations — Hints for destructive, read-only, idempotent, and open-world operations
MCP resources —
ssh://serversresource for listing configured serversPagination — Directory listings support
limit/offsetfor large directoriesInput validation — Path and filter sanitization to prevent command injection
Structured errors — Consistent error responses with codes, messages, and suggestions
Related MCP server: R-Shell
Installation
Using uv (recommended)
uv tool install mcp-ssh-multiUsing pip
pip install mcp-ssh-multiUsing uvx (one-shot)
uvx --from mcp-ssh-multi ssh-mcpFrom source
git clone https://github.com/gilberth/mcp-ssh-multi.git
cd mcp-ssh-multi
uv syncConfiguration
1. SSH Servers (ssh_servers.yaml)
Create a ssh_servers.yaml file with your server definitions:
servers:
proxmox:
host: 192.168.1.100
port: 22
username: root
key_file: ~/.ssh/id_rsa
description: "Proxmox VE hypervisor"
truenas:
host: 192.168.1.101
port: 22
username: root
password: "my-password" # or use key_file
description: "TrueNAS storage server"2. Environment Variables (.env)
Copy .env.example to .env and customize:
cp .env.example .envVariable | Default | Description |
|
| Path to servers config |
|
| Default command timeout (seconds) |
|
| Combined stdout/stderr retention limit per command |
|
| Logging level |
|
| HTTP server port |
|
| HTTP endpoint path |
Usage
stdio mode (local MCP clients)
ssh-mcpOr with uvx:
uvx --from mcp-ssh-multi ssh-mcpHTTP mode (web/remote MCP clients)
ssh-mcp-webThe server will listen on http://0.0.0.0:8086/mcp by default.
MCP Client Configuration
Add to your MCP client config (e.g., Claude Desktop):
{
"mcpServers": {
"ssh": {
"command": "uvx",
"args": ["--from", "mcp-ssh-multi", "ssh-mcp"],
"env": {
"SSH_SERVERS_FILE": "/path/to/ssh_servers.yaml"
}
}
}
}For HTTP mode:
{
"mcpServers": {
"ssh": {
"url": "http://localhost:8086/mcp"
}
}
}Tool Reference
Connection Management
Tool | Description |
| List all configured servers with connection status |
| Disconnect from a specific server |
Command Execution
Tool | Description |
| Execute a shell command on a remote server |
ssh_execute streams stdout and stderr concurrently and retains at most
SSH_MAX_OUTPUT_BYTES bytes across both streams. If the limit is exceeded, the
remote process is terminated and the response includes "truncated": true.
Commands which exceed their timeout are terminated, escalated to a kill when
necessary, and have their SSH process channel explicitly closed.
File Operations
Tool | Description |
| Upload a local file to a remote server |
| Download a file from a remote server |
| Check if a file/directory exists on a server |
| List contents of a remote directory (supports pagination with |
| Read a text file from a remote server |
| Write content to a file on a remote server |
System Monitoring
Tool | Description |
| Tail a log file on a remote server |
| List running processes (optionally filtered) |
MCP Resources
The server exposes the following MCP resources:
Resource URI | Description |
| List of all configured SSH servers with connection status |
Changelog
v0.4.0
Bounded command output —
ssh_executereads stdout and stderr concurrently in chunks and enforces the combinedSSH_MAX_OUTPUT_BYTESlimitTimeout process cleanup — Timed-out commands are terminated, escalated to
kill()when necessary, and their SSH channels are explicitly closedTruncation reporting — Command responses expose
truncatedwhen output exceeds the configured limitRobust transport cleanup — Connections which fail to close gracefully are aborted and invalidated instead of being returned to the pool
Memory-efficient pagination — SFTP directory pagination retains only the requested page while still reporting the total entry count
Reproducible dependency ranges — FastMCP, MCP, and AsyncSSH are constrained to the audited major versions
v0.2.0
Per-server connection locks — Replaced global lock with per-server async locks for better concurrency
Connection retry — Automatic single retry on stale/lost SSH connections
MCP tool annotations — Added
destructiveHint,readOnlyHint,idempotentHint,openWorldHintto all toolsMCP resource — Added
ssh://serversresource endpointDirectory pagination —
ssh_list_dirnow supportslimitandoffsetparametersInput validation — Path sanitization for
ssh_tail_logand filter validation forssh_process_listStructured errors — Consistent error format with
ErrorCodeenum across all toolsDynamic versioning — Version sourced from
importlib.metadatainstead of hardcoded stringsTest suite — Added tests for pagination, retry logic, input validation, and version consistency
v0.1.1
Initial public release with 11 SSH tools, stdio and HTTP transports
Production Deployment (LXC + Cloudflare Tunnel)
Full deployment guide for running mcp-ssh-multi as a systemd service behind a Cloudflare Tunnel on a Proxmox LXC container.
Prerequisites
A Proxmox LXC container (Debian 12/13)
A Cloudflare account with a domain
uvandcloudflaredinstalled on the LXC
1. Install dependencies
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install cloudflared
curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb \
-o cloudflared.deb && dpkg -i cloudflared.deb2. Create SSH servers config
mkdir -p /ssh-mcp
cat > /ssh-mcp/ssh_servers.yaml << 'EOF'
servers:
my-server:
host: 192.168.1.100
port: 22
username: root
password: "my-password" # or use key_file
description: "My server"
EOF3. Create the Cloudflare Tunnel
# Login to Cloudflare (opens browser)
cloudflared tunnel login
# Create the named tunnel
cloudflared tunnel create ssh-mcp
# Route DNS to your domain
cloudflared tunnel route dns ssh-mcp ssh-mcp.yourdomain.com4. Configure the tunnel
The tunnel create command outputs the tunnel UUID (e.g. 2687c640-38df-40f9-...) and creates a credentials file at /root/.cloudflared/<TUNNEL-ID>.json. If you need to find it later, run cloudflared tunnel list.
# Replace <TUNNEL-ID> with the UUID from "cloudflared tunnel create" output
cat > /root/.cloudflared/config.yml << 'EOF'
tunnel: <TUNNEL-ID>
credentials-file: /root/.cloudflared/<TUNNEL-ID>.json
ingress:
- hostname: ssh-mcp.yourdomain.com
service: http://localhost:8086
- service: http_status:404
EOF5. Create systemd services
mcp-ssh-multi service:
cat > /etc/systemd/system/mcp-ssh-multi.service << 'EOF'
[Unit]
Description=MCP SSH Multi Server
After=network.target
[Service]
Type=simple
Environment=SSH_SERVERS_FILE=/ssh-mcp/ssh_servers.yaml
Environment=MCP_SECRET_PATH=/your-secret-path
ExecStart=/root/.local/bin/uvx --from mcp-ssh-multi@latest ssh-mcp-web
Restart=always
RestartSec=5
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
EOFcloudflared service:
cloudflared service installEnable and start both:
systemctl daemon-reload
systemctl enable --now mcp-ssh-multi
systemctl enable --now cloudflared6. Verify
# Check services
systemctl status mcp-ssh-multi
systemctl status cloudflared
# Test the endpoint
curl -s -X POST "https://ssh-mcp.yourdomain.com/your-secret-path" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'7. Configure your MCP client
{
"mcpServers": {
"ssh": {
"type": "remote",
"url": "https://ssh-mcp.yourdomain.com/your-secret-path"
}
}
}Service management
# View logs
journalctl -u mcp-ssh-multi -f
journalctl -u cloudflared -f
# Restart services
systemctl restart mcp-ssh-multi
systemctl restart cloudflaredEnvironment Variables
Variable | Default | Description |
|
| Path to servers config |
|
| Default command timeout (seconds) |
|
| Combined stdout/stderr retention limit per command |
|
| Logging level |
|
| HTTP server port |
|
| HTTP endpoint path (use a secret value) |
Development
# Install with dev dependencies
uv sync --group dev
# Run linting
uv run ruff check src/ tests/ --fix
uv run ruff format src/ tests/
# Run type checking
uv run mypy src/
# Run tests
uv run pytest tests/ -vLicense
MIT
Available Tools
11 toolsssh_disconnectAIdempotent
Disconnect from a specific SSH server.
Closes the active SSH connection to the named server. The connection will be re-established automatically on next command.
EXAMPLES:
Disconnect: ssh_disconnect("proxmox")
Inputs: server_name (required). Returns: object
ssh_downloadA
Download a file from a remote server to the local machine via SFTP. Use this tool (NOT scp via ssh_execute) to transfer files FROM a remote SSH server TO the local machine.
Inputs: local_path (required), remote_path (required), server_name (required). Returns: object
ssh_executeADestructive
Execute a command on a remote SSH server.
Runs the given shell command on the specified server and returns stdout, stderr, and exit code. Connections are established automatically and reused.
EXAMPLES:
Run command: ssh_execute("proxmox", "uptime")
With timeout: ssh_execute("truenas", "zpool status", timeout=60)
Inputs: command (required), server_name (required), timeout. Returns: object
ssh_file_existsARead-only
Check if a file or directory exists on a remote server.
Returns existence status, type (file/directory), size, and permissions.
EXAMPLES:
ssh_file_exists("proxmox", "/etc/pve/qemu-server/100.conf")
Inputs: remote_path (required), server_name (required). Returns: object
ssh_list_dirARead-only
List contents of a remote directory.
Returns file names, types, sizes, and permissions. Supports pagination with limit/offset for large directories.
EXAMPLES:
ssh_list_dir("truenas", "/mnt/data")
ssh_list_dir("proxmox") # lists home directory
ssh_list_dir("proxmox", "/var/log", limit=50, offset=100)
Inputs: server_name (required), limit, offset, remote_path. Returns: object
ssh_list_serversARead-only
List all configured SSH servers with connection status.
Returns server names, hosts, usernames, descriptions, and whether each server currently has an active connection.
EXAMPLES:
List all servers: ssh_list_servers()
Inputs: _placeholder. Returns: object
ssh_process_listARead-only
List running processes on a remote server.
Returns process list sorted by CPU usage. Optionally filter by name.
EXAMPLES:
ssh_process_list("proxmox")
ssh_process_list("truenas", filter_name="zfs")
Inputs: server_name (required), filter_name. Returns: object
ssh_read_fileARead-only
Read a text file from a remote server.
Returns the file contents as a string. For binary or large files, use ssh_download instead.
EXAMPLES:
ssh_read_file("proxmox", "/etc/hostname")
ssh_read_file("truenas", "/var/log/messages", max_size=5000000)
Inputs: remote_path (required), server_name (required), max_size. Returns: object
ssh_tail_logARead-only
Tail a log file on a remote server.
Returns the last N lines of the specified log file.
EXAMPLES:
ssh_tail_log("proxmox")
ssh_tail_log("truenas", "/var/log/messages", lines=100)
Inputs: server_name (required), lines, log_path. Returns: object
ssh_uploadADestructive
Upload a local file to a remote server via SFTP. Use this tool (NOT scp via ssh_execute) to transfer files FROM the local machine TO a remote SSH server. For server-to-server transfers, download from source first, then upload to destination.
Inputs: local_path (required), remote_path (required), server_name (required). Returns: object
ssh_write_fileADestructive
Write content to a file on a remote server.
Creates or overwrites the file with the given content.
EXAMPLES:
ssh_write_file("proxmox", "/tmp/test.txt", "Hello World")
Inputs: content (required), remote_path (required), server_name (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool has a clearly distinct action (execute, download, upload, read, write, list, etc.) with no overlapping purposes. The descriptions further clarify when to use which, e.g., ssh_download for binary files vs ssh_read_file for text.
All tools follow a consistent 'ssh_verb_noun' snake_case pattern (e.g., ssh_execute, ssh_list_servers, ssh_read_file). No mixing of styles or verbs.
With 11 tools covering connection management, command execution, file transfer, directory listing, process listing, and log tailing, the count is well-scoped for a comprehensive SSH management server.
The tool set covers core SSH operations but lacks direct tools for file deletion, directory creation, or server-to-server copy. However, these can be accomplished via ssh_execute, so minor gaps exist.
Maintenance
Related MCP Connectors
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server that lets your AI assistant build and deploy apps, hosting each one at a live URL.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives AI assistants full SSH/SFTP remote operations — session management, command execution, interactive shells, file transfers, port forwarding, and system diagnostics.2MIT
- AlicenseNot gradedqualityCmaintenanceMCP server enabling AI assistants to securely operate remote servers via persistent SSH sessions, with tools for command execution, file transfer, directory listing, and system monitoring.4MIT
- AlicenseCqualityBmaintenanceAn MCP server that enables AI agents to establish and manage persistent SSH sessions with smart command execution, async support, and file operations.221MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI assistants to perform development operations on remote servers via SSH, including executing commands, managing files, and browsing directories.1MIT