vmware-vsphere-mcp-server-ansible

jonnyfiveiq/vmware-vsphere-mcp-server-ansible

3.1

If you are the rightful owner of vmware-vsphere-mcp-server-ansible and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The vSphere 7 MCP Server is a management tool that provides an interface to manage vSphere virtual machines (VMs) through a set of exposed tools.

Tools
5
Resources
0
Prompts
0

vSphere 7 MCP Server

MCP server exposing tools to manage vSphere VMs.

Tools

  • list_vms — list all VMs (optionally filter by datacenter, folder, power_state; outputs table or JSON)
  • create_vm — clone a new VM from a template
  • delete_vm — delete a powered-off VM
  • power_on_vm — power on a VM
  • power_off_vm — power off a VM

1) Local shell script (no Docker/Ansible)

./scripts/start_local.sh

The script will:

  • Create a .venv if needed
  • Install requirements
  • Load .env variables (VCENTER creds)
  • Run the MCP server

Edit .env to match your vCenter.


2) Docker

docker build -t vsphere7-mcp-server:latest .
docker compose up

docker-compose.yml reads env vars from .env in this folder.


3) Ansible (installs a systemd service)

cd ansible
ansible-playbook -i inventory.ini site.yml --ask-become-pass
  • Installs to /opt/vsphere7-mcp-server
  • Creates venv and writes /etc/vsphere7-mcp-server.env
  • Manages vsphere7-mcp-server.service

Check:

systemctl status vsphere7-mcp-server
journalctl -u vsphere7-mcp-server -f

4) Claude Desktop — test any running server

Claude can launch the MCP server via stdio. Example entries for your claude_desktop_config.json:

4.a Docker-based

{
  "mcpServers": {
    "vsphere-docker": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "--env-file", "/Users/johnhardy/Downloads/vsphere7-mcp/.env",
        "vsphere7-mcp-server:latest"
      ],
      "cwd": "/Users/johnhardy/Downloads/vsphere7-mcp"
    }
  }
}

4.b Ansible-installed (direct venv python with env inline)

{
  "mcpServers": {
    "vsphere-ansible": {
      "command": "/opt/vsphere7-mcp-server/.venv/bin/python",
      "args": ["/opt/vsphere7-mcp-server/mcp-vsphere-server.py"],
      "env": {
        "VCENTER_HOST": "192.168.0.195",
        "VCENTER_USER": "administrator@vsphere.local",
        "VCENTER_PASSWORD": "xxxxxxx",
        "VCENTER_VERIFY_SSL": "false"
      }
    }
  }
}

4.c Ansible-installed (recommended wrapper script)

Create /usr/local/bin/vsphere-mcp.sh on the host:

#!/usr/bin/env bash
set -a
source /etc/vsphere7-mcp-server.env
set +a
exec /opt/vsphere7-mcp-server/.venv/bin/python /opt/vsphere7-mcp-server/mcp-vsphere-server.py

Make it executable:

sudo chmod +x /usr/local/bin/vsphere-mcp.sh

Claude config:

{
  "mcpServers": {
    "vsphere-ansible-wrapper": {
      "command": "/usr/local/bin/vsphere-mcp.sh",
      "args": []
    }
  }
}

Quick MCP tool tests (from Claude)

  • List everything:
    list_vms()
    
  • Only powered-on:
    list_vms(power_state="on")
    
  • Create from a template:
    create_vm(name="test-01", template="my-template", datacenter="Datacenter", cluster="Cluster1", datastore="datastore1", power_on=false)
    

License

MIT License (c) 2025