Prototype · Preview: every server in the official registry, synced every 30 minutes. Sign in with Google to write reviews.Prototype · updated every 30 min
PopNx MCPMCP servers for people who use AI · explained in plain words Sign in

Kubernetes Troubleshoot

by NanaGyamfiPrempeh30version 1.0.0i★ 0iRuns on your computerRepository ↗
Registry nameio.github.NanaGyamfiPrempeh30/k8s-troubleshoot-mcp

How to install

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

rea

Reverse engineer anything with agents, from app behavior down to native binaries.

by morluto★ 468,7331 skills

Skill · How-to guide

andrej-karpathy-skills

A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.

by multica-ai★ 234,3321 skills

Skill · How-to guideNo license stated

graphify

Turn any codebase, with its docs, SQL schemas, configs, and PDFs, into a queryable knowledge graph. A /graphify skill for Claude Code, Cursor, Codex, and Gemini CLI: local deterministic AST parsing, every edge explained, no vector store.

by Graphify-Labs★ 150,2871 skills

Skill · How-to guide

Why it ranks here

Lists are ordered by a usage score (out of 100) built from these parts

Popularity0/80GitHub stars or weekly downloads: the larger counts 60, the smaller 20
Freshness7/12Full marks for a release or code change within 30 days
Still answering0/8The cloud endpoint answered at the last check
Usage score7/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

  1. 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 --version

    Install once; it works for everything that needs Docker

  2. Fill in 2 setting(s)

    These are program settings, not keys. No sign-up needed; fill them in as the maker describes.

    • KUBECONFIG Path 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 /kubeconfig
    • ALLOWED_NAMESPACES Comma-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.

  3. Open the Claude desktop app’s settings file

    SettingsDeveloperEdit Config

  4. Paste these settings and save the file

    Checking the commands · copy buttons appear once they pass

  5. Quit Claude and open it again

  6. 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_LEVEL DEBUG, INFO, WARNING or ERROR. All logging goes to stderr; stdout carries the JSON-RPC stream exclusively. · default INFO
  • API_TIMEOUT_SECONDS Kubernetes API request timeout. Must be a positive integer. · default 30
  • MAX_LOG_LINES Maximum 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

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)

  1. 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 --version

    Install once; it works for everything that needs Docker

  2. Fill in 2 setting(s)

    These are program settings, not keys. No sign-up needed; fill them in as the maker describes.

    • KUBECONFIG Path 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 /kubeconfig
    • ALLOWED_NAMESPACES Comma-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.

  3. Open Terminal

    Mac: press Command+Space and type Terminal · Windows: open PowerShell

  4. Paste this command and press Enter

    Checking the commands · copy buttons appear once they pass

  5. Type /mcp in Claude Code

    You should see Kubernetes Troubleshoot listed as connected

  6. 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_LEVEL DEBUG, INFO, WARNING or ERROR. All logging goes to stderr; stdout carries the JSON-RPC stream exclusively. · default INFO
  • API_TIMEOUT_SECONDS Kubernetes API request timeout. Must be a positive integer. · default 30
  • MAX_LOG_LINES Maximum 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)

  1. 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 --version

    Install once; it works for everything that needs Docker

  2. Fill in 2 setting(s)

    These are program settings, not keys. No sign-up needed; fill them in as the maker describes.

    • KUBECONFIG Path 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 /kubeconfig
    • ALLOWED_NAMESPACES Comma-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.

  3. Click this button to open Cursor

    Checking the commands · copy buttons appear once they pass

  4. Fill in your key

    In the Kubernetes Troubleshoot settings, KUBECONFIG, ALLOWED_NAMESPACES is empty; add your key and save

  5. Open the AI chat in Cursor in Agent mode

  6. 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_LEVEL DEBUG, INFO, WARNING or ERROR. All logging goes to stderr; stdout carries the JSON-RPC stream exclusively. · default INFO
  • API_TIMEOUT_SECONDS Kubernetes API request timeout. Must be a positive integer. · default 30
  • MAX_LOG_LINES Maximum 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)

  1. 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 --version

    Install once; it works for everything that needs Docker

  2. Fill in 2 setting(s)

    These are program settings, not keys. No sign-up needed; fill them in as the maker describes.

    • KUBECONFIG Path 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 /kubeconfig
    • ALLOWED_NAMESPACES Comma-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.

  3. Click this button to open VS Code

    Checking the commands · copy buttons appear once they pass

  4. Fill in your key

    In the Kubernetes Troubleshoot settings, KUBECONFIG, ALLOWED_NAMESPACES is empty; add your key and save

  5. Open the AI chat in VS Code in Agent mode

  6. 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_LEVEL DEBUG, INFO, WARNING or ERROR. All logging goes to stderr; stdout carries the JSON-RPC stream exclusively. · default INFO
  • API_TIMEOUT_SECONDS Kubernetes API request timeout. Must be a positive integer. · default 30
  • MAX_LOG_LINES Maximum 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.

See every app that uses MCP →

JSON settings are under “For developers” below

