SSH MCP Server
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., "@SSH MCP Server check the disk space on my-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.
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
Related MCP server: MCP SSH Server
Installation
npm install
npm run buildConfiguration
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 |
| Yes | - | Unique identifier for the connection |
| Yes | - | Server hostname or IP address |
| No | 22 | SSH port |
| Yes | - | SSH username |
| No | - | Path to SSH private key (supports |
| 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.jsonEnvironment variable —
SSH_CONNECTIONSBinaryLane 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_connectionsSecurity 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 serverProject 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.jsonLicense
MIT
Available Tools
11 toolsadd_connectionA
Add or update a manual SSH connection. Persisted to config file across restarts.
Parameters:
name: Unique name for this connection (required)
host: Server hostname or IP address (required)
port: SSH port (default: 22)
username: SSH username (required)
privateKeyPath: Path to SSH private key (supports ~ expansion)
password: SSH password (if not using key auth)
Example: add_connection("staging", "10.0.0.5", 22, "deploy", "~/.ssh/deploy_key")
Inputs: host (required), name (required), username (required), port, +2 more.
download_fileA
Download a file from a remote server via SFTP.
Parameters:
connection: Name of the connection (from list_connections)
remote_path: Path to the file on the remote server
local_path: Destination path on the local machine
Example usage: download_file("web1", "/var/log/nginx/error.log", "/tmp/error.log")
Inputs: connection (required), local_path (required), remote_path (required).
get_configARead-only
Show the current SSH MCP configuration.
Returns the config file contents with sensitive values (tokens, passwords) redacted. Shows BinaryLane auto-discovery settings and all manual connections.
Inputs: no named parameters.
list_connectionsARead-only
List all configured SSH connections.
Returns the name, host, port, and username for each connection. Connections are configured via the SSH_CONNECTIONS environment variable.
Example usage: Before running commands, list connections to see what's available.
Inputs: no named parameters.
list_remote_directoryBRead-only
List contents of a directory on a remote server.
Parameters:
connection: Name of the connection (from list_connections)
path: Absolute path to the directory on the remote server
Example usage: list_remote_directory("web1", "/var/log")
Returns a list of files/directories with name, type, size, and modification time.
Inputs: path (required), connection (required).
read_remote_fileARead-only
Read the contents of a file on a remote server.
Parameters:
connection: Name of the connection (from list_connections)
path: Absolute path to the file on the remote server
Example usage: read_remote_file("web1", "/etc/nginx/nginx.conf")
Returns the file contents as text.
Inputs: path (required), connection (required).
refresh_connectionsARead-only
Re-discover BinaryLane servers and reload all connections.
Refreshes the connection list by:
Re-reading the config file
Re-discovering BinaryLane servers (if enabled)
Re-reading SSH_CONNECTIONS env var
Merging all sources (config > env > auto-discovered)
Use after creating/deleting BinaryLane servers to update the connection list.
Inputs: no named parameters.
remove_connectionADestructive
Remove a manual SSH connection from the config file.
Only removes connections added via add_connection (source: config). Auto-discovered BinaryLane connections cannot be removed this way.
Parameters:
name: Name of the connection to remove
Inputs: name (required).
run_commandADestructive
Execute a command on a remote server via SSH.
Runs a shell command and returns stdout, stderr, and exit code.
Parameters:
connection: Name of the connection (from list_connections)
command: The shell command to execute
timeout: Command timeout in milliseconds (default: 30000)
Example usage: run_command("web1", "uptime") Example usage: run_command("db1", "systemctl status mysql", 60000)
Returns:
stdout: Command standard output
stderr: Command standard error
code: Exit code (0 = success)
Inputs: command (required), connection (required), timeout.
test_connectionARead-only
Test connectivity to an SSH server.
Attempts to establish an SSH connection and reports success/failure with latency.
Parameters:
connection: Name of the connection to test (from list_connections)
Example usage: Verify a server is reachable before running commands.
Inputs: connection (required).
upload_fileBDestructive
Upload a local file to a remote server via SFTP.
Parameters:
connection: Name of the connection (from list_connections)
local_path: Path to the local file
remote_path: Destination path on the remote server
Example usage: upload_file("web1", "/tmp/config.txt", "/etc/myapp/config.txt")
Inputs: connection (required), local_path (required), remote_path (required).
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 purpose: connection listing/testing/management, command execution, configuration inspection, and remote file operations. The only mild overlap is among list_connections, get_config, and refresh_connections, but their descriptions clearly separate listing, config inspection, and re-discovery.
All tool names use a consistent snake_case verb_noun pattern, such as list_connections, run_command, read_remote_file, and upload_file. There are no mixed conventions or vague standalone verbs.
Eleven tools is well within a reasonable range for an SSH management server and each tool maps to a distinct operational need. The set is neither bloated nor too thin for the domain.
The surface covers connection management, command execution, and core file operations including read, list, upload, and download. Minor gaps exist for direct remote file deletion, directory creation, or renaming, though run_command can serve as a workaround.
Maintenance
Related MCP Connectors
- browser-sshDeprecatedcom.browserssh
Scoped, audited SSH exec, sessions, and SFTP on your saved servers without exposing credentials
Manage remote servers, SSH terminals, files, databases and proxies with scoped access and approvals.
Manage servers through SSH.
SSH client, server management and one remote MCP URL for your machines, with human approvals.
Related MCP Servers
- AlicenseBqualityNot gradedmaintenanceEnables SSH operations including connecting to remote servers, executing commands, and transferring files between local and remote systems. Supports multiple SSH connections with both password and private key authentication methods.18MIT
- AlicenseBqualityDmaintenanceEnables seamless SSH operations including secure connections, file transfers, interactive shell sessions, and Docker container management on remote servers. Supports both password and SSH key authentication with credential management and connection pooling.18MIT
- AlicenseAqualityDmaintenanceEnables secure SSH connections to multiple remote servers with support for command execution, file transfers (SFTP), directory listing, and both password and key-based authentication.7MIT
- AlicenseAqualityDmaintenanceEnables remote server management through SSH and SFTP, supporting command execution, file transfers, and interactive shell sessions. It allows for multiple concurrent connections using either password or SSH key authentication.1127 npm5MIT