The Cloud Manage MCP Server is a Model Context Protocol-based server that allows you to manage DigitalOcean cloud servers through their public IP addresses. It provides comprehensive droplet management capabilities including power controls, status monitoring, and enhanced deletion protection.
To install the required dependencies:
pip install -r requirements.txt
Create a .env
file with the following configuration:
# DigitalOcean API Token (Required)
# Get it from: https://cloud.digitalocean.com/account/api/tokens
DIGITALOCEAN_TOKEN=your_digitalocean_api_token_here
# IPInfo API Token (Optional, for IP address lookups)
# Get it from: https://ipinfo.io/account/token
IPINFO_API_TOKEN=your_ipinfo_api_token_here
# Deletion Control (strongly recommended to keep disabled)
# ALLOW_DROPLET_DELETION=false # Default value
Launch the server with:
python main.py
Here's how to perform common droplet management tasks:
# List all droplets
result = list_droplets()
print(f"Total droplets: {result['total_droplets']}")
# Find droplets by name (supports partial matching)
result = find_droplet_by_name("web-server")
if result['found']:
droplet = result['droplets'][0]
droplet_id = droplet['id']
# Get detailed status
status = get_droplet_status(droplet_id)
print(f"Droplet status: {status['status']}")
Control the power state of your droplets:
# Power on a droplet
power_on_result = power_on_droplet(droplet_id)
# Graceful shutdown
shutdown_result = shutdown_droplet(droplet_id)
# Force power off (like unplugging)
power_off_result = power_off_droplet(droplet_id)
# Reboot a droplet
reboot_result = reboot_droplet(droplet_id)
# Check operation status
action_id = reboot_result['action']['id']
action_status = get_action_status(action_id)
print(f"Reboot operation status: {action_status['action']['status']}")
Access performance metrics and action history:
# Get monitoring data
monitoring_result = get_droplet_monitoring(droplet_id)
if monitoring_result['monitoring_enabled']:
metrics = monitoring_result['metrics']
for metric_type, data in metrics.items():
if data['available']:
print(f"{metric_type} monitoring data available")
else:
print(f"No data available for {metric_type}")
else:
print("Please enable monitoring in the DigitalOcean control panel")
# Get operation history
action_history = get_droplet_actions(droplet_id)
The system includes a comprehensive five-layer deletion protection mechanism:
# Check deletion policy
policy = get_droplet_deletion_policy()
print(f"Deletion feature status: {policy['deletion_policy']['current_status']}")
# Check deletion safety for a specific droplet
safety_check = check_droplet_deletion_safety(droplet_id)
print(f"Safety level: {safety_check['safety_level']}")
# View safety check details
for check in safety_check['safety_checks']:
print(f"{check['check']}: {check['status']} - {check['message']}")
Find droplet information using a public IP address:
# Get droplet info from IP address
droplet_info = get_dg_info("203.0.113.10")
if 'error' not in droplet_info:
print(f"Found droplet: {droplet_info['name']}")
The server implements a strict five-layer deletion protection system:
The system automatically protects droplets with these tags:
production
/ prod
important
critical
backup
# To enable deletion (strongly not recommended):
export ALLOW_DROPLET_DELETION=true
{
"cloud_provider": "digitalocean",
"droplet_id": 123456789,
"status": "active",
"name": "web-server-01",
"locked": false,
"size_slug": "s-1vcpu-1gb",
"memory": 1024,
"vcpus": 1,
"disk": 25,
"region": {
"name": "New York 3",
"slug": "nyc3"
},
"image": {
"name": "Ubuntu 20.04 x64",
"distribution": "Ubuntu"
},
"created_at": "2024-01-01T10:00:00Z",
"features": ["monitoring", "ipv6"],
"tags": ["web", "production"]
}
{
"cloud_provider": "digitalocean",
"droplet_id": 123456789,
"action": {
"id": 987654321,
"status": "in-progress",
"type": "reboot",
"started_at": "2024-01-01T12:00:00Z",
"completed_at": null,
"resource_id": 123456789,
"resource_type": "droplet",
"region": "New York 3"
},
"message": "Successfully submitted reboot operation, Action ID: 987654321"
}
Safe Operations:
check_droplet_deletion_safety()
Batch Operations: Use list_droplets()
to get all droplets, then filter and operate as needed
Status Checking: Always check a droplet's current status before performing power operations
Operation Tracking: Save operation IDs for subsequent status queries
Error Handling: Always check for the error
field in return results
Monitoring: Enable monitoring when creating droplets to get usage data later
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.