Stuck? Ask people who use Kubernetes Troubleshoot💬 Discussion →
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

  • KUBECONFIG required env
    Path 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_NAMESPACES required env
    Comma-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_LEVEL env
    DEBUG, INFO, WARNING or ERROR. All logging goes to stderr; stdout carries the JSON-RPC stream exclusively.
  • API_TIMEOUT_SECONDS env
    Kubernetes API request timeout. Must be a positive integer.
  • MAX_LOG_LINES env
    Maximum 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
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

All apps, with pros and cons →

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

What we check → · JSON

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.

[![Featured on PopNx MCP](https://mcp.popnx.com/badge/nanagyamfiprempeh30-k8s-troubleshoot-mcp.svg)](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.

Sign in to post

User reviews

No reviews yet

Sign in to write a review

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.

by ahmedkhaleel2004Widely used★ 19KUpdated 2 months ago

Runs in the cloud✓ service owner · gitdiagram.comTried by the PopNx team

Appllama

Study screens, flows and paywalls from top-earning iOS apps, then build from what wins.

by AppllamaWidely used★ 5.2KUpdated 3 months ago

Runs in the cloud✓ service owner · appllama.io

Repowise

Codebase intelligence for AI coding agents: graph, git history, docs, decisions, code health.

by repowise-devWidely used↓ 6.5K/wk★ 8.2K Stars for the whole repoUpdated 7 days ago

Computer or cloud✓ service owner · repowise.dev
Compared with similar ones
This one
Kubernetes Troubleshoot
GitDiagramAppllamaCloudflare MCPOmnaraRepowise
Runs whereInstalls on your computerRuns in the cloud, nothing to installRuns in the cloud, nothing to installRuns in the cloud, nothing to installRuns in the cloud, nothing to installCloud or install on your computer
Needs a keyNoNoNoNoNoNo
Add with + in ClaudeNoNoNoYesNoNo
Basic checks3/34/44/44/44/45/5
LicenseMITMITMITApache-2.0Apache-2.0AGPL-3.0
PriceNo cost listed in the registryNo cost listed in the registryNo cost listed in the registryNo cost listed in the registryNo cost listed in the registryNo 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 checkout pod in staging not ready?"
  • "Show me the last 50 lines of logs from the api container"
  • "Which nodes are not Ready, and what are their taints?"
  • "Is the web HPA scaling, and what does its current metric say?"
  • "What events fired in production in 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.

ToolDescriptionParameters
get_pod_statusPhase, conditions, container statuses, QoS class and node for a podpod_name, namespace
get_pod_logsRecent log lines from a pod container. Content is untrusted — see Reading get_pod_logs outputpod_name, namespace, container?, previous?, tail_lines?
get_pod_eventsRecent events for a pod, newest first, with total_availablepod_name, namespace
list_podsPods in a namespace with phase, restart count and readinessnamespace, label_selector?
get_node_statusConditions, capacity, allocatable, taints and roles for a nodenode_name
list_nodesCluster nodes with readiness, roles, age and kubelet versionnone
get_deployment_statusReplica counts, conditions and rollout strategydeployment_name, namespace
list_deploymentsDeployments in a namespace with replica counts and availabilitynamespace
get_statefulset_statusReplica counts, revisions and update strategystatefulset_name, namespace
get_daemonset_statusScheduling counts and update strategydaemonset_name, namespace
get_serviceType, ClusterIP, ports, selector and ready endpoint countservice_name, namespace
get_endpointsReady and not-ready endpoint addresses backing a serviceservice_name, namespace
get_pvc_statusPhase, capacity, binding and resize state for a PVCpvc_name, namespace
get_hpa_statusReplica bounds, current metrics and conditions for an HPAhpa_name, namespace
get_namespace_eventsRecent events across a namespace, newest first, with total_availablenamespace, limit?
list_namespacesThe namespaces this server is permitted to readnone

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:

ManifestScopeGrants
clusterrole.yaml + clusterrolebinding.yamlclusterget/list/watch on nodes and namespaces only
role.yamlnamespaceget/list/watch on the diagnostic resources
rolebinding.yaml.templatenamespacebinds 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
LayerWhat it doesWhat it is not
RBACGrants read verbs on diagnostic resources in bound namespaces only— this *is* the boundary
Explicit kubeconfigReads KUBECONFIG from an exact path; no ~/.kube/config, no in-cluster config, no fallback chainNot a permission check — it prevents silently picking up an ambient credential
Namespace allowlistRejects wildcards, strips kube-system/kube-public, validates before every callAdvisory; a bug here is contained by RBAC
Output escapingAll cluster-authored free text routed through serialize_log_contentPrevents breaking out of a JSON string; cannot stop a model acting on legible instructions
Structured errorsEvery 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

  1. A Kubernetes cluster and a kubectl context 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.
  2. Kubernetes 1.24+ — scripts/generate-kubeconfig.sh mints a token via the TokenRequest API, not a legacy auto-mounted Secret.
  3. Python 3.11+
  4. 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.yaml in the *current* namespace and skipping

rolebinding.yaml.template entirely, because kubectl apply -f only

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

Only the beginning is shown; read the rest in the repo