VMware Storage
Disclaimer: This is a community-maintained open-source project and is not affiliated with, endorsed by, or sponsored by VMware, Inc. or Broadcom Inc. "VMware" and "vSphere" are trademarks of Broadcom. Source code is publicly auditable at github.com/zw008/VMware-Storage under the MIT license.
VMware vSphere storage management — 11 MCP tools for datastores, iSCSI, and vSAN.
Split from vmware-aiops for lighter context and local model compatibility.
Companion skills: vmware-aiops (VM lifecycle), vmware-monitor (read-only monitoring), vmware-vks (Tanzu Kubernetes), vmware-nsx (NSX networking), vmware-nsx-security (DFW/firewall), vmware-aria (metrics/alerts/capacity), vmware-avi (AVI/ALB/AKO).
| vmware-pilot (workflow orchestration) | vmware-policy (audit/policy)
What This Skill Does
| Category | Tools | Count |
|---|
| Datastore | list all datastores, browse files, scan for OVA/ISO/OVF/VMDK images, list cached images | 4 |
| iSCSI |
enable adapter, show status, add target, remove target, rescan HBAs | 5 |
|
vSAN | cluster health summary, capacity overview (total/used/free) | 2 |
Quick Install
CODEBLOCK0
When to Use This Skill
- - Browse datastore files or scan for deployable images (OVA/ISO/VMDK)
- Configure iSCSI: enable adapter, add/remove send targets, rescan storage
- Check vSAN cluster health and capacity
- Any storage-focused VMware operation
Use companion skills for:
- - VM lifecycle, deployment, guest ops → INLINECODE0
- Inventory, health, alarms, events → INLINECODE1
- Tanzu Kubernetes → INLINECODE2
- Load balancing, AVI/ALB, AKO, Ingress → INLINECODE3
Related Skills — Skill Routing
| User Intent | Recommended Skill |
|---|
| Read-only monitoring, alarms, events | vmware-monitor |
| Storage: iSCSI, vSAN, datastores |
vmware-storage ← this skill |
| VM lifecycle, deployment, guest ops |
vmware-aiops |
| Tanzu Kubernetes (vSphere 8.x+) |
vmware-vks |
| NSX networking: segments, gateways, NAT |
vmware-nsx |
| NSX security: DFW rules, security groups |
vmware-nsx-security |
| Aria Ops: metrics, alerts, capacity planning |
vmware-aria |
| Multi-step workflows with approval |
vmware-pilot |
| Load balancer, AVI, ALB, AKO, Ingress |
vmware-avi (
uv tool install vmware-avi) |
| Audit log query |
vmware-policy (
vmware-audit CLI) |
Common Workflows
Set Up iSCSI Storage on a Host
- 1. Enable iSCSI adapter → INLINECODE6
- Add target → INLINECODE7
- Verify → INLINECODE8
The add-target command automatically rescans storage after adding the target. If you need an additional rescan later:
- 4. Rescan → INLINECODE10
Dry-run first: Append --dry-run to any write command to preview without executing:
CODEBLOCK1
Find Deployable Images Across Datastores
- 1. List all datastores → INLINECODE12
- Scan a datastore for images → INLINECODE13
- Browse with a pattern → INLINECODE14
- If datastore not found → verify name with
vmware-storage datastore list --target <vcenter>. Datastore names are case-sensitive.
To filter cached results by type or datastore, use the list_cached_images MCP tool with image_type and datastore parameters.
vSAN Health Assessment
- 1. Check health → INLINECODE19
- Check capacity → INLINECODE20
- If issues found, investigate with
vmware-monitor for alarms and events - If vSAN not enabled → this cluster may not use vSAN. Check cluster type with INLINECODE22
Multi-Target Operations
All commands accept --target <name> to operate against a specific vCenter or ESXi host from your config:
CODEBLOCK2
Usage Mode
| Scenario | Recommended | Why |
|---|
| Local/small models (Ollama, Qwen) | CLI | ~2K tokens vs ~8K for MCP |
| Cloud models (Claude, GPT-4o) |
Either | MCP gives structured JSON I/O |
| Automated pipelines |
MCP | Type-safe parameters, structured output |
MCP Tools (11 — 6 read, 5 write)
All MCP tools accept an optional target parameter to select which vCenter/ESXi to connect to.
| Category | Tool | Type | Description |
|---|
| Datastore | INLINECODE25 | Read | List datastores with capacity, usage %, VM count |
|
browse_datastore | Read | Browse files with optional path and glob pattern |
| |
scan_datastore_images | Read | Find OVA/ISO/OVF/VMDK in a datastore |
| |
list_cached_images | Read | Query local image registry with type/datastore filters |
| iSCSI |
storage_iscsi_status | Read | Show adapter status, HBA device, IQN, send targets |
| |
storage_iscsi_enable | Write | Enable software iSCSI adapter on a host |
| |
storage_iscsi_add_target | Write | Add iSCSI send target (IP + port) and rescan |
| |
storage_iscsi_remove_target | Write | Remove iSCSI send target and rescan |
| |
storage_rescan | Write | Rescan all HBAs and VMFS volumes |
| vSAN |
vsan_health | Read | Cluster health summary and disk group details |
| |
vsan_capacity | Read | Total/used/free capacity in GB and usage % |
Read/write split: 6 tools are read-only, 5 modify state. Write tools require explicit parameters (host name, IP address) and are audit-logged.
CLI Quick Reference
CODEBLOCK3
Full CLI reference with all options and output formats: see INLINECODE36
Troubleshooting
iSCSI enable fails with "already enabled"
Not an error. The software iSCSI adapter is already active on that host. The response includes the current HBA device name and IQN. Run iscsi status to see configured send targets.
"Datastore not found" when browsing
Datastore names are case-sensitive. Run vmware-storage datastore list to get the exact name. Common mistakes: Datastore1 vs datastore1, trailing spaces.
vSAN health shows "unknown" status
vSAN health checks require a vCenter connection (not standalone ESXi). The full VsanVcClusterHealthSystem runs via vCenter's vSAN Health Service. If connected to a standalone ESXi host, vSAN queries will fail or return limited info.
Rescan doesn't discover new LUNs
After adding iSCSI targets, the storage subsystem may need 10-30 seconds to enumerate new LUNs. Steps to resolve:
- 1. Verify the target IP is reachable from the ESXi host (
vmkping from ESXi shell) - Check that the iSCSI target is correctly configured: INLINECODE42
- Wait 15-30 seconds, then rescan again: INLINECODE43
"Password not found" error
The password environment variable is missing. Variable names follow the pattern VMWARE_<TARGET_NAME_UPPER>_PASSWORD where hyphens become underscores. Example: target my-vcenter needs VMWARE_MY_VCENTER_PASSWORD. Check your ~/.vmware-storage/.env file.
Doctor reports ".env permissions too open"
The .env file contains passwords and must have owner-only permissions:
CODEBLOCK4
Connection timeout to vCenter
The doctor command tests connectivity with a 5-second TCP timeout. If your vCenter is on a high-latency network, the check may fail even though the connection works. Use --skip-auth to bypass both connectivity and auth checks, then test manually.
Safety
- - No VM operations: This skill cannot power on/off, create, delete, or modify VMs — that scope belongs to INLINECODE51
- Read-heavy: 6 of 11 tools are read-only (list, browse, scan, status, health, capacity)
- Audit logging: All operations (including reads) are logged to
~/.vmware/audit.db (SQLite WAL, via vmware-policy) with timestamp, user, target, operation, parameters, and result - Double confirmation: CLI write commands (iSCSI enable, add/remove target) require two separate "Are you sure?" prompts before executing
- Dry-run mode: All write commands support
--dry-run to preview API calls without executing - Input validation: IP addresses validated via
ipaddress.ip_address(), ports checked for 1-65535 range, host/cluster/datastore names looked up before operations - Prompt injection defense: Datastore file names and paths from vSphere are sanitized via
_sanitize() — strips control characters (C0/C1), truncates to 500 chars — preventing malicious file names from injecting instructions into downstream LLM agents - Credential safety: Passwords loaded only from environment variables (
.env file), never from config.yaml; .env permissions are checked at startup
Full security details: see INLINECODE59
Setup
CODEBLOCK5
All tools are automatically audited via vmware-policy. Audit logs: INLINECODE60
Full setup guide with multi-target config, MCP server setup, and Docker: see INLINECODE61
Architecture
CODEBLOCK6
The MCP server uses stdio transport (local only, no network listener). Connections to vSphere use SSL/TLS on port 443.
Audit & Safety
All operations are automatically audited via vmware-policy (@vmware_tool decorator):
- - Every tool call logged to
~/.vmware/audit.db (SQLite, framework-agnostic) - Policy rules enforced via
~/.vmware/rules.yaml (deny rules, maintenance windows, risk levels) - Risk classification: each tool tagged as low/medium/high/critical
- View recent operations: INLINECODE65
- View denied operations: INLINECODE66
vmware-policy is automatically installed as a dependency — no manual setup needed.
License
MIT — github.com/zw008/VMware-Storage
VMware 存储
免责声明:这是一个由社区维护的开源项目,与 VMware, Inc. 或 Broadcom Inc. 无任何关联、认可或赞助关系。VMware 和 vSphere 是 Broadcom 的商标。源代码在 github.com/zw008/VMware-Storage 以 MIT 许可证公开审计。
VMware vSphere 存储管理 — 11 个 MCP 工具,用于数据存储、iSCSI 和 vSAN。
从 vmware-aiops 拆分而来,以实现更轻量的上下文和本地模型兼容性。
配套技能:vmware-aiops(VM 生命周期)、vmware-monitor(只读监控)、vmware-vks(Tanzu Kubernetes)、vmware-nsx(NSX 网络)、vmware-nsx-security(DFW/防火墙)、vmware-aria(指标/告警/容量)、vmware-avi(AVI/ALB/AKO)。
| vmware-pilot(工作流编排)| vmware-policy(审计/策略)
此技能的功能
| 类别 | 工具 | 数量 |
|---|
| 数据存储 | 列出所有数据存储、浏览文件、扫描 OVA/ISO/OVF/VMDK 镜像、列出缓存镜像 | 4 |
| iSCSI |
启用适配器、显示状态、添加目标、移除目标、重新扫描 HBA | 5 |
|
vSAN | 集群健康摘要、容量概览(总容量/已用/可用) | 2 |
快速安装
bash
uv tool install vmware-storage
vmware-storage doctor
何时使用此技能
- - 浏览数据存储文件或扫描可部署镜像(OVA/ISO/VMDK)
- 配置 iSCSI:启用适配器、添加/移除发送目标、重新扫描存储
- 检查 vSAN 集群健康和容量
- 任何以存储为中心的 VMware 操作
使用配套技能处理:
- - VM 生命周期、部署、客户机操作 → vmware-aiops
- 清单、健康、告警、事件 → vmware-monitor
- Tanzu Kubernetes → vmware-vks
- 负载均衡、AVI/ALB、AKO、Ingress → vmware-avi
相关技能 — 技能路由
| 用户意图 | 推荐技能 |
|---|
| 只读监控、告警、事件 | vmware-monitor |
| 存储:iSCSI、vSAN、数据存储 |
vmware-storage ← 此技能 |
| VM 生命周期、部署、客户机操作 |
vmware-aiops |
| Tanzu Kubernetes(vSphere 8.x+) |
vmware-vks |
| NSX 网络:分段、网关、NAT |
vmware-nsx |
| NSX 安全:DFW 规则、安全组 |
vmware-nsx-security |
| Aria Ops:指标、告警、容量规划 |
vmware-aria |
| 带审批的多步骤工作流 |
vmware-pilot |
| 负载均衡器、AVI、ALB、AKO、Ingress |
vmware-avi(uv tool install vmware-avi) |
| 审计日志查询 |
vmware-policy(vmware-audit CLI) |
常见工作流
在主机上设置 iSCSI 存储
- 1. 启用 iSCSI 适配器 → vmware-storage iscsi enable esxi-01
- 添加目标 → vmware-storage iscsi add-target esxi-01 <iscsi-target-ip>
- 验证 → vmware-storage iscsi status esxi-01
add-target 命令在添加目标后会自动重新扫描存储。如果之后需要额外重新扫描:
- 4. 重新扫描 → vmware-storage iscsi rescan esxi-01
先试运行:在任何写入命令后附加 --dry-run 以预览而不执行:
bash
vmware-storage iscsi enable esxi-01 --dry-run
vmware-storage iscsi add-target esxi-01 <iscsi-target-ip> --dry-run
跨数据存储查找可部署镜像
- 1. 列出所有数据存储 → vmware-storage datastore list
- 扫描数据存储中的镜像 → vmware-storage datastore scan-images datastore01
- 使用模式浏览 → vmware-storage datastore browse datastore01 --pattern *.iso
- 如果未找到数据存储 → 使用 vmware-storage datastore list --target 验证名称。数据存储名称区分大小写。
要按类型或数据存储过滤缓存结果,请使用 listcachedimages MCP 工具,并传入 image_type 和 datastore 参数。
vSAN 健康评估
- 1. 检查健康 → vmware-storage vsan health Cluster-Prod
- 检查容量 → vmware-storage vsan capacity Cluster-Prod
- 如果发现问题,使用 vmware-monitor 调查告警和事件
- 如果未启用 vSAN → 此集群可能未使用 vSAN。使用 vmware-monitor inventory clusters 检查集群类型
多目标操作
所有命令都接受 --target 参数,以针对配置中的特定 vCenter 或 ESXi 主机进行操作:
bash
默认目标(config.yaml 中的第一个)
vmware-storage datastore list
特定目标
vmware-storage datastore list --target prod-vcenter
vmware-storage iscsi status esxi-lab --target lab-esxi
使用模式
| 场景 | 推荐 | 原因 |
|---|
| 本地/小型模型(Ollama、Qwen) | CLI | 约 2K token vs MCP 的约 8K |
| 云端模型(Claude、GPT-4o) |
两者均可 | MCP 提供结构化 JSON I/O |
| 自动化流水线 |
MCP | 类型安全参数、结构化输出 |
MCP 工具(11 个 — 6 个读取、5 个写入)
所有 MCP 工具都接受可选的 target 参数,用于选择要连接的 vCenter/ESXi。
| 类别 | 工具 | 类型 | 描述 |
|---|
| 数据存储 | listalldatastores | 读取 | 列出数据存储,包含容量、使用率百分比、VM 数量 |
|
browse_datastore | 读取 | 浏览文件,支持可选路径和 glob 模式 |
| | scan
datastoreimages | 读取 | 在数据存储中查找 OVA/ISO/OVF/VMDK |
| | list
cachedimages | 读取 | 使用类型/数据存储过滤器查询本地镜像注册表 |
| iSCSI | storage
iscsistatus | 读取 | 显示适配器状态、HBA 设备、IQN、发送目标 |
| | storage
iscsienable | 写入 | 在主机上启用软件 iSCSI 适配器 |
| | storage
iscsiadd_target | 写入 | 添加 iSCSI 发送目标(IP + 端口)并重新扫描 |
| | storage
iscsiremove_target | 写入 | 移除 iSCSI 发送目标并重新扫描 |
| | storage_rescan | 写入 | 重新扫描所有 HBA 和 VMFS 卷 |
| vSAN | vsan_health | 读取 | 集群健康摘要和磁盘组详情 |
| | vsan_capacity | 读取 | 总容量/已用/可用容量(GB)及使用率百分比 |
读/写分离:6 个工具为只读,5 个修改状态。写入工具需要显式参数(主机名、IP 地址)并记录审计日志。
CLI 快速参考
bash
数据存储
vmware-storage