A Model Context Protocol (MCP) server for automated VPS initialization and management. This tool provides SSH-based automation for setting up fresh VPS instances with common services and CI/CD pipelines.
- 🔐 SSH Authentication: Supports both password and private key authentication
- 🛠️ VPS Initialization: Automated setup of Node.js, PM2, Rust, Nginx, Redis
- 🌐 Nginx Configuration: Domain setup with reverse proxy and SSL certificates
- 🚀 GitHub CI/CD: Automated deploy key generation and workflow creation
- 📝 Comprehensive Logging: Winston-based structured logging
- 🔧 TypeScript: Fully typed with strict TypeScript configuration
# Clone the repository
git clone <repository-url>
cd mcp-vps-initialize
# Install dependencies
npm install
# Build the project
npm run build
# Start the server
npm start# Run in development mode
npm run dev
# Lint code
npm run lint
npm run lint:fix
# Format code
npm run format
npm run format:checkConnect to a VPS via SSH using password or private key authentication.
Parameters:
host(required): VPS IP address or hostnameusername(required): SSH usernameport(optional): SSH port (default: 22)password(optional): SSH passwordprivateKeyPath(optional): Path to private key filepassphrase(optional): Private key passphrase
Example:
{
"host": "192.168.1.100",
"username": "root",
"password": "your-password"
}Initialize a fresh VPS with system updates and optional services.
Parameters:
services(optional): Object specifying which services to installnodejs(boolean): Install Node.js LTSpm2(boolean): Install PM2 process managerrust(boolean): Install Rust toolchainnginx(boolean): Install and configure Nginxredis(boolean): Install and configure Redis
Example:
{
"services": {
"nodejs": true,
"pm2": true,
"nginx": true,
"redis": false
}
}Configure Nginx with domain, reverse proxy, and SSL certificates.
Parameters:
domain(required): Domain name for the siteport(required): Backend port to proxy requests tossl(optional): Enable SSL with Certbot (default: true)
Example:
{
"domain": "example.com",
"port": 3000,
"ssl": true
}Setup GitHub CI/CD with deploy keys and automated workflows.
Parameters:
repoUrl(required): GitHub repository URLdeployPath(required): Deployment path on the server
Example:
{
"repoUrl": "https://github.com/username/repo.git",
"deployPath": "/opt/deployments/myapp"
}Execute arbitrary commands on the connected VPS.
Parameters:
command(required): Command to execute
Example:
{
"command": "systemctl status nginx"
}-
Connect to VPS:
{ "tool": "ssh_connect", "args": { "host": "your-vps-ip", "username": "root", "password": "your-password" } } -
Initialize VPS:
{ "tool": "vps_initialize", "args": { "services": { "nodejs": true, "pm2": true, "nginx": true } } } -
Setup Nginx:
{ "tool": "nginx_setup", "args": { "domain": "yourdomain.com", "port": 3000, "ssl": true } } -
Setup CI/CD:
{ "tool": "github_cicd_setup", "args": { "repoUrl": "https://github.com/username/repo.git", "deployPath": "/opt/deployments/myapp" } }
After running the github_cicd_setup tool, you'll receive:
- Deploy Key: Add to your GitHub repository's Deploy Keys
- GitHub Secrets: Add to your repository's Actions secrets
- Workflow File: Add to
.github/workflows/deploy.yml
The generated workflow will:
- Trigger on pushes to main/master branch
- Run tests (if available)
- Build the application (if build script exists)
- Deploy to your VPS automatically
- Firewall Configuration: Automatic UFW setup with secure defaults
- SSL Certificates: Automated Let's Encrypt certificate generation
- SSH Key Management: Secure deploy key generation
- Process Isolation: Optional deploy user creation
Logs are written to:
logs/combined.log: All log levelslogs/error.log: Error logs only- Console: Formatted output with colors
Log levels: error, warn, info, debug
The server can be configured through environment variables:
LOG_LEVEL: Set logging level (default: 'info')PORT: Server port (if running standalone)
-
SSH Connection Failed
- Verify IP address and credentials
- Check firewall settings
- Ensure SSH service is running
-
SSL Certificate Issues
- Verify domain DNS points to server
- Check firewall allows HTTP/HTTPS
- Ensure email is valid for Let's Encrypt
-
Service Installation Failed
- Check system update status
- Verify internet connectivity
- Review error logs
Enable debug logging:
LOG_LEVEL=debug npm start- Node.js 18+
- Fresh Ubuntu/Debian VPS
- Domain name (for SSL setup)
- GitHub repository (for CI/CD)
MIT License - see LICENSE file for details.