davidroman1914/vmware-mcp-server
If you are the rightful owner of vmware-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A clean, focused Model Context Protocol (MCP) server for VMware vCenter management using pyvmomi.
list_vms
Lists all VMs in vCenter with detailed information.
power_on_vm
Powers on a VM by name.
power_off_vm
Powers off a VM by name.
create_vm_from_template
Creates a new VM from a template with full customization.
VMware MCP Server
A clean, focused Model Context Protocol (MCP) server for VMware vCenter management using pyvmomi.
š Features
- VM Management: List, create, power on/off VMs
- Host Monitoring: Physical host information and health
- Performance Metrics: CPU, memory, disk, network monitoring
- Fast REST API: Quick VM listing and operations
- Multiple Transport Modes: STDIO (Goose), SSE (n8n), HTTP (web)
- Modular Design: Clean, maintainable code structure
Installation
š Features
- VM Listing: List all VMs with detailed information (power state, IP, CPU, memory, network adapters)
- Power Management: Power on/off VMs by name
- VM Creation: Create new VMs from templates with full customization (IP, hostname, CPU, memory, disk)
- MCP stdio Protocol: Fully compatible with MCP clients
- Docker Support: Easy deployment and testing
šļø Project Structure
vmware-mcp-server/
āāā mcp-server/ # Python logic only
ā āāā server.py # MCP server with stdio protocol
ā āāā vm_info.py # VM listing and information
ā āāā power.py # Power management (on/off)
ā āāā vm_creation.py # VM creation from templates
ā āāā test_server.py # Test script
āāā requirements.txt # Python dependencies (pyvmomi)
āāā pyproject.toml # Project configuration
āāā Dockerfile # Docker configuration
āāā docker-compose.yml # Docker Compose configuration
āāā Makefile # Build and run targets
āāā env.example # Environment variables template
āāā README.md # This file
š§ Setup
Prerequisites
- Python 3.10+
- VMware vCenter access
- Docker (optional)
Environment Variables
Create a .env
file based on env.example
:
VCENTER_HOST=your-vcenter-host
VCENTER_USER=your-username
VCENTER_PASSWORD=your-password
VCENTER_INSECURE=true # Set to "true" for self-signed certificates
# MCP Transport Configuration
MCP_TRANSPORT=stdio # Options: stdio, sse, http
MCP_HOST=127.0.0.1 # For sse/http modes
MCP_PORT=8000 # For sse/http modes
š Quick Start
Using Docker (Recommended)
# Setup environment
make setup
# Build and run
make build
make run-docker
# Or run detached
make run-detached
# Test the server
make test-docker
Using Local Python
# Install dependencies
make install
# Run locally
make run
# Test locally
make test
š Transport Modes
The VMware MCP Server supports multiple transport protocols for different use cases:
STDIO Mode (Default)
- Use case: Local tools like Goose
- Configuration:
MCP_TRANSPORT=stdio
(default) - Command:
python mcp-server/server.py
SSE Mode (Server-Sent Events)
- Use case: Web clients like n8n
- Configuration:
MCP_TRANSPORT=sse
- Command:
python mcp-server/server.py
- Access:
http://127.0.0.1:8000
HTTP Mode
- Use case: Web deployments and APIs
- Configuration:
MCP_TRANSPORT=http
- Command:
python mcp-server/server.py
- Access:
http://127.0.0.1:8000/mcp
Environment Variables for Transport
# Transport mode (stdio, sse, http)
MCP_TRANSPORT=stdio
# Network configuration (for sse/http modes)
MCP_HOST=127.0.0.1
MCP_PORT=8000
MCP_PATH=/mcp # Only for http mode
š Available MCP Tools
1. List VMs (list_vms
)
Lists all VMs in vCenter with detailed information.
Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "list_vms",
"arguments": {}
}
}
2. Power On VM (power_on_vm
)
Powers on a VM by name.
Request:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "power_on_vm",
"arguments": {
"vm_name": "my-vm"
}
}
}
3. Power Off VM (power_off_vm
)
Powers off a VM by name.
Request:
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "power_off_vm",
"arguments": {
"vm_name": "my-vm"
}
}
}
4. Create VM from Template (create_vm_from_template
)
Creates a new VM from a template with full customization.
Request:
{
"jsonrpc": "2.0",
"id": 4,
"method": "tools/call",
"params": {
"name": "create_vm_from_template",
"arguments": {
"template_name": "ubuntu-template",
"vm_name": "new-vm",
"hostname": "new-vm",
"ip_address": "192.168.1.100",
"netmask": "255.255.255.0",
"gateway": "192.168.1.1",
"network_name": "VM Network",
"cpu_count": 2,
"memory_mb": 2048,
"disk_size_gb": 20,
"datastore_name": "datastore1"
}
}
}
šÆ How to Prompt the MCP Server
Here are example prompts you can use with the MCP server:
List all VMs
List all virtual machines in vCenter
Power management
Power on the VM named "ubuntu-server"
Power off the VM named "test-vm"
Create a new VM
Create a new VM named "web-server" from the "ubuntu-template" with IP address 192.168.1.50, 4 CPUs, 8GB RAM, and 50GB disk
š ļø Development
Available Make Targets
make help # Show all available commands
make setup # Create .env file from template
make install # Install Python dependencies
make run # Run server locally
make test # Test server locally
make build # Build Docker image
make run-docker # Run server in Docker
make test-docker # Test server in Docker
make stop # Stop Docker containers
make clean # Clean up Docker resources
make logs # View Docker logs
make docker-shell # Start shell in Docker container
Testing
# Test locally
make test
# Test in Docker
make test-docker
# Start interactive shell for manual testing
make docker-shell
š Troubleshooting
Connection Issues
- Verify vCenter credentials are correct
- Check network connectivity to vCenter
- For self-signed certificates, set
VCENTER_INSECURE=true
VM Creation Issues
- Ensure the template VM exists and is accessible
- Verify network and datastore names are correct
- Check that the target IP address is available on the network
Power Management Issues
- Verify the VM name exists
- Check that the VM is not in a locked state
- Ensure you have sufficient permissions
š License
This project is licensed under the MIT License.