Skip to main content
Glama
OpenShift MCP Server

OpenShift MCP Server

by junzzhu

OpenShift MCP Server

A Model Context Protocol (MCP) server for OpenShift diagnostics and troubleshooting.

Features

Storage Tools

  • Storage Analysis: get_cluster_storage_report - comprehensive report of ephemeral storage usage on nodes, including top pod consumers.

  • Deep Forensics: inspect_node_storage_forensics - deep analysis of disk usage on a specific node, checking for unused images and container writable layers.

  • PV Capacity: check_persistent_volume_capacity - monitor persistent volume usage across namespaces with configurable thresholds.

Monitoring Tools

  • Resource Balance: get_cluster_resource_balance - analyze CPU and memory resource distribution across nodes.

  • Pod Restarts: detect_pod_restarts_anomalies - identify pods with excessive restart counts within a time window.

  • GPU Utilization: get_gpu_utilization - track GPU usage and identify idle GPU resources.

  • Inspect GPU Pod: inspect_gpu_pod - run nvidia-smi inside a GPU-enabled pod to view real-time process and memory details.

  • Check GPU Health: check_gpu_health - check for GPU hardware errors (XID) and throttling events across the cluster.

  • vLLM Metrics: get_vllm_metrics - monitor vLLM inference server performance metrics (throughput, queue size, cache usage).

All monitoring tools use Prometheus metrics via OpenShift route for real-time cluster observability.

Pod Diagnostics Tools

  • Pod Logs: get_pod_logs - retrieve and analyze logs from a specific pod, with support for previous container logs, tail limits, and time-based filtering.

  • Pod Diagnostics: get_pod_diagnostics - comprehensive health check of a pod including status, conditions, container states, restart counts, and issue detection.

Related MCP server: PTP MCP Server

Installation

# Using uv (recommended)
uv tool install .

# Or pip
pip install .

Configuration

This server relies on the oc command line tool.

  1. Ensure oc is installed and in your PATH.

  2. Ensure you are authenticated (oc login ...) to your target cluster before running the server.

MCP Client Configuration

Configure the MCP server in your Claude Desktop or Gemini CLI settings:

{
  "mcpServers": {
    "openshift-tools": {
      "command": "uv",
      "args": ["run", "openshift-mcp-server"]
    }
  }
}

Example Usage

Once configured, you can ask questions like:

"Give me a summary of storage usage for all nodes"

"Check GPU utilization in the cluster"

"Diagnose pod health for my-app-pod in production namespace"

Simulated Tool Output (get_cluster_storage_report):

# Storage Usage Report (3 nodes)

### Node: master0.example.com
- **Filesystem**: Used: 36.70 Gi | Capacity: 99.44 Gi | Available: 62.74 Gi
- **Image FS**: Used: 34.17 Gi
- **Total Pod Ephemeral Storage**: 5.19 Gi

**Top Pod Consumers:**
- 2.60 Gi: `openshift-marketplace/redhat-operators-gb8ff`
- 974.96 Mi: `openshift-marketplace/community-operators-fq744`

Simulated Tool Output (get_gpu_utilization):

### GPU Utilization Report
**Total GPUs Found:** 4

| Node | GPU | Utilization | Memory Used | Status |
|------|-----|-------------|-------------|--------|
| `host-a:9400` | 0 | **0.0%** | 0.0% | ⚠️ Idle |
| `host-a:9400` | 1 | **85.2%** | 92.3% | ✅ Active |

Simulated Tool Output (detect_pod_restarts_anomalies):

### Pod Restart Anomalies (>5 in last 1h)
| Namespace | Pod | Restarts |
|-----------|-----|----------|
| `ns-1` | `pod-a-7b666bd598-cvrlk` | **34** |
| `ns-2` | `pod-b-6dcf7d7bb8-dw8sg` | **16** |

#### 📋 Recommendations
1. **Check Logs**: `oc logs <pod> -n <namespace> --previous`
2. **Check Events**: `oc get events -n <namespace>`

Development

# Run locally
uv run openshift-mcp-server

Testing the server directly

When run directly, the server expects JSON-RPC messages on standard input. You can verify the registered tools by simulating a full client handshake (Initialize -> Initialized -> Tools/List):

(echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test-client", "version": "1.0"}}}'; sleep 0.5; echo '{"jsonrpc": "2.0", "method": "notifications/initialized"}'; sleep 0.5; echo '{"jsonrpc": "2.0", "id": 2, "method": "tools/list"}') | uv run openshift-mcp-server

Expected output (truncated for brevity):

{"jsonrpc":"2.0","id":1,"result":{...}}
{"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"get_cluster_storage_report",...},{"name":"inspect_node_storage_forensics",...},...]}}

Available Tools

11 tools
check_gpu_healthA
Check for GPU hardware errors (XID) and throttling events across the cluster.

Why:
- Detect Hardware Failures: XID errors often indicate physical GPU faults.
- Explain Performance Issues: Thermal or Power throttling explains why a model is slow. 

Returns:
    Markdown report of GPU health issues.

Inputs: no named parameters. Returns: result

check_persistent_volume_capacityA
Monitor Persistent Volume Claim (PVC) capacity usage across the cluster.

Critical for preventing database crashes and data loss due to full disks.
This checks PVCs (persistent storage) which is distinct from ephemeral storage.

Args:
    namespace: Optional namespace to filter PVCs. If None, checks all namespaces.
    threshold: Alert threshold percentage (default: 85%). PVCs above this will be flagged.

Returns:
    Formatted report of PVC usage with warnings for volumes exceeding threshold.

Inputs: namespace, threshold. Returns: result

detect_pod_restarts_anomaliesA
Identify unstable pods experiencing high restart rates.

Why:
- Application stability indicator: High restart rates signal code issues (OOM, panics, misconfigurations)
- Proactive detection: Catches intermittent failures before they become incidents
- Actionable: Directly points to problematic workloads

Args:
    threshold: Minimum number of restarts to flag (default: 5).
    duration: Window of time to analyze (e.g., '1h', '24h', '10m').
    
Returns:
    Markdown report of unstable pods.

Inputs: threshold, duration. Returns: result

get_cluster_resource_balanceA
Analyze cluster resource balance, focusing on Request vs Usage gaps.

Why Essential:
- Scheduling bottleneck diagnosis: Explains why pods are Pending despite capacity.
- Resource fragmentation detection: Identifies "request vs usage" gaps.
- Cost efficiency: Reveals over-provisioned nodes.

Returns:
    Markdown table showing CPU/Memory Requests vs Usage per node.

Inputs: no named parameters. Returns: result

get_cluster_storage_reportA
Use this FIRST. Fast, high-level summary of storage usage for all nodes or a specific node.
Checks quotas and reported usage from the Kubelet API.

If 'node' is provided, analyzes only that node.
If 'node' is not provided, analyzes all worker nodes.

Inputs: node. Returns: result

get_gpu_utilizationA
Monitor GPU usage and health across the cluster.

Why:
- Cost efficiency: GPUs are expensive. Low utilization indicates wasted money.
- Resource optimization: Identifies idle GPUs that could be deallocated.
- Hardware health: High error rates indicate hardware issues.

Prerequisites:
- NVIDIA GPU Operator installed (exports DCGM metrics).

Returns:
    Markdown report of GPU utilization per node.

Inputs: no named parameters. Returns: result

get_pod_diagnosticsB
Comprehensive pod health analysis with events, status, and actionable recommendations.

Args:
    namespace: Pod namespace
    pod_name: Pod name
    
Returns:
    Detailed diagnostic report with recommendations

Inputs: namespace (required), pod_name (required). Returns: result

get_pod_logsA
Retrieve container logs from a pod.

Args:
    namespace: Pod namespace
    pod_name: Pod name
    container: Specific container name (if None, gets all containers)
    previous: Get logs from previous container instance
    tail: Number of recent lines to retrieve (default: 100)
    since: Time duration to retrieve logs from (e.g., "1h", "30m")
    
Returns:
    Formatted logs with container separation

Inputs: namespace (required), pod_name (required), container, previous, +2 more. Returns: result

get_vllm_metricsA
Monitor vLLM inference server performance metrics by directly querying pods.

Why:
- Performance monitoring: Track request latency and throughput
- Capacity planning: Monitor queue size and running requests
- Resource optimization: Track GPU cache usage
- Proactive alerting: Detect performance degradation

Args:
    namespace: Optional namespace filter
    pod_filter: Optional pod name filter (supports partial match)
    
Returns:
    Markdown report of vLLM metrics

Inputs: namespace, pod_filter. Returns: result

inspect_gpu_podA
Run 'nvidia-smi' inside a GPU-enabled pod to view real-time process and memory details.

Why:
- Debug OOM: See exact memory usage per process.
- Verify allocation: Confirm the pod actually sees the GPU.
- Check processes: Identify zombie processes or unexpected workloads.

Args:
    namespace: Pod namespace
    pod_name: Pod name
    
Returns:
    Output of nvidia-smi from inside the pod.

Inputs: namespace (required), pod_name (required). Returns: result

inspect_node_storage_forensicsA
SLOW operation (10s+). Performs a deep forensic analysis of a node's storage.

Use this tool ONLY when:
1. A specific node is known to be problematic (full disk).
2. 'get_storage_usage' does not reveal the root cause.

This tool runs a debug pod on the node to calculate:
- Real disk usage (df -h).
- Reclaimable space from UNUSED images.
- Growth of container writable layers (indicating log/file issues inside containers).

Inputs: node_name (required). Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 11 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no significant overlap. For example, check_gpu_health focuses on hardware errors, get_gpu_utilization monitors usage metrics, and inspect_gpu_pod runs diagnostics inside pods. The descriptions clearly differentiate between cluster-wide monitoring, pod-level diagnostics, storage analysis, and GPU-specific operations.

    Naming Consistency4/5

    The naming follows a consistent verb_noun pattern throughout (e.g., check_gpu_health, get_cluster_resource_balance, inspect_node_storage_forensics). All tools use snake_case, and verbs like 'check', 'get', 'detect', and 'inspect' are appropriately matched to their actions. The only minor deviation is 'get_vllm_metrics' which uses an acronym, but it still fits the pattern.

    Tool Count5/5

    With 11 tools, the count is well-scoped for an OpenShift monitoring and diagnostics server. Each tool serves a specific, non-redundant function in areas like GPU health, storage analysis, pod diagnostics, and cluster resource monitoring. The set covers essential operations without being overwhelming or too sparse.

    Completeness4/5

    The toolset provides comprehensive coverage for monitoring and diagnostics in an OpenShift cluster, including GPU health, storage, pod stability, and resource balance. Minor gaps exist, such as no tools for node-level CPU/memory diagnostics beyond resource balance or for managing resources (e.g., scaling pods), but agents can work around these with the available tools for core troubleshooting workflows.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables comprehensive benchmarking and performance monitoring of OpenShift clusters using OVN-Kubernetes networking through automated data collection, AI-powered analysis, and report generation. Provides intelligent insights into cluster performance, bottleneck detection, and optimization recommendations.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Monitors and analyzes Precision Time Protocol (PTP) systems in OpenShift clusters, enabling configuration analysis, real-time log monitoring, and health checks.
      MIT