cnv-lab-mcp
cnv-lab-mcp
用于在 GLPI 中预留实验室硬件、在 Jenkins 中触发 CNV 集群部署以及导入 ACM spoke 集群的 MCP 服务器。没有硬编码任何实例 URL、硬件名称或令牌——所有内容都来自工具参数或环境变量。
添加到 Cursor
Related MCP server: quads-mcp
先决条件
Node.js >= 20
一个 GLPI 个人 API 令牌(
My Settings→API tokens)。如果实例需要,可选的GLPI_APP_TOKEN。一个 Jenkins API 令牌(
User→Configure→API Token)以及短用户名,而不是电子邮件。user@example.com返回 401;user有效。GLPI 配置文件必须在目标实体上具有非零的
reservation权限。Jenkins 帐户需要对要触发的作业具有 Job/Build 和 Job/Read 权限。
内部 TLS / NODE_EXTRA_CA_CERTS
Node 的 fetch(undici)不像 curl 那样使用操作系统/钥匙串 CA 存储。如果 curl 有效但 MCP 服务器报告 fetch failed,请将 NODE_EXTRA_CA_CERTS 设置为你的内部 CA 捆绑包并重启 Cursor:
export NODE_EXTRA_CA_CERTS=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pemTLS 错误与通用网络故障分开报告,因此这并不神秘。
配置
复制 .env.example 并设置:
变量 | 必需 | 备注 |
| 是 | 带或不带 |
| 是 | 个人 API 令牌 |
| 否 | 仅当实例需要时 |
| 是 | Jenkins 根 URL |
| 是 | 短用户名(不是电子邮件) |
| 是 | API 令牌 |
示例 mcp.json 条目(通过环境变量插值获取机密):
{
"mcpServers": {
"cnv-lab-mcp": {
"command": "npx",
"args": ["-y", "cnv-lab-mcp"],
"env": {
"GLPI_BASE_URL": "https://glpi.example.internal",
"GLPI_USER_TOKEN": "${env:GLPI_USER_TOKEN}",
"JENKINS_BASE_URL": "https://jenkins.example.internal",
"JENKINS_USER": "${env:JENKINS_USER}",
"JENKINS_API_TOKEN": "${env:JENKINS_API_TOKEN}",
"NODE_EXTRA_CA_CERTS": "${env:NODE_EXTRA_CA_CERTS}"
}
}
}
}在包发布到 npm 之前,请将 args 指向此仓库:
"args": ["-y", "github:galkremer1/cnv-lab-mcp"]工具
预留:
list_reservable_items— 浏览 GLPI 可预留资产find_available_cluster— 匹配需求(结构化 + 自由文本注释)并按最早空闲时段排序。不进行预订。check_availability— 单个项目的预留 + 间隙reserve_cluster— 预订一个时间段;始终从会话设置users_idcancel_reservation— 释放预订
Jenkins:
trigger_jenkins_job— 通用触发器;start_at变为delay=NNNsecget_build_status— 队列/构建 + 控制台尾部abort_build— 停止构建
集群访问:
get_cluster_info— 来自*-data.zip的非敏感元数据和控制台/API URLget_cluster_kubeconfig— 仅在内存中获取auth/kubeconfig+auth/kubeadmin-password。集群管理员凭据;不要在聊天中回显它们。
ACM:
import_spoke_cluster— ManagedCluster + KlusterletAddonConfig,将导入清单应用到 spoke,轮询加入状态get_managed_cluster_status— hub 侧加入/可用条件
场景(预订前确认):
list_scenariosplan_scenario— 提出集群/时间段/参数,不进行任何预订execute_scenario— 根据计划进行预留 + 触发
内置场景位于 src/scenarios/catalog.json 中,可通过 PR 扩展:basic-bm-cnv、acm-hub-and-spoke、sriov-cnv-cluster。
开发
npm install
npm test
npm run lint
npm run typecheck
npm run build针对真实实例的手动冒烟测试(不在 CI 中运行):
npx tsx scripts/smoke.ts
SMOKE_JOB=deploy-ocp-bare-metal-cluster-with-abi-cnv-5.0 SMOKE_CLUSTER=example-cluster npx tsx scripts/smoke.ts安全
.env已被 gitignore。示例使用明显虚假的占位符。CI 在每次推送/PR 上运行 gitleaks。
客户端错误会编辑令牌,并且从不记录
Authorization/user_token值。get_cluster_kubeconfig将 zip 下载到 Buffer 中,并使用 JSZip 在内存中提取。它从不将归档或auth/*写入磁盘。get_cluster_info仅读取deploydata.json、metadata.json和install-config.backup.yaml。
Available Tools
15 toolsabort_buildA
Stop a running or queued Jenkins build (job/{name}/{build}/stop).
Inputs: job_name (required), build_number (required).
cancel_reservationB
Delete/release a GLPI reservation by id.
Inputs: reservation_id (required).
check_availabilityA
Fetch the full reservation list for one ReservationItem (paginated correctly) and compute free gaps / the first slot of duration_minutes.
Inputs: reservation_item_id (required), earliest_start, duration_minutes.
execute_scenarioA
Execute a plan from plan_scenario: reserve each role, trigger Jenkins jobs (delayed if start is in the future). ACM import runs only if wait_timeout_seconds is set and builds complete.
Inputs: plan (required), wait_timeout_seconds.
find_available_clusterA
Find reservable clusters matching requirements and rank them by earliest free slot of duration_minutes. Proposes slots only — does not book.
Inputs: duration_minutes (required), limit, itemtype, requirements, +1 more.
get_build_statusB
Poll Jenkins queue/build state. Returns building/result and a console-log tail.
Inputs: job_name (required), queue_id, build_number.
get_cluster_infoA
Return non-sensitive cluster metadata from a deploy job *-data.zip (deploydata.json, metadata.json, console/API URLs). Does not read kubeconfig or kubeadmin-password.
Inputs: job_name (required), build_number, cluster_name.
get_cluster_kubeconfigA
Extract auth/kubeconfig and auth/kubeadmin-password from a deploy job *-data.zip in memory. Returns cluster-admin credentials — do not echo them back in chat.
Inputs: job_name (required), build_number, cluster_name.
get_managed_cluster_statusB
Read ManagedCluster join/available conditions from the hub.
Inputs: cluster_name (required), hub_kubeconfig (required).
import_spoke_clusterA
Import a spoke into an ACM hub: create ManagedCluster + KlusterletAddonConfig, fetch the generated import Secret, apply manifests to the spoke, poll until Joined/Available.
Inputs: cluster_name (required), hub_kubeconfig (required), spoke_kubeconfig (required), timeout_seconds.
list_reservable_itemsB
Search GLPI for reservable assets (default itemtype Peripheral). Returns id, name, comment/capability text, and linked ReservationItem id.
Inputs: filter, itemtype.
list_scenariosA
List built-in end-to-end scenario presets (id, name, description, overridable fields).
Inputs: no named parameters.
plan_scenarioA
Resolve a scenario into a concrete unbooked plan (candidate clusters, windows, Jenkins parameters). Books and triggers nothing.
Inputs: scenario_id (required), overrides.
reserve_clusterA
Create a GLPI reservation. Always sets users_id from the authenticated session. Re-validates for conflicts immediately before booking.
Inputs: reservation_item_id (required), end, start, comment, +1 more.
trigger_jenkins_jobA
Trigger a Jenkins job with parameters. If start_at is in the future, passes delay=NNNsec so the build does not start immediately.
Inputs: job_name (required), start_at, parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Most tools have distinct resource-action targets, but a few boundaries could be sharper: check_availability and find_available_cluster both deal with availability, and get_cluster_info vs. get_cluster_kubeconfig both extract from the same deploy artifact. Descriptions clarify the difference well enough that an agent can usually choose correctly.
All 15 tool names follow a consistent snake_case verb_noun convention (list, check, find, reserve, cancel, trigger, get, abort, import, plan, execute). There are no camelCase names, vague single verbs, or arbitrary suffixes.
Fifteen tools is at the upper end of the ideal range but appropriate for the server's scope: reservation management, Jenkins build control, cluster artifact access, ACM import/monitoring, and scenario orchestration. Each tool covers a distinct step and no tool feels redundant.
The core path from finding/reserving assets, triggering and monitoring builds, extracting cluster credentials, and importing a spoke into ACM is covered. However, the lifecycle lacks cleanup operations (e.g., deleting/detaching a ManagedCluster, removing an imported spoke) and there is no dedicated way to list or look up existing reservations before canceling.
Maintenance
Related MCP Connectors
MCP server for GLPI: tickets, ITIL, assets, knowledge base. GLPI 10/11. Not affiliated with Teclib'.
One MCP server for all your MCP servers: code mode, per-tool permissions, approvals and audit.
MCP server for Appcircle mobile CI/CD platform.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceMCP server for automating VLP lab VM operations, exposing VM management tools to AI agents like Cursor and Claude Code.-
- AlicenseNot gradedqualityDmaintenanceMCP server for interacting with QUADS infrastructure systems via API, enabling resource management and automation through LLM applications.MIT
- FlicenseAqualityDmaintenanceAn MCP server for OpenShift Baremetal IPI cluster provisioning, allowing users to generate and validate install-config.yaml files, test BMC connectivity, validate networks, and manage cluster installation lifecycle.24-
- FlicenseAqualityDmaintenanceMCP server for IBM Technology Zone: manage reservations end-to-end and search the catalog from Claude.11-