New Features: - Add proxmox_create_vm tool for QEMU VM creation - Add test-basic-tools.js for validating basic operations (7/7 tests) - Add test-workflows.js for lifecycle workflow testing (19/22 tests) - Add TEST-WORKFLOWS.md with comprehensive test documentation Bug Fixes: - Fix regex patterns in test scripts for MCP formatted output - Increase snapshot wait times and add retry logic - Handle markdown formatting in tool responses Documentation: - Update tool count from 54 to 55 - Add Claude Desktop integration with OS-specific paths - Document proxmox_create_vm with full parameters and examples - Add testing section with usage examples Other: - Update .gitignore for Node.js (node_modules, package-lock.json)
7.2 KiB
Proxmox MCP Workflow Test Scripts
This directory contains comprehensive test scripts for validating Proxmox MCP server functionality.
Available Test Scripts
1. test-basic-tools.js
Tests all basic (non-elevated) read-only tools:
proxmox_get_nodes- List cluster nodesproxmox_get_cluster_status- Cluster statusproxmox_get_vms- List VMs/containersproxmox_get_vm_status- VM detailsproxmox_get_storage- Storage informationproxmox_get_next_vmid- Get next available VMIDproxmox_list_templates- List LXC templates
Usage:
node test-basic-tools.js
Requirements:
- Valid
.envconfiguration - Working Proxmox connection
- Does NOT require
PROXMOX_ALLOW_ELEVATED=true
2. test-workflows.js
Comprehensive workflow tests for complete lifecycle operations.
Usage:
# Run all workflows
node test-workflows.js
# Run specific workflow
node test-workflows.js --workflow=lxc
node test-workflows.js --workflow=vm
node test-workflows.js --workflow=network
node test-workflows.js --workflow=disk
node test-workflows.js --workflow=snapshot
node test-workflows.js --workflow=backup
# Dry-run mode (show what would be done)
node test-workflows.js --dry-run
# Interactive mode (confirm before destructive operations)
node test-workflows.js --interactive
# Skip cleanup (keep test resources)
node test-workflows.js --no-cleanup
# Combine options
node test-workflows.js --workflow=lxc --interactive --dry-run
Requirements:
- Valid
.envconfiguration PROXMOX_ALLOW_ELEVATED=truein.env- API token with appropriate permissions:
VM.Allocate- Create VMs/containersVM.Config.Disk- Disk managementVM.Config.Network- Network managementVM.PowerMgmt- Start/stop/rebootVM.Snapshot- Snapshot operationsVM.Backup- Backup operationsDatastore.Allocate- Storage allocation
Workflows Tested
LXC Container Complete Workflow
- Get next available VMID
- List available templates
- Create new LXC container
- Start container
- Check status
- Create snapshot
- List snapshots
- Stop container
- Delete snapshot
- Delete container (cleanup)
What it validates:
- Container creation with templates
- Lifecycle management (start/stop)
- Snapshot operations
- Status monitoring
- Resource cleanup
VM Lifecycle Operations
- Find existing VM
- Detect VM type (QEMU/LXC)
- Get detailed status
- Start (if stopped) or reboot (if running)
- Verify operations
What it validates:
- VM discovery
- Power management operations
- Status checking
- Type detection
Network Management Workflow
- Find stopped VM
- Add network interface (net1, bridge vmbr0)
- Update interface (add rate limit)
- Remove interface
What it validates:
- Network interface addition
- Configuration updates
- Interface removal
- Bridge configuration
Note: VM must be stopped for network changes
Disk Management Workflow
- Find QEMU VM
- Add new disk (10G on local-lvm)
- Resize disk (+2G)
- Remove disk
What it validates:
- Disk allocation
- Disk resizing
- Disk removal
- Storage integration
Note: Primarily tests QEMU VMs for reliability
Snapshot Workflow
- Find VM
- Create snapshot
- List snapshots
- Delete snapshot
What it validates:
- Snapshot creation
- Snapshot listing
- Snapshot deletion
- Snapshot naming
Backup Workflow
- Find VM
- Create backup (to local storage)
- Wait for background job
- List backups
What it validates:
- Backup job creation
- Background job handling
- Backup listing
- Storage integration
Note: Backup restoration is not tested automatically (destructive operation)
Exit Codes
0- All tests passed1- One or more tests failed or error occurred
Test Output
The scripts provide detailed, color-coded output:
- 🟢 Green - Success
- 🔴 Red - Failure
- 🟡 Yellow - Warning
- 🔵 Blue - Information
- 🟣 Magenta - Headers
Example output:
═══════════════════════════════════════════════════════════════════
LXC Container Complete Workflow
═══════════════════════════════════════════════════════════════════
[12:34:56] ▶ Step 1: Get next available VMID
✓ Got VMID: 105
[12:34:57] ▶ Step 2: List available templates
Node: pve1
✓ Templates listed successfully
✓ Found template: local:vztmpl/debian-12-standard_12.2-1_amd64.tar.gz
[12:34:58] ▶ Step 3: Create LXC container
VMID: 105, Template: local:vztmpl/debian-12-standard_12.2-1_amd64.tar.gz
✓ Create Container: Container 105 created
Cleanup
By default, test-workflows.js automatically cleans up test resources (deletes created VMs/containers) at the end.
To keep test resources:
node test-workflows.js --no-cleanup
Manual cleanup: If a test fails or is interrupted, you may need to manually delete test resources:
- Container hostname:
test-mcp-{vmid} - Snapshots:
test-snapshotortest-snap-{timestamp}
Troubleshooting
"Elevated permissions required"
Solution: Set PROXMOX_ALLOW_ELEVATED=true in your .env file
"No templates found"
Solution: Download LXC templates via Proxmox UI: Storage → local → CT Templates → Download
"No stopped VMs found" (network workflow)
Solution: Stop a VM first, or skip network workflow: --workflow=lxc
"Failed to connect to Proxmox"
Solution:
- Check
.envconfiguration - Verify Proxmox API is accessible
- Check API token permissions
- Ensure firewall allows connection
Tests timing out
Solution:
- Increase timeout values in script
- Check Proxmox performance
- Reduce concurrent operations
Safety Features
- Dry-run mode - Preview operations without executing
- Interactive mode - Confirm before destructive operations
- Resource tracking - Automatic cleanup of created resources
- Error handling - Graceful failure with detailed messages
- Status validation - Verify operations completed successfully
Best Practices
- Start with dry-run:
node test-workflows.js --dry-run - Test basic tools first:
node test-basic-tools.js - Run one workflow at a time initially:
--workflow=lxc - Use interactive mode for production:
--interactive - Review cleanup: Don't use
--no-cleanupunless debugging - Check permissions: Ensure API token has all required permissions
- Monitor Proxmox: Watch for resource usage during tests
Integration with CI/CD
These scripts can be integrated into CI/CD pipelines:
# Basic connectivity test
node test-basic-tools.js || exit 1
# Full workflow validation (non-interactive)
node test-workflows.js || exit 1
# Or specific workflow
node test-workflows.js --workflow=snapshot || exit 1
Contributing
When adding new workflows:
- Follow existing pattern (logStep, recordResult)
- Add cleanup tracking for new resources
- Include error handling
- Add to workflow list in main()
- Document in this README
License
Same as parent project (MIT)