mcp-vmwhere
One-line summary: This is a read-only VMware vCenter MCP server that lets you query inventory (VMs, hosts, clusters, storage, networking) and compute pre-aggregated capacity/usage summaries — it cannot change anything in the environment.
List VMs (
list_vms) — filter by power state, exact name, or partial name (case-insensitive); returns total VM count, per-power-state counts, summed vCPU and memory (GiB), plus each VM's id, name, power state, CPU count and memory.Inspect a single VM (
get_vm) — hardware config (CPU, memory, disks, NICs), power state, and guest OS identity when VMware Tools is running, with a note when guest data is unavailable.List ESXi hosts (
list_hosts) — optional connection-state filter; totals plus connection-state and power-state breakdowns.List clusters (
list_clusters) — each cluster's id/name with DRS and HA enabled flags, plus counts of DRS/HA-enabled clusters.List datastores (
list_datastores) — capacity, free space, GiB conversions and used % per datastore, sorted by usage; totals plus counts at ≥80% and ≥90% used.List networks / port groups (
list_networks) — total and counts grouped by type (standard vs distributed port group, etc.).List datacenters (
list_datacenters) — count and id/name of each datacenter.List resource pools (
list_resource_pools) — count and id/name of each resource pool.List folders (
list_folders) — count and id/name/type (datacenter, VM, host, datastore, network folders).Answers come pre-counted — tools return
totaland grouped counts so the model doesn't have to count long lists itself; all tools are annotated read-only/non-destructive/idempotent with structured output schemas.
(Note: the README also documents a get_vm_performance tool for historical CPU/memory/disk/network stats, but it is not present in the supplied server schema.)
Provides read-only querying of VMware vCenter environments through the vSphere Automation REST API, including listing virtual machines, ESXi hosts, clusters, datastores, networks, datacenters, resource pools, and folders, plus retrieving detailed VM information.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-vmwhere list powered-on VMs and the ESXi hosts they run on"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-vmware
一個唯讀的 MCP server,讓 Claude 能查詢 VMware vCenter 環境。
只讀不控 — 不提供任何開關機、修改、刪除等操作。
inventory 查詢透過 vSphere Automation REST API(
/api/vcenter/*),僅發出GET請求 (唯一例外是 session 登入/登出)。VM 歷史效能數據透過 vSphere Web Services(SOAP)的 PerformanceManager,只呼叫唯讀方法 (REST API 在 vCenter 7 沒有效能端點)。
遵循 MCP 2026-07-28 規範(MCP Python SDK 2.x)。
MCP 2.x 規範對應
規範要點 | 本專案實作 |
Stateless protocol core(2026-07-28) | 使用 SDK 2.x 的 |
Tool annotations | 所有 tool 標註 |
Structured output | 每個 tool 都有 |
Tool title / server title | server 與 tool 皆提供人類可讀的 |
Cacheable list results |
|
Lifespan 資源管理 | vCenter session 由 server lifespan 建立,結束時自動登出 |
Related MCP server: VMware-Monitor
需求
Python 3.10+
vCenter Server 7.0 / 8.0(使用
/api/vcenter/*REST 路徑)一組具備唯讀(Read-only)權限的 vCenter 帳號即可
安裝
pip install -e .相依套件:mcp>=2.2.0、httpx2(MCP SDK 2.x 隨附的 HTTP client)、pydantic、
pyvmomi(效能數據查詢用)、tzdata(時區資料)。
設定
透過環境變數提供連線資訊(可參考 .env.example):
變數 | 必填 | 說明 |
| 是 | vCenter FQDN 或 IP,例 |
| 是 | 帳號,例 |
| 是 | 密碼 |
| 否 | 設為 |
| 否 |
|
啟動
python -m mcp_vmware以 stdio transport 執行,通常由 MCP 用戶端(Claude Code / Claude Desktop)自動啟動。
接入 Claude Code
claude mcp add vmware \
-e VCENTER_HOST=vcenter.example.com \
-e VCENTER_USER=administrator@vsphere.local \
-e VCENTER_PASSWORD=yourpassword \
-- python -m mcp_vmware接入 Claude Desktop
Claude Desktop 由 app 直接啟動 server 行程,不會繼承終端機的 PATH 與虛擬環境 —
command 請填 Python 直譯器的絕對路徑(有用虛擬環境就填該環境下的 python),
否則會出現找不到指令或 No module named mcp_vmware。
取得絕對路徑:
# 先啟用安裝本專案的環境,再執行
python -c "import sys; print(sys.executable)"設定步驟
開啟 Claude 選單(macOS 在系統最上方的選單列)→ Settings… → 左側 Developer → 按 Edit Config,會開啟設定檔:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
在
mcpServers底下加入vmware(把路徑與帳密換成自己的):macOS / Linux:
{ "mcpServers": { "vmware": { "command": "/Users/yourname/git/mcp-vmware/.venv/bin/python", "args": ["-m", "mcp_vmware"], "env": { "VCENTER_HOST": "vcenter.example.com", "VCENTER_USER": "readonly@vsphere.local", "VCENTER_PASSWORD": "yourpassword", "VCENTER_INSECURE": "false" } } } }Windows(路徑的反斜線要寫成
\\):{ "mcpServers": { "vmware": { "command": "C:\\Users\\yourname\\git\\mcp-vmware\\.venv\\Scripts\\python.exe", "args": ["-m", "mcp_vmware"], "env": { "VCENTER_HOST": "vcenter.example.com", "VCENTER_USER": "readonly@vsphere.local", "VCENTER_PASSWORD": "yourpassword", "VCENTER_INSECURE": "false" } } } }完全結束(Quit,不是關視窗)Claude Desktop 後重新開啟。
在對話輸入框左下角點 Add files, connectors, and more → Connectors → Manage connectors,選
vmware就會看到本 server 的 10 個唯讀工具。
試著問問看
「現在有幾台 VM 是開機狀態?」
「列出所有 ESXi 主機和它們的連線狀態」
「哪個 datastore 的剩餘空間最少?」
「給我 vm-123 近一週的效能分析」
疑難排解
看不到 vmware 或工具呼叫失敗時,先看 log:
# macOS
tail -n 50 -f ~/Library/Logs/Claude/mcp*.log# Windows
type "%APPDATA%\Claude\logs\mcp-server-vmware.log"再用同一組路徑與環境變數手動啟動一次,確認 server 本身沒問題:
VCENTER_HOST=vcenter.example.com \
VCENTER_USER=readonly@vsphere.local \
VCENTER_PASSWORD=yourpassword \
/Users/yourname/git/mcp-vmware/.venv/bin/python -m mcp_vmware正常情況下不會有任何輸出(server 在等 stdin),按 Ctrl-C 結束即可。
常見原因:
症狀 | 原因 |
完全看不到這個 connector |
|
log 出現 |
|
log 出現「缺少必要環境變數: …」 |
|
TLS 憑證錯誤 | 自簽憑證環境請設 |
用 MCP Inspector 測試
npx @modelcontextprotocol/inspector python -m mcp_vmware提供的 Tool(全部唯讀)
Tool | 說明 | 回傳型別 |
| 列出虛擬機摘要(可依電源狀態、名稱過濾) |
|
| 取得單一 VM 詳情(硬體、電源、客體 OS) |
|
| 取得單一 VM 近 N 天的效能數據(CPU、記憶體、磁碟、網路)與統計 |
|
| 列出 ESXi 主機(可依連線狀態過濾) |
|
| 列出叢集 |
|
| 列出 Datastore 容量資訊 |
|
| 列出網路 / Port Group |
|
| 列出資料中心 |
|
| 列出資源池 |
|
| 列出資料夾 |
|
回傳模型的欄位名稱與 vSphere REST API 一致,且允許額外欄位 — 不同 vCenter 版本多回的欄位會原樣保留,不會被丟棄或造成驗證失敗。
get_vm_performance 說明
參數 | 預設 | 說明 |
| — | VM 的 managed object id,例 |
|
| 查詢最近幾天(1~365) |
|
| 是否附上完整時間序列 |
取樣間隔依 vCenter「統計資料」設定,自動選擇能涵蓋查詢範圍的最細間隔 (預設:1 天內 5 分鐘、1 週內 30 分鐘、1 個月內 2 小時、1 年內 1 天); 都涵蓋不到時取保留最久者,並寫在
notes。查詢結束時間以 vCenter 伺服器時間為準。指標(皆取彙總值):CPU 使用率/MHz/Ready、記憶體 usage/consumed/active/balloon/swap、 磁碟吞吐量與最大延遲、網路吞吐量。
每個指標回傳 min / max / avg / p95 / 最新值、峰值時間,以及每日平均、最大值與當日峰值時間(
daily[].peak_time)。單位換算:百分比已除以 100、記憶體為 MiB、吞吐量為 KBps;
cpu.ready.summation換算為「每 vCPU 平均 Ready %」。統計層級 1(vCenter 預設)不收集
mem.active、mem.swapped, 這些會列在unavailable_metrics;需要時可把該統計間隔的層級調到 2。 查詢期間全無資料(全為 -1)的指標也會列在這裡。每日統計與時間以
VCENTER_TIMEZONE為準;容器部署請設定,否則會以 UTC 分日(台灣會偏 8 小時)。權限:唯讀(Read-only)角色即可,不需額外權限。
安全說明
本 server 不會對 vCenter 做任何異動;
vcenter.py中除 session 登入(POST /api/session) 與登出(DELETE /api/session)外,僅有GET請求。perf.py走 SOAP API(協定上一律是 POST),只呼叫Login/Logout、CurrentTime、 屬性讀取,以及QueryAvailablePerfMetric/QueryPerf這些唯讀方法。所有 tool 皆標註
readOnlyHint,用戶端可據此判斷本 server 不會改動環境。建議搭配僅具唯讀權限的 vCenter 服務帳號使用,以從權限層面再加一道保險。
Claude Desktop / Claude Code 的設定檔會以明文存放
VCENTER_PASSWORD,請勿把設定檔提交進版控; macOS 可再收緊權限:chmod 600 ~/Library/Application\ Support/Claude/claude_desktop_config.json。
HTTP 模式(Open WebUI 原生 MCP 連線)
除了 stdio,也可用 Streamable HTTP 執行,端點 /mcp/:
PYTHONPATH=src HTTP_PORT=8000 MCP_AUTH_TOKEN=<token> python -m http_server驗證:請求需帶
Authorization: Bearer <MCP_AUTH_TOKEN>(可逗號分隔多組以便輪替)。 未設MCP_AUTH_TOKEN時不驗證並在 log 警告 —— 任何連得到的人都能讀整個 vCenter inventory,只限本機除錯。 另支援選用的 OAuth access token(MCP_OAUTH_ISSUER/MCP_OAUTH_AUDIENCE/MCP_OAUTH_JWKS_URL,三者皆設定才啟用), 詳見src/mcp_vmware/auth.py。/health免驗證,供容器健康檢查使用。缺
VCENTER_HOST/VCENTER_USER/VCENTER_PASSWORD時程序直接結束(健康檢查會失敗)。無狀態(stateless)、JSON 回應;全程序共用一個 vCenter session。
工具名不帶前綴;Open WebUI 的函式名是「連線識別碼+底線+工具名」,例
vmware_list_vms。所有
list_*工具都回傳物件而非裸陣列:附total與依狀態/類型分組的計數(list_datastores另附 GiB 換算、used_pct,並已依使用率由高到低排序)。數量一律由工具算好 —— LLM 自行計算長清單 容易數錯。list_vms另有name_contains(不分大小寫的部分名稱比對)。
容器與部署
docker build --target production -t mcp-vmware .
docker run -d --name mcp-vmware -p 8000:8000 \
-e VCENTER_HOST=vcenter.example.com \
-e VCENTER_USER=readonly@vsphere.local \
-e VCENTER_PASSWORD=yourpassword \
-e MCP_AUTH_TOKEN=<token> \
mcp-vmware
curl http://localhost:8000/health容器內預設執行
python -m http_server,監聽HTTP_PORT(預設8000)。建議以
--env-file .env或部署平台的 secret 機制注入VCENTER_*與MCP_AUTH_TOKEN,勿寫進 image。依賴版本以
constraints.txt鎖定;有意升級時在建好的 image 內pip freeze重新產生。
授權
Available Tools
9 toolsget_vm取得虛擬機詳情ARead-onlyIdempotent
取得單一虛擬機的詳細資訊。
彙整硬體設定(CPU、記憶體、磁碟、網卡)、電源狀態,以及客體 OS 身分資訊 (需 VM 開機且 VMware Tools 執行中才有客體資訊)。
參數: vm_id: VM 的 managed object id,例如 "vm-123"(可由 list_vms 取得)。
Inputs: vm_id (required). Returns: 單一虛擬機詳情(硬體 / 電源 / 客體 OS)。
list_clusters列出叢集ARead-onlyIdempotent
列出 vCenter 中的叢集(Cluster)。
回傳 total、啟用 DRS/HA 的叢集數,以及每個叢集的 id、名稱與 DRS/HA 設定。
Inputs: no named parameters. Returns: total, clusters, ha_enabled_count, drs_enabled_count
list_datacenters列出資料中心ARead-onlyIdempotent
列出 vCenter 中的資料中心(Datacenter):total 與每個資料中心的 id、名稱。
Inputs: no named parameters. Returns: total, datacenters
list_datastores列出 DatastoreARead-onlyIdempotent
列出 vCenter 中的 Datastore(儲存),附上算好的容量與使用率。
回傳: total: Datastore 數量(直接引用,不要自己數)。 total_capacity_GiB / total_free_GiB / overall_used_pct: 全部合計。 used_pct_at_least_90 / used_pct_at_least_80: 使用率達 90%/80% 以上的數量。 datastores: 每個 datastore 的 id、名稱、類型、capacity/free_space(位元組)、 capacity_GiB、free_GiB、used_pct(已用百分比),已依 used_pct 由高到低排序 (容量為 0 或未知者排最後)。
Inputs: no named parameters. Returns: total, sorted_by, datastores, total_free_GiB, +4 more
list_folders列出資料夾ARead-onlyIdempotent
列出 vCenter 中的資料夾(Folder)。
回傳 total、依類型分組的數量(DATACENTER、VIRTUAL_MACHINE、HOST、DATASTORE、NETWORK), 以及每個資料夾的 id、名稱與類型。
Inputs: no named parameters. Returns: total, folders, type_counts
list_hosts列出 ESXi 主機ARead-onlyIdempotent
列出 vCenter 管理的 ESXi 主機,並附上依狀態分組的台數。
回傳 total(主機台數,直接引用)、connection_state_counts、power_state_counts, 以及每台主機的 id、名稱、連線狀態與電源狀態(依名稱排序)。
參數: connection_state: 選填,依連線狀態過濾。
Inputs: connection_state. Returns: hosts, total, power_state_counts, connection_state_counts
list_networks列出網路ARead-onlyIdempotent
列出 vCenter 中的網路 / Port Group。
回傳 total、依類型分組的數量(STANDARD_PORTGROUP、DISTRIBUTED_PORTGROUP 等), 以及每個網路的 id、名稱與類型。
Inputs: no named parameters. Returns: total, networks, type_counts
list_resource_pools列出資源池BRead-onlyIdempotent
列出 vCenter 中的資源池(Resource Pool):total 與每個資源池的 id、名稱。
Inputs: no named parameters. Returns: total, resource_pools
list_vms列出虛擬機ARead-onlyIdempotent
列出 vCenter 中的虛擬機(VM),並附上算好的彙總。
回傳: total: 符合條件的 VM 台數(要回答「幾台」請直接引用,不要自己數 vms)。 power_state_counts: 依電源狀態分組的台數。 total_cpu_count / total_memory_GiB: 符合條件 VM 的 vCPU 與記憶體配置合計。 vms: 每台 VM 的 id、名稱、電源狀態、CPU 數與記憶體(MiB),依名稱排序。
參數: power_state: 選填,依電源狀態過濾。 name: 選填,VM 名稱完全比對。 name_contains: 選填,名稱包含此關鍵字(不分大小寫)。只知道部分名稱時用這個。
Inputs: name, power_state, name_contains. Returns: vms, total, total_cpu_count, total_memory_GiB, +1 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool targets a distinct vCenter object type (VM, host, cluster, datastore, network, datacenter, resource pool, folder), and get_vm is clearly differentiated from list_vms by returning detailed single-object data. There is no plausible way to confuse the tools at selection time.
All names use a consistent snake_case verb_noun pattern (list_vms, list_hosts, get_vm), with 'list_' for collection queries and 'get_' for single-object retrieval. The convention is predictable and readable.
Nine tools is well within the ideal range and each maps to a real vCenter inventory entity, so nothing feels padded. The one list-per-resource-type layout is the natural minimal surface for this domain.
The server is a read-only inventory surface: it lists every major vCenter entity but offers no mutations, no VM power operations (power on/off/reset), and no detail getters for hosts, datastores, or clusters analogous to get_vm. Agents can survey the environment but cannot act on it or drill into non-VM objects.
Maintenance
Related MCP Connectors
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
Read-only MCP server that answers questions about turva.dev from its published data. Seven tools return JSON. Five of them return fixed data: the service catalog with prices and the full contract terms, contact and operator details with the privacy sections of the legal page, the engagement principles, and dated agent-readiness and security evidence with verification links. The other two read turva.dev when you call them: get_page_index lists the pages of the site from its /llms.txt index, and get_page returns one page as markdown inside that JSON. Connect over Streamable HTTP. You need no API key and no account. The server does not scan other websites or run audits.
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
Read-only MCP access to a documented IT fleet: state, changes, posture. 15 tools.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA VMware ESXi/vCenter management server based on MCP (Machine Control Protocol), providing simple REST API interfaces for virtual machine management.65MIT
- AlicenseAqualityBmaintenanceRead-only VMware vCenter/ESXi monitoring. 8 MCP tools for VM inventory, host status, datastore capacity, cluster info, alarms, events, and VM details. Code-level enforced safety — no destructive operations exist in the codebase. Supports vSphere 6.5–8.0. Works with local models via Ollama/LM Studio.33534 PyPI20MIT
- FlicenseAqualityDmaintenanceConnects MCP-compatible coding agents to VMware vCenter to query information about virtual machines, hosts, clusters, datastores, datacenters, and networks.9-
- FlicenseNot gradedqualityBmaintenanceA read-only MCP server that gives Claude Code secure, non-invasive access to infrastructure logs, service status, metrics, Ansible facts, and Docker state via SSH, with a strict command allowlist and no write operations.-