vCenter MCP Server

vCenter MCP Server

Enables interaction with VMware vCenter 8.0 REST API via a reverse proxy, providing read-only and write tools with dry-run protection and automatic session management.

Category
Visit Server

README

vCenter MCP Server

透過 reverse proxy(apigw)操作 VMware vCenter 8.0 REST API 的 MCP server。 以 streamable-HTTP transport 常駐於 Docker host,同時服務兩個 vCenter(DCS / Foreman)。

特性

  • Read / Write 權限分群:read-only tools 一律提供;write tools(電源、CPU/記憶體修改)由 VCENTER_ENABLE_WRITE 控制,預設關閉(read 模式下這些 tool 根本不會出現在清單)。
  • 寫入防護 dry-run:所有 write tool 預設 confirm=false,只回報「將要做什麼」,需 confirm=true 才真正執行。
  • 祕密不外洩:帳密與 proxy URL 全部從環境變數讀取,不進程式碼、不進 LLM context。
  • token 自動管理:session token(30 分鐘)由 server 快取與自動重取,client 完全不碰。

環境變數

變數 說明
VCENTER_DCS_BASE DCS vCenter proxy base URL
VCENTER_FOREMAN_BASE Foreman vCenter proxy base URL
VCENTER_USER vSphere 帳號(如 administrator@vsphere.local
VCENTER_PASSWORD 密碼
VCENTER_ENABLE_WRITE true 才註冊 write tools(預設 false
MCP_HOST / MCP_PORT 監聽位址(預設 0.0.0.0:8000)

複製 .env.example.env 並填入密碼(.env 已被 .gitignore)。

Docker 部署(apigw / apigw)

容器部署在 /opt/vcenter-mcp/,不對外開 port,只接上 nginx(vcenter-proxy)的既有 docker network(vcenter-proxy_default),由 nginx 在 /mcp 加 basic auth 後反向代理。

apigw 為封閉內網,build 需經內部 proxy 抓 base image 與 PyPI 套件。proxy 位址 不寫死在 repo,部署前以環境變數帶入(見下方 BUILD_HTTP_PROXY)。 base image 的 pull 走 docker daemon 既有 proxy(/etc/systemd/system/docker.service.d/)。

cp .env.example .env      # 填 VCENTER_PASSWORD;含 $ 要寫成 $$

# 封閉環境:build 前設定內部 proxy(位址問網管/見 docker daemon 設定)
export BUILD_HTTP_PROXY=http://<proxy-host>:<port>
export BUILD_HTTPS_PROXY=http://<proxy-host>:<port>

docker compose up -d --build
docker compose logs -f

與 nginx 的整合(重點:互不干擾)

  • MCP 與 nginx 是兩個獨立的 compose project(vcenter-mcp / vcenter-proxy)。 在 /opt/vcenter-proxydocker compose up -d 只會動 nginx,不會碰 MCP 容器
  • nginx 設定:/opt/vcenter-proxy/nginx/conf.d/vcenter.conflocation = /mcp, basic auth 密碼檔 /opt/vcenter-proxy/nginx/conf.d/.htpasswd-mcp(帳號 mcp)。
  • 改完 nginx 設定用 docker exec vcenter-proxy nginx -t && nginx -s reload(不重啟容器)。

Client 連線(.mcp.json)

對外經 nginx 的 HTTPS + basic auth(注意 endpoint 是 /mcp 無尾斜線):

{
  "mcpServers": {
    "vcenter": {
      "type": "http",
      "url": "https://apigw.example.com/mcp",
      "headers": {
        "Authorization": "Basic <base64(mcp:<密碼>)>"
      }
    }
  }
}

<密碼> 為部署時產生的 basic auth 密碼。產生 header:printf 'mcp:<密碼>' | base64

Tools

每個 tool 都接受 targetdcs 預設 / foreman)。

Read-only(18 個,一律啟用)

list_vmsget_vm_detailget_vm_powerget_vm_guestlist_clusterslist_hostslist_datastoresget_datastore_usagelist_networkslist_resource_poolslist_datacenterslist_folderslist_tagsget_object_tagsget_appliance_healthget_vcenter_versionget_resource_summaryget_vms_high_usage

Write(3 個,需 VCENTER_ENABLE_WRITE=true,全部 dry-run + confirm)

  • vm_power_action:start / stop / reset / suspend
  • update_vm_cpu:改 vCPU 核心數
  • update_vm_memory:改記憶體(MiB)

CPU/記憶體修改若 VM 開機且未啟用 hot-add,dry-run 會回 warning 提示需先關機。

已知限制(本環境 REST proxy)

功能 狀態 說明
VM snapshot 清單 ❌ 未提供 GET /api/vcenter/vm/{id}/snapshot 在此 proxy 回 404,REST 不支援。
Content Library template 清單 ❌ 未提供 vm-template/library-items 回 404。
per-VM 時序效能 ⚠️ 降級 REST 僅提供 vCenter appliance 層級監控;per-VM CPU/mem 配置可由 get_vm_detail / get_vms_high_usage 取得,但即時利用率時序需 pyVmomi,未實作。

本機開發

python3 -m venv .venv && .venv/bin/pip install -e .
set -a; source .env; set +a
.venv/bin/python -m vcenter_mcp.server

注意:本機若已有其他 MCP server 佔用 8000(如 google-workspace),請改 MCP_PORT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured