OpenShift MCP Server

OpenShift MCP Server

Enables diagnostics and troubleshooting of OpenShift clusters through storage analysis, resource monitoring, GPU utilization tracking, and pod health checks using Prometheus metrics and the oc CLI.

Category
访问服务器

README

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.

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",...},...]}}

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选