WhiteCapData-Dev — an MCP server to operate a k3s / Kubernetes cluster (health, logs, and guarded restart/scale/delete) straight from your AI agent.
Project description
WhiteCapData-Dev
Operate a k3s / Kubernetes cluster straight from your AI agent — safe by default.
An MCP server that lets an agent (Claude Code, Claude Desktop, Cursor, …) inspect and operate a Kubernetes / k3s cluster — your homelab box, a dev cluster, whatever your kubeconfig points at — without shelling out to kubectl. It talks to the Kubernetes API directly using your existing kubeconfig (or an in-cluster service account).
The design goal is safe by default: reads are always on; every mutating action (restart / scale / delete) is gated before the API call by a read-only switch and a namespace allowlist, so an over-eager agent can't touch kube-system or nuke a deployment you didn't sandbox.
Name note: the PyPI package is
whitecapdata-dev(thehomelab-k8s-style name was taken); the import package and tools are k8s/homelab-focused as described here.
Why you'd want this
- 🩺 One-call health.
cluster_summarygives node + pod totals and the unhealthy pods, so the agent starts triage with real data. - 🔒 Safe by default. Mutations are blocked unless the namespace is on your allowlist; flip
HOMELAB_MCP_READONLY=1to make the whole server read-only. - 🧰 The operations you actually do. Pods, deployments, events, logs, node health, rollout-restart, scale, delete-pod.
- 🪶 No bespoke backend. Uses the standard Kubernetes API + your kubeconfig — nothing to deploy server-side.
- ✅ Tested. Pure logic is unit-tested with fakes; guard logic is tested against a mocked API. No cluster needed to run the suite.
Requirements
- A reachable cluster and a working kubeconfig (the same one
kubectluses), or run it in-cluster with a service account. - Python 3.11+ (or just
uvx).
Install
uvx whitecapdata-dev # run directly
# or
pip install whitecapdata-dev # then run: whitecapdata-dev
Claude Code
claude mcp add homelab -- uvx whitecapdata-dev
Claude Desktop / Cursor
{
"mcpServers": {
"homelab": {
"command": "uvx",
"args": ["whitecapdata-dev"],
"env": {
"HOMELAB_MCP_MUTABLE_NAMESPACES": "default,apps,monitoring",
"HOMELAB_MCP_READONLY": "0"
}
}
}
}
Tools
| Tool | Kind | Description |
|---|---|---|
cluster_summary |
read | Node/pod health totals + unhealthy pods |
list_pods |
read | Pods (optionally one namespace), unhealthy first |
list_deployments |
read | Deployments with ready/desired replicas |
list_events |
read | Recent events, Warnings first |
pod_logs |
read | Tail a pod's logs |
node_health |
read | Per-node readiness, kubelet, capacity, pressure |
restart_deployment |
write | Rollout-restart (allowlisted namespaces) |
scale_deployment |
write | Scale to N replicas (0..max, allowlisted) |
delete_pod |
write | Delete a pod; its controller recreates it (allowlisted) |
server_info |
read | Effective config (context, read-only, allowlist) |
Configuration
| Variable | Default | Description |
|---|---|---|
HOMELAB_MCP_CONTEXT |
current-context | kubeconfig context to use |
HOMELAB_MCP_READONLY |
0 |
1/true disables all mutating tools |
HOMELAB_MCP_MUTABLE_NAMESPACES |
default,apps,monitoring,ci |
Namespaces mutations may touch; * = all |
HOMELAB_MCP_MAX_REPLICAS |
10 |
Upper bound for scale_deployment |
Safety model
- Read-only switch —
HOMELAB_MCP_READONLY=1rejects every mutating tool up front. - Namespace allowlist — mutating tools refuse any namespace not in
HOMELAB_MCP_MUTABLE_NAMESPACES(default a homelab-friendly set;*opts into all). - Bounded scale —
scale_deploymentclamps to0..HOMELAB_MCP_MAX_REPLICAS.
The cluster's own RBAC still applies on top — this server can only do what the kubeconfig identity is permitted to do.
Development
git clone https://github.com/Michael-WhiteCapData/WhiteCapData-Dev
cd WhiteCapData-Dev
uv pip install -e ".[dev]"
ruff check .
pytest # no cluster required — APIs are faked/mocked
See CONTRIBUTING.md.
License
MIT © Michael Tierney
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 whitecapdata_dev-0.1.0.tar.gz.
File metadata
- Download URL: whitecapdata_dev-0.1.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97dca13fa4b585a5b243d2169022f52647fad3339d5539b3b2375133a1e49b76
|
|
| MD5 |
53d1d8f7600008984eb4ce67a4ed2a7c
|
|
| BLAKE2b-256 |
44664a68320075514d0c10d3f3ffe6f574ee1ef6a8e1bcb63fe4732a0244369e
|
File details
Details for the file whitecapdata_dev-0.1.0-py3-none-any.whl.
File metadata
- Download URL: whitecapdata_dev-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c3059c5234b69f8124cf6a35f55f6eb480bf791667f851086b8a23388ef38e0
|
|
| MD5 |
8c0ff034b3c541e2b15d8e7bac70243e
|
|
| BLAKE2b-256 |
1ea5d89632693e64afe0c4ee32d11a28954f81f73a88fb7e26017ff24692735a
|