MCP SSH Manager
Enables Claude to manage multiple SSH connections, execute remote commands, and transfer files across servers. Supports secure authentication, default directories, sudo operations, and deployment automation with profiles for different project types.
README
MCP SSH Manager 🚀
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.
🌟 Features
- 🔗 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
.envfile setup with guided configuration tool - 🔧 Connection Testing - Built-in tools to verify server connectivity
- 🚀 Smart Deployment - NEW! Automated file deployment with permission handling
- 🔑 Sudo Support - NEW! Execute commands with sudo privileges securely
- 🏷️ Server Aliases - NEW! Use short aliases instead of full server names
📋 Prerequisites
- Node.js (v16 or higher)
- Python 3.8+
- Claude Code CLI installed
- npm (comes with Node.js)
🚀 Quick Start
1. Clone the Repository
git clone https://github.com/yourusername/mcp-ssh-manager.git
cd mcp-ssh-manager
2. Install Dependencies
npm install
pip install -r tools/requirements.txt
3. Configure Your Servers
Run the interactive configuration tool:
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)
4. Install to Claude Code
# 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
5. Start Using!
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)
🛠️ Available MCP Tools
Core Tools
ssh_list_servers
Lists all configured SSH servers with their details.
ssh_execute
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
ssh_upload
Upload files to remote servers.
- Parameters:
server,local_path,remote_path
ssh_download
Download files from remote servers.
- Parameters:
server,remote_path,local_path
Advanced Tools (v1.2+)
ssh_deploy 🚀
Deploy files with automatic permission and backup handling.
- Parameters:
server,files(array),options(owner, permissions, backup, restart) - Automatically handles permission issues and creates backups
ssh_execute_sudo 🔐
Execute commands with sudo privileges.
- Parameters:
server,command,password(optional),cwd(optional) - Securely handles sudo password without exposing in logs
ssh_alias 🏷️
Manage server aliases for easier access.
- Parameters:
action(add/remove/list),alias,server - Example: Create alias "prod" for "production" server
ssh_command_alias 📝
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
ssh_hooks 🎣
Manage automation hooks for SSH operations.
- Parameters:
action(list/enable/disable/status),hook - Hooks loaded from active profile
- Example: Project-specific validation and automation
ssh_profile 📚
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
🔧 Configuration
Profiles
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
Environment Variables
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
Server Management Tool
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
📁 Project Structure
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
🧪 Testing
Test Server Connection
python tools/test-connection.py production
Verify MCP Installation
claude mcp list
Check Server Status in Claude Code
/mcp
🔒 Security Best Practices
- 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
📚 Advanced Usage
Documentation
- DEPLOYMENT_GUIDE.md - Deployment strategies and permission handling
- ALIASES_AND_HOOKS.md - Command aliases and automation hooks
- Real-world examples and best practices
🐛 Troubleshooting
MCP Tools Not Available
- Ensure MCP is installed:
claude mcp list - Restart Claude Code after installation
- Check server logs for errors
Connection Failed
- Test connection:
python tools/test-connection.py [server_name] - Verify network connectivity
- Check firewall rules
- Ensure SSH service is running on remote server
Permission Denied
- Verify username and password/key
- Check SSH key permissions:
chmod 600 ~/.ssh/your_key - Ensure user has necessary permissions on remote server
🤝 Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
Development Setup
- 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
Code Quality
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
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Built for Claude Code
- Uses the Model Context Protocol
- SSH handling via node-ssh
- Server management with Paramiko
📧 Support
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
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。