Skip to main content
Glama
vcenter-mcp
by michaelrice

vcenter-mcp

Model Context Protocolサーバーであり、VMware vCenter / ESXiのVMライフサイクル管理ツールをClaude Codeやその他のMCPクライアントに公開します。pyVmomiをベースに構築されています。

機能

  • vCenterデータセンター(ホストごとにグループ化)またはスタンドアロンESXiホスト上のVMをリスト表示

  • VMの作成(ネットワークブート優先、シンまたはシックプロビジョニング、ESXiターゲット向けのネストされた仮想化オプション)

  • VMの電源オンおよびオフ

  • VMの削除(実行中の場合は先に電源をオフにし、その後ディスクから破棄)

検索には表示名またはmoref ID(例: vm-42)を使用できます。morefパスを使用するとインベントリスキャンをスキップできるため、大規模な環境では高速に動作します。

Related MCP server: VMWare MCP

前提条件

  • Python 3.10以降

  • ネットワーク経由でアクセス可能なvCenter ServerまたはスタンドアロンESXiホスト

  • 実行したい操作に必要な権限を持つvSphereアカウント(list_vmsには読み取り専用で十分ですが、作成や削除には対応するVMおよびリソースプールの権限が必要です)

インストール

プロジェクトローカルのvirtualenvにインストールします。venvを使用することで、vcenter-mcpとその依存関係(特にpyVmomi)をシステムPythonから分離できます。

このリポジトリをクローンした場所から実行します:

python3 -m venv .venv
.venv/bin/pip install --upgrade pip
.venv/bin/pip install -e .

開発用(pytestもインストールされます):

.venv/bin/pip install -e ".[dev]"

このREADME全体を通して、コマンドは .venv/bin/... を使用しています。シェルごとに一度 source .venv/bin/activate を実行すれば、プレフィックスを省略しても同じ結果が得られます。

ターゲットの設定

venvのPythonを使用して対話型セットアップを実行します:

.venv/bin/python -m vcenter_mcp setup

以下の入力を求められます:

  1. ターゲット名(例: lab-vcenter) — 後でこのターゲットを参照するために使用します

  2. vCenter / ESXiのホスト名またはIPアドレス

  3. ユーザー名とパスワード

  4. ターゲットタイプ: vcenter または esxi

  5. (vCenterのみ)データセンター名とクラスター名

  6. データストア名

  7. 1つ以上のネットワークプロファイル(名前と1つ以上のポートグループ名の組み合わせ)

セットアップにより、~/.config/vcenter-mcp/config.json(モード 0600)に設定が書き込まれます。ターゲットを追加したり既存の設定を更新したりする場合は、いつでも再実行してください。

設定ファイルの形式

{
  "default_target": "lab-vcenter",
  "targets": {
    "lab-vcenter": {
      "host": "vcenter.lab.example.com",
      "user": "admin@vsphere.local",
      "password": "...",
      "type": "vcenter",
      "datacenter": "Lab DC",
      "cluster": "Lab Cluster",
      "datastore": "datastore1",
      "networks": {
        "standard": ["VM Network"],
        "secure-boot": ["pg-secure-1", "pg-secure-2"]
      },
      "default_network": "standard"
    }
  },
  "templates": {
    "esxi":   { "cpu": 4, "ram_mb": 16384, "disk_gb": 100, "disk_provisioning": "thin", "guest_id": "vmkernel7Guest", "vhv": true },
    "ubuntu": { "cpu": 2, "ram_mb": 4096,  "disk_gb": 40,  "disk_provisioning": "thin", "guest_id": "ubuntu64Guest",  "vhv": false },
    "rhel":   { "cpu": 2, "ram_mb": 4096,  "disk_gb": 40,  "disk_provisioning": "thin", "guest_id": "rhel9_64Guest",  "vhv": false }
  }
}

ネットワークプロファイルはポートグループのリストです。最初の項目がブートNICになります。独自のVMタイプを追加するには templates にエントリを追加してください。create_vm に渡される vm_type 文字列がこの辞書と照合されます。

Claude Codeへの登録

venvのPythonの絶対パスを使用してMCPサーバーを登録します。Claude Codeはアクティブ化されたvenvを継承しない新しいシェルでサーバーを起動するため、絶対パスが必要です。ここで単なる python を指定すると vcenter_mcp のインポートに失敗します。

VCENTER_MCP_DIR="$(pwd)"   # run this from the repo root, after install
claude mcp add --scope user vcenter -- "$VCENTER_MCP_DIR/.venv/bin/python" -m vcenter_mcp

