ocp-triage-mcp

ocp-triage-mcp

Enables deterministic triage of OpenShift alerts by executing YAML-defined runbooks against an upstream OCP MCP server, collecting auditable evidence bundles for LLM interpretation.

Category
访问服务器

README

ocp-triage-mcp

An MCP server that triages OpenShift alerts by orchestrating an upstream OCP MCP server (the one exposing oc get nodes, get namespaces, describe pods, etc.). This server is both an MCP server (to whoever is triaging) and an MCP client (of the OCP MCP) — the consuming team never touches the upstream server directly.

 LLM / agent ──MCP──▶ ocp-triage-mcp ──MCP (Streamable HTTP)──▶ OCP MCP ──▶ cluster
                        │
                        └── runbooks/*.yaml   (one file per alert code)

Each alert code maps to a runbook: a YAML-defined sequence of upstream tool calls. Triage is deterministic — no LLM inside this server — so evidence collection is repeatable, auditable, and cheap. The LLM sitting above it interprets the evidence bundle.

Tools exposed

Tool Purpose
list_runbooks Alert codes supported, required/optional inputs, steps
triage_alert(alert_code, params) Run the full runbook, return the evidence bundle
run_step(alert_code, step_id, params) Re-run one step of a runbook
validate_runbooks Check all runbooks against the live upstream tool list

The evidence bundle reports per-step status (ok / error / skipped / aborted) so partial failures are visible, never silent.

Passthrough discovery tools

Callers usually need to find the runbook inputs first — which clusters, namespaces, and pods exist. Set TRIAGE_PASSTHROUGH_TOOLS to a comma-separated allowlist of upstream tool names (fnmatch patterns allowed):

TRIAGE_PASSTHROUGH_TOOLS=get_clusters,get_namespaces,get_pods,list_*

Matching upstream tools are re-exposed on this server verbatim — same name, same input schema, same description — and calls are forwarded to the OCP MCP. Nothing is passed through by default; the surface stays curated. The tool list is fetched from the upstream lazily and cached; validate_runbooks refreshes it and reports which names currently match.

Setup

Full guide — install, verification, hosting for another team, container deployment, troubleshooting: docs/setup.md

Quick start:

pip install -e .

Configuration is via environment variables:

Variable Meaning Default
OCP_MCP_URL Upstream OCP MCP Streamable HTTP endpoint, e.g. https://host/mcp (required)
OCP_MCP_HEADERS Extra upstream headers, ;;-separated: Authorization: Bearer x;;X-Y: z none
TRIAGE_PASSTHROUGH_TOOLS Upstream tools to re-expose here (comma-separated, fnmatch patterns) none
TRIAGE_RUNBOOKS_DIR Directory of runbook YAMLs ./runbooks
TRIAGE_MCP_TRANSPORT This server's transport: stdio, streamable-http, sse stdio
TRIAGE_HTTP_HOST / TRIAGE_HTTP_PORT Listen address for the HTTP transports 127.0.0.1 / 8000

Variables can also live in a .env file next to the server (copy .env.example); real environment variables override it.

Run it:

ocp-triage-mcp

Registering in Claude Code (stdio):

{
  "mcpServers": {
    "ocp-triage": {
      "command": "ocp-triage-mcp",
      "env": {
        "OCP_MCP_URL": "https://ocp-mcp.example.com/mcp",
        "OCP_MCP_HEADERS": "Authorization: Bearer <token>",
        "TRIAGE_RUNBOOKS_DIR": "C:/GIT/mcp-runbook/runbooks"
      }
    }
  }
}

To serve it to another team over HTTP instead, set TRIAGE_MCP_TRANSPORT=streamable-http and deploy it like any web service.

Writing runbooks

One YAML file per alert code in runbooks/:

alert: KubePodCrashLooping          # the alert code callers pass to triage_alert
description: What this runbook collects and why.

inputs:
  required: [namespace, pod]        # must be present in params
  optional: [cluster]

steps:
  - id: describe_pod                # unique id; defaults to the tool name
    tool: describe_pod              # tool name ON THE UPSTREAM OCP MCP
    args:
      namespace: "{{namespace}}"    # template from params...
      pod: "{{pod}}"

  - id: node_status
    tool: describe_node
    when: "{{describe_pod.spec.nodeName}}"   # skip unless resolvable & truthy
    continue_on_error: true                  # don't abort the runbook on failure
    args:
      node: "{{describe_pod.spec.nodeName}}" # ...or from earlier step results

Templating rules:

  • {{name}} resolves from params first, then from earlier step results by step id.
  • Dotted paths ({{describe_pod.spec.nodeName}}) walk into a step's result — this requires the upstream tool to return JSON (structured content or a JSON text block). Plain-text output is kept verbatim and can't be path-referenced.
  • A string that is exactly one template keeps the referenced value's type (numbers, booleans, objects); mixed strings are substituted as text.
  • Steps run sequentially. A step failure aborts the rest of the runbook unless the failing step has continue_on_error: true.

The example runbooks use placeholder tool names. After pointing OCP_MCP_URL at your real server, call validate_runbooks — it lists the upstream's actual tools and flags every runbook step that references a tool the upstream doesn't expose.

Design notes

  • Fresh upstream connection per call. Each triage_alert opens its own Streamable HTTP session to the upstream and closes it when done. Remote sessions get dropped by idle timeouts/proxies; reconnecting per run makes every triage self-contained at negligible handshake cost.
  • Runbooks are re-read from disk on every call, so editing a YAML takes effect without restarting the server. If load cost ever matters, add mtime caching in server._load.
  • No LLM inside. If a runbook someday needs in-flight reasoning, first try extending when: conditions; embedding an agent is the last resort.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选