Skip to main content
Glama

CloudStack MCP Server

by phantosmax

CloudStack MCP Server

A high-performance MCP (Model Context Protocol) server for Apache CloudStack API integration. This server provides comprehensive tools for managing CloudStack infrastructure through the MCP protocol, enabling seamless integration with AI assistants and automation tools.

Features

  • 🔧 Complete VM Lifecycle Management: Deploy, start, stop, reboot, and destroy virtual machines
  • 🏗️ Infrastructure Discovery: List zones, templates, and service offerings
  • 🔐 Secure Authentication: HMAC-SHA1 signed requests with CloudStack API credentials
  • ⚡ High Performance: Efficient TypeScript implementation with proper error handling
  • 🛡️ Type Safety: Full TypeScript support with comprehensive interfaces
  • 📊 Rich Information: Detailed VM metadata including CPU, memory, network, and status

Quick Start

Installation

  1. Clone and install dependencies:
    git clone <repository-url> cd cloudstack-mcp-server npm install
  2. Configure environment variables: Create a .env file in the project root:
    CLOUDSTACK_API_URL=https://your-cloudstack-server/client/api CLOUDSTACK_API_KEY=your-api-key CLOUDSTACK_SECRET_KEY=your-secret-key CLOUDSTACK_TIMEOUT=30000
  3. Run the server:
    # Development mode npm run dev # Production mode npm run build && npm start

MCP Client Integration

Add to your MCP client configuration (e.g., Claude Desktop):

{ "mcpServers": { "cloudstack": { "command": "node", "args": ["/path/to/cloudstack-mcp-server/build/index.js"], "env": { "CLOUDSTACK_API_URL": "https://your-cloudstack-server/client/api", "CLOUDSTACK_API_KEY": "your-api-key", "CLOUDSTACK_SECRET_KEY": "your-secret-key" } } } }

Available Tools (45 Tools)

🖥️ Virtual Machine Management (7 Tools)

ToolDescriptionParameters
list_virtual_machinesList VMs with optional filteringzoneid, state, keyword
get_virtual_machineGet detailed VM informationid (required)
start_virtual_machineStart a stopped virtual machineid (required)
stop_virtual_machineStop a running virtual machineid (required), forced (optional)
reboot_virtual_machineReboot a virtual machineid (required)
destroy_virtual_machineDestroy a virtual machineid (required), confirm (required), expunge (optional)
deploy_virtual_machineDeploy a new virtual machineserviceofferingid, templateid, zoneid (required), name, displayname (optional)

⚙️ VM Advanced Operations (4 Tools)

ToolDescriptionParameters
scale_virtual_machineScale (resize) a virtual machineid, serviceofferingid, confirm (required)
migrate_virtual_machineMigrate VM to another hostvirtualmachineid, confirm (required), hostid (optional)
reset_password_virtual_machineReset password for a virtual machineid, confirm (required)
change_service_offering_virtual_machineChange service offering for a VMid, serviceofferingid (required)

💾 Storage Management (7 Tools)

ToolDescriptionParameters
list_volumesList storage volumesvirtualmachineid, type, zoneid
create_volumeCreate a new storage volumename, zoneid (required), diskofferingid, size
attach_volumeAttach a volume to a virtual machineid, virtualmachineid (required)
detach_volumeDetach a volume from a virtual machineid, confirm (required)
resize_volumeResize a storage volumeid, size, confirm (required)
create_snapshotCreate a snapshot of a volumevolumeid (required), name
list_snapshotsList volume snapshotsvolumeid, snapshottype

🌐 Networking (7 Tools)

ToolDescriptionParameters
list_networksList networkszoneid, type
create_networkCreate a new networkname, networkofferingid, zoneid (required), displaytext
list_public_ip_addressesList public IP addresseszoneid, associatednetworkid
associate_ip_addressAcquire a new public IP addresszoneid (required), networkid
enable_static_natEnable static NAT for an IP addressipaddressid, virtualmachineid (required)
create_firewall_ruleCreate a firewall ruleipaddressid, protocol (required), startport, endport, cidrlist
list_load_balancer_rulesList load balancer rulespublicipid, zoneid

📊 Monitoring & Analytics (5 Tools)

ToolDescriptionParameters
list_virtual_machine_metricsGet virtual machine performance metricsids
list_eventsList CloudStack eventstype, level, startdate, pagesize
list_alertsList system alertstype
list_capacityList system capacity informationzoneid, type
list_async_jobsList asynchronous jobsjobstatus, jobresulttype

👥 Account & User Management (4 Tools)

ToolDescriptionParameters
list_accountsList CloudStack accountsdomainid, accounttype
list_usersList usersaccountid, username
list_domainsList CloudStack domainsname
list_usage_recordsList resource usage recordsstartdate, enddate (required), type

🏗️ Infrastructure Discovery (2 Tools)

ToolDescriptionParameters
list_zonesList all available zonesavailable (optional)
list_templatesList available VM templatestemplatefilter, zoneid (optional)

🔧 System Administration (5 Tools)

ToolDescriptionParameters
list_hostsList physical hostszoneid, type, state
list_clustersList host clusterszoneid
list_storage_poolsList storage poolszoneid, clusterid
list_system_vmsList system virtual machineszoneid, systemvmtype
list_service_offeringsList service offeringsname, domainid

🔐 Security & Compliance (4 Tools)

ToolDescriptionParameters
list_ssh_key_pairsList SSH key pairsname
create_ssh_key_pairCreate a new SSH key pairname (required)
list_security_groupsList security groupssecuritygroupname
create_security_group_ruleCreate a security group ingress rulesecuritygroupid, protocol (required), startport, endport, cidrlist

Example Usage

List Virtual Machines

{ "tool": "list_virtual_machines", "arguments": { "state": "Running", "zoneid": "1746ef10-8fa6-40c1-9c82-c3956bf75db8" } }

Deploy New Virtual Machine

{ "tool": "deploy_virtual_machine", "arguments": { "serviceofferingid": "c6f99499-7f59-4138-9427-a09db13af2bc", "templateid": "7d4a7bb5-2409-4c8f-8537-6bbdc8a4e5c1", "zoneid": "1746ef10-8fa6-40c1-9c82-c3956bf75db8", "name": "my-new-vm", "displayname": "My New VM" } }

Project Structure

├── src/ │ ├── index.ts # Entry point with environment setup │ ├── server.ts # Main MCP server (468 lines) │ └── cloudstack-client.ts # CloudStack API client (145 lines) ├── build/ # Compiled JavaScript output ├── package.json # Dependencies and scripts ├── tsconfig.json # TypeScript configuration └── .env # Environment variables (not in repo)

Architecture Overview

  • src/index.ts: Minimal entry point that loads environment variables and imports the server
  • src/server.ts: Comprehensive MCP server implementation with 9 tool handlers, error management, and CloudStack integration
  • src/cloudstack-client.ts: Robust CloudStack API client with HMAC-SHA1 authentication, type-safe interfaces, and comprehensive error handling

Configuration

Required Environment Variables

VariableDescriptionExample
CLOUDSTACK_API_URLCloudStack API endpointhttp://cloudstack.example.com:8080/client/api
CLOUDSTACK_API_KEYCloudStack API keyyour-32-character-api-key
CLOUDSTACK_SECRET_KEYCloudStack secret keyyour-secret-key

Optional Environment Variables

VariableDescriptionDefault
CLOUDSTACK_TIMEOUTRequest timeout (milliseconds)30000

Development

Build Commands

# Build TypeScript to JavaScript npm run build # Run in development mode with hot reload npm run dev # Run compiled JavaScript npm start # Type checking only npx tsc --noEmit

Code Quality

  • TypeScript: Full type safety with strict mode enabled
  • Error Handling: Comprehensive error handling with MCP error types
  • Async/Await: Modern async patterns throughout
  • Modular Design: Clean separation of concerns

Security

  • HMAC-SHA1 Signing: All API requests are cryptographically signed
  • No Credential Storage: Credentials read from environment variables only
  • Request Validation: Input validation on all tool parameters
  • Error Sanitization: Sensitive information filtered from error messages

Compatibility

  • CloudStack: Compatible with CloudStack 4.11+
  • Node.js: Requires Node.js 18+
  • MCP Protocol: Implements MCP SDK 0.5.0+
  • TypeScript: Built with TypeScript 5.0+

License

MIT - See LICENSE file for details

Related MCP Servers

  • -
    security
    F
    license
    -
    quality
    A versatile Model Context Protocol server that enables AI assistants to manage calendars, track tasks, handle emails, search the web, and control smart home devices.
    Last updated -
    2
    Python
    • Apple
    • Linux
  • -
    security
    -
    license
    -
    quality
    An open standard server implementation that enables AI assistants to directly access APIs and services through Model Context Protocol, built using Cloudflare Workers for scalability.
    Last updated -
    TypeScript
  • -
    security
    F
    license
    -
    quality
    A comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.
    Last updated -
    16
    TypeScript
  • -
    security
    A
    license
    -
    quality
    A Model Context Protocol server that provides AI assistants access to AWS CloudWatch Logs, enabling browsing, searching, summarizing, and correlating logs across multiple AWS services.
    Last updated -
    71
    Python
    Apache 2.0

View all related MCP servers

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/phantosmax/cloudstack-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server