enable_static_nat
Map a public IP address to a virtual machine using static NAT, ensuring direct accessibility and efficient routing between the VM and external networks. Requires IP address ID and VM ID for configuration.
Instructions
Enable static NAT for an IP to a VM
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ipaddressid | Yes | Public IP address ID | |
| virtualmachineid | Yes | VM ID | |
| vmguestip | No | VM guest IP (for multiple IPs) |
Implementation Reference
- src/handlers/network-handlers.ts:95-106 (handler)The main handler function that implements the enable_static_nat tool logic. It calls the CloudStack client to enable static NAT and returns a formatted text response indicating success.async handleEnableStaticNat(args: any) { const result = await this.cloudStackClient.enableStaticNat(args); return { content: [ { type: 'text', text: `Enabled static NAT for IP ${args.ipaddressid} to VM ${args.virtualmachineid}. Success: ${result.enablestaticnatresponse?.success}` } ] }; }
- The tool schema definition including name, description, and input schema validation for enable_static_nat.{ name: 'enable_static_nat', description: 'Enable static NAT for an IP to a VM', inputSchema: { type: 'object', properties: { ipaddressid: { type: 'string', description: 'Public IP address ID', }, virtualmachineid: { type: 'string', description: 'VM ID', }, vmguestip: { type: 'string', description: 'VM guest IP (for multiple IPs)', }, }, required: ['ipaddressid', 'virtualmachineid'], additionalProperties: false, }, },
- src/server.ts:158-159 (registration)The registration and dispatching of the enable_static_nat tool in the MCP server's CallToolRequest handler switch statement.case 'enable_static_nat': return await this.networkHandlers.handleEnableStaticNat(args);
- src/cloudstack-client.ts:201-203 (helper)Helper method in the CloudStackClient class that wraps the API request to CloudStack's enableStaticNat endpoint.async enableStaticNat(params: CloudStackParams): Promise<CloudStackResponse> { return this.request('enableStaticNat', params); }