What it does
Read-only Kubernetes diagnostics: pods, logs, events, workloads, services, PVCs and nodes.
- Connects Runs on your computer
- Account or key No key needed · 2 settings to fill in (KUBECONFIG, ALLOWED_NAMESPACES)
- Category Developer tools
Use together with
Skills that teach the AI this kind of work; they work alongside this one
andrej-karpathy-skills
A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
Why it ranks here
Lists are ordered by a usage score (out of 100) built from these parts
| Popularity | 0/80 | GitHub stars or weekly downloads: the larger counts 60, the smaller 20 |
|---|---|---|
| Freshness | 7/12 | Full marks for a release or code change within 30 days |
| Still answering | 0/8 | The cloud endpoint answered at the last check |
| Usage score | 7/100 |
Quality: Passed 3/3 basic checks (shown, not used for ordering) · Momentum: No data yet (Used only on the Trending tab)
Install
Pick the AI app you use, then copy the settings.
Passed 3/3 checks · Runs on your computer
First: which AI do you use?
Pick your app and the steps appear below.
Works with Claude, with some setup first
2 setting(s) to fill in (KUBECONFIG, ALLOWED_NAMESPACES) · Install Docker on your computer first (one time) · Only the Claude desktop app (Windows or Mac), not the web or phone
Install Docker (if you don’t have it)
Already installed? Check first · Open Terminal, type this command and press Enter
docker --version- A version number such as Docker version … = installed, skip this step
- "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
How to open Terminal
Mac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Install Docker Desktop: on Mac open Docker.dmg and drag the icon to Applications (pick Apple silicon or Intel to match your Mac) · on Windows double-click Docker Desktop Installer.exe · then open the Docker Desktop app and leave it running. No curl command needed
Open the Docker download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number:
docker --versionInstall once; it works for everything that needs Docker
Fill in 2 setting(s)
These are program settings, not keys. No sign-up needed; fill them in as the maker describes.
KUBECONFIGPath to the kubeconfig inside the container. Must match the mount destination. There is no fallback to ~/.kube/config and no in-cluster config: a missing, unreadable or malformed file is a startup fa… · default /kubeconfigALLOWED_NAMESPACESComma-separated namespaces the server may read, e.g. staging,production. Wildcards (* and all) are rejected at startup, and kube-system and kube-public are stripped even if listed. This is defense-in…
Descriptions are as written by the maker.
Open the Claude desktop app’s settings file
SettingsDeveloperEdit Config
Paste these settings and save the file
Checking the commands · copy buttons appear once they pass
Quit Claude and open it again
Try it
Use Kubernetes Troubleshoot and tell me what you can do for me, then show me one thing✓ If Claude says it is using Kubernetes Troubleshoot or shows a Kubernetes Troubleshoot tool in the answer, you are connected
3 optional setting(s) (works without them)
The command above works without these. Add them only if you want to change something, following the maker’s description.
LOG_LEVELDEBUG, INFO, WARNING or ERROR. All logging goes to stderr; stdout carries the JSON-RPC stream exclusively. · default INFOAPI_TIMEOUT_SECONDSKubernetes API request timeout. Must be a positive integer. · default 30MAX_LOG_LINESMaximum log lines any single get_pod_logs call may return. Must be a positive integer; clamped to a hard ceiling of 1000 with a warning. · default 200
Descriptions are as written by the maker.
Menu names checked against Anthropic’s help page on Nov 11, 2026 · your screen may differ slightly by app version
ChatGPT cannot connect Kubernetes Troubleshoot yet
Kubernetes Troubleshoot runs on your computer, but ChatGPT can only connect servers that run on the web
What you can do instead
A · Use an app that can connect Kubernetes Troubleshoot
- 2 setting(s) to fill in (KUBECONFIG, ALLOWED_NAMESPACES) · Install Docker on your computer first (one time) · Only the Claude desktop app (Windows or Mac), not the web or phone
- 2 setting(s) to fill in (KUBECONFIG, ALLOWED_NAMESPACES) · Install Docker on your computer first (one time)
- 2 setting(s) to fill in (KUBECONFIG, ALLOWED_NAMESPACES) · Install Docker on your computer first (one time)
- 2 setting(s) to fill in (KUBECONFIG, ALLOWED_NAMESPACES) · Install Docker on your computer first (one time)
B · Others in Developer tools that work with ChatGPT
Picked from the most used in the same category, only ones that connect by address with no key
- Sentry✓ ChatGPT
- Compiler Explorer✓ ChatGPT
- GitDiagram✓ ChatGPT
Works with Claude Code, with some setup first
2 setting(s) to fill in (KUBECONFIG, ALLOWED_NAMESPACES) · Install Docker on your computer first (one time)
Install Docker (if you don’t have it)
Already installed? Check first · Open Terminal, type this command and press Enter
docker --version- A version number such as Docker version … = installed, skip this step
- "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
How to open Terminal
Mac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Install Docker Desktop: on Mac open Docker.dmg and drag the icon to Applications (pick Apple silicon or Intel to match your Mac) · on Windows double-click Docker Desktop Installer.exe · then open the Docker Desktop app and leave it running. No curl command needed
Open the Docker download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number:
docker --versionInstall once; it works for everything that needs Docker
Fill in 2 setting(s)
These are program settings, not keys. No sign-up needed; fill them in as the maker describes.
KUBECONFIGPath to the kubeconfig inside the container. Must match the mount destination. There is no fallback to ~/.kube/config and no in-cluster config: a missing, unreadable or malformed file is a startup fa… · default /kubeconfigALLOWED_NAMESPACESComma-separated namespaces the server may read, e.g. staging,production. Wildcards (* and all) are rejected at startup, and kube-system and kube-public are stripped even if listed. This is defense-in…
Descriptions are as written by the maker.
Open Terminal
Mac: press Command+Space and type Terminal · Windows: open PowerShell
Paste this command and press Enter
Checking the commands · copy buttons appear once they pass
Type /mcp in Claude Code
You should see Kubernetes Troubleshoot listed as connected
Try it
Use Kubernetes Troubleshoot and tell me what you can do for me, then show me one thing✓ If Claude Code says it is using Kubernetes Troubleshoot or shows a Kubernetes Troubleshoot tool in the answer, you are connected
3 optional setting(s) (works without them)
The command above works without these. Add them only if you want to change something, following the maker’s description.
LOG_LEVELDEBUG, INFO, WARNING or ERROR. All logging goes to stderr; stdout carries the JSON-RPC stream exclusively. · default INFOAPI_TIMEOUT_SECONDSKubernetes API request timeout. Must be a positive integer. · default 30MAX_LOG_LINESMaximum log lines any single get_pod_logs call may return. Must be a positive integer; clamped to a hard ceiling of 1000 with a warning. · default 200
Descriptions are as written by the maker.
Menu names checked against Anthropic’s help page on Nov 11, 2026 · your screen may differ slightly by app version
Works with Cursor, with some setup first
2 setting(s) to fill in (KUBECONFIG, ALLOWED_NAMESPACES) · Install Docker on your computer first (one time)
Install Docker (if you don’t have it)
Already installed? Check first · Open Terminal, type this command and press Enter
docker --version- A version number such as Docker version … = installed, skip this step
- "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
How to open Terminal
Mac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Install Docker Desktop: on Mac open Docker.dmg and drag the icon to Applications (pick Apple silicon or Intel to match your Mac) · on Windows double-click Docker Desktop Installer.exe · then open the Docker Desktop app and leave it running. No curl command needed
Open the Docker download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number:
docker --versionInstall once; it works for everything that needs Docker
Fill in 2 setting(s)
These are program settings, not keys. No sign-up needed; fill them in as the maker describes.
KUBECONFIGPath to the kubeconfig inside the container. Must match the mount destination. There is no fallback to ~/.kube/config and no in-cluster config: a missing, unreadable or malformed file is a startup fa… · default /kubeconfigALLOWED_NAMESPACESComma-separated namespaces the server may read, e.g. staging,production. Wildcards (* and all) are rejected at startup, and kube-system and kube-public are stripped even if listed. This is defense-in…
Descriptions are as written by the maker.
Click this button to open Cursor
Checking the commands · copy buttons appear once they pass
Fill in your key
In the Kubernetes Troubleshoot settings, KUBECONFIG, ALLOWED_NAMESPACES is empty; add your key and save
Open the AI chat in Cursor in Agent mode
Try it
Use Kubernetes Troubleshoot and tell me what you can do for me, then show me one thing✓ If Cursor says it is using Kubernetes Troubleshoot or shows a Kubernetes Troubleshoot tool in the answer, you are connected
3 optional setting(s) (works without them)
The command above works without these. Add them only if you want to change something, following the maker’s description.
LOG_LEVELDEBUG, INFO, WARNING or ERROR. All logging goes to stderr; stdout carries the JSON-RPC stream exclusively. · default INFOAPI_TIMEOUT_SECONDSKubernetes API request timeout. Must be a positive integer. · default 30MAX_LOG_LINESMaximum log lines any single get_pod_logs call may return. Must be a positive integer; clamped to a hard ceiling of 1000 with a warning. · default 200
Descriptions are as written by the maker.
Menu names checked against Cursor’s help page on Nov 11, 2026 · your screen may differ slightly by app version
Works with VS Code, with some setup first
2 setting(s) to fill in (KUBECONFIG, ALLOWED_NAMESPACES) · Install Docker on your computer first (one time)
Install Docker (if you don’t have it)
Already installed? Check first · Open Terminal, type this command and press Enter
docker --version- A version number such as Docker version … = installed, skip this step
- "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
How to open Terminal
Mac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Install Docker Desktop: on Mac open Docker.dmg and drag the icon to Applications (pick Apple silicon or Intel to match your Mac) · on Windows double-click Docker Desktop Installer.exe · then open the Docker Desktop app and leave it running. No curl command needed
Open the Docker download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number:
docker --versionInstall once; it works for everything that needs Docker
Fill in 2 setting(s)
These are program settings, not keys. No sign-up needed; fill them in as the maker describes.
KUBECONFIGPath to the kubeconfig inside the container. Must match the mount destination. There is no fallback to ~/.kube/config and no in-cluster config: a missing, unreadable or malformed file is a startup fa… · default /kubeconfigALLOWED_NAMESPACESComma-separated namespaces the server may read, e.g. staging,production. Wildcards (* and all) are rejected at startup, and kube-system and kube-public are stripped even if listed. This is defense-in…
Descriptions are as written by the maker.
Click this button to open VS Code
Checking the commands · copy buttons appear once they pass
Fill in your key
In the Kubernetes Troubleshoot settings, KUBECONFIG, ALLOWED_NAMESPACES is empty; add your key and save
Open the AI chat in VS Code in Agent mode
Try it
Use Kubernetes Troubleshoot and tell me what you can do for me, then show me one thing✓ If VS Code says it is using Kubernetes Troubleshoot or shows a Kubernetes Troubleshoot tool in the answer, you are connected
3 optional setting(s) (works without them)
The command above works without these. Add them only if you want to change something, following the maker’s description.
LOG_LEVELDEBUG, INFO, WARNING or ERROR. All logging goes to stderr; stdout carries the JSON-RPC stream exclusively. · default INFOAPI_TIMEOUT_SECONDSKubernetes API request timeout. Must be a positive integer. · default 30MAX_LOG_LINESMaximum log lines any single get_pod_logs call may return. Must be a positive integer; clamped to a hard ceiling of 1000 with a warning. · default 200
Descriptions are as written by the maker.
Menu names checked against VS Code’s help page on Nov 11, 2026 · your screen may differ slightly by app version
Other apps that use MCP, such as Windsurf, Zed or Gemini CLI, each add servers differently. See how in the app list.
JSON settings are under “For developers” below
For developers: Terminal commands and JSON settings
Installed on your computer
Claude Code
Checking the commands · copy buttons appear once they pass
Claude Desktop (claude_desktop_config.json)
Checking the commands · copy buttons appear once they pass
Cursor (~/.cursor/mcp.json)
Checking the commands · copy buttons appear once they pass
VS Code (mcp.json)
Checking the commands · copy buttons appear once they pass
Values you fill in
KUBECONFIGrequired envPath to the kubeconfig inside the container. Must match the mount destination. There is no fallback to ~/.kube/config and no in-cluster config: a missing, unreadable or malformed file is a startup fa…ALLOWED_NAMESPACESrequired envComma-separated namespaces the server may read, e.g. staging,production. Wildcards (* and all) are rejected at startup, and kube-system and kube-public are stripped even if listed. This is defense-in…LOG_LEVELenvDEBUG, INFO, WARNING or ERROR. All logging goes to stderr; stdout carries the JSON-RPC stream exclusively.API_TIMEOUT_SECONDSenvKubernetes API request timeout. Must be a positive integer.MAX_LOG_LINESenvMaximum log lines any single get_pod_logs call may return. Must be a positive integer; clamped to a hard ceiling of 1000 with a warning.
Descriptions are as written by the maker.
These settings are generated from the maker’s registry entry. If the README says otherwise, follow the README.
At a glance
- Downloads per weeki
- Not on npm/PyPI
- Connection
- Runs on your computer
- Latest versioni
- 1.0.0
- Categoryi
- Developer tools
- Published to registryi
- Aug 25, 2026
- Code last changedi
- Aug 25, 2026
- Maker
- NanaGyamfiPrempeh30
- Packages
oci: docker.io/yawgyamfiprem32/k8s-troubleshoot-mcp:1.0.0- Website
- github.com
- Registry status
- Active
Which apps can use it
Based on how this server connects and on each app’s own docs, checked Nov 10, 2026.
Run on your computer in
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
Related guides
What it can do
Runs on your computer; the tool list appears in your AI app after you install it.
Basic checksi
We check information anyone can see; we have not read the code. Checks that do not apply are left out of the count. · Checked Nov 20, 2026
- ✓ Pass
Maker matches the repo
The registry name was verified with the GitHub account NanaGyamfiPrempeh30, which owns the repo
- ✓ Pass
Still maintained
Code last changed 3 months ago
- ✓ Pass
Has a licence
Uses MIT
- – Not applicable
Endpoint responds
This one runs on your computer; there is no internet endpoint
- – Not applicable
Sign-in with OAuth
Runs on your computer and uses local settings instead
- … Not checked yet
No hidden instructions in tool descriptions
Runs on your computer; we can only read tool lists from internet endpoints
Published vulnerabilities (OSV.dev)
Not checked: only npm and PyPI packages with a version can be checked
Makers: ask for a re-check or report wrong info
For makers: add a badge to your README
If you made this, paste this code into your README. The badge links back to this page.
[](https://mcp.popnx.com/en/servers/nanagyamfiprempeh30-k8s-troubleshoot-mcp)Discussion
Ask, share a tip or report that it does not work. Sorted by what people marked helpful.
No posts yet. Be the first to ask or share.
Posts here are written by users, not the PopNx team.
User reviews
No reviews yet
Compared with others in Developer toolsi
- More stars than 0% of the other 6209 servers in this category
- Published to the registry more recently than 28% of the other 6209 servers in this category
- Basic checks equal to or better than 99% of the other 6209 servers in this category
Compared with every active server in this category in the registry. Stars count only when the publisher owns the repo.
Common questions
Is Kubernetes Troubleshoot safe?
It passed 3 of 3 applicable basic checks. We have not read the code. Before adding a key or token, see what access the server asks for and use a key with only the permissions you need.
What keys or codes does it need?
The registry does not list a required key, though some servers ask you to sign in on first use.
Does it run on my computer or in the cloud?
It runs on your computer. Your AI app starts it when needed, and data does not pass through the maker’s servers (unless it calls an online service itself).
Is it still maintained?
The GitHub repo last changed 3 months ago, and the latest version (1.0.0) reached the registry 3 months ago.
Which apps can use it?
Apps that support MCP, such as Claude Desktop, Claude Code, Cursor and VS Code. You also need Docker on your computer.
What can I use instead?
In the same category: GitDiagram, Appllama, Cloudflare MCP, Omnara, Repowise
Similar alternatives
Same category, other makers, commands already checked. Official ones first, then by stars.
Reading a card:↓ Downloads per weeki★ GitHub starsiThree pillars: reviews · checks · usageiUpdated = latest version published to the registryi
GitDiagram
Architecture diagrams, explanations and Mermaid source for public GitHub repositories.
Appllama
Study screens, flows and paywalls from top-earning iOS apps, then build from what wins.
Cloudflare MCP
Cloudflare MCP servers
Omnara
Deploy durable AI agents with Omnara, an open-source managed-agent platform.
Repowise
Codebase intelligence for AI coding agents: graph, git history, docs, decisions, code health.
| This one Kubernetes Troubleshoot | GitDiagram | Appllama | Cloudflare MCP | Omnara | Repowise | |
|---|---|---|---|---|---|---|
| Runs where | Installs on your computer | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install | Cloud or install on your computer |
| Needs a key | No | No | No | No | No | No |
| Add with + in Claude | No | No | No | Yes | No | No |
| Basic checks | 3/3 | 4/4 | 4/4 | 4/4 | 4/4 | 5/5 |
| License | MIT | MIT | MIT | Apache-2.0 | Apache-2.0 | AGPL-3.0 |
| Price | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry |
README from the maker
Open the README
Copied from the maker’s repo as written. PopNx MCP has not reviewed or endorsed it. HTML, images and scripts are removed. Links lead off this site.
k8s-troubleshoot-mcp
A read-only MCP (Model Context Protocol) server that lets an AI assistant diagnose a Kubernetes cluster. Ask why a pod is crash-looping instead of running six kubectl commands and correlating the output by hand.
Read-only is a structural property, not a promise. There are no write tools, and the RBAC manifests grant no write verbs. See Security model.
What It Does
The server exposes 16 diagnostic tools over stdio. Connect it to Claude Desktop, VS Code, or Kiro, and you can ask things like:
- "Why is the
checkoutpod instagingnot ready?" - "Show me the last 50 lines of logs from the
apicontainer" - "Which nodes are not Ready, and what are their taints?"
- "Is the
webHPA scaling, and what does its current metric say?" - "What events fired in
productionin the last few minutes?"
The assistant calls the tools, the server queries the Kubernetes API with a scoped ServiceAccount token, and every response comes back as a structured dict — including errors, which are never raised as exceptions into the MCP layer.
Architecture
┌──────────────────┐ stdio (JSON-RPC) ┌──────────────────────────┐
│ MCP Client │◄─────────────────────►│ MCP Server │ │ Claude Desktop │ │ (this project) │ │ VS Code / Kiro │ │ │ └──────────────────┘ │ config.py ─ validate │ │ server.py ─ 16 tools │ │ tools/*.py ─ read+shape│ │ response.py ─ escape + │ │ structure │ └───────────┬──────────────┘ │ HTTPS, explicit │ KUBECONFIG only ┌───────────▼──────────────┐ │ Kubernetes API server │ │ ── RBAC boundary ── │ │ ServiceAccount: │ │ get/list/watch only │ └──────────────────────────┘
Configuration is validated once at startup. If anything is wrong — KUBECONFIG unset, the file unreadable or malformed, ALLOWED_NAMESPACES missing or containing a wildcard — the process writes one line to stderr and exits 1. It never starts in a partially-valid state.
Available Tools
Arguments marked ? are optional.
| Tool | Description | Parameters |
|---|---|---|
get_pod_status | Phase, conditions, container statuses, QoS class and node for a pod | pod_name, namespace |
get_pod_logs | Recent log lines from a pod container. Content is untrusted — see Reading get_pod_logs output | pod_name, namespace, container?, previous?, tail_lines? |
get_pod_events | Recent events for a pod, newest first, with total_available | pod_name, namespace |
list_pods | Pods in a namespace with phase, restart count and readiness | namespace, label_selector? |
get_node_status | Conditions, capacity, allocatable, taints and roles for a node | node_name |
list_nodes | Cluster nodes with readiness, roles, age and kubelet version | none |
get_deployment_status | Replica counts, conditions and rollout strategy | deployment_name, namespace |
list_deployments | Deployments in a namespace with replica counts and availability | namespace |
get_statefulset_status | Replica counts, revisions and update strategy | statefulset_name, namespace |
get_daemonset_status | Scheduling counts and update strategy | daemonset_name, namespace |
get_service | Type, ClusterIP, ports, selector and ready endpoint count | service_name, namespace |
get_endpoints | Ready and not-ready endpoint addresses backing a service | service_name, namespace |
get_pvc_status | Phase, capacity, binding and resize state for a PVC | pvc_name, namespace |
get_hpa_status | Replica bounds, current metrics and conditions for an HPA | hpa_name, namespace |
get_namespace_events | Recent events across a namespace, newest first, with total_available | namespace, limit? |
list_namespaces | The namespaces this server is permitted to read | none |
Every namespaced tool validates its namespace argument before making any API call, so a disallowed namespace produces a structured error and no network request.
Deliberately absent
No get_secrets, get_configmap, exec_into_pod, port_forward, or any create/update/patch/delete tool. These are excluded from all versions unless a new threat-model review is conducted and documented — they are not backlog items. The reasoning for each is in SECURITY.md.
Security model
Full detail is in SECURITY.md. The summary:
The boundary is Kubernetes RBAC
Everything this server does in application code is defense-in-depth. The enforcement boundary is the ServiceAccount's RBAC bindings. If the bindings grant more than intended, the application-layer allowlist is all that stands in the way, and it is not a boundary you should rely on.
Provisioning is split by scope so that the cluster-scoped grant is minimal:
| Manifest | Scope | Grants |
|---|---|---|
clusterrole.yaml + clusterrolebinding.yaml | cluster | get/list/watch on nodes and namespaces only |
role.yaml | namespace | get/list/watch on the diagnostic resources |
rolebinding.yaml.template | namespace | binds the Role, one namespace at a time |
Applying the cluster-scoped pair makes no namespace readable. A namespace becomes readable only when a Role *and* a RoleBinding exist in it. A namespace listed in ALLOWED_NAMESPACES but never bound stays unreadable — RBAC wins.
pods/log is granted in its own rule block, never folded into the pods rule, because Kubernetes subresources do not inherit from their parent.
Defense-in-depth layers
| Layer | What it does | What it is not |
|---|---|---|
| RBAC | Grants read verbs on diagnostic resources in bound namespaces only | — this *is* the boundary |
| Explicit kubeconfig | Reads KUBECONFIG from an exact path; no ~/.kube/config, no in-cluster config, no fallback chain | Not a permission check — it prevents silently picking up an ambient credential |
| Namespace allowlist | Rejects wildcards, strips kube-system/kube-public, validates before every call | Advisory; a bug here is contained by RBAC |
| Output escaping | All cluster-authored free text routed through serialize_log_content | Prevents breaking out of a JSON string; cannot stop a model acting on legible instructions |
| Structured errors | Every failure returns a dict; no exception reaches the MCP layer | — |
Prompt injection is mitigated, not eliminated
Pod logs and event messages are written by workloads in the cluster. A container can print anything, including text shaped like instructions to the model reading it. Escaping keeps injected text inside its JSON string; it cannot stop a model from acting on instructions it reads as data. Treat tool output as untrusted input to whatever consumes it. This residual risk is accepted and documented.
Prerequisites
- A Kubernetes cluster and a
kubectlcontext with enough permission to create a ServiceAccount, Role, RoleBinding, ClusterRole and ClusterRoleBinding — you need this once, to provision. The server itself never uses your admin credential. - Kubernetes 1.24+ —
scripts/generate-kubeconfig.shmints a token via the TokenRequest API, not a legacy auto-mounted Secret. - Python 3.11+
- uv —
curl -LsSf https://astral.sh/uv/install.sh | sh(or use Docker, which needs neither Python nor uv on the host)
Setup
git clone https://github.com/NanaGyamfiPrempeh30/k8s-troubleshoot-mcp.git
cd k8s-troubleshoot-mcp
Install dependencies (uv creates .venv automatically)
uv sync
Run the test suite
uv run pytest tests/ -q
Provision RBAC and mint a kubeconfig
scripts/generate-kubeconfig.sh /secure/path/k8s-mcp-kubeconfig.yaml staging production
The first argument is where to write the kubeconfig; the rest are the namespaces the server may read. Pass the same set you intend to put in ALLOWED_NAMESPACES — RBAC is the enforcement boundary, and a namespace bound here but absent from the allowlist (or the reverse) is a mismatch between real permission and configured capability.
The script applies the cluster-scoped manifests together, then applies role.yaml with an explicit -n and renders a RoleBinding per namespace. On success it prints the kubeconfig path to stdout and nothing else; all diagnostics go to stderr. It also asserts after provisioning that kubectl auth can-i get secrets returns no, and aborts if it does not.
Do not run `kubectl apply -f kubernetes/`. It does not fail — it reports
success while creating
role.yamlin the *current* namespace and skipping
rolebinding.yaml.templateentirely, becausekubectl apply -fonly
reads
.yaml/.yml/.json. The result is a server that looks provisioned
and can read nothing. Verified against a v1.35 API server with
--dry-run=server: 5 resources applied, not 6.
The generated kubeconfig is written with umask 077 and chmod 600. Keep it out of the repository — the script warns if the output path is inside a repository and not covered by .gitignore.
Run it
KUBECONFIG=/secure/path/k8s-mcp-kubeconfig.yaml \
ALLOWED_NAMESPACES=staging,production \ uv run k8s-troubleshoot-mcp
The server speaks JSON-RPC on stdin/stdout, so it will appear to hang — that is correct. It is waiting for a client.
Connecting to Claude Desktop
Add to claude_desktop_config.json (%APPDATA%\Claude\claude_desktop_config.json on Windows, ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": { "k8s-troubleshoot": { "command": "uv", "args": ["run", "k8s-troubleshoot-mcp"], "cwd": "/path/to/k8s-troubleshoot-mcp", "env": { "KUBECONFIG": "/secure/path/k8s-mcp-kubeconfig.yaml", "ALLOWED_NAMESPACES": "staging,production" } } } }
Restart Claude Desktop fully (quit from the system tray, reopen), then check Settings → Developer → k8s-troubleshoot shows running.
On Windows, if the server shows as disconnected, use a batch file wrapper — Claude Desktop has working-directory issues with direct interpreter invocation:
@echo off
cd /d C:\Users\YourUsername\k8s-troubleshoot-mcp uv run k8s-troubleshoot-mcp
{
"mcpServers": { "k8s-troubleshoot": { "command": "cmd.exe", "args": ["/c", "C:\\Users\\YourUsername\\k8s-troubleshoot-mcp\\run_mcp.bat"], "env": { "KUBECONFIG": "C:\\secure\\path\\k8s-mcp-kubeconfig.yaml", "ALLOWED_NAMESPACES": "staging,production" } } } }
Running with Docker
docker build -t k8s-troubleshoot-mcp .
docker run -i --rm \ -v /secure/path/k8s-mcp-kubeconfig.yaml:/kubeconfig:ro \ -e KUBECONFIG=/kubeconfig \ -e ALLOWED_NAMESPACES=staging,production \ k8s-troubleshoot-mcp
-i is required — JSON-RPC travels on stdin/stdout. :ro is not decoration: this server performs no writes of any kind, so a writable mount would grant privilege it has no use for.
The image runs as non-root, UID 10001, and contains no c