VS Code's GitHub Copilot supports MCP servers via .vscode/mcp.json. This guide shows how to add vmware-monitor for safe, read-only VMware monitoring from within VS Code.
Code-level safety: vmware-monitor contains zero destructive code — no power off, delete, create, or reconfigure functions in the codebase.
-
Install vmware-monitor
uv tool install vmware-monitor
-
Configure credentials
mkdir -p ~/.vmware-monitor cat > ~/.vmware-monitor/config.yaml << 'EOF' targets: my-vcenter: host: vcenter.example.com username: readonly-user@vsphere.local password_env: VMWARE_MONITOR_PASSWORD verify_ssl: false EOF echo "VMWARE_MONITOR_PASSWORD=your_password" > ~/.vmware-monitor/.env chmod 600 ~/.vmware-monitor/.env
-
Verify setup
vmware-monitor doctor
Create or edit .vscode/mcp.json in your workspace:
{
"servers": {
"vmware-monitor": {
"type": "stdio",
"command": "vmware-monitor",
"args": ["mcp"],
"env": {
"VMWARE_MONITOR_CONFIG": "${env:HOME}/.vmware-monitor/config.yaml"
}
}
}
}Add to VS Code settings.json (Cmd+Shift+P → "Open User Settings JSON"):
{
"github.copilot.chat.mcp.enabled": true,
"mcp": {
"servers": {
"vmware-monitor": {
"type": "stdio",
"command": "vmware-monitor",
"args": ["mcp"],
"env": {
"VMWARE_MONITOR_CONFIG": "/Users/your-name/.vmware-monitor/config.yaml"
}
}
}
}
}A ready-to-use template is available at examples/mcp-configs/vscode-copilot.json.
| Tool | Description |
|---|---|
list_virtual_machines |
List VMs with power state, CPU, RAM, IP. Supports limit, sort_by, power_state, fields |
list_esxi_hosts |
List hosts with CPU cores, memory, ESXi version, uptime |
list_all_datastores |
List datastores with capacity, free space, type |
list_all_clusters |
List clusters with host count, DRS/HA status |
get_alarms |
Get active alarms with severity and description |
get_events |
Get recent vCenter/ESXi events |
vm_info |
Get detailed VM info including snapshot list |
All tools accept an optional target parameter to switch between environments.
Example 1: Check environment before deployment
You: @vmware-monitor Is the staging environment healthy?
Copilot: [calls get_alarms + vm_info for vm-staging]
vm-staging: ✓ ON | 8 vCPU | 16GB (11GB used)
No active alarms | Datastore: 450GB free
Ready for deployment ✓
Example 2: Inventory during incident response
You: @vmware-monitor Which VMs are on esxi-03 and what's their status?
Copilot: [calls list_virtual_machines with fields filtering]
esxi-03 (14 VMs — CPU 88%, RAM 94%):
- vm-db-primary: ON, 32GB RAM, 2 active alarms
- vm-db-replica: ON, 32GB RAM, healthy
- vm-web01..vm-web08: ON, 8GB RAM each, healthy
- vm-batch01: ON, 64GB RAM — likely causing high load
Example 3: Snapshot audit
You: @vmware-monitor Find VMs with snapshots older than 7 days
Copilot: [calls list_virtual_machines → vm_info for each]
3 VMs with stale snapshots:
- vm-db-01: snapshot "pre-patch" — 21 days old (4.2GB)
- vm-web03: snapshot "before-upgrade" — 14 days old (1.8GB)
- vm-test-02: snapshot "initial" — 45 days old (8.1GB) ← consider removing