A powerful Model Context Protocol (MCP) server that enables Claude Code to manage multiple SSH connections seamlessly. Control remote servers, execute commands, and transfer files directly from Claude Code.
- π Multiple SSH Connections - Manage unlimited SSH servers from a single interface
- π Secure Authentication - Support for both password and SSH key authentication
- π 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
.env
file setup with guided configuration tool
- π 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
- Node.js (v18 or higher)
- Python 3.8+
- Claude Code CLI installed
- npm (comes with Node.js)
# 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
# Add servers using CLI
ssh-manager server add
# Test connection
ssh-manager server test production
# Quick SSH connection
ssh-manager ssh production
# Clone the repository
git clone https://github.com/bvisible/mcp-ssh-manager.git
cd mcp-ssh-manager
# Install dependencies
npm install
pip install -r tools/requirements.txt
# Configure servers
python tools/server_manager.py
Choose option 2 to add a server. You'll be prompted for:
- Server name (e.g.,
production
,staging
) - Host/IP address
- Username
- Port (default: 22)
- Authentication method (password or SSH key)
# 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.js
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)
Lists all configured SSH servers with their details.
Execute commands on remote servers.
- Parameters:
server
(name),command
,cwd
(optional working directory) - Note: If no
cwd
is 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
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-profile
with profile name - Default: Uses
default
profile 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]_PORT=22 # Optional, defaults to 22
SSH_SERVER_[NAME]_DEFAULT_DIR=/path/to/dir # Optional, default working directory
SSH_SERVER_[NAME]_DESCRIPTION=Description # Optional
# Example
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
The 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 implementation
βββ tools/
β βββ server_manager.py # Interactive server management
β βββ test-connection.py # Connection testing utility
β βββ requirements.txt # Python dependencies
βββ examples/
β βββ .env.example # Example configuration
β βββ claude-code-config.example.json
βββ package.json # Node.js dependencies
βββ .env # Your server configurations (create from .env.example)
βββ README.md # This file
python tools/test-connection.py production
claude mcp list
/mcp
- Never commit
.env
files - Always use.env.example
as template - Use SSH keys when possible - More secure than passwords
- Limit server access - Use minimal required permissions
- Rotate credentials - Update passwords and keys regularly
- DEPLOYMENT_GUIDE.md - Deployment strategies and permission handling
- ALIASES_AND_HOOKS.md - Command aliases and automation hooks
- Real-world examples and best practices
- Ensure MCP is installed:
claude mcp list
- Restart Claude Code after installation
- Check server logs for errors
- Test connection:
python tools/test-connection.py [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
Once installed in Claude Code, you'll have access to these powerful tools:
ssh_execute
- Execute commands on remote serversssh_upload
- Upload files to remote serversssh_download
- Download files from remote serversssh_list_servers
- List all configured SSH servers
ssh_sync
- Bidirectional file synchronization with rsyncssh_tail
- Real-time log monitoring with follow modessh_monitor
- System metrics monitoring (CPU, RAM, disk, network)ssh_history
- View command execution history
ssh_session_start
- Start persistent SSH sessionssh_session_send
- Send commands to active sessionssh_session_list
- List active sessionsssh_session_close
- Close specific session
ssh_execute_group
- Execute commands on server groupsssh_group_manage
- Manage server groups (create, update, delete)
ssh_tunnel_create
- Create SSH tunnels (local, remote, SOCKS)ssh_tunnel_list
- List active tunnels with statisticsssh_tunnel_close
- Close specific or all tunnels
ssh_deploy
- Smart deployment with permission handlingssh_execute_sudo
- Execute commands with sudo privilegesssh_alias
- Manage server aliases
# 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 Claude:
- "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"
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
For issues, questions, or suggestions:
- Open an issue on GitHub Issues
- Check existing issues before creating new ones
Made with β€οΈ for the Claude Code community