または、使用したい絶対パスを直接指定します:

claude mcp add --scope user vcenter -- /absolute/path/to/vcenter-mcp/.venv/bin/python -m vcenter_mcp

読み取りツール(list_vms)はプロンプトなしで許可しても安全です。~/.claude/settings.json の permissions.allow に追加してください:

{
  "permissions": {
    "allow": [
      "mcp__vcenter__list_vms"
    ]
  }
}

破壊的なツール(create_vm、power_on_vm、power_off_vm、delete_vm)はデフォルトの許可リストには含まれていません。Claudeは呼び出しごとに確認を求めます。

ツール

ツール

機能

list_vms

ターゲット上のVMをリスト表示します。vCenterターゲットはデータセンター内のホストごとにグループ化され、ESXiターゲットはホスト上のすべてをリスト表示します。

create_vm

ネットワークブートを優先するVMを作成します。vm_type(テンプレート)を選択し、オプションでCPU/RAM/ディスクのオーバーライドや network_profile を指定できます。

power_on_vm

表示名またはmoref IDでVMの電源をオンにします。

power_off_vm

表示名またはmoref IDでVMの電源を強制的にオフにします。

delete_vm

VMを完全に削除します(実行中の場合は先に電源をオフにし、その後ディスクから破棄します)。

TLSに関する注意点

vcenter-mcp は検証なしのSSLコンテキストで接続します。これは、ラボ環境のvCenterでは自己署名証明書が非常に一般的であるため、govc やほとんどのpyVmomiサンプルコードでもデフォルトとなっている動作です。ターゲットが適切に署名された証明書を使用しており、厳密な検証が必要な場合は、src/vcenter_mcp/client.py 内の _ssl_context() を変更してください。

開発

python3 -m venv .venv
.venv/bin/pip install -e ".[dev]"
.venv/bin/pytest

テストはCI環境のPython 3.10、3.11、3.12で実行されます(.github/workflows/test.yml を参照)。

ライセンス

Apache-2.0

Available Tools

5 tools
create_vmA

Create a VM that network boots first. vm_type: esxi, ubuntu, rhel (or any type defined in config templates). disk_provisioning: thin (default) or thick. network_profile: named profile from target config (e.g. standard, secure-boot).

Inputs: name (required), vm_type (required), target, network_profile, +4 more. Returns: result

delete_vmA

Permanently delete a VM (power off if running, then destroy from disk). Accepts display name or moref ID (e.g. 'vm-42').

Inputs: name_or_id (required), target. Returns: result

list_vmsA

List VMs on a target.

  • Standalone ESXi: lists all VMs on the host.

  • vCenter: groups VMs by host within the specified datacenter (defaults to the target's configured datacenter).

Inputs: target, datacenter. Returns: result

power_off_vmB

Hard power off a VM by display name or moref ID (e.g. 'vm-42').

Inputs: name_or_id (required), target. Returns: result

power_on_vmA

Power on a VM by display name or moref ID (e.g. 'vm-42').

Inputs: name_or_id (required), target. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: create, delete, list, power on, power off. No overlap in functionality.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern in snake_case (create_vm, delete_vm, list_vms, power_off_vm, power_on_vm). Minor plural variation for list_vms is acceptable.

    Tool Count5/5

    5 tools cover the essential VM lifecycle operations without being excessive or insufficient for a vCenter MCP server.

    Completeness3/5

    Missing common operations like get single VM details, update VM configuration, clone, or snapshot management. Basic CRUD and power actions are present but gaps exist for full lifecycle management.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to manage VMware vSphere virtual infrastructure through comprehensive operations including VM power control, snapshot management, resource monitoring, performance analytics, and bulk operations with built-in safety confirmations for destructive actions.
      -
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to manage VMware vSphere infrastructure through 55 typed tools built on the govc CLI. It supports comprehensive operations including VM lifecycle management, snapshot control, datastore navigation, and networking configuration.
      5
      -
    • A
      license
      A
      quality
      A
      maintenance
      AI-powered VMware vCenter/ESXi monitoring and operations. 20 MCP tools for inventory queries, health monitoring, VM lifecycle management, fast provisioning (Linked Clone, OVA, template deploy), snapshot management, and datastore browsing. Supports vSphere 6.5–8.0. Works with local models via Ollama/LM Studio.
      44
      566 PyPI
      87
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables natural language interaction with VMware SDDC Manager and vCenter APIs through MCP tools, allowing users to query workload domains, VMs, clusters, and more.
      MIT