Skip to main content

triagekit-mcp-k8s-triage

Part of the TriageKit MCP server suite.

Diagnoses unhealthy Kubernetes workloads and finds resource right-sizing candidates using real cluster state — not another kubectl wrapper. Existing Kubernetes MCP servers mostly expose cluster CRUD; this one narrows hard on read-only diagnosis and right-sizing.

Why

When a pod is crash-looping, an on-call engineer pivots across kubectl describe, kubectl logs, rollout history, and (if they're lucky) a Grafana dashboard to figure out what's actually wrong. This server does that correlation directly: container exit codes and event reasons get mapped to a ranked failure category, crashes get checked against recent rollouts, and Prometheus usage history gets compared against resource requests — all as structured evidence, not another raw JSON dump.

Tools

Tool What it does
diagnose_workload Classifies a pod/deployment's failure as OOMKilled, image-pull error, config error, probe failure, or scheduling failure, with evidence
explain_pod_events Orders a pod's raw Kubernetes events into a time-sequenced narrative
get_pod_logs_since_last_restart Fetches logs from the container's current run only, so an old crash's logs don't drown out the current state
correlate_crashloop_with_recent_changes Checks whether a crash lines up with a recent rollout (deploy-related vs. pre-existing bug)
find_resource_right_sizing_candidates Compares Prometheus usage history against resource requests, flags over/under-provisioned workloads
cluster_health_summary One-shot digest: node pressure, failed/pending pods, PDB violations, HPAs at max

Also exposes a resource (k8s://{context}/{namespace}/{workload}/diagnosis) and a prompt (incident_response_runbook) that walks an LLM through the standard triage sequence.

This server is read-only by design — see SECURITY.md. It never creates, updates, or deletes cluster resources.

Install

Not yet published. This package itself is not on PyPI yet (alpha, pre-release) - its dependency triagekit-mcp-core is. Once this package is published, install with uvx triagekit-mcp-k8s-triage or pip install triagekit-mcp-k8s-triage. Until then, build locally: uv build --out-dir dist && uv pip install dist/*.whl.

Quick Start (Claude Desktop / Claude Code)

Add to your mcp.json:

{
  "mcpServers": {
    "k8s-triage": {
      "command": "uvx",
      "args": ["triagekit-mcp-k8s-triage"],
      "env": {
        "KUBECONFIG": "/path/to/your/kubeconfig"
      }
    }
  }
}

Example prompts

  • "Why is the checkout deployment in prod crash-looping?"
  • "Walk me through the incident response runbook for the payments-api pod in staging."
  • "Show me the event timeline for pod worker-7f9c8d-abc12 in default."
  • "Give me logs for api-server since its last restart, not the old crash logs."
  • "Did the last rollout of checkout in prod cause these crashes?"
  • "Is anything in prod over- or under-provisioned based on the last 7 days of usage?"
  • "Give me a cluster health summary for prod."

Authentication

Variable Required for Notes
KUBECONFIG (native) or TRIAGEKIT_K8S_TRIAGE_KUBECONFIG_PATH All 6 tools Path to a kubeconfig file. Falls back to the default kubeconfig resolution if unset.
TRIAGEKIT_K8S_TRIAGE_PROMETHEUS_URL (or native PROMETHEUS_URL) find_resource_right_sizing_candidates Base URL of a Prometheus server scraping container_cpu_usage_seconds_total / container_memory_working_set_bytes (e.g. via kube-state-metrics + cAdvisor)

Recommended minimum-privilege RBAC — a read-only ClusterRole covering exactly what these tools use:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: triagekit-k8s-triage-readonly
rules:
  - apiGroups: [""]
    resources: ["pods", "pods/log", "events", "nodes"]
    verbs: ["get", "list"]
  - apiGroups: ["apps"]
    resources: ["deployments", "replicasets"]
    verbs: ["get", "list"]
  - apiGroups: ["policy"]
    resources: ["poddisruptionbudgets"]
    verbs: ["get", "list"]
  - apiGroups: ["autoscaling"]
    resources: ["horizontalpodautoscalers"]
    verbs: ["get", "list"]

Credentials are only ever read from the environment/kubeconfig at startup — no tool accepts a credential as a parameter. See CONTRIBUTING.md for why.

Development

uv sync
uv run pytest -v
uv run ruff check .
uv run pyright

Tests never talk to a real cluster — KubeClient and PrometheusClient are constructed from mocked API objects/HTTP responses in every test.

License

MIT

Release files for triagekit-mcp-k8s-triage 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for triagekit-mcp-k8s-triage 0.1.0
File Size Uploaded
triagekit_mcp_k8s_triage-0.1.0.tar.gz 176.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for triagekit-mcp-k8s-triage 0.1.0
File Interpreter ABI Platform
triagekit_mcp_k8s_triage-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 194.5 kB

Release files / triagekit_mcp_k8s_triage-0.1.0.tar.gz

Download URL triagekit_mcp_k8s_triage-0.1.0.tar.gz
Size 176.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f1dc371a5d42cff8ecd6dcbb325d45626f601b7d900784c2681ce9d4b7a7432b
BLAKE2b-256 checksum
How to use checksums
516e10aa87ec276c485c2e28f138b00a0d59245a630bc4a3b69c42e0cdfdc9a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Release files / triagekit_mcp_k8s_triage-0.1.0-py3-none-any.whl

Download URL triagekit_mcp_k8s_triage-0.1.0-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9a25f427cb44ad7dfc4661550220fd8d66c88694505b3ce4f8755906b41bf24
BLAKE2b-256 checksum
How to use checksums
56bf525b670161d4889b2f718d077a603dcab5e8c2e2f2b44f14c842e1b322b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page