A Model Context Protocol (MCP) server that enables Claude Code and OpenAI Codex to manage multiple SSH connections. Execute commands, transfer files, manage databases, create backups, monitor health, and automate DevOps tasks across your servers β directly from your AI assistant.
Per-server security modes β readonly / restricted + audit log (Released: May 18, 2026)
A second authorization layer that filters tool invocations inside the MCP server, complementing the existing client-side autoApprove. Useful when sharing the MCP with a third-party agent, a CI bot, or any client where ssh_execute shouldn't be unconditionally trusted.
- π Three modes, opt-in per server (no
MODEfield = identical to v3.4.x):unrestricted(default) β strict no-op.evaluatePolicy()early-returns on the first line, zero overhead.readonlyβ blocks mutating tools (ssh_upload,ssh_deploy,ssh_sync,ssh_execute_sudo,ssh_backup_*,ssh_db_import/dump, plus action-gatedssh_key_manage accept|remove,ssh_alert_setup set,ssh_process_manager kill) AND applies a built-in denylist onssh_execute(rm, mv, dd, mkfs, chmod, chown, sudo, systemctl restart/stop, docker rm/stop, pipe-to-sh, redirect outside/tmp, curl|sh, etc.).restrictedβ every command must match at least oneALLOW_PATTERNSregex AND noDENY_PATTERNSregex. DENY wins. With noALLOW_PATTERNSeverything is refused (fail-closed).
- π Audit log β opt-in JSONL per server (
SSH_SERVER_<N>_AUDIT_LOG=/path/to/audit.jsonl). Recordsts,server,tool, args,allowed,reasonon denial,exitCode/successon execution. Sensitive arg fields (password,passphrase,sudoPassword,token,secret,apikey) are replaced with***. - πͺ Command aliases expanded BEFORE policy evaluation β a
DENYpattern can't be bypassed via an alias. - β»οΈ Backward-compatible by design β a v3.4.x
.envor TOML loads identically. NoMODEfield β zero behavior change. The interactive wizard (ssh-manager server add) defaults all three new prompts to skip. All 13 pre-existing tests pass unmodified. Newtests/test-policy.jsadds 26 tests covering modes, DENY > ALLOW precedence, invalid-regex handling, redaction, and the backward-compat fast path.
Full reference β Β· Read full changelog β
- π Expanded SSH algorithm list β handshake against OpenSSH 9.x out of the box (#32)
- KEX:
curve25519-sha256(+@libssh.org),diffie-hellman-group15-sha512,diffie-hellman-group16-sha512 - Server host key:
rsa-sha2-512,rsa-sha2-256(RFC 8332) - Cipher:
aes128-gcm@openssh.com,aes256-gcm@openssh.com - HMAC:
hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com - Backward-compatible β legacy algorithms preserved at lower preference, older servers (CentOS 7, Debian 10) keep working. Thanks @YoungHong1992.
- KEX:
- πͺ Windows OpenSSH encoding & syntax fixes β UTF-16LE base64 PowerShell payloads (Ansible-style) +
Set-Locationreplacingcd &&(#31, thanks @WenKingSu) - π― Marker-based SSH session sync β UUID v4 protocol boundaries with
ECHO: 0PTY, real$?exit codes, no more "Timeout waiting for shell prompt" on custom/slow/AIX shells (#30, thanks @MakksSh)
- π ProxyCommand support for SOCKS5 / custom proxy commands (#24)
- β±οΈ
ssh_executetimeout silently capped at 30 s β fixed (#28, #29) - πͺ Windows global install
/bin/bashshim error β fixed (#22, #23) - π§
server addblocked by missingrsyncβrsyncnow optional (#26) - π‘ Hyphenated server names silently dropped β validation hardened (#25, #27)
- π§ Global install fixed:
.envpath resolution now uses a fallback chain instead of hardcoded__dirnameβ works correctly withnpm install -g(#16, #19)- Fallback chain:
~/.ssh-manager/.envβcwd/.envβ~/.envβ project.env - Auto-creates
~/.ssh-manager/.envon firstssh-manager server add
- Fallback chain:
- π¦
ssh-managerCLI registered as binary:npm install -gnow creates bothmcp-ssh-managerandssh-managercommands (#18) - β‘ Race condition fix: Server config is now fully loaded before the MCP server accepts requests
- π ProxyJump support: Connect to servers behind bastion/jump hosts with a simple
PROXYJUMPconfig field (#15)- Chain multiple jumps (A β B β C) via recursive connections
- Circular dependency detection prevents infinite loops
- All tools work transparently through jump hosts
- π¦ npx support fixed:
npx mcp-ssh-managernow works correctly (#14)
- π SSH Agent support: Automatically uses
ssh-agentwhenSSH_AUTH_SOCKis available β passphrase-protected keys work transparently - π Passphrase configuration: New
passphrasefield for both.envand TOML formats
Thanks to @snjax for the original contribution (#12).
- πͺ Windows SSH host fix: Commands no longer fail on Windows hosts running OpenSSH (#10)
- New per-server
platformconfig field (SSH_SERVER_FOO_PLATFORM=windowsorplatform = "windows"in TOML) - When
platform=windows, the Linuxtimeout/sh -ccommand wrapper is skipped and the SSH library's native timeout is used instead - All tools (
ssh_execute,ssh_tail,ssh_monitor,ssh_deploy,ssh_execute_sudo,ssh_group_execute) are platform-aware
- πͺ Windows support: Fixed crash on Windows where
process.env.HOMEis undefined (#8) - Now uses
os.homedir()for cross-platform compatibility (Linux, macOS, Windows)
- 92% context reduction: Enable only the tools you need (minimal mode: 5 tools vs all 37)
- Tool management CLI:
ssh-manager tools list/configure/enable/disable - 6 tool groups: Core, Sessions, Monitoring, Backup, Database, Advanced
- Auto-approval export: Generate Claude Code auto-approval configs
This release adds 12 new MCP tools transforming SSH Manager into a comprehensive DevOps automation platform:
- Automated backups for MySQL, PostgreSQL, MongoDB, and file systems
- Smart scheduling with cron integration and retention policies
- One-click restore with cross-database support
- Metadata tracking for audit and compliance
- Real-time health checks with CPU, RAM, Disk, and Network metrics
- Service monitoring for nginx, mysql, docker, and custom services
- Process management with CPU/RAM sorting and kill capabilities
- Alert thresholds with configurable notifications
- Safe database dumps with compression and selective exports
- Database imports with automatic decompression
- Schema exploration listing databases, tables, and collections
- Secure queries with SQL injection prevention (SELECT-only)
π Total: 37 MCP Tools | π§ ~4,100 Lines of Code Added | β Production Ready
- Features
- Tool Management
- Prerequisites
- Quick Start - Claude Code
- Quick Start - OpenAI Codex
- Available MCP Tools
- Configuration
- Usage Examples
- Security
- Troubleshooting
- Known Limitations
- Contributing
- License
- π Multiple SSH Connections - Manage unlimited SSH servers from a single interface
- π Secure Authentication - Support for password, SSH key, and ssh-agent authentication (including passphrase-protected keys)
- π ProxyJump / Bastion Host - Connect to servers behind jump hosts with chained multi-hop support
- π ProxyCommand / Custom Proxy - Connect through SOCKS5 proxies or custom proxy commands (ncat, ssh -W, etc.)
- π File Operations - Upload and download files between local and remote systems
- β‘ Command Execution - Run commands on remote servers with working directory support
- π Default Directories - Set default working directories per server for convenience
- π― Easy Configuration - Simple
.envfile setup with guided configuration tool
- πΎ Backup & Restore - Automated backups for MySQL, PostgreSQL, MongoDB, and files
- π₯ Health Monitoring - Real-time server health checks (CPU, RAM, Disk, Services)
- ποΈ Database Management - Safe database operations with SQL injection prevention
- π Process Management - Monitor and control server processes
β οΈ Smart Alerts - Configurable health thresholds and notifications
- π Bash CLI - Lightning-fast pure Bash CLI for server management
- π Advanced Logging - Comprehensive logging system with levels and history
- π Rsync Integration - Bidirectional file sync with rsync support
- π» Persistent Sessions - Maintain shell context across multiple commands
- π₯ Server Groups - Execute commands on multiple servers simultaneously
- π§ SSH Tunnels - Local/remote port forwarding and SOCKS proxy support
- π System Monitoring - Real-time monitoring of CPU, memory, disk, and network
- π·οΈ Server Aliases - Use short aliases instead of full server names
- π Smart Deployment - Automated file deployment with permission handling
- π Sudo Support - Execute commands with sudo privileges securely
- π OpenAI Codex Support - Compatible with OpenAI Codex via TOML configuration
NEW in v3.1: Reduce Claude Code context usage by 92% with tool activation management!
MCP SSH Manager includes 37 tools organized into 6 groups. By default, all tools are enabled, but you can optimize for your specific workflow:
# Interactive configuration wizard
ssh-manager tools configure
# View current configuration
ssh-manager tools list
# Enable/disable specific groups
ssh-manager tools enable monitoring
ssh-manager tools disable backup| Mode | Tools | Context Usage | Best For |
|---|---|---|---|
| All (default) | 37 tools | ~43.5k tokens | Full feature set, most users |
| Minimal | 5 tools | ~3.5k tokens | Basic SSH operations only |
| Custom | 5-37 tools | Varies | Tailored to your workflow |
- Core (5 tools) - Always enabled: list, execute, upload, download, sync
- Sessions (4 tools) - Persistent SSH sessions
- Monitoring (6 tools) - Health checks, service status, process management
- Backup (4 tools) - Database and file backups
- Database (4 tools) - MySQL, PostgreSQL, MongoDB operations
- Advanced (14 tools) - Deployment, sudo, tunnels, groups, aliases, etc.
- 92% context reduction in minimal mode (~40k tokens saved)
- Fewer approval prompts in Claude Code
- Faster loading and cleaner interface
- Auto-approval configuration export for Claude Code
π Complete Tool Management Guide β
- Node.js (v18 or higher)
- npm (comes with Node.js)
- Platforms: Linux, macOS, Windows
- For Claude Code: Claude Code CLI installed
- For OpenAI Codex: Codex CLI configured
- Bash 4.0+ (for CLI management tools)
- rsync (for file synchronization)
- sshpass (optional, for rsync with password authentication)
- macOS:
brew install hudochenkov/sshpass/sshpass - Linux:
apt-get install sshpass
- macOS:
Option A: Install from npm (recommended)
# Install globally from npm
npm install -g mcp-ssh-manager
# Or install locally
npx mcp-ssh-managerOption B: Install from source
# Clone and install
git clone https://github.com/bvisible/mcp-ssh-manager.git
cd mcp-ssh-manager
npm install
# Install the Bash CLI
cd cli && ./install.sh
# Configure your first server
ssh-manager server add# For personal use (current user only)
claude mcp add ssh-manager node /path/to/mcp-ssh-manager/src/index.js
# For team sharing (creates .mcp.json in project)
claude mcp add ssh-manager --scope project node /path/to/mcp-ssh-manager/src/index.js
# For all your projects
claude mcp add ssh-manager --scope user node /path/to/mcp-ssh-manager/src/index.jsTo avoid being prompted for approval on every SSH command, add auto-approve configuration:
Edit ~/.config/claude-code/claude_code_config.json:
{
"mcpServers": {
"ssh-manager": {
"command": "node",
"args": ["/path/to/mcp-ssh-manager/src/index.js"],
"autoApprove": [
"mcp__ssh-manager__ssh_execute",
"mcp__ssh-manager__ssh_list_servers",
"mcp__ssh-manager__ssh_upload",
"mcp__ssh-manager__ssh_download",
"mcp__ssh-manager__ssh_sync",
"mcp__ssh-manager__ssh_alias"
]
}
}
}Important: Restart Claude Code after making this change.
For full auto-approval of all SSH tools, see the complete list in examples/claude-code-config.example.json.
autoApprove is all-or-nothing per tool: once ssh_execute is approved, anything goes. If you want a second layer that filters what the MCP server actually accepts to run β useful when sharing the MCP with a third-party agent, a CI bot, or a client's server β declare a per-server security mode.
# In your .env β three optional fields. Omit them all to keep v3.4.x behavior exactly.
SSH_SERVER_CLIENT_PROD_HOST=client-prod.example.com
SSH_SERVER_CLIENT_PROD_USER=consultant
SSH_SERVER_CLIENT_PROD_KEYPATH=~/.ssh/consultant_ed25519
SSH_SERVER_CLIENT_PROD_MODE=readonly # unrestricted | readonly | restricted
SSH_SERVER_CLIENT_PROD_AUDIT_LOG=~/.ssh-manager/audit.jsonl # opt-in JSONL audit trail
# For mode=restricted, provide an allowlist of regex (DENY wins over ALLOW):
# SSH_SERVER_CI_ALLOW_PATTERNS="^docker (ps|logs);^kubectl get "unrestricted(default, no field needed) β identical to pre-v3.5.0 behavior. Zero overhead.readonlyβ blocksssh_upload,ssh_deploy,ssh_sync,ssh_execute_sudo, backup/db write tools, and built-in destructive commands (rm,mv,sudo,systemctl restart, redirects outside/tmp,curl | sh, β¦).restrictedβ everyssh_executecommand must match at least oneALLOW_PATTERNSregex AND noDENY_PATTERNSregex.
Existing configs are unaffected β no field is mandatory, no behavior changes unless you opt in. See docs/SECURITY_MODES.md for the full reference, recipes, and limitations.
In Claude Code, you can now:
"List all my SSH servers"
"Execute 'ls -la' on production server" # Uses default directory if set
"Run 'docker ps' on staging"
"Upload config.json to production:/etc/app/config.json"
"Download logs from staging:/var/log/app.log"
With Default Directories:
If you set /var/www/html as default for production, these commands are equivalent:
"Run 'ls' on production"β executes in/var/www/html"Run 'ls' on production in /tmp"β executes in/tmp(overrides default)
Same installation as Claude Code (see above), then configure for Codex:
# Set up Codex integration
ssh-manager codex setup
# Migrate existing servers to TOML format (if you have .env servers)
ssh-manager codex migrate
# Test the integration
ssh-manager codex testIf you prefer manual setup, add to ~/.codex/config.toml:
[mcp_servers.ssh-manager]
command = "node"
args = ["/absolute/path/to/mcp-ssh-manager/src/index.js"]
env = { SSH_CONFIG_PATH = "/Users/you/.codex/ssh-config.toml" }
startup_timeout_ms = 20000Create or edit ~/.codex/ssh-config.toml:
[ssh_servers.production]
host = "prod.example.com"
user = "admin"
password = "secure_password" # or use key_path
key_path = "~/.ssh/id_rsa" # for SSH key auth (recommended)
passphrase = "key_passphrase" # optional, for passphrase-protected keys
port = 22
default_dir = "/var/www"
description = "Production server"
[ssh_servers.staging]
host = "staging.example.com"
user = "deploy"
key_path = "~/.ssh/staging_key"
port = 2222
default_dir = "/home/deploy/app"
[ssh_servers.winhost]
host = "192.168.1.90"
user = "svc-ssh"
key_path = "~/.ssh/winhost_key"
port = 2222
platform = "windows"
description = "Windows host via OpenSSH"
[ssh_servers.bastion]
host = "bastion.example.com"
user = "jumpuser"
key_path = "~/.ssh/bastion_key"
[ssh_servers.internal]
host = "10.0.0.5"
user = "admin"
key_path = "~/.ssh/internal_key"
proxy_jump = "bastion"
description = "Private server behind bastion"π‘ See examples/codex-ssh-config.example.toml for more complete examples!
In OpenAI Codex, you can now:
"List my SSH servers"
"Execute 'docker ps' on production"
"Upload file.txt to staging:/tmp/"
"Monitor CPU usage on all servers"
"Download production:/var/log/app.log to ./logs/"
Switch easily between Claude Code (.env) and Codex (TOML):
# Convert .env to TOML (for Codex)
ssh-manager codex convert to-toml
# Convert TOML back to .env (for Claude Code)
ssh-manager codex convert to-envBoth formats can coexist! The system supports both simultaneously.
Lists all configured SSH servers with their details.
Execute commands on remote servers.
- Parameters:
server(name),command,cwd(optional working directory) - Note: If no
cwdis provided, uses the server's default directory if configured
Upload files to remote servers.
- Parameters:
server,local_path,remote_path
Download files from remote servers.
- Parameters:
server,remote_path,local_path
Create backup of database or files on remote server.
- Types: MySQL, PostgreSQL, MongoDB, Files
- Parameters:
server,type,name,database,paths,retention - Automatic compression and metadata tracking
- See Backup Guide for detailed usage
List all available backups on remote server.
- Parameters:
server,type(optional filter) - Returns backup details with size, date, and retention info
Restore from a previous backup.
- Parameters:
server,backupId,database,targetPath - Supports cross-database restoration
Schedule automatic backups using cron.
- Parameters:
server,schedule(cron format),type,name - Automatic cleanup based on retention policy
Perform comprehensive health check on remote server.
- Checks: CPU, Memory, Disk, Network, Uptime, Load average
- Returns overall health status (healthy/warning/critical)
- Optional detailed mode for extended metrics
Check status of services (nginx, mysql, docker, etc.).
- Parameters:
server,services(array) - Returns running/stopped status for each service
- Works with both systemd and sysv init systems
List, monitor, or kill processes on remote server.
- Actions: list (top processes), kill (terminate), info (details)
- Sort by CPU or memory usage
- Filter processes by name
Configure health monitoring alerts and thresholds.
- Actions: set (configure), get (view), check (test thresholds)
- Configurable CPU, memory, and disk thresholds
- Automatic alert triggering when thresholds exceeded
Create database dump/backup on remote server.
- Supports: MySQL, PostgreSQL, MongoDB
- Parameters:
server,type,database,outputFile,dbUser,dbPassword,dbHost,dbPort - Optional:
compress(gzip),tables(specific tables only) - Returns dump size and location
Import SQL dump or restore database on remote server.
- Supports: MySQL, PostgreSQL, MongoDB
- Parameters:
server,type,database,inputFile,dbUser,dbPassword,dbHost,dbPort - Handles compressed (.gz) files automatically
- Optional:
drop(drop database before restore for MongoDB)
List databases or tables on remote server.
- Parameters:
server,type,database(optional),dbUser,dbPassword,dbHost,dbPort - Without database: lists all databases (filters system DBs)
- With database: lists all tables/collections
- Returns structured list with count
Execute read-only SQL queries on remote database.
- Parameters:
server,type,database,query,dbUser,dbPassword,dbHost,dbPort - Security: Only SELECT queries allowed for safety
- MongoDB: Use
collectionparameter for find queries - Returns query results with row count
Deploy files with automatic permission and backup handling.
- Parameters:
server,files(array),options(owner, permissions, backup, restart) - Automatically handles permission issues and creates backups
Execute commands with sudo privileges.
- Parameters:
server,command,password(optional),cwd(optional) - Securely handles sudo password without exposing in logs
Manage server aliases for easier access.
- Parameters:
action(add/remove/list),alias,server - Example: Create alias "prod" for "production" server
Manage command aliases for frequently used commands.
- Parameters:
action(add/remove/list/suggest),alias,command - Aliases loaded from active profile
- Example: Custom aliases for your project
Manage automation hooks for SSH operations.
- Parameters:
action(list/enable/disable/status),hook - Hooks loaded from active profile
- Example: Project-specific validation and automation
Manage configuration profiles for different project types.
- Parameters:
action(list/switch/current),profile - Available profiles: default, frappe, docker, nodejs
- Example: Switch between different project configurations
SSH Manager uses profiles to configure aliases and hooks for different project types:
-
Set active profile:
- Environment variable:
export SSH_MANAGER_PROFILE=frappe - Configuration file: Create
.ssh-manager-profilewith profile name - Default: Uses
defaultprofile if not specified
- Environment variable:
-
Available profiles:
default- Basic SSH operationsfrappe- Frappe/ERPNext specificdocker- Docker container managementnodejs- Node.js applications- Create custom profiles in
profiles/directory
Servers are configured in the .env file with this pattern:
# Server configuration pattern
SSH_SERVER_[NAME]_HOST=hostname_or_ip
SSH_SERVER_[NAME]_USER=username
SSH_SERVER_[NAME]_PASSWORD=password # For password auth
SSH_SERVER_[NAME]_KEYPATH=~/.ssh/key # For SSH key auth
SSH_SERVER_[NAME]_PASSPHRASE=key_passphrase # Optional, for passphrase-protected keys
SSH_SERVER_[NAME]_PORT=22 # Optional, defaults to 22
SSH_SERVER_[NAME]_DEFAULT_DIR=/path/to/dir # Optional, default working directory
SSH_SERVER_[NAME]_DESCRIPTION=Description # Optional
SSH_SERVER_[NAME]_PLATFORM=windows # Optional: "linux" (default) or "windows"
SSH_SERVER_[NAME]_PROXYJUMP=bastion # Optional: name of another server to use as jump host
SSH_SERVER_[NAME]_PROXYCOMMAND=command # Optional: custom proxy command (ncat, ssh -W, etc.)
# Example: Linux server
SSH_SERVER_PRODUCTION_HOST=prod.example.com
SSH_SERVER_PRODUCTION_USER=admin
SSH_SERVER_PRODUCTION_PASSWORD=secure_password
SSH_SERVER_PRODUCTION_PORT=22
SSH_SERVER_PRODUCTION_DEFAULT_DIR=/var/www/html
SSH_SERVER_PRODUCTION_DESCRIPTION=Production Server
SSH_SERVER_PRODUCTION_SUDO_PASSWORD=secure_sudo_pass # Optional, for automated deployments
# Example: Windows server (OpenSSH for Windows)
SSH_SERVER_WINHOST_HOST=192.168.1.90
SSH_SERVER_WINHOST_USER=svc-ssh
SSH_SERVER_WINHOST_KEYPATH=~/.ssh/winhost_key
SSH_SERVER_WINHOST_PORT=2222
SSH_SERVER_WINHOST_PLATFORM=windows
SSH_SERVER_WINHOST_DESCRIPTION=Windows host via OpenSSH
# Example: Server behind a bastion/jump host
SSH_SERVER_BASTION_HOST=bastion.example.com
SSH_SERVER_BASTION_USER=jumpuser
SSH_SERVER_BASTION_KEYPATH=~/.ssh/bastion_key
SSH_SERVER_INTERNAL_HOST=10.0.0.5
SSH_SERVER_INTERNAL_USER=admin
SSH_SERVER_INTERNAL_KEYPATH=~/.ssh/internal_key
SSH_SERVER_INTERNAL_PROXYJUMP=bastion
SSH_SERVER_INTERNAL_DESCRIPTION=Private server behind bastionThe Python management tool (tools/server_manager.py) provides:
- List servers - View all configured servers
- Add server - Interactive server configuration
- Test connection - Verify server connectivity
- Remove server - Delete server configuration
- Update Claude Code - Configure MCP in Claude Code
- Install dependencies - Setup required packages
mcp-ssh-manager/
βββ src/
β βββ index.js # Main MCP server (37 tools)
β βββ ssh-manager.js # SSH connection handling
β βββ config-loader.js # .env & TOML config loading
β βββ session-manager.js # Persistent SSH sessions
β βββ backup-manager.js # Backup & restore
β βββ health-monitor.js # Health checks & alerts
β βββ database-manager.js # Database operations
β βββ tunnel-manager.js # SSH tunnel management
β βββ server-groups.js # Group operations
β βββ ...
βββ cli/
β βββ ssh-manager # Bash CLI entrypoint
β βββ commands/ # CLI command modules
β βββ lib/ # CLI libraries
βββ profiles/ # Configuration profiles (frappe, docker, nodejs...)
βββ examples/ # Example configs
βββ docs/ # Documentation
βββ package.json
python tools/test-connection.py productionclaude mcp list/mcp
- Never commit
.envfiles - Always use.env.exampleas template - Use SSH keys when possible - More secure than passwords
- Limit server access - Use minimal required permissions
- Rotate credentials - Update passwords and keys regularly
MCP SSH Manager supports passphrase-protected SSH keys in two ways:
Option 1: SSH Agent (recommended)
If your SSH key is loaded into ssh-agent, MCP SSH Manager will use it automatically β no configuration changes needed:
# Add your key to the agent (enter passphrase once)
ssh-add ~/.ssh/your_key
# Verify the key is loaded
ssh-add -lThe server detects the SSH_AUTH_SOCK environment variable and connects to the running agent. This is the same mechanism that regular ssh uses for GUI passphrase prompts.
Option 2: Passphrase in configuration
You can store the passphrase directly in the server config:
.env format:
SSH_SERVER_MYSERVER_KEYPATH=~/.ssh/id_rsa
SSH_SERVER_MYSERVER_PASSPHRASE="your_passphrase"TOML format:
[ssh_servers.myserver]
key_path = "~/.ssh/id_rsa"
passphrase = "your_passphrase"Note: SSH Agent is preferred over storing passphrases in config files for better security.
Connect to servers behind a bastion or jump host. The connection is tunneled through the jump server transparently β all tools (execute, upload, download, sync) work as usual.
# Define the bastion server
SSH_SERVER_BASTION_HOST=bastion.example.com
SSH_SERVER_BASTION_USER=jumpuser
SSH_SERVER_BASTION_KEYPATH=~/.ssh/bastion_key
# Point the target server to the bastion
SSH_SERVER_PRIVATE_HOST=10.0.0.5
SSH_SERVER_PRIVATE_USER=admin
SSH_SERVER_PRIVATE_PROXYJUMP=bastionOr in TOML:
[ssh_servers.bastion]
host = "bastion.example.com"
user = "jumpuser"
key_path = "~/.ssh/bastion_key"
[ssh_servers.private]
host = "10.0.0.5"
user = "admin"
proxy_jump = "bastion"Chained jumps are supported: if bastion itself has a proxy_jump, the chain is followed recursively. Circular references are detected and rejected.
Connect through SOCKS5 proxies or custom proxy commands. The proxy command executes locally and forwards traffic to the remote host.
# SOCKS5 proxy via ncat
SSH_SERVER_SOCKS_HOST=target.example.com
SSH_SERVER_SOCKS_USER=admin
SSH_SERVER_SOCKS_PROXYCOMMAND="ncat --proxy 127.0.0.1:1080 --proxy-type socks5 %h %p"
# Windows SSH proxy command
SSH_SERVER_WINPROXY_HOST=internal.example.com
SSH_SERVER_WINPROXY_USER=admin
SSH_SERVER_WINPROXY_PROXYCOMMAND="C:\Windows\System32\OpenSSH\ssh.exe -W %h:%p user@jump-host"Or in TOML:
[ssh_servers.socks]
host = "target.example.com"
user = "admin"
proxy_command = "ncat --proxy 127.0.0.1:1080 --proxy-type socks5 %h %p"
[ssh_servers.winproxy]
host = "internal.example.com"
user = "admin"
proxy_command = "C:\\Windows\\System32\\OpenSSH\\ssh.exe -W %h:%p user@jump-host"The proxy command must be a valid command that reads from stdin and writes to stdout, accepting %h and %p placeholders for host and port.
- DEPLOYMENT_GUIDE.md - Deployment strategies and permission handling
- ALIASES_AND_HOOKS.md - Command aliases and automation hooks
- Real-world examples and best practices
Symptoms:
- Claude shows "Interrupted: What should Claude do instead?"
- MCP tools execute but Claude stops working
- Commands succeed but Claude freezes
Solution: v3.1.1 includes automatic fixes:
- β Output auto-truncated to prevent context overflow
- β Timeout increased to 2 minutes (default), max 5 minutes
- β Standardized error responses
Performance Tuning (add to .env):
# Reduce output size (default: 10000 characters)
MCP_SSH_MAX_OUTPUT_LENGTH=5000
# Increase timeout for slow commands (default: 120000ms)
MCP_SSH_DEFAULT_TIMEOUT=180000
# Use compact JSON to save tokens (default: false)
MCP_SSH_COMPACT_JSON=trueFor large outputs:
# Instead of: cat huge-log.txt
# Use: tail -n 100 huge-log.txt
# Or: grep ERROR huge-log.txt | tail -n 50See docs/TROUBLESHOOTING.md for complete guide.
- Ensure MCP is installed:
claude mcp list - Restart Claude Code after installation
- Check server logs for errors
- Test connection:
ssh-manager server test [server_name] - Verify network connectivity
- Check firewall rules
- Ensure SSH service is running on remote server
- Verify username and password/key
- Check SSH key permissions:
chmod 600 ~/.ssh/your_key - Ensure user has necessary permissions on remote server
"Backup production MySQL database before deployment"
"List all backups on production server"
"Restore backup from yesterday"
"Schedule daily database backup at 2 AM"
"Backup website files excluding cache and logs"
For detailed backup examples, see examples/backup-workflow.js and docs/BACKUP_GUIDE.md.
# Basic server management
ssh-manager server list
ssh-manager server add
ssh-manager ssh prod1
# File synchronization
ssh-manager sync push prod1 ./app /var/www/
ssh-manager sync pull prod1 /var/log/app.log ./
# SSH tunnels
ssh-manager tunnel create prod1 local 3307:localhost:3306
ssh-manager tunnel list
# Execute commands
ssh-manager exec prod1 "docker ps"Once installed, simply ask your AI assistant:
Claude Code examples:
- "List my SSH servers"
- "Execute 'df -h' on production server"
- "Upload this file to staging:/var/www/"
- "Create an SSH tunnel to access remote MySQL"
- "Monitor CPU usage on all servers"
- "Start a persistent session on prod1"
OpenAI Codex examples:
- "Show my SSH servers"
- "Run df -h on production"
- "Upload file.txt to staging:/tmp/"
- "Check CPU usage on all servers"
Both AI assistants support the same MCP tools! π
We welcome contributions! Please see CONTRIBUTING.md for details.
- Fork the repository
- Clone and install dependencies
- Setup pre-commit hooks for code quality:
./scripts/setup-hooks.sh
- Create your feature branch
- Make your changes (hooks will validate on commit)
- Push to your branch
- Open a Pull Request
This project uses automated quality checks:
- ESLint for JavaScript linting
- Black for Python formatting
- Flake8 for Python linting
- Prettier for code formatting
- Pre-commit hooks for automated validation
- Secret detection to prevent credential leaks
Run validation manually: ./scripts/validate.sh
This project is licensed under the MIT License - see the LICENSE file for details.
- Built for Claude Code
- Uses the Model Context Protocol
- SSH handling via node-ssh
- Server management with Paramiko
- The timeout parameter for SSH commands is advisory only
- Due to SSH2 library limitations, commands may continue running on the server even after timeout
- On Linux/macOS hosts, a system
timeoutwrapper is used for reliable command termination - Windows hosts: Set
PLATFORM=windowsin your server config to skip the Linuxtimeout/sh -cwrapper (which is incompatible with Windows OpenSSH)
- Password authentication requires
sshpassto be installed - SSH key authentication is recommended for better security and reliability
- Large file transfers may take time and appear to hang - be patient
- Connections are pooled and reused for performance
- If a connection becomes stale, it will be automatically reconnected on next use
- Force reconnection by using the
ssh_connection_statustool withreconnectaction
For issues, questions, or suggestions:
- Open an issue on GitHub Issues
- Check existing issues before creating new ones
