Model Context Protocol (MCP) server for managing aaPanel/BT Panel servers through AI assistants.
- 🐳 Docker Management - Start, stop, restart, and monitor containers
- 📦 PM2 Management - Manage Node.js applications
- 🔒 SSL Certificate Management - List, check status, and renew certificates
- 💾 Database Management - Create databases, list databases, setup Drupal
- 📊 System Monitoring - Resource usage, system info, service status
- 🔧 Service Management - Unified control for all services
- 🌐 Website Management - List and manage websites
- Python 3.7+
- aaPanel or BT Panel installed
- Docker (optional, for container management)
- PM2 (optional, for Node.js app management)
# Clone or download this package
cd mcp-aapanel
# Run installer
chmod +x install.sh
./install.sh# 1. Install Python dependencies
pip3 install requests
# 2. Create config directory
mkdir -p ~/.aapanel
# 3. Configure API access
cat > ~/.aapanel/config.json <<EOF
{
"url": "http://localhost:7800",
"api_key": "YOUR_AAPANEL_API_KEY"
}
EOF
# 4. Get API key from aaPanel
# Settings → API → Generate/Copy API Key
# 5. Make server executable
chmod +x aapanel-mcp-server.py- Log into aaPanel web interface
- Go to Settings → API
- Generate or copy your API key
- Add it to
~/.aapanel/config.json
Instead of config file, you can use environment variables:
export AAPANEL_URL="http://localhost:7800"
export AAPANEL_API_KEY="your_api_key_here"Add to your MCP configuration (usually ~/.cursor/mcp.json or similar):
{
"mcpServers": {
"aapanel": {
"command": "python3",
"args": ["/path/to/mcp-aapanel/aapanel-mcp-server.py"],
"env": {
"AAPANEL_URL": "http://localhost:7800",
"AAPANEL_API_KEY": "your_api_key"
}
}
}
}# Test the server
echo '{"method": "aapanel/get_system_info"}' | python3 aapanel-mcp-server.py
# Get resource usage
echo '{"method": "aapanel/get_resource_usage"}' | python3 aapanel-mcp-server.py
# List Docker containers
echo '{"method": "aapanel/get_docker_status"}' | python3 aapanel-mcp-server.pyaapanel/get_system_info- Get system information (memory, disk, uptime)aapanel/get_resource_usage- Get current resource usage (CPU, memory, disk, Docker)aapanel/get_dashboard- Get comprehensive dashboard information
aapanel/get_docker_status- Get Docker container statusaapanel/stop_container- Stop a Docker containeraapanel/start_container- Start a Docker containeraapanel/restart_container- Restart a Docker container
aapanel/get_pm2_status- Get PM2 application statusaapanel/pm2_start- Start PM2 applicationaapanel/pm2_stop- Stop PM2 applicationaapanel/pm2_restart- Restart PM2 applicationaapanel/pm2_logs- Get PM2 application logs
aapanel/get_ssl_list- Get list of SSL certificatesaapanel/get_ssl_status- Get SSL certificate status for a domainaapanel/renew_ssl- Renew SSL certificate
aapanel/create_database- Create MySQL database and useraapanel/list_databases- List all MySQL databasesaapanel/setup_drupal_database- Complete Drupal database setup
aapanel/get_sites- Get list of websitesaapanel/restart_service- Restart a system serviceaapanel/get_logs- Get logs from a serviceaapanel/get_all_services_status- Get status of all servicesaapanel/service_manager- Unified service manager
{
"method": "aapanel/create_database",
"params": {
"db_name": "my_database",
"db_user": "my_user",
"db_pass": "secure_password"
}
}{
"method": "aapanel/setup_drupal_database"
}This automatically:
- Creates database
drupal_slideindm - Creates user
drupal_user - Configures Drupal's
settings.php - Returns credentials
{
"method": "aapanel/stop_container",
"params": {
"container_name": "my-container"
}
}{
"method": "aapanel/get_pm2_status"
}mcp-aapanel/
├── README.md # This file
├── aapanel-mcp-server.py # Main MCP server
├── install.sh # Installation script
├── config.example.json # Example configuration
├── setup.sh # Setup script
├── LICENSE # License file
└── docs/ # Additional documentation
├── API.md # API reference
├── EXAMPLES.md # Usage examples
└── TROUBLESHOOTING.md # Troubleshooting guide
Make sure you've set the API key in ~/.aapanel/config.json or as an environment variable.
Check that aaPanel is running and accessible at the configured URL.
Make sure the script is executable: chmod +x aapanel-mcp-server.py
Ensure Docker is installed and the user has permissions to run Docker commands.
- Keep your API key secure
- Don't commit
config.jsonto version control - Use environment variables in production
- Restrict API key permissions in aaPanel if possible
See LICENSE file for details.
For issues and questions:
- Check the troubleshooting guide
- Review the API documentation
- Check aaPanel logs:
/www/server/panel/logs/
Contributions welcome! Please ensure:
- Code follows Python PEP 8 style
- All methods are documented
- Error handling is comprehensive
- Tests are included for new features
Version: 1.0.0
Last Updated: November 2025