Cloud Infrastructure Manager MCP server

Provides unified cloud infrastructure management across AWS, DigitalOcean, Vultr, and Alibaba Cloud for creating virtual machines, configuring security groups, and handling DNS records through provider-specific modules that abstract underlying APIs.
Back to servers
Provider
rainhan99
Release date
May 29, 2025
Stats
1 star

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.

Installation

Dependencies

To install the required dependencies:

pip install -r requirements.txt

Environment Setup

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

Starting the Server

Launch the server with:

python main.py

Usage Guide

Basic Droplet Operations

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']}")

Power Management

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']}")

Monitoring and History

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)

Deletion Protection

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']}")

IP Address Lookup

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']}")

Deletion Protection Features

The server implements a strict five-layer deletion protection system:

Protection Levels

  1. Global switch protection: All deletion operations are disabled by default
  2. Confirmation code protection: A specific confirmation code is required
  3. Status check protection: Running droplets cannot be deleted
  4. Tag protection: Important droplets are automatically protected
  5. Final safety check: Even if previous checks pass, actual deletion is still disabled

Protected Tags

The system automatically protects droplets with these tags:

  • production / prod
  • important
  • critical
  • backup

Enabling Deletion (Not Recommended)

# To enable deletion (strongly not recommended):
export ALLOW_DROPLET_DELETION=true

Response Examples

Successful Status Query

{
    "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"]
}

Operation Status

{
    "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"
}

Best Practices

  1. Safe Operations:

    • Avoid enabling deletion functionality
    • Regularly assess server security with check_droplet_deletion_safety()
    • Add protection tags to important servers
  2. Batch Operations: Use list_droplets() to get all droplets, then filter and operate as needed

  3. Status Checking: Always check a droplet's current status before performing power operations

  4. Operation Tracking: Save operation IDs for subsequent status queries

  5. Error Handling: Always check for the error field in return results

  6. Monitoring: Enable monitoring when creating droplets to get usage data later

How to add this MCP server to Cursor

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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later