MCP server that diagnoses unhealthy Kubernetes workloads and finds resource right-sizing candidates using real cluster state - not another kubectl wrapper.
Project description
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-coreis. Once this package is published, install withuvx triagekit-mcp-k8s-triageorpip 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
checkoutdeployment inprodcrash-looping?" - "Walk me through the incident response runbook for the
payments-apipod instaging." - "Show me the event timeline for pod
worker-7f9c8d-abc12indefault." - "Give me logs for
api-serversince its last restart, not the old crash logs." - "Did the last rollout of
checkoutinprodcause these crashes?" - "Is anything in
prodover- 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file triagekit_mcp_k8s_triage-0.1.0.tar.gz.
File metadata
- Download URL: triagekit_mcp_k8s_triage-0.1.0.tar.gz
- Upload date:
- Size: 176.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1dc371a5d42cff8ecd6dcbb325d45626f601b7d900784c2681ce9d4b7a7432b
|
|
| MD5 |
a35f21029341f8c75c2944e43591ae6a
|
|
| BLAKE2b-256 |
516e10aa87ec276c485c2e28f138b00a0d59245a630bc4a3b69c42e0cdfdc9a9
|
Provenance
The following attestation bundles were made for triagekit_mcp_k8s_triage-0.1.0.tar.gz:
Publisher:
release.yml on Karthick-dev-cart/k8s-triage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
triagekit_mcp_k8s_triage-0.1.0.tar.gz -
Subject digest:
f1dc371a5d42cff8ecd6dcbb325d45626f601b7d900784c2681ce9d4b7a7432b - Sigstore transparency entry: 2342109535
- Sigstore integration time:
-
Permalink:
Karthick-dev-cart/k8s-triage@ab87410b5c862170e1a87d95407fc1f3cc967522 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Karthick-dev-cart
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ab87410b5c862170e1a87d95407fc1f3cc967522 -
Trigger Event:
push
-
Statement type:
File details
Details for the file triagekit_mcp_k8s_triage-0.1.0-py3-none-any.whl.
File metadata
- Download URL: triagekit_mcp_k8s_triage-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9a25f427cb44ad7dfc4661550220fd8d66c88694505b3ce4f8755906b41bf24
|
|
| MD5 |
cf8fbe965b13a9c197b1b6ac5832866d
|
|
| BLAKE2b-256 |
56bf525b670161d4889b2f718d077a603dcab5e8c2e2f2b44f14c842e1b322b3
|
Provenance
The following attestation bundles were made for triagekit_mcp_k8s_triage-0.1.0-py3-none-any.whl:
Publisher:
release.yml on Karthick-dev-cart/k8s-triage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
triagekit_mcp_k8s_triage-0.1.0-py3-none-any.whl -
Subject digest:
b9a25f427cb44ad7dfc4661550220fd8d66c88694505b3ce4f8755906b41bf24 - Sigstore transparency entry: 2342109538
- Sigstore integration time:
-
Permalink:
Karthick-dev-cart/k8s-triage@ab87410b5c862170e1a87d95407fc1f3cc967522 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Karthick-dev-cart
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ab87410b5c862170e1a87d95407fc1f3cc967522 -
Trigger Event:
push
-
Statement type: