The MCP SSH Manager now includes advanced deployment features that solve common deployment challenges:
- ✅ Automatic permission handling
- ✅ Secure sudo execution
- ✅ Server aliases for easier access
- ✅ Batch file deployments
- ✅ Automatic backups before deployment
Deploy files with automatic permission handling and backup.
"Deploy my config file to production server"
"Upload all JavaScript files to staging"
{
"server": "production",
"files": [
{
"local": "/local/path/file.js",
"remote": "/var/www/app/file.js"
}
],
"options": {
"owner": "www-data:www-data",
"permissions": "644",
"backup": true,
"restart": "systemctl restart nginx"
}
}Run commands with sudo privileges securely.
"Run 'apt update' on production with sudo"
"Execute 'systemctl restart nginx' as root on staging"
Create shortcuts for your servers.
"Create alias 'prod' for production server"
"List all server aliases"
"Remove alias 'old-server'"
For the scenario from your conversation, here's the optimized workflow:
# Step 1: Create aliases for easier access
"Create alias 'dmis' for dmis server"
# Step 2: Deploy files using the new tool
"Deploy payment_proposal.py and payment_proposal.js to dmis:/home/neoffice/frappe-bench/apps/erpnextswiss/"
# Step 3: Restart the service
"Run 'bench restart' on dmis"
The deployment tool automatically:
- Uploads to a temp location first
- Moves files to the correct location
- Handles permissions if needed
- Creates backups of existing files
# Deploy with automatic nginx restart
"Deploy index.html to production:/var/www/html with nginx restart"
# This single command:
# 1. Backs up existing index.html
# 2. Uploads new file to temp
# 3. Moves to final location with correct permissions
# 4. Restarts nginx
# Deploy sensitive config with proper permissions
"Deploy nginx.conf to prod:/etc/nginx/ with owner root:root and permissions 644"
Option A: Configure in .env (Recommended)
SSH_SERVER_PRODUCTION_SUDO_PASSWORD=your_passwordOption B: Use key-based sudo (Most Secure) Configure passwordless sudo for specific commands on your server.
The deployment tool automatically:
- Never logs passwords in output
- Masks sensitive information in logs
- Uses secure temp file locations
Always enabled by default:
- Creates timestamped backups before overwriting
- Format:
original_file.bak.YYYYMMDD_HHMMSS
Problem: Can't write to system directories
Solution: Use ssh_deploy with proper options:
{
"options": {
"owner": "www-data:www-data",
"sudoPassword": "configured_in_env"
}
}Problem: "Server 'dmis.neoffice.me' not found"
Solution: Use configured name or create an alias:
"Create alias 'dmis.neoffice.me' for dmis"
Problem: Files uploaded but changes not visible
Solution: Ensure service restart:
{
"options": {
"restart": "bench restart"
}
}# Server with sudo password for deployments
SSH_SERVER_PRODUCTION_HOST=prod.example.com
SSH_SERVER_PRODUCTION_USER=deploy
SSH_SERVER_PRODUCTION_PASSWORD=deploy_password
SSH_SERVER_PRODUCTION_SUDO_PASSWORD=sudo_password
SSH_SERVER_PRODUCTION_DEFAULT_DIR=/var/www/app
# Development server with key auth
SSH_SERVER_DEV_HOST=dev.example.com
SSH_SERVER_DEV_USER=developer
SSH_SERVER_DEV_KEYPATH=~/.ssh/dev_key
SSH_SERVER_DEV_DEFAULT_DIR=/home/developer/appCreate a .server-aliases.json:
{
"prod": "production",
"dev": "development",
"stage": "staging",
"dmis": "dmis_server"
}- Batch Deployments: Deploy multiple files in one command
- Use Aliases: Shorter names = faster typing
- Default Directories: Set default dirs to avoid repetition
- Connection Reuse: Connections are kept alive during session
Based on your real scenario, here's the optimized workflow:
# 1. Setup (one time)
"Create alias 'dmis' for dmis server"
# 2. Deploy both files at once
"Deploy these files to dmis:
- payment_proposal.py to /home/neoffice/frappe-bench/apps/erpnextswiss/erpnextswiss/doctype/payment_proposal/
- payment_proposal.js to same location"
# 3. Restart service
"Run 'cd /home/neoffice/frappe-bench && bench restart' on dmis"This replaces your previous multi-step process:
- ❌ Upload to wrong location
- ❌ Permission errors
- ❌ Manual sudo password entry
- ❌ Copy from /tmp
- ✅ Single command deployment!
For issues or questions:
- Check server logs:
"Execute 'tail -f /var/log/syslog' on server" - Test connection:
python tools/test-connection.py servername - View aliases:
"List server aliases"