Skip to main content
Glama
cnv-lab-mcp
by galkremer1

cnv-lab-mcp

GLPIでラボ用ハードウェアを予約し、JenkinsでCNVクラスターデプロイをトリガーし、ACMスポーククラスターをインポートするためのMCPサーバーです。インスタンスURL、ハードウェア名、トークンは一切ハードコードされておらず、すべてツール引数または環境変数から取得されます。

Cursorに追加

Add to 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.jsのfetch(undici)は、curlのようにOS/キーチェーンの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.pem

TLSエラーは一般的なネットワーク障害とは別に報告されるため、原因が不明瞭になることはありません。

設定

.env.exampleをコピーして設定してください:

変数

必須

備考

GLPI_BASE_URL

はい

/apirest.phpの有無は問いません

GLPI_USER_TOKEN

はい

個人用APIトークン

GLPI_APP_TOKEN

いいえ

インスタンスが要求する場合のみ

JENKINS_BASE_URL

はい

JenkinsのルートURL

JENKINS_USER

はい

短いユーザー名(メールアドレスではない)

JENKINS_API_TOKEN

はい

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 — 1つのアイテムの予約と空き時間を確認します

  • reserve_cluster — 時間枠を予約し、常にセッションからusers_idを設定します

  • cancel_reservation — 予約を解除します

Jenkins:

  • trigger_jenkins_job — 汎用トリガー。start_atはdelay=NNNsecになります

  • get_build_status — キュー/ビルド+コンソール末尾を取得します

  • abort_build — ビルドを停止します

クラスターアクセス:

  • get_cluster_info — *-data.zipから、機密情報を含まないメタデータとコンソール/APIのURLを取得します

  • get_cluster_kubeconfig — auth/kubeconfig+auth/kubeadmin-passwordをメモリ上のみで取得します。クラスター管理者の認証情報のため、チャットにそのまま出力しないでください。

ACM:

  • import_spoke_cluster — ManagedCluster+KlusterletAddonConfigを作成し、インポートマニフェストをスポークに適用して、参加(join)をポーリングします

  • get_managed_cluster_status — ハブ側の参加(join)/利用可能(available)状態を取得します

シナリオ(予約前の確認あり):

  • list_scenarios

  • plan_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はすべてのpush/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 tools
abort_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

    A3.7/5.0

    Scored across 15 tools

    Disambiguation4/5

    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.

    Naming Consistency5/5

    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.

    Tool Count5/5

    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.

    Completeness3/5

    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

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server for interacting with QUADS infrastructure systems via API, enabling resource management and automation through LLM applications.
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      MCP server for IBM Technology Zone: manage reservations end-to-end and search the catalog from Claude.
      11
      -