Skip to main content
Glama

irq-cloudstack-mcp

CI/CD Pipeline CodeQL License: MIT Node.js Version TypeScript

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, destroy, scale, and migrate virtual machines

  • Storage Management: Volumes, snapshots, disk offerings with full CRUD operations

  • Advanced Networking: VPCs, routers, load balancers, firewalls, NAT, and port forwarding

  • Kubernetes Orchestration: Create, manage, scale, and upgrade Kubernetes clusters

  • Template & ISO Management: Register, copy, update, attach/detach VM templates and ISOs

  • Resource Organization: Tags and affinity groups for resource metadata and placement rules

  • Infrastructure Discovery: Zones, templates, service offerings, hosts, and clusters

  • Monitoring & Analytics: Events, alerts, capacity, metrics, and async job tracking

  • Instance Status: CloudStack instance and server version information

  • 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

  • Command Line Interface: Direct CLI access for interactive CloudStack management

  • MCP Integration: Seamless integration with AI assistants via MCP protocol

Related MCP server: CloudStack MCP Server

Quick Start

# 1. Clone the repository
git clone https://github.com/irq-studio/irq-cloudstack-mcp.git
cd irq-cloudstack-mcp

# 2. Install dependencies
npm install

# 3. Configure your CloudStack credentials
cp .env.example .env
nano .env  # Edit with your API credentials

# 4. Build the project
npm run build

# 5. Start Claude Code in this directory
claude

That's it! The CloudStack MCP server will automatically load with all 271 tools available.

For Standalone CLI

Run the CloudStack CLI directly:

# Development mode
npm run dev:cli -- list-vms --help

# Production mode
npm run build
npm run cli -- list-vms --help

MCP Client Integration

Claude Code (CLI)

Copy .mcp.json.example to .mcp.json and update with your credentials:

{
  "mcpServers": {
    "irq-cloudstack": {
      "command": "node",
      "args": ["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"
      }
    }
  }
}

The server will automatically load when you run Claude Code in this directory.

Command Line Interface

For direct command-line access, use the built-in CLI:

# Install globally (optional)
npm link

# Use the CLI
cloudstack-cli list-vms --state Running
cloudstack-cli deploy-vm --service-offering-id 1 --template-id 2 --zone-id 3
cloudstack-cli get-vm --id 12345-67890-abcdef

# See all available commands
cloudstack-cli --help

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              # MCP server entry point
│   ├── server.ts             # Main MCP server implementation
│   ├── cli.ts                # Command-line interface
│   └── cloudstack-client.ts  # CloudStack API client
├── build/                    # Compiled JavaScript output
├── package.json             # Dependencies and scripts
├── tsconfig.json            # TypeScript configuration
└── .env                     # Environment variables (not in repo)

Architecture Overview

  • src/index.ts: MCP server entry point that loads environment variables and starts the server

  • src/server.ts: Comprehensive MCP server implementation with 96 tool handlers across 11 categories, error management, and CloudStack integration

  • src/cli.ts: Command-line interface for direct CloudStack management via JSON-RPC communication with the MCP server

  • src/cloudstack-client.ts: Robust CloudStack API client with HMAC-SHA1 authentication, type-safe interfaces, and comprehensive error handling

  • src/tool-definitions/: Modular tool definitions organized by category (VM, storage, network, Kubernetes, templates, monitoring, etc.)

  • src/handlers/: Request handlers organized by functionality for clean separation of concerns

Configuration

Required Environment Variables

Variable

Description

Example

CLOUDSTACK_API_URL

CloudStack API endpoint

http://cloudstack.example.com:8080/client/api

CLOUDSTACK_API_KEY

CloudStack API key

your-32-character-api-key

CLOUDSTACK_SECRET_KEY

CloudStack secret key

your-secret-key

Optional Environment Variables

Variable

Description

Default

CLOUDSTACK_TIMEOUT

Request timeout (milliseconds)

30000

CLOUDSTACK_REJECT_UNAUTHORIZED

Reject self-signed SSL certificates

false

Development

Build Commands

# Build TypeScript to JavaScript
npm run build

# Run MCP server in development mode with hot reload
npm run dev

# Run CLI in development mode
npm run dev:cli -- list-vms --help

# Run compiled MCP server
npm start

# Run compiled CLI
npm run cli -- list-vms --help

# Type checking only
npx tsc --noEmit

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

  • SSL Certificate Handling: Built-in support for self-signed certificates (configurable via CLOUDSTACK_REJECT_UNAUTHORIZED)

Compatibility

Platform Support

Platform

Status

Notes

CloudStack

Supported

4.11+ recommended

Node.js

Required

18+ required

MCP Protocol

Implemented

SDK 0.5.0+

TypeScript

Built with

5.0+

License

MIT - See LICENSE file for details

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      A high-performance server that enables integration between Apache CloudStack infrastructure and AI assistants through the Model Context Protocol, providing comprehensive tools for managing virtual machines, storage, networking, and other cloud resources.
      45
      6
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables comprehensive management of CloudStack infrastructure through natural language, providing access to over 735 API methods for virtual machines, networking, and storage. It features enterprise-grade security with a safety confirmation system for destructive operations and extensive API coverage.
      Creative Commons Attribution Non Commercial Share Alike 4.0 International
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to manage LXD containers and virtual machines through a standardized MCP interface for lifecycle management, image operations, and server monitoring.
      10 npm
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to manage Apache Ambari clusters, including services, hosts, alerts, and configurations via the MCP protocol.
      40
      1
      Apache 2.0