vmware-vdi 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. vmware_vdi-1.0.0/PKG-INFO +48 -0
  2. vmware_vdi-1.0.0/README-CN.md +42 -0
  3. vmware_vdi-1.0.0/README.md +27 -0
  4. vmware_vdi-1.0.0/RELEASE_NOTES.md +33 -0
  5. vmware_vdi-1.0.0/SECURITY.md +50 -0
  6. vmware_vdi-1.0.0/pyproject.toml +60 -0
  7. vmware_vdi-1.0.0/server.json +19 -0
  8. vmware_vdi-1.0.0/skills/vmware-vdi/SKILL.md +199 -0
  9. vmware_vdi-1.0.0/skills/vmware-vdi/references/capabilities.md +54 -0
  10. vmware_vdi-1.0.0/skills/vmware-vdi/references/cli-reference.md +55 -0
  11. vmware_vdi-1.0.0/skills/vmware-vdi/references/setup-guide.md +73 -0
  12. vmware_vdi-1.0.0/tests/eval/regression/test_catalog_tasks.py +100 -0
  13. vmware_vdi-1.0.0/tests/eval/regression/test_machines_pools.py +155 -0
  14. vmware_vdi-1.0.0/tests/eval/regression/test_monitor.py +101 -0
  15. vmware_vdi-1.0.0/tests/eval/regression/test_review_fixes.py +122 -0
  16. vmware_vdi-1.0.0/tests/eval/regression/test_sessions.py +137 -0
  17. vmware_vdi-1.0.0/tests/eval/spec/horizon_endpoints.py +76 -0
  18. vmware_vdi-1.0.0/uv.lock +1345 -0
  19. vmware_vdi-1.0.0/vmware_vdi/__init__.py +3 -0
  20. vmware_vdi-1.0.0/vmware_vdi/cli/__init__.py +84 -0
  21. vmware_vdi-1.0.0/vmware_vdi/cli/_common.py +63 -0
  22. vmware_vdi-1.0.0/vmware_vdi/cli/catalog.py +152 -0
  23. vmware_vdi-1.0.0/vmware_vdi/cli/machine.py +125 -0
  24. vmware_vdi-1.0.0/vmware_vdi/cli/monitor.py +93 -0
  25. vmware_vdi-1.0.0/vmware_vdi/cli/pool.py +92 -0
  26. vmware_vdi-1.0.0/vmware_vdi/cli/session.py +134 -0
  27. vmware_vdi-1.0.0/vmware_vdi/config.py +219 -0
  28. vmware_vdi-1.0.0/vmware_vdi/connection.py +329 -0
  29. vmware_vdi-1.0.0/vmware_vdi/doctor.py +76 -0
  30. vmware_vdi-1.0.0/vmware_vdi/init_wizard.py +145 -0
  31. vmware_vdi-1.0.0/vmware_vdi/mcp_server/__init__.py +0 -0
  32. vmware_vdi-1.0.0/vmware_vdi/mcp_server/_shared.py +55 -0
  33. vmware_vdi-1.0.0/vmware_vdi/mcp_server/server.py +46 -0
  34. vmware_vdi-1.0.0/vmware_vdi/mcp_server/tools/__init__.py +1 -0
  35. vmware_vdi-1.0.0/vmware_vdi/mcp_server/tools/catalog.py +62 -0
  36. vmware_vdi-1.0.0/vmware_vdi/mcp_server/tools/entitlement.py +84 -0
  37. vmware_vdi-1.0.0/vmware_vdi/mcp_server/tools/farm.py +27 -0
  38. vmware_vdi-1.0.0/vmware_vdi/mcp_server/tools/machine.py +129 -0
  39. vmware_vdi-1.0.0/vmware_vdi/mcp_server/tools/monitor.py +90 -0
  40. vmware_vdi-1.0.0/vmware_vdi/mcp_server/tools/pool.py +99 -0
  41. vmware_vdi-1.0.0/vmware_vdi/mcp_server/tools/session.py +163 -0
  42. vmware_vdi-1.0.0/vmware_vdi/mcp_server/tools/task.py +57 -0
  43. vmware_vdi-1.0.0/vmware_vdi/notify/__init__.py +1 -0
  44. vmware_vdi-1.0.0/vmware_vdi/notify/audit.py +70 -0
  45. vmware_vdi-1.0.0/vmware_vdi/ops/__init__.py +1 -0
  46. vmware_vdi-1.0.0/vmware_vdi/ops/_errors.py +13 -0
  47. vmware_vdi-1.0.0/vmware_vdi/ops/_fetch.py +57 -0
  48. vmware_vdi-1.0.0/vmware_vdi/ops/_paging.py +22 -0
  49. vmware_vdi-1.0.0/vmware_vdi/ops/apps.py +28 -0
  50. vmware_vdi-1.0.0/vmware_vdi/ops/entitlements.py +113 -0
  51. vmware_vdi-1.0.0/vmware_vdi/ops/farms.py +37 -0
  52. vmware_vdi-1.0.0/vmware_vdi/ops/images.py +39 -0
  53. vmware_vdi-1.0.0/vmware_vdi/ops/machines.py +173 -0
  54. vmware_vdi-1.0.0/vmware_vdi/ops/monitor.py +133 -0
  55. vmware_vdi-1.0.0/vmware_vdi/ops/pools.py +139 -0
  56. vmware_vdi-1.0.0/vmware_vdi/ops/sessions.py +204 -0
  57. vmware_vdi-1.0.0/vmware_vdi/ops/tasks.py +58 -0
@@ -0,0 +1,48 @@
1
+ Metadata-Version: 2.4
2
+ Name: vmware-vdi
3
+ Version: 1.0.0
4
+ Summary: VMware/Omnissa Horizon VDI intelligent operations — pools, sessions, machines, entitlements, images (MCP + CLI)
5
+ Author-email: Wei Zhou <wei-wz.zhou@broadcom.com>
6
+ License-Expression: MIT
7
+ Keywords: ai-ops,desktop,euc,horizon,mcp,omnissa,vdi,vmware
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Topic :: System :: Systems Administration
12
+ Requires-Python: >=3.10
13
+ Requires-Dist: httpx<1.0,>=0.27
14
+ Requires-Dist: mcp[cli]<2.0,>=1.10
15
+ Requires-Dist: python-dotenv<2.0,>=1.0
16
+ Requires-Dist: pyyaml<7.0,>=6.0
17
+ Requires-Dist: rich<15.0,>=13.0
18
+ Requires-Dist: typer<1.0,>=0.12
19
+ Requires-Dist: vmware-policy<2.0,>=1.8.8
20
+ Description-Content-Type: text/markdown
21
+
22
+ <!-- mcp-name: io.github.zw008/vmware-vdi -->
23
+
24
+ # VMware VDI (Horizon)
25
+
26
+ AI-powered VMware / Omnissa **Horizon VDI** intelligent operations — desktop pools, RDS farms, **user
27
+ sessions**, desktop machines, entitlements, events/health, statistics, and instant-clone image push,
28
+ through the Horizon 8 Connection Server REST API. MCP server + CLI, part of the VMware skill family.
29
+
30
+ > **Disclaimer**: Community-maintained open-source project, **not affiliated with, endorsed by, or
31
+ > sponsored by VMware, Inc., Broadcom Inc., or Omnissa, LLC.** "VMware", "Horizon", and "Omnissa" are
32
+ > trademarks of their respective owners. Source is publicly auditable under the MIT license.
33
+
34
+ > **Status: in development (v1.0.0).** Design in `design/vmware-vdi-skill-design.md`. Tool surface
35
+ > (15 read / 14 write across monitoring / statistics / management / ops actions / tasks) is landing
36
+ > vertical by vertical — **sessions first**. Governed by the family harness (audit + policy + teaching
37
+ > errors); authorization is delegated to the Horizon admin account's role (a read-only role refuses
38
+ > writes at the Connection Server).
39
+
40
+ ## Companion skills
41
+
42
+ - [vmware-aiops](https://github.com/zw008/VMware-AIops) — the vCenter VMs backing the desktops
43
+ - [vmware-monitor](https://github.com/zw008/VMware-Monitor) — read-only vSphere monitoring
44
+ - [vmware-nsx-security](https://github.com/zw008/VMware-NSX-Security) — desktop microsegmentation
45
+
46
+ ## License
47
+
48
+ MIT
@@ -0,0 +1,42 @@
1
+ <!-- mcp-name: io.github.zw008/vmware-vdi -->
2
+
3
+ # VMware VDI (Horizon)
4
+
5
+ AI 驱动的 VMware / Omnissa **Horizon VDI** 智能运维 —— 桌面池、RDS 农场、**用户会话**、桌面机器、授权、
6
+ 事件/健康/统计、即时克隆金像推送,通过 **Horizon 8 Connection Server REST API**(以 Horizon 8 为主,
7
+ 兼容最新 Omnissa Horizon,同一套 `/rest/v1` API)。MCP server + CLI,VMware skill 家族成员。
8
+
9
+ > **声明**:社区维护的开源项目,**与 VMware, Inc.、Broadcom Inc.、Omnissa, LLC. 无任何隶属、背书或赞助关系。**
10
+ > "VMware"、"Horizon"、"Omnissa" 为各自商标。源码遵循 MIT 许可,公开可审计。
11
+
12
+ > **状态:v1.0.0(beta)。** REST 端点已对照官方 Horizon Server API 核实;GET 响应字段投影为防御式,
13
+ > 待真机 Connection Server 验证(在真实 Horizon 上跑一次 `vmware-vdi init` 即可确认)。由家族 harness
14
+ > 治理(审计 + 策略 + 教学性错误);读写授权交由 Horizon 管理账号的角色(RBAC)。
15
+
16
+ ## 能力(27 工具:16 读 / 11 写)
17
+
18
+ | 类别 | 工具 |
19
+ |------|------|
20
+ | **监控** | 健康速览、会话 列表/详情、机器 列表/详情、事件列表 |
21
+ | **统计** | 会话并发统计、按池利用率 |
22
+ | **管理** | 池/农场/应用池/授权/镜像 列表、AD 搜索;池 启用/禁用、授权 增/删 |
23
+ | **运维动作** | 会话 注销/断开/发消息、机器 重置/维护/移除 |
24
+ | **任务** | 任务状态;镜像推送、任务取消 |
25
+
26
+ 破坏性写操作预览爆炸半径、CLI 双重确认、`--dry-run`、统一审计到 `~/.vmware/audit.db`。
27
+ `pool_push_image` 重建整池桌面,爆炸半径最高,预览报受影响桌面数 + 在线用户数。
28
+
29
+ ## 快速开始
30
+ ```bash
31
+ uv tool install vmware-vdi
32
+ vmware-vdi init # 友好向导:连接 Connection Server 并发现你的桌面池
33
+ vmware-vdi doctor
34
+ ```
35
+
36
+ ## Companion Skills
37
+ - [vmware-aiops](https://github.com/zw008/VMware-AIops) —— 桌面背后的 vCenter 虚机
38
+ - [vmware-monitor](https://github.com/zw008/VMware-Monitor) —— 只读 vSphere 监控
39
+ - [vmware-nsx-security](https://github.com/zw008/VMware-NSX-Security) —— 桌面微隔离
40
+
41
+ ## License
42
+ MIT
@@ -0,0 +1,27 @@
1
+ <!-- mcp-name: io.github.zw008/vmware-vdi -->
2
+
3
+ # VMware VDI (Horizon)
4
+
5
+ AI-powered VMware / Omnissa **Horizon VDI** intelligent operations — desktop pools, RDS farms, **user
6
+ sessions**, desktop machines, entitlements, events/health, statistics, and instant-clone image push,
7
+ through the Horizon 8 Connection Server REST API. MCP server + CLI, part of the VMware skill family.
8
+
9
+ > **Disclaimer**: Community-maintained open-source project, **not affiliated with, endorsed by, or
10
+ > sponsored by VMware, Inc., Broadcom Inc., or Omnissa, LLC.** "VMware", "Horizon", and "Omnissa" are
11
+ > trademarks of their respective owners. Source is publicly auditable under the MIT license.
12
+
13
+ > **Status: in development (v1.0.0).** Design in `design/vmware-vdi-skill-design.md`. Tool surface
14
+ > (15 read / 14 write across monitoring / statistics / management / ops actions / tasks) is landing
15
+ > vertical by vertical — **sessions first**. Governed by the family harness (audit + policy + teaching
16
+ > errors); authorization is delegated to the Horizon admin account's role (a read-only role refuses
17
+ > writes at the Connection Server).
18
+
19
+ ## Companion skills
20
+
21
+ - [vmware-aiops](https://github.com/zw008/VMware-AIops) — the vCenter VMs backing the desktops
22
+ - [vmware-monitor](https://github.com/zw008/VMware-Monitor) — read-only vSphere monitoring
23
+ - [vmware-nsx-security](https://github.com/zw008/VMware-NSX-Security) — desktop microsegmentation
24
+
25
+ ## License
26
+
27
+ MIT
@@ -0,0 +1,33 @@
1
+ ## v1.0.0 (beta) — first release
2
+
3
+ The family's 14th skill: **vmware-vdi** — VMware/Omnissa Horizon VDI intelligent operations through the
4
+ Horizon 8 Connection Server REST API. Independent version line (not aligned to the family's 1.8.x).
5
+
6
+ **27 MCP tools (16 read / 11 write)** + full CLI parity, across monitoring / statistics / management /
7
+ ops-actions / tasks:
8
+ - **Sessions** — list/get, logoff, disconnect, send-message (help-desk core).
9
+ - **Machines** — list/get, reset, enter/exit maintenance, remove.
10
+ - **Pools** — list/get, enable/disable, **push-image** (recreates every desktop; highest blast radius in
11
+ the family — preview states affected-desktop + in-session-user counts).
12
+ - **Monitoring & statistics** — one-glance health, session stats, pool utilization, audit events.
13
+ - **Catalog & access** — farms, application pools, instant-clone images, AD search, entitlement
14
+ list/add/remove.
15
+ - **Tasks** — pool-scoped task status + cancel (image push / provisioning).
16
+
17
+ **Governance (family harness)**: every write goes through `@vmware_tool`/`@guarded` → `~/.vmware/audit.db`;
18
+ destructive CLI writes double-confirm + `--dry-run`; Connection-Server text is `sanitize()`d; authorization
19
+ is delegated to the Horizon admin role (a read-only role refuses writes at the server, un-bypassably).
20
+
21
+ **Friendly onboarding**: `vmware-vdi init` connects to a Connection Server and discovers your pools,
22
+ machines, and sessions with next-step hints.
23
+
24
+ **Supported**: Horizon 8.x (primary) and the latest Omnissa Horizon (2406/2412+); same `/rest/v1` API.
25
+
26
+ ### Beta caveat (please read)
27
+ REST **endpoints** are verified against the official Horizon Server API operation index. GET-response
28
+ **field names** and a few write bodies are defensive (`.get()` with fallbacks) and **pending validation
29
+ against a live Connection Server** — on a field-name mismatch a list reads empty rather than crashing.
30
+ First production use should run `vmware-vdi init` on a real Horizon 8 and confirm the session/machine/pool
31
+ projections and the apply-image / entitlement bodies; please file an issue with raw `*_get` output if a
32
+ projection looks empty. Quality: 32 regression tests, ruff clean, bandit 0 issues, tool endpoints pinned
33
+ to a verified spec set.
@@ -0,0 +1,50 @@
1
+ # Security Policy
2
+
3
+ ## Disclaimer
4
+ Community-maintained open-source project, **not affiliated with, endorsed by, or sponsored by VMware,
5
+ Inc., Broadcom Inc., or Omnissa, LLC.** "VMware", "Horizon", and "Omnissa" are trademarks of their
6
+ respective owners.
7
+
8
+ ## Reporting Vulnerabilities
9
+ Please open a GitHub private security advisory at https://github.com/zw008/VMware-VDI/security/advisories
10
+ or email the maintainer. Do not file public issues for security reports.
11
+
12
+ ## Security Design
13
+
14
+ ### Credential Management
15
+ - Passwords live only in `~/.vmware-vdi/.env` (chmod 600), obfuscated to `b64:` at rest (obfuscation, not
16
+ encryption; defeats casual grep / shoulder-surfing). Config files hold host/username/domain only.
17
+ - Per-target env vars `VMWARE_VDI_<TARGET>_PASSWORD` can be injected from a secret manager.
18
+ - Username + password are resolved together on every call so a rotated credential never half-updates.
19
+
20
+ ### Authorization — delegated to Horizon RBAC
21
+ The skill ships full read+write and does not gate read-vs-write itself. Point a target at a read-only
22
+ Horizon admin role and every write is refused at the Connection Server, un-bypassably — the one place the
23
+ control cannot be stepped around by a shell.
24
+
25
+ ### Destructive-operation safety
26
+ `session_logoff`, `machine_reset`, `machine_remove`, `pool_set_enabled` (disable), `entitlement_remove`,
27
+ `pool_push_image`, and `task_cancel` preview their blast radius, require CLI double-confirmation, and
28
+ support `--dry-run`. `pool_push_image` (recreates every desktop in a pool) reports affected-desktop and
29
+ in-session-user counts before any confirm.
30
+
31
+ ### SSL/TLS Verification
32
+ On by default. `verify_ssl: false` is per-target and intended only for self-signed lab certificates.
33
+
34
+ ### Transitive Dependencies
35
+ Runtime deps: httpx, typer, rich, pyyaml, python-dotenv, mcp, and `vmware-policy` (the family's shared
36
+ audit/policy harness). No urllib3, no requests.
37
+
38
+ ### Prompt Injection Protection
39
+ All Connection-Server-supplied text is passed through `vmware_policy.sanitize()` (truncation +
40
+ C0/C1 control-character stripping) before it reaches the model.
41
+
42
+ ## Static Analysis
43
+ ```bash
44
+ uvx bandit -r vmware_vdi/ # 0 issues at all severities as of v1.0.0
45
+ ```
46
+
47
+ ## Supported Versions
48
+ | Version | Supported |
49
+ |---------|-----------|
50
+ | 1.0.x | ✅ (beta) |
@@ -0,0 +1,60 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "vmware-vdi"
7
+ version = "1.0.0"
8
+ description = "VMware/Omnissa Horizon VDI intelligent operations — pools, sessions, machines, entitlements, images (MCP + CLI)"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
+ authors = [{ name = "Wei Zhou", email = "wei-wz.zhou@broadcom.com" }]
13
+ keywords = ["vmware", "omnissa", "horizon", "vdi", "desktop", "euc", "mcp", "ai-ops"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Python :: 3",
18
+ "Topic :: System :: Systems Administration",
19
+ ]
20
+ dependencies = [
21
+ "httpx>=0.27,<1.0",
22
+ "typer>=0.12,<1.0",
23
+ "rich>=13.0,<15.0",
24
+ "pyyaml>=6.0,<7.0",
25
+ "python-dotenv>=1.0,<2.0",
26
+ "mcp[cli]>=1.10,<2.0",
27
+ "vmware-policy>=1.8.8,<2.0",
28
+ ]
29
+
30
+ [project.scripts]
31
+ vmware-vdi = "vmware_vdi.cli:app"
32
+ vmware-vdi-mcp = "vmware_vdi.mcp_server.server:main"
33
+
34
+ [tool.hatch.build.targets.wheel]
35
+ packages = ["vmware_vdi"]
36
+
37
+ [tool.pytest.ini_options]
38
+ testpaths = ["tests"]
39
+ markers = [
40
+ "capability: Capability evals — scored trends, not pass/fail gates. Excluded from the default run. Run with: pytest -m capability",
41
+ ]
42
+ addopts = "-m 'not capability'"
43
+
44
+ [dependency-groups]
45
+ dev = [
46
+ "pytest>=8.0,<10.0",
47
+ "pytest-cov>=5.0,<8.0",
48
+ "ruff>=0.5,<1.0",
49
+ ]
50
+
51
+ [tool.ruff]
52
+ line-length = 120
53
+ target-version = "py310"
54
+
55
+ [tool.ruff.lint.per-file-ignores]
56
+ # 踩坑 #33: MCP-server modules are reflected by FastMCP/Pydantic at import time.
57
+ # Tool-signature annotations must stay `Optional[X]` — the PEP 604 `X | None` form
58
+ # can raise `subclass() arg 1 must be a class` under older interpreters. Never let
59
+ # pyupgrade (UP007/UP045) rewrite them in the reflected files.
60
+ "vmware_vdi/mcp_server/**/*.py" = ["UP007", "UP045"]
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json",
3
+ "name": "io.github.zw008/vmware-vdi",
4
+ "description": "VMware/Omnissa Horizon VDI intelligent operations — pools, sessions, machines, entitlements, images",
5
+ "version": "1.0.0",
6
+ "packages": [
7
+ {
8
+ "registry_type": "pypi",
9
+ "registry_base_url": "https://pypi.org",
10
+ "identifier": "vmware-vdi",
11
+ "version": "1.0.0",
12
+ "transport": { "type": "stdio" }
13
+ }
14
+ ],
15
+ "repository": {
16
+ "url": "https://github.com/zw008/VMware-VDI",
17
+ "source": "github"
18
+ }
19
+ }
@@ -0,0 +1,199 @@
1
+ ---
2
+ name: vmware-vdi
3
+ description: >
4
+ Use this skill whenever the user needs to operate a VMware/Omnissa Horizon VDI environment via its
5
+ Connection Server: list and manage desktop pools, RDS farms and published apps, inspect and act on
6
+ user sessions (log off, disconnect, send message), manage desktop machines (reset, maintenance,
7
+ remove), view and change entitlements, read Horizon events/health/statistics, and push instant-clone
8
+ golden images. Always use this skill for "log off VDI user", "reset this desktop", "why is the desktop
9
+ pool not provisioning", "push the new image to the pool", "list Horizon sessions", "who is entitled to
10
+ the pool", "VDI health" — when the context is explicitly Horizon / Omnissa / VDI / desktop-pool /
11
+ RDS-farm. Do NOT use for the underlying vCenter VM lifecycle/power/snapshot/migrate (use vmware-aiops),
12
+ read-only vSphere monitoring (use vmware-monitor), or NSX microsegmentation (use vmware-nsx-security).
13
+ This skill manages the Horizon broker layer; vmware-aiops manages the vCenter VMs backing the desktops.
14
+ installer:
15
+ kind: uv
16
+ package: vmware-vdi
17
+ allowed-tools:
18
+ - Bash
19
+ metadata: {"openclaw":{"requires":{"env":["VMWARE_VDI_CONFIG"],"bins":["vmware-vdi"],"config":["~/.vmware-vdi/config.yaml"]},"primaryEnv":"VMWARE_VDI_CONFIG"}}
20
+ ---
21
+
22
+ # VMware VDI (Horizon)
23
+
24
+ > **Disclaimer**: Community-maintained open-source project, **not affiliated with, endorsed by, or
25
+ > sponsored by VMware, Inc., Broadcom Inc., or Omnissa, LLC.** "VMware", "Horizon", and "Omnissa" are
26
+ > trademarks of their respective owners. Source is publicly auditable under the MIT license.
27
+
28
+ Horizon VDI intelligent operations for the VMware skill family — desktop pools, RDS farms, **user
29
+ sessions**, desktop machines, entitlements, events/health/statistics, and instant-clone image push,
30
+ through the **Horizon 8 Connection Server REST API** (primary; also targets the latest Omnissa Horizon,
31
+ which shares the same `/rest/v1` API lineage).
32
+
33
+ > **Companion skills**: [vmware-aiops](https://github.com/zw008/VMware-AIops) (the vCenter VMs backing
34
+ > the desktops), [vmware-monitor](https://github.com/zw008/VMware-Monitor) (read-only vSphere),
35
+ > [vmware-nsx-security](https://github.com/zw008/VMware-NSX-Security) (desktop microsegmentation).
36
+
37
+ > **Status: v1.0.0 (beta).** Endpoints are verified against the official Horizon Server API; GET-response
38
+ > field projections are defensive and pending validation against a live Connection Server (run
39
+ > `vmware-vdi init` on a real Horizon once to confirm). Governed by the family harness (audit + policy +
40
+ > teaching errors); authorization is delegated to the Horizon admin account's role.
41
+
42
+ ## What This Skill Does
43
+
44
+ | Category | Tools | Count | Read/Write |
45
+ |----------|-------|:-----:|:----------:|
46
+ | **Monitoring** | health summary, session list/get, machine list/get, event list | 6 | 6 R |
47
+ | **Statistics** | session concurrency stats, per-pool utilization | 2 | 2 R |
48
+ | **Management** | pool list/get, farm list, app-pool list, entitlement list, image list, AD search; pool enable/disable, entitlement add/remove | 9 | 7 R / 2 W |
49
+ | **Ops actions** | session logoff/disconnect/message, machine reset/maintenance/remove | 6 | 6 W |
50
+ | **Tasks** | task status; image push, task cancel | 3 | 1 R / 2 W |
51
+
52
+ **27 MCP tools (16 read / 11 write).** Reads are strictly non-destructive. Writes preview their blast
53
+ radius, are double-confirmed at the CLI, and are audit-logged.
54
+
55
+ ## Quick Install
56
+
57
+ ```bash
58
+ uv tool install vmware-vdi
59
+ vmware-vdi init # friendly setup: connect to a Connection Server + discover your pools
60
+ vmware-vdi doctor # verify config / credentials / connectivity
61
+ ```
62
+
63
+ ## When to Use This Skill
64
+
65
+ Use vmware-vdi for the **Horizon broker layer**: desktop pools, RDS farms, published apps, **user
66
+ sessions** (logoff/disconnect/message), desktop machine state (reset/maintenance/remove), entitlements,
67
+ Horizon events/health/statistics, and **instant-clone image push** — when the context is explicitly
68
+ Horizon / Omnissa / VDI / desktop-pool / RDS-farm.
69
+
70
+ **Do NOT use when**: the task is the underlying vCenter VM (power/snapshot/clone/migrate → **vmware-aiops**),
71
+ read-only vSphere inventory/alarms (→ **vmware-monitor**), or NSX microsegmentation of the desktops
72
+ (→ **vmware-nsx-security**). A Horizon desktop's *backing VM* is aiops; the *session/pool/broker* is vdi.
73
+
74
+ ## Related Skills — Skill Routing
75
+
76
+ | The user wants… | Skill |
77
+ |-----------------|-------|
78
+ | Log off / reset / re-image a Horizon desktop or session | **vmware-vdi** (this) |
79
+ | Power/snapshot/clone/migrate the backing vCenter VM | vmware-aiops |
80
+ | Read-only vSphere inventory / alarms / host health | vmware-monitor |
81
+ | Microsegment the desktop pool network | vmware-nsx-security |
82
+ | Multi-step VDI workflow with approval + rollback | vmware-pilot |
83
+
84
+ ## Common Workflows
85
+
86
+ **1. Help-desk: a user's desktop is stuck.**
87
+ ```
88
+ vmware-vdi session list --user alice # find their session + state
89
+ vmware-vdi machine list --state AGENT_UNREACHABLE # is the desktop broken?
90
+ vmware-vdi session logoff --user alice --dry-run # preview blast radius (which sessions)
91
+ vmware-vdi session logoff --user alice # double-confirm, then logs off + audits
92
+ ```
93
+ *Failure branch*: if `session list` returns a teaching 404/auth error, run `vmware-vdi doctor` — a
94
+ read-only Horizon role is enough for the reads but the account must be able to reach the Connection Server.
95
+
96
+ **2. Patch night: push a new golden image to a pool.**
97
+ ```
98
+ vmware-vdi image list # find the base VM + snapshot
99
+ vmware-vdi pool push-image --id pool-fin --dry-run # BLAST RADIUS: N desktops, M logged-in users
100
+ vmware-vdi pool set-enabled --id pool-fin --disable # optional: stop new logins first
101
+ vmware-vdi pool push-image --id pool-fin # double-confirm; returns a task
102
+ vmware-vdi task status --pool pool-fin # track progress
103
+ ```
104
+ *Failure branch*: if the preview shows logged-in users you did not expect, `session send-message --user …`
105
+ to warn them, or push with `--force-logoff` only after confirming impact.
106
+
107
+ **3. Onboard a group to a pool.**
108
+ ```
109
+ vmware-vdi ad-search "Finance" # resolve the AD group → its SID
110
+ vmware-vdi entitlement add --pool pool-fin --sid <SID>
111
+ vmware-vdi entitlement list --pool pool-fin # verify
112
+ ```
113
+ *Failure branch*: `ad-search` returning nothing usually means the domain in `~/.vmware-vdi/config.yaml`
114
+ is wrong — re-run `vmware-vdi init --force`.
115
+
116
+ ## Usage Mode
117
+
118
+ - **CLI** — interactive help-desk work, scripting, small/local models (lower context cost).
119
+ - **MCP** — agent-driven operations with structured output; run `vmware-vdi mcp` (an installed console
120
+ script, so no `uvx` network re-resolve — works through enterprise TLS proxies).
121
+
122
+ ## MCP Tools (27 — 16 read, 11 write)
123
+
124
+ | Category | Tools | R/W |
125
+ |----------|-------|:---:|
126
+ | Monitoring | `health_summary`, `session_list`, `session_get`, `machine_list`, `machine_get`, `event_list` | Read |
127
+ | Statistics | `session_stats`, `pool_utilization` | Read |
128
+ | Management (read) | `pool_list`, `pool_get`, `farm_list`, `app_pool_list`, `entitlement_list`, `image_list`, `ad_user_search` | Read |
129
+ | Tasks (read) | `task_status` | Read |
130
+ | Ops actions | `session_logoff`, `session_disconnect`, `session_send_message`, `machine_reset`, `machine_maintenance`, `machine_remove` | Write |
131
+ | Management (write) | `pool_set_enabled`, `entitlement_add`, `entitlement_remove` | Write |
132
+ | Tasks (write) | `pool_push_image`, `task_cancel` | Write |
133
+
134
+ **List envelope**: every `*_list` tool returns `{items, returned, limit, total, truncated, hint}` — read
135
+ rows from `items` and check `truncated` before concluding a listing is complete; empty `items` with
136
+ `truncated:false` means checked-and-none, not a failure. Lists are fetched with server-side pagination.
137
+
138
+ **Blast radius (normative)**: `pool_push_image` recreates **every desktop in the pool** — the highest
139
+ single-call blast radius in the family. Its preview states affected-desktop and in-session-user counts
140
+ before any confirm. `session_logoff` / `machine_reset` / `machine_remove` state their affected users/
141
+ machines and require double confirmation at the CLI.
142
+
143
+ **Read/write split**: 16 read-only tools (`[READ]` docstring marker), 11 modify state. All writes are
144
+ audit-logged; destructive ones (`session_logoff`, `machine_reset`, `machine_remove`, `pool_set_enabled`
145
+ disable, `entitlement_remove`, `pool_push_image`, `task_cancel`) require CLI double-confirmation and
146
+ support `--dry-run`.
147
+
148
+ ## CLI Quick Reference
149
+
150
+ ```bash
151
+ vmware-vdi init # friendly setup + pool discovery
152
+ vmware-vdi health # one-glance VDI health
153
+ vmware-vdi stats # session concurrency statistics
154
+ vmware-vdi utilization # per-pool desktop utilization
155
+ vmware-vdi session list [--user U] [--pool P] [--state CONNECTED]
156
+ vmware-vdi session logoff --user U [--dry-run] # double-confirm
157
+ vmware-vdi machine list [--pool P] [--state AGENT_UNREACHABLE]
158
+ vmware-vdi machine reset --id M [--dry-run] # hard reset; double-confirm
159
+ vmware-vdi machine maintenance --id M --enter|--exit
160
+ vmware-vdi pool list
161
+ vmware-vdi pool set-enabled --id P --enable|--disable
162
+ vmware-vdi pool push-image --id P [--force-logoff] [--dry-run] # highest blast radius
163
+ vmware-vdi task status --pool P [--task T]
164
+ vmware-vdi ad-search "<name>" # resolve AD SID for entitlement
165
+ vmware-vdi entitlement add|remove --pool P --sid <SID>
166
+ ```
167
+ Full list: `references/cli-reference.md`.
168
+
169
+ ## Troubleshooting
170
+
171
+ - **`Password not found. Set environment variable: VMWARE_VDI_<TARGET>_PASSWORD`** — run `vmware-vdi init`
172
+ (writes `~/.vmware-vdi/.env`, 0600), or export the var manually.
173
+ - **Login fails (HTTP 401/400)** — check `username`/`domain` in `~/.vmware-vdi/config.yaml`; Horizon
174
+ authenticates against the AD `domain`. A local Connection Server admin leaves `domain` blank.
175
+ - **`certificate could not be verified`** — for a self-signed lab cert set `verify_ssl: false` for that
176
+ target in the config.
177
+ - **A write is refused with "read-only role"** — that is RBAC working as designed. Point the target at a
178
+ Horizon admin role with write privilege, or keep the read-only account for read commands only.
179
+ - **`session list --pool` or a push-image preview shows 0 where you expect users** — on your Horizon
180
+ version a field name may differ; this is a beta known-limitation, please file an issue with the raw
181
+ `session_get` output so the projection can be pinned.
182
+
183
+ ## Audit & Safety
184
+
185
+ 1. **Source Code** — https://github.com/zw008/VMware-VDI (MIT).
186
+ 2. **Config File Contents** — `config.yaml` holds host/username/domain only; passwords live in
187
+ `~/.vmware-vdi/.env` (0600, obfuscated to `b64:` at rest — obfuscation, not encryption).
188
+ 3. **Webhook Data Scope** — none. This skill makes no outbound calls except to the configured
189
+ Connection Server.
190
+ 4. **TLS Verification** — on by default; `verify_ssl: false` is per-target and only for self-signed labs.
191
+ 5. **Prompt Injection Protection** — all Connection-Server-supplied text (user names, machine/pool names,
192
+ event messages) passes through `vmware_policy.sanitize()` (truncation + control-char stripping).
193
+ 6. **Least Privilege** — authorization is the Horizon account's job: a read-only Horizon admin role
194
+ refuses every write at the Connection Server, un-bypassably. All writes are recorded in
195
+ `~/.vmware/audit.db`. See `references/setup-guide.md`.
196
+
197
+ ## License
198
+
199
+ MIT
@@ -0,0 +1,54 @@
1
+ # vmware-vdi — Capabilities
2
+
3
+ 27 MCP tools (16 read / 11 write) over the Horizon 8 Connection Server REST API. Every tool accepts an
4
+ optional `target`. Typical response tokens are estimates for a small estate; lists paginate at 50.
5
+
6
+ ## Monitoring (6 read)
7
+ | Tool | R/W | Returns | ~tokens |
8
+ |------|:---:|---------|:------:|
9
+ | `health_summary` | R | session totals by state, problem-machine count, pool enabled/disabled | 80–200 |
10
+ | `session_list` | R | id, user, type, state, protocol, pool_id, machine_id, start_time (filter user/pool/state) | 60–500 |
11
+ | `session_get` | R | one session's projection | 40–100 |
12
+ | `machine_list` | R | id, name, pool_id, state, user, agent_version, base_image (filter pool/state) | 60–500 |
13
+ | `machine_get` | R | one machine's projection | 40–100 |
14
+ | `event_list` | R | time, severity, type, module, user, machine, message (filter severity) | 100–600 |
15
+
16
+ ## Statistics (2 read)
17
+ | Tool | R/W | Returns | ~tokens |
18
+ |------|:---:|---------|:------:|
19
+ | `session_stats` | R | current concurrent, by-state, by-protocol, top pools | 80–200 |
20
+ | `pool_utilization` | R | per-pool total/available/in-use/error + utilization % | 80–300 |
21
+
22
+ ## Management (7 read / 2 write)
23
+ | Tool | R/W | Notes | ~tokens |
24
+ |------|:---:|-------|:------:|
25
+ | `pool_list` / `pool_get` | R | pools: type, enabled, assignment | 60–300 |
26
+ | `farm_list` | R | RDS farms: type, enabled, server count | 40–200 |
27
+ | `app_pool_list` | R | published apps: farm, enabled, executable | 40–300 |
28
+ | `entitlement_list` | R | AD principals entitled to a pool | 40–300 |
29
+ | `image_list` | R | instant-clone base VMs + snapshots | 60–400 |
30
+ | `ad_user_search` | R | resolve AD name → SID (for `entitlement_add`) | 40–200 |
31
+ | `pool_set_enabled` | W | enable/disable pool (idempotent, preview) | 40–120 |
32
+ | `entitlement_add` / `entitlement_remove` | W | grant/revoke pool access by SID (preview) | 40–120 |
33
+
34
+ ## Ops actions (6 write) — help-desk
35
+ | Tool | R/W | Risk | Blast radius |
36
+ |------|:---:|:----:|--------------|
37
+ | `session_send_message` | W | low | informational, no disruption |
38
+ | `session_disconnect` | W | medium | one session, state preserved |
39
+ | `session_logoff` | W | high | kicks the user (profile write-back) |
40
+ | `machine_maintenance` | W | medium | drains a machine (no new sessions) |
41
+ | `machine_reset` | W | high | hard reset — user loses unsaved state |
42
+ | `machine_remove` | W | high | removes from pool; deletes VM for instant clones |
43
+
44
+ ## Tasks (1 read / 2 write)
45
+ | Tool | R/W | Notes |
46
+ |------|:---:|-------|
47
+ | `task_status` | R | pool-scoped task status/progress (or all tasks for the pool) |
48
+ | `pool_push_image` | W | **critical** — apply pending image; recreates EVERY desktop; preview states affected desktops + in-session users |
49
+ | `task_cancel` | W | cancel a running pool task (applied work is not rolled back) |
50
+
51
+ **Beta note (踩坑 #36)**: REST endpoints are verified against the official Horizon Server API operation
52
+ index. GET-response *field names* are defensive (`.get()` with fallbacks) and pending validation against a
53
+ live Connection Server — a mismatch yields empty results, not a crash. First real-Horizon use should
54
+ confirm the `session`/`machine`/`pool` projections and the `apply-image` / entitlement bodies.
@@ -0,0 +1,55 @@
1
+ # vmware-vdi — CLI Reference
2
+
3
+ All commands accept `--target/-t <name>` (config target) and `--config/-c <path>` (alternate config file).
4
+ Destructive commands accept `--dry-run` (preview only) and interactively double-confirm.
5
+
6
+ ## Setup & diagnostics
7
+ ```bash
8
+ vmware-vdi init [--force] [--skip-test] # friendly setup: prompt, write config + .env, test, discover pools
9
+ vmware-vdi doctor # config / credentials / connectivity checks
10
+ vmware-vdi mcp # run the MCP server (stdio) — the primary MCP entry point
11
+ ```
12
+
13
+ ## Monitoring & statistics (read-only)
14
+ ```bash
15
+ vmware-vdi health # session totals, problem machines, pool availability
16
+ vmware-vdi stats # concurrency by state/protocol, busiest pools
17
+ vmware-vdi utilization # per-pool total/available/in-use/error + utilization %
18
+ vmware-vdi events [--severity ERROR] # recent Horizon audit events (newest first)
19
+ ```
20
+
21
+ ## Sessions
22
+ ```bash
23
+ vmware-vdi session list [--user U] [--pool P] [--state CONNECTED|DISCONNECTED|PENDING]
24
+ vmware-vdi session logoff [--id S] [--user U] [--dry-run] # kicks the user; double-confirm
25
+ vmware-vdi session disconnect [--id S] [--user U] [--dry-run] # state preserved; double-confirm
26
+ vmware-vdi session message "<text>" [--user U] [--id S] [--type INFO|WARNING|ERROR]
27
+ ```
28
+
29
+ ## Machines
30
+ ```bash
31
+ vmware-vdi machine list [--pool P] [--state AGENT_UNREACHABLE|ERROR|...]
32
+ vmware-vdi machine reset --id M [--dry-run] # hard reset; double-confirm
33
+ vmware-vdi machine maintenance --id M --enter|--exit [--dry-run] # double-confirm
34
+ vmware-vdi machine remove --id M [--dry-run] # deletes VM (instant clone); double-confirm
35
+ ```
36
+
37
+ ## Pools, images, tasks
38
+ ```bash
39
+ vmware-vdi pool list
40
+ vmware-vdi pool set-enabled --id P --enable|--disable [--dry-run] # disable stops NEW sessions
41
+ vmware-vdi pool push-image --id P [--force-logoff] [--dry-run] # recreates EVERY desktop; double-confirm
42
+ vmware-vdi images # instant-clone base VMs + snapshots
43
+ vmware-vdi task status --pool P [--task T] # track an image push / provisioning
44
+ vmware-vdi task cancel --pool P --task T [--dry-run] # double-confirm
45
+ ```
46
+
47
+ ## Farms, apps, entitlements
48
+ ```bash
49
+ vmware-vdi farm list
50
+ vmware-vdi app-pool list
51
+ vmware-vdi ad-search "<name>" # resolve AD user/group → SID
52
+ vmware-vdi entitlement list --pool P
53
+ vmware-vdi entitlement add --pool P --sid <SID> [--sid <SID> ...] [--dry-run]
54
+ vmware-vdi entitlement remove --pool P --sid <SID> [--dry-run] # double-confirm
55
+ ```