kubestash-mcp
An MCP server for inspecting KubeStash backup health on any Kubernetes cluster. It connects through your kubeconfig — exactly like kubectl — and exposes read-only tools that an AI assistant (Claude Code, Claude Desktop, etc.) can call in natural language.
Its headline capability is stuck-repository detection: KubeStash's Repository.status.lastBackupTime can freeze while backups keep succeeding, which silently breaks any alert that reads that field. This server computes the true backup freshness from status.recentSnapshots and tells you when the two disagree.
No vendor lock-in: no hardcoded endpoints, clusters, metrics backend, or auth. If kubectl can reach your cluster, so can this.
Install
# run straight from PyPI, no install
uvx mcp-server-kubestash
# or install into a tool environment
uv tool install mcp-server-kubestash
Requires Python 3.11+ and a kubeconfig with access to the KubeStash CRDs
(core.kubestash.com, storage.kubestash.com).
Configure an MCP client
Add to your MCP client config (e.g. ~/.mcp.json):
{
"mcpServers": {
"kubestash": {
"type": "stdio",
"command": "uvx",
"args": ["mcp-server-kubestash"],
"env": {
"KUBESTASH_CONTEXTS": "all",
"KUBESTASH_STALE_HOURS": "24"
}
}
}
}
All settings are optional — see .env.example:
| Variable | Default | Meaning |
|---|---|---|
KUBESTASH_CONTEXTS |
all |
all / `` (current) / CSV of context names or unique short ids |
KUBESTASH_CONTEXTS_EXCLUDE |
— | fnmatch globs dropped after resolution |
KUBESTASH_NAMESPACES |
— | namespaces to search (empty = whole cluster) |
KUBESTASH_STALE_HOURS |
24 |
freshness threshold for "stale" |
KUBESTASH_STUCK_THRESHOLD_MINUTES |
60 |
tolerance before a repo counts as "stuck" |
KUBECONFIG |
— | standard kubeconfig path override |
Tools
| Tool | What it does |
|---|---|
list_clusters |
The kubeconfig contexts that will be queried, and any that didn't resolve |
backup_health |
Fleet rollup: session phase counts, repo counts, stuck/stale, overall verdict |
list_repositories |
Repositories with freshness + stuck check |
detect_stuck_repositories |
Only the repositories whose lastBackupTime has frozen |
list_backup_sessions |
BackupSessions, optionally filtered by phase |
list_backup_configurations |
What's configured to back up: target, schedule, history limit |
repository_detail |
One repository, including the raw recentSnapshots |
diagnose_failed_session |
Triage a failed BackupSession + remediation hints |
All tools are read-only — the server never mutates cluster state.
How "stuck" is determined
For each Repository, the server compares status.lastBackupTime against the newest
status.recentSnapshots[].snapshotTime whose phase == "Succeeded". If the newest succeeded
snapshot is more than KUBESTASH_STUCK_THRESHOLD_MINUTES newer than lastBackupTime — or
snapshots exist but lastBackupTime is unset — the repository is stuck: backups are
healthy, but the status field (and anything alerting on it) is not.
Development
uv sync --all-extras --dev
uv run ruff check .
uv run pytest -q
The suite is fully offline (the Kubernetes client is mocked). A small opt-in end-to-end check
runs against a real cluster when RUN_E2E=1 and a kubeconfig are present.
License
MIT
Metadata
Release files for mcp-server-kubestash 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mcp_server_kubestash-0.1.0.tar.gz | 128.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_server_kubestash-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 142.8 kB
Release files / mcp_server_kubestash-0.1.0.tar.gz
| Download URL | mcp_server_kubestash-0.1.0.tar.gz |
|---|---|
| Size | 128.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0697dc528e2dbfdb9d8e911453874b32c5f29016b2f21ad090cea20a16e2a2d2
|
|
BLAKE2b-256 checksum How to use checksums |
21ab07f9a8a0ae1772c3b57c5eee7d3b0337bc777b2fbb4ff8422b5de3bf5d7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 26, 2026.
Transparency logRelease files / mcp_server_kubestash-0.1.0-py3-none-any.whl
| Download URL | mcp_server_kubestash-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bafab2061bd8457bcd688da0715ca9744c4edef256f6ed8c0c0e39273925a86d
|
|
BLAKE2b-256 checksum How to use checksums |
282b8aa360a6e2f12f04983d3757b242f4cd86a8243cb690b7a92d23923181bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jun 26, 2026.
Transparency log