Skip to main content
Glama
phantosmax

CloudStack MCP Server

by phantosmax

create_firewall_rule

Add a firewall rule to secure CloudStack MCP Server by specifying IP address, protocol, ports, and CIDR list to control incoming and outgoing traffic.

Instructions

Create a firewall rule

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cidrlistNoCIDR list (comma-separated)
endportNoEnd port
ipaddressidYesPublic IP address ID
protocolYesProtocol (tcp, udp, icmp)
startportNoStart port

Implementation Reference

  • The main handler function that executes the create_firewall_rule tool. It calls the CloudStack client to create the rule and returns a formatted MCP response.
    async handleCreateFirewallRule(args: any) {
      const result = await this.cloudStackClient.createFirewallRule(args);
      
      return {
        content: [
          {
            type: 'text',
            text: `Created firewall rule. Job ID: ${result.createfirewallruleresponse?.jobid}\nRule ID: ${result.createfirewallruleresponse?.id}`
          }
        ]
      };
    }
  • Tool definition including name, description, and input schema for validation.
    {
      name: 'create_firewall_rule',
      description: 'Create a firewall rule',
      inputSchema: {
        type: 'object',
        properties: {
          ipaddressid: {
            type: 'string',
            description: 'Public IP address ID',
          },
          protocol: {
            type: 'string',
            description: 'Protocol (tcp, udp, icmp)',
          },
          startport: {
            type: 'number',
            description: 'Start port',
          },
          endport: {
            type: 'number',
            description: 'End port',
          },
          cidrlist: {
            type: 'string',
            description: 'CIDR list (comma-separated)',
          },
        },
        required: ['ipaddressid', 'protocol'],
        additionalProperties: false,
      },
    },
  • src/server.ts:160-161 (registration)
    Dispatch registration in the MCP server that routes calls to the network handler.
    case 'create_firewall_rule':
      return await this.networkHandlers.handleCreateFirewallRule(args);
  • Helper method in CloudStack client that wraps the API request for creating a firewall rule.
    async createFirewallRule(params: CloudStackParams): Promise<CloudStackResponse> {
      return this.request('createFirewallRule', params);
    }

Latest Blog Posts

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