Skip to main content
Glama
KubeCraft MCP Server

KubeCraft MCP Server

KubeCraft MCP Server

A Model Context Protocol (MCP) server that gives AI assistants (Claude, Cursor, etc.) full visibility and control over Kubernetes clusters.

Features (73 Community tools · 140 with KubeCraft Pro)

The open-source Community Edition (this repository, MIT) ships 73 tools. The separately licensed KubeCraft Pro add-on registers 67 more (140 total); those are marked Pro below and are not included in this repository or the Community image.

Category

Tools

Community

With Pro

Cluster Info

get_cluster_info, list_namespaces, list_nodes (includes GPU(alloc) column), get_node_health

4

4

Resources

list_pods, list_deployments, list_services, list_ingresses, list_gateway_api, list_hpas, list_resource_quotas, list_pod_disruption_budgets, list_resources, describe_resource, get_resource_usage

11

11

Diagnostics

diagnose_pod, get_pod_logs, get_events

3

3

Management

scale_deploymentPro, restart_deploymentPro, rollout_historyPro, rollback_deploymentPro, cordon_nodePro, uncordon_nodePro, delete_resourcePro, apply_manifestPro, validate_manifestPro

0

9

Platform / Posture

inspect_rbac, list_storage_overview, cert_manager_healthPro, summarize_network_policies, diagnose_service_endpointsPro, summarize_policy_engines

4

6

Security Posture

summarize_pod_security_standardsPro, audit_service_accountsPro, summarize_image_vulnerabilitiesPro, audit_secret_hygienePro

0

4

Workloads

list_daemonsets, restart_daemonsetPro, list_statefulsets, scale_statefulsetPro, restart_statefulsetPro, list_cronjobs, list_jobs, trigger_cronjobPro, analyze_pod_disruptionPro

4

9

Cluster Intelligence

cluster_health_scorePro, scan_deprecationsPro, unused_resource_reportPro

0

3

Advanced Storage

list_csi_drivers (capabilities + node registration), list_volume_snapshotsPro (snapshot.storage.k8s.io), analyze_storage_capacityPro (PV/PVC utilization + CSIStorageCapacity)

1

3

Advanced Networking

list_ingress_classes, detect_service_mesh (Istio/Linkerd/Cilium + sidecar status), detect_cni (Calico/Cilium/Flannel/AWS VPC/etc.), diagnose_coredns, analyze_network_reachabilityPro (NetworkPolicy posture), visualize_network_policiesPro (Mermaid graph), simulate_pod_reachabilityPro (pure-logic NetworkPolicy walker), visualize_egress_allowancesPro (NS → external CIDR Mermaid), find_unprotected_workloadsPro (zero-trust gap detector), audit_loadbalancersPro (LB services + pending allocations), port_conflict_checkPro (NodePort + hostNetwork conflicts), dns_lookup (cluster-DNS view of any hostname)

5

12

Ingress Audit

audit_ingress_endpointsPro (backends + TLS), audit_ingress_tlsPro (cert expiry, sorted by urgency), visualize_ingress_topologyPro (Mermaid Ingress → Service → Pod chains), test_ingress_connectivityPro (synthetic curl probe with timing breakdown)

0

4

Access Control (RBAC YAML)

grant_namespace_accessPro (viewer/editor/admin), grant_resource_accessPro (least-privilege Role generator + lint warnings), revoke_accessPro (find + remove all bindings)

0

3

Compliance Reporting

generate_compliance_reportPro — aggregates evidence from 11 audit-relevant tools and exports to Markdown + PDF + DOCX. Supports CIS Kubernetes Benchmark, SOC 2, ISO 27001, NIST 800-53, PCI-DSS, HIPAA, or comprehensive (all). Multi-cluster optional.

0

1

CRDs & Operators

list_crds, describe_crd, count_custom_resources (find bloat), detect_operators (combines OLM + known-group + Deployment-pattern signals), audit_finalizersPro (stuck-Terminating resources + unstuck recipes), audit_operator_rbacPro (flag operators running with cluster-admin), find_orphan_crsPro (CRs after operator uninstall), audit_crd_versionsPro (multi-version + conversion strategy + preserveUnknownFields), list_olm_subscriptionsPro, visualize_operatorsPro (Mermaid: operators → CRDs → CR counts)

4

10

Visualization

visualize_cluster_topology, visualize_namespace, visualize_network, visualize_app_architecture, analyze_connectionsPro

4

5

Rendered Diagrams

render_cluster_topology, render_namespace, render_network, render_app_architecture, render_app_architecture_premiumPro, render_gpu_dashboard, render_gpu_metrics, render_gpu_sparkline

7

8

3D Visualization

render_3d_topologyPro — interactive Three.js 3D cluster topology returned as MCP EmbeddedResource (HTML) + auto-opens in browser

0

1

Multi-Cluster

list_contexts, switch_context, multi_cluster_overviewPro

2

3

Pod Exec

exec_commandPro

0

1

Helm

helm_list, helm_get_values, helm_installPro, helm_uninstallPro

2

4

Cost Analysis

analyze_costPro, rightsizing_reportPro

0

2

OpenShift

openshift_detect, openshift_list_routes, openshift_list_projects, openshift_list_builds

4

4

ArgoCD

argocd_detect, argocd_list_apps, argocd_get_appPro, argocd_list_projects, argocd_app_historyPro, argocd_sync_appPro, argocd_rollback_appPro, visualize_argocdPro

3

8

Flux CD

flux_detect, flux_list_sources, flux_list_kustomizations, flux_list_helmreleases, visualize_flux

5

5

Tekton

tekton_detect, tekton_list_pipelines, tekton_list_runs, tekton_list_tasks, visualize_tektonPro

4

5

GitOps Overview

visualize_gitopsPro — unified Mermaid diagram of all detected CD tools

0

1

GPU / Accelerators

list_gpu_workloads, gpu_cluster_readiness, visualize_gpu_allocationPro, visualize_gpu_metricsPro, gpu_nvidia_smiPro, get_gpu_promql_reference

3

6

Observability

get_server_stats (OpenTelemetry), prometheus_queryPro, loki_queryPro

1

3

License

get_license_info, register_license

2

2

Total

73

140

Further roadmap items (HTTP MCP transport, deeper GitOps) are in docs/ROADMAP.md.

Related MCP server: Kubernetes MCP Server

Diagram & Visual Rendering

KubeCraft returns visual content using multiple MCP content types, with automatic browser fallback for clients that don't render visuals inline.

Content

MCP response type

Inline rendering

Fallback

PNG diagrams (render_*)

ImageContent (base64 PNG)

Cursor renders inline

Auto-opens saved PNG in default viewer; also saved to KUBECRAFT_OUTPUT_DIR

3D topology (render_3d_topology, Pro)

EmbeddedResource (base64 HTML, text/html)

Future clients that support EmbeddedResource

Auto-opens HTML in default browser; also saved to KUBECRAFT_OUTPUT_DIR or temp dir

Mermaid text (visualize_*)

TextContent (markdown)

Cursor + Claude Desktop render natively

Copy Mermaid block to any Mermaid renderer

Auto-open behavior: When KUBECRAFT_OUTPUT_DIR is configured and writable, rendered PNGs and 3D HTML files are saved to disk and automatically opened in the user's default browser or image viewer. Inside Docker containers, auto-open works only when the container can reach the host display (e.g. via X11 forwarding or host networking); otherwise, open the saved files from the host-mounted output directory.

Kubernetes Distribution Compatibility

KubeCraft uses the standard Kubernetes Python client and communicates directly with the K8s API server — no kubectl or other CLI wrappers required.

Distribution

Status

Notes

Vanilla K8s / KinD

Fully supported

Primary dev/test target

Amazon EKS

Fully supported

kubeconfig via aws eks update-kubeconfig

Azure AKS

Fully supported

kubeconfig via az aks get-credentials

Google GKE

Fully supported

kubeconfig via gcloud container clusters get-credentials

Canonical K8s / MicroK8s

Fully supported

CNCF certified, standard APIs

k3s / Rancher

Fully supported

Lightweight but fully conformant

Red Hat OpenShift

Fully supported

Standard K8s tools + OCP-specific tools for Routes, Projects, BuildConfigs

Quick Start

Build the Docker image

docker build -t kubecraft-mcp:latest .

Configure in Cursor

Create or edit .cursor/mcp.json in your project:

{
  "mcpServers": {
    "kubecraft": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i", "--network=host",
        "-v", "/home/<user>/.kube:/home/mcp/.kube:ro",
        "-e", "KUBECONFIG=/home/mcp/.kube/config",
        "kubecraft-mcp:latest"
      ]
    }
  }
}

Windows (WSL kubeconfig):

{
  "mcpServers": {
    "kubecraft": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-v", "C:\\Users\\<user>\\.kube:/home/mcp/.kube:ro",
        "-e", "KUBECONFIG=/home/mcp/.kube/config",
        "kubecraft-mcp:latest"
      ]
    }
  }
}

3D topology viewer (HTTP link, KubeCraft Pro): The Viewer URL works only while the Kubecraft process is running. If you run a one-off python -c locally, the server exits immediately and the link will show connection refused. On Docker Desktop (Windows/macOS), --network=host does not publish the container's loopback to your host browser like it does on Linux; prefer opening the saved HTML file from KUBECRAFT_OUTPUT_DIR, or publish a fixed port, for example add to args: "run", "--rm", "-i", "-p", "8765:8765", plus -e, KUBECRAFT_VIEWER_BIND=0.0.0.0:8765, -e, KUBECRAFT_VIEWER_EXPOSE=1, then use http://127.0.0.1:8765 plus the path from the tool output (copy it exactly; the token is case-sensitive).

Configure in Claude Desktop

Claude Desktop doesn't render MCP ImageContent or EmbeddedResource inline, so diagrams are saved to a shared folder on your machine and automatically opened in your default browser/viewer. Open (or create) %APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

Windows:

{
  "mcpServers": {
    "kubecraft": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i", "--network=host",
        "-v", "C:\\Users\\<user>\\.kube:/home/mcp/.kube:ro",
        "-v", "C:\\Users\\<user>\\kubecraft-diagrams:/output",
        "-e", "KUBECONFIG=/home/mcp/.kube/config",
        "-e", "KUBECRAFT_OUTPUT_DIR=/output",
        "kubecraft-mcp:latest"
      ]
    }
  }
}

Rendered PNG diagrams and 3D topology HTML files will appear in C:\Users\<user>\kubecraft-diagrams\ and auto-open in your browser.

macOS / Linux:

{
  "mcpServers": {
    "kubecraft": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i", "--network=host",
        "-v", "/home/<user>/.kube:/home/mcp/.kube:ro",
        "-v", "/home/<user>/kubecraft-diagrams:/output",
        "-e", "KUBECONFIG=/home/mcp/.kube/config",
        "-e", "KUBECRAFT_OUTPUT_DIR=/output",
        "kubecraft-mcp:latest"
      ]
    }
  }
}

Configure in Claude Code

claude mcp add kubecraft \
  -- docker run --rm -i --network=host \
  -v ~/.kube:/home/mcp/.kube:ro \
  -e KUBECONFIG=/home/mcp/.kube/config \
  kubecraft-mcp:latest

Built-in Chat UI (Web mode)

KubeCraft ships with a full React/TypeScript chat UI bundled in the same Docker image. It exposes the full tool surface (73 Community tools, or 140 with KubeCraft Pro installed) as a conversational interface backed by your choice of LLM (Claude, OpenAI, or Azure OpenAI) — the LLM decides when to call MCP tools and the UI streams the results back with markdown, embedded PNG diagrams, and (with Pro) an interactive 3D topology viewer.

Pages

  • Chat — streaming conversation with expandable tool-invocation cards, image/HTML embedding, kubeconfig context switcher in the header. Per-message Copy and Edit actions (hover any message); Suggestions picker right next to the input opens a searchable popover of the full template library.

  • Templates — curated catalog of 159 prompt templates spanning all 27 tool categories. Sidebar filter by category, full-text search across title / prompt / tool name / tags. Click Use to drop a template into the chat input.

  • Saved — bookmark your own reusable questions; one click sends them to chat.

  • History — every past conversation, resumable.

  • Audit — every MCP tool call ever executed (compliance trail).

  • Settings — provider config, license registration, full tool inventory.

Compliance reporting (KubeCraft Pro)

KubeCraft Pro's generate_compliance_report tool produces audit-ready PDF and Word documents mapped to the major compliance frameworks. Run it from chat with one prompt like "Generate a SOC 2 compliance audit report and export PDF + Word".

Frameworks supported:

Framework

Mapping

CIS Kubernetes Benchmark v1.9

Direct control-ID mapping (5.1.x RBAC, 5.2.x PSS, 5.3.x networking, 5.4.x secrets, etc.)

SOC 2 Trust Service Criteria

CC6.x logical access · CC7.x system operations · CC8.x change management

ISO 27001:2022

Annex A (A.5 access control · A.8 operations / cryptography / network security)

NIST 800-53 Rev. 5

AC, AU, CM, IA, RA, SC, SI control families

PCI-DSS v4.0

Req 1, 2, 6, 7, 8, 10

HIPAA Security Rule

§164.312 Technical Safeguards (a) Access · (b) Audit · (c) Integrity · (e) Transmission

comprehensive

All of the above in one report — every finding lists its mapping in each framework

What the report contains:

  1. Executive summary — color-coded status counts + a 0-100 compliance score with interpretation

  2. Findings summary table — every control with status, control ID, and one-line summary

  3. Detailed findings — per-control: status, evidence excerpt, cross-framework mappings, remediation guidance

  4. Methodology — which tools were used to gather evidence, which findings need manual review

Evidence sources (run automatically, read-only):

inspect_rbac · summarize_pod_security_standards · analyze_network_reachability · find_unprotected_workloads · audit_secret_hygiene · summarize_image_vulnerabilities · scan_deprecations · audit_ingress_tls · audit_loadbalancers · get_node_health · list_pod_disruption_budgets

Multi-cluster: Set multi_cluster=true to loop over every kubeconfig context and produce one combined report — each finding is prefixed with the originating cluster name.

Output: Files are saved under KUBECRAFT_OUTPUT_DIR/compliance/ as kubecraft-compliance-{framework}-{timestamp}.{md,pdf,docx}. When the web UI is running, the chat response includes a Download link served by /api/v1/files/... (path-traversal protected, scoped to the output dir).

Note: This is an evidence-aggregation tool, not a substitute for a qualified auditor. Findings flagged 🔍 manual review require human verification (e.g., kube-apiserver flags, organizational controls outside the cluster).

Output beautification

Assistant replies and tool outputs are rendered with GitHub-flavored markdown, including:

  • Mermaid diagrams — fenced ```mermaid blocks (returned by visualize_* tools) are rendered as interactive SVG with a toolbar: Copy source, Copy as PNG, Download PNG, Toggle source, Fullscreen. Mermaid is lazy-loaded so the bundle stays slim for users who never see a diagram.

  • PNG renders — every render_* tool output (cluster topology, namespace, network, app architecture, premium architecture, GPU dashboard / metrics / sparkline) gets the same toolbar: Copy PNG, Download, Open in new tab, Fullscreen. Click the image to open it fullscreen; click the backdrop or press Esc to dismiss.

  • 3D HTML topology (render_3d_topology, Pro) gets a matching panel: Open viewer (in-page iframe overlay), New tab (standalone Blob URL), Download (.html file), Copy (HTML source). Includes a size readout (e.g. "342 KB · self-contained Three.js HTML").

  • Syntax-highlighted fenced code blocks (highlight.js, common-language bundle)

  • Per-codeblock Copy button on hover

  • JSON auto-pretty-print when fenced as ```json

  • Wide tables with sticky headers + horizontal scroll wrapper

  • Status emojis (✅ ❌ ⚠️ 🟢 🟡 🔴 ⏳) automatically rendered as tinted chips for fast scanning

Run web mode

Web mode has no authentication yet — bind it to localhost only (-p 127.0.0.1:8080:8080, or -e KUBECRAFT_HTTP_HOST=127.0.0.1 with --network=host); never publish it on a shared or public network.

Linux / WSL2 (recommended — uses host networking so the container can reach 127.0.0.1 clusters like kind/k3d/minikube):

docker run --rm --network=host \
  -v ~/.kube:/home/mcp/.kube:ro \
  -e KUBECONFIG=/home/mcp/.kube/config \
  -e KUBECRAFT_MODE=http \
  -e KUBECRAFT_HTTP_HOST=127.0.0.1 \
  -e KUBECRAFT_LLM_PROVIDER=anthropic \
  -e ANTHROPIC_API_KEY=sk-ant-... \
  kubecraft-mcp:latest

Open http://localhost:8080.

Docker Desktop (Windows / macOS — --network=host is a no-op there; use host.docker.internal to reach a localhost cluster):

docker run --rm -p 127.0.0.1:8080:8080 --add-host=host.docker.internal:host-gateway \
  -v ~/.kube:/home/mcp/.kube:ro \
  -e KUBECONFIG=/home/mcp/.kube/config \
  -e KUBECRAFT_MODE=http \
  -e ANTHROPIC_API_KEY=sk-ant-... \
  kubecraft-mcp:latest

Then rewrite your kubeconfig to use host.docker.internal instead of 127.0.0.1 for the cluster URL — see Troubleshooting below.

The same image still runs MCP stdio mode by default — KUBECRAFT_MODE=http (or --http) opts into the web UI.

Provider configuration

Provider

Env vars

Anthropic Claude (default)

KUBECRAFT_LLM_PROVIDER=anthropic · ANTHROPIC_API_KEY · optional KUBECRAFT_LLM_MODEL (default claude-sonnet-4-6; other options: claude-opus-4-7, claude-haiku-4-5-20251001)

OpenAI

KUBECRAFT_LLM_PROVIDER=openai · OPENAI_API_KEY · optional KUBECRAFT_LLM_MODEL (default gpt-4o)

Azure OpenAI

KUBECRAFT_LLM_PROVIDER=azure-openai · AZURE_OPENAI_KEY · AZURE_OPENAI_ENDPOINT · AZURE_OPENAI_DEPLOYMENT · optional AZURE_OPENAI_API_VERSION

The Settings page shows whether the active provider is configured and lists every supported provider.

Tool surface limits per provider

The 73-tool Community build fits every provider's limit. With KubeCraft Pro installed, KubeCraft exposes 140 tools, but OpenAI and Azure OpenAI cap tools at 128 entries per request (Anthropic has no practical limit). KubeCraft handles this transparently with a smart tool selector (kubecraft_mcp/llm/tool_selector.py):

  1. Anthropic — receives every tool, every turn. No filtering.

  2. OpenAI / Azure OpenAI — receives a relevant subset of ≤128 tools per turn, chosen by:

    • Always-include core (~15 tools): cluster discovery, diagnostics, apply_manifest, etc.

    • Category routing: keyword classifier on your most recent prompt + last few user messages → matches against a tool/category map.

    • Priority padding: any remaining slots are filled by global priority order (most universally useful tools first).

You'll see the selected count in the server log on every turn (e.g. Tool subset for openai: 128/140 tools). If the LLM ever says it can't find a tool you expected, rephrase with stronger keywords ("audit my RBAC for risky bindings" rather than "check permissions") to surface the right category.

Develop the UI locally

The UI lives at ui/ inside this repo (not a separate project). For local dev:

# Terminal 1 — Python backend
KUBECRAFT_MODE=http ANTHROPIC_API_KEY=... python -m kubecraft_mcp

# Terminal 2 — Vite dev server (proxies /api/* to :8080)
cd ui && npm install && npm run dev
# → http://localhost:5173

For production builds, the Dockerfile bundles npm run build output into /app/ui/dist, served by FastAPI under /. No separate dev server needed.

Environment Variables

Variable

Description

KUBECONFIG

Path to kubeconfig file

KUBECRAFT_OUTPUT_DIR

Directory for saving diagrams and 3D HTML files. Saved files are auto-opened in the default browser/viewer. Pre-created as /output inside the container image

KUBECRAFT_VIEWER_BIND

Pro (render_3d_topology): optional bind for the built-in 3D viewer URL. Loopback: 127.0.0.1:0, localhost:0, ::1:0. With KUBECRAFT_VIEWER_EXPOSE=1, also 0.0.0.0:PORT (for docker run -p host:port)

KUBECRAFT_VIEWER_EXPOSE

Pro (render_3d_topology): set to 1 to allow binding 0.0.0.0 so Docker port publishing works. The viewer still uses unguessable URLs; avoid on hostile networks without firewall rules

KUBECRAFT_CPU_HOUR_RATE

Pro (analyze_cost): CPU rate (default: $0.031/vCPU-hr)

KUBECRAFT_MEM_GIB_HOUR_RATE

Pro (analyze_cost): memory rate (default: $0.004/GiB-hr)

OTEL_EXPORTER_OTLP_ENDPOINT

OpenTelemetry OTLP endpoint for trace export

ARGOCD_SERVER

Pro: ArgoCD server URL for sync/rollback actions (e.g. https://argocd.example.com)

ARGOCD_TOKEN

Pro: ArgoCD API token for authenticated REST operations (argocd_detect also reports whether it is set)

KUBECRAFT_PROMETHEUS_URL

Prometheus base URL for prometheus_query, visualize_gpu_metrics, render_gpu_metrics, render_gpu_sparkline (e.g. https://prometheus.example.com)

KUBECRAFT_PROMETHEUS_TOKEN

Optional Bearer token for Prometheus

KUBECRAFT_PROMETHEUS_USER / KUBECRAFT_PROMETHEUS_PASSWORD

Optional basic auth for Prometheus (used instead of token when both are set)

KUBECRAFT_LOKI_URL

Loki base URL for loki_query (e.g. https://loki.example.com)

KUBECRAFT_LOKI_TOKEN

Optional Bearer token for Loki

KUBECRAFT_LOKI_USER / KUBECRAFT_LOKI_PASSWORD

Optional basic auth for Loki

KUBECRAFT_LOKI_ORG_ID

Optional X-Scope-OrgID header for multi-tenant Loki

KUBECRAFT_LICENSE_KEY

KubeCraft Pro license key (overrides file-based license; unused by the Community build)

KUBECRAFT_EMAIL

Email address for KubeCraft Pro license registration

KUBECRAFT_MODE

stdio (default — MCP) or http (web UI on port 8080). Equivalent to passing --http

KUBECRAFT_HTTP_HOST

Bind address for web mode (default 0.0.0.0). Web mode has no authentication yet — set 127.0.0.1 when using --network=host so it is reachable from localhost only

KUBECRAFT_HTTP_PORT

Port for web mode (default 8080)

KUBECRAFT_INSTANCE_NAME

Optional label shown in the UI header to distinguish multiple deployments

KUBECRAFT_LLM_PROVIDER

anthropic (default), openai, or azure-openai

KUBECRAFT_LLM_MODEL

Override the default model for the active provider

ANTHROPIC_API_KEY

API key for Anthropic Claude provider

ANTHROPIC_BASE_URL

Optional Anthropic API base URL (proxies, mirrors)

OPENAI_API_KEY

API key for OpenAI provider

OPENAI_BASE_URL

Optional OpenAI base URL (compatible endpoints, proxies)

AZURE_OPENAI_KEY / AZURE_OPENAI_ENDPOINT / AZURE_OPENAI_DEPLOYMENT / AZURE_OPENAI_API_VERSION

Azure OpenAI configuration (deployment-based; KUBECRAFT_LLM_MODEL falls back to the deployment name)

KUBECRAFT_CORS_ORIGINS

Comma-separated CORS allow-list for web mode (default http://localhost:5173 for Vite dev). Production same-origin deploys can ignore

Project Structure

kubecraft-mcp-server/
├── Dockerfile
├── pyproject.toml
├── kubecraft_mcp/
│   ├── server.py              # MCP server entry point (73 Community tools)
│   ├── registry.py            # Tool registry (ToolSpec: schema + handler + tier + kind)
│   ├── plugins.py             # Entry-point plugin loader (how KubeCraft Pro adds its tools)
│   ├── licensing.py           # Edition seam: reports Community edition; KubeCraft Pro adds trials + license keys
│   ├── observability.py       # OpenTelemetry tracing + server stats
│   ├── k8s/
│   │   ├── client.py          # Kubernetes API client wrapper
│   │   ├── formatters.py      # Resource formatting utilities
│   │   ├── mermaid.py         # Mermaid diagram generation
│   │   ├── metrics_backend.py # Prometheus/Loki query backend
│   │   ├── renderer.py        # Shared colour palette for the Pillow renderers
│   │   ├── gpu_utils.py       # GPU extended-resource detection helpers
│   │   ├── gpu_renderer.py    # Pillow PNG dashboards for GPU allocation / metrics
│   │   └── logo_gen.py        # Programmatic KubeCraft logo generator
│   └── tools/
│       ├── cluster.py         # Cluster-level tools
│       ├── diagnostics.py     # Pod diagnostics and logs
│       ├── gateway_api.py     # Gateway API (HTTPRoute, GRPCRoute)
│       ├── gpu.py             # GPU workloads, readiness, Prometheus, nvidia-smi
│       ├── helm.py            # Helm releases + values (read-only)
│       ├── multicluster.py    # Multi-cluster context management
│       ├── openshift.py       # OpenShift-specific tools
│       ├── platform_posture.py # Storage, cert-manager, NetworkPolicy, endpoints
│       ├── policy_budgets.py  # PodDisruptionBudget listing
│       ├── policy_engines.py  # Kyverno / Gatekeeper policy summaries
│       ├── rbac_inspector.py  # RBAC role/binding inspection
│       ├── operators.py       # CRD & operator discovery (4 tools)
│       ├── network_advanced.py # IngressClasses, service mesh, CNI, CoreDNS, DNS lookup
│       ├── render.py          # PNG rendering (mermaid.ink + Pillow GPU dashboards) + auto-open
│       ├── resources.py       # Resource listing and describe
│       ├── storage_advanced.py # CSI drivers
│       ├── visualization.py   # Mermaid text diagram tools
│       ├── workloads.py       # DaemonSet, StatefulSet, CronJob/Job listing
│       ├── argocd.py          # ArgoCD detection + app/project listing (CRD-based)
│       ├── flux.py            # Flux CD integration (CRD-based)
│       └── tekton.py          # Tekton CI/CD integration (CRD-based)
├── kubecraft_mcp/llm/         # Multi-provider LLM bridge (web mode)
│   ├── base.py                # Provider ABC + streaming event types
│   ├── tool_bridge.py         # MCP tool → Anthropic/OpenAI tool_use translation
│   ├── anthropic_provider.py  # Claude (default) — drives the tool_use loop
│   ├── openai_provider.py     # OpenAI function calling
│   └── azure_provider.py      # Azure OpenAI (deployment-based)
├── kubecraft_mcp/web/         # FastAPI HTTP/SSE server bundled with the chat UI
│   ├── app.py                 # FastAPI factory + uvicorn entry point
│   ├── storage.py             # SQLite (sessions, messages, audit, saved)
│   ├── tool_runner.py         # Async wrapper that executes any registered MCP tool
│   ├── static.py              # Serves the built UI from /app/ui/dist
│   ├── templates_data.py      # Curated template library (159 prompts × 27 categories)
│   └── routes/
│       ├── chat.py            # POST /api/v1/ask (SSE streaming + tool orchestration)
│       ├── sessions.py        # Session CRUD
│       ├── config.py          # /api/v1/config (provider, instance metadata)
│       ├── audit.py           # /api/v1/audit (tool invocation log)
│       ├── saved.py           # Saved questions + suggested-questions starter prompts
│       ├── templates.py       # /api/v1/templates (curated library)
│       ├── files.py           # /api/v1/files (download exported reports / artifacts)
│       └── kubecraft.py       # /api/v1/contexts, /api/v1/license, /api/v1/tools
├── kubecraft_mcp/__main__.py  # Dispatcher: stdio (default) | http (KUBECRAFT_MODE=http)
├── ui/                        # React/TypeScript chat UI (Vite + Tailwind + Zustand)
│   ├── src/
│   │   ├── App.tsx            # Routes: /chat, /templates, /saved, /history, /audit, /settings
│   │   ├── pages/             # ChatPage, TemplatesPage, SavedPage, HistoryPage, AuditPage, SettingsPage
│   │   ├── components/        # Header, MessageCard, MarkdownView (highlight.js), ToolInvocationCard, SuggestionsPicker, ContextPicker, CopyButton
│   │   ├── store/chat.ts      # Zustand chat store with streaming reducers
│   │   └── lib/{api,stream,format,copy,icons}.ts(x)
│   ├── package.json
│   ├── vite.config.ts         # Proxies /api/* → :8080 in dev
│   └── tailwind.config.js     # KubeCraft brand palette
└── .cursor/
    └── mcp.json               # Cursor MCP configuration

Troubleshooting

Windows: "Permission denied" on /output (diagrams not saved)

If you see warnings like Permission denied: '/output/index.html' in the MCP server logs, diagrams still work inline but the optional file-save to your host directory fails. This is a Docker Desktop volume-mount permissions issue.

Fix: Ensure the host directory exists before starting the container:

mkdir C:\Users\<user>\kubecraft-diagrams

Then confirm your config maps it correctly:

"-v", "C:\\Users\\<user>\\kubecraft-diagrams:/output"

If the error persists, check that Docker Desktop has file-sharing access to the drive (Settings → Resources → File sharing). Alternatively, use a named Docker volume:

"-v", "kubecraft-output:/output"

Note: Diagrams are always returned inline via MCP regardless of whether the file-save succeeds. The file-save is a convenience for hosts like Claude Desktop that don't render MCP images natively.

Diagrams don't auto-open in browser

Auto-open uses webbrowser.open() which requires the container to reach the host display. Inside Docker, this only works with X11 forwarding or host networking on Linux. On Windows/macOS Docker Desktop, open the saved files from your host-mounted KUBECRAFT_OUTPUT_DIR directory instead, or use the dashboard at <KUBECRAFT_OUTPUT_DIR>/index.html (auto-refreshes every 5 seconds).

Kubernetes API server unreachable (connection refused)

If tools fail with errors like:

HTTPSConnectionPool(host='127.0.0.1', port=53842): Max retries exceeded ...
[Errno 111] Connection refused

…the cause is that your kubeconfig points to a localhost endpoint on the host (typical for kind, k3d, minikube, or kubectl proxy), but inside the container 127.0.0.1 is the container's own loopback — which has nothing listening.

Diagnose first:

kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}'
# → e.g. https://127.0.0.1:53842   ← that's the smoking gun

Fix on Linux / WSL2 — use host networking:

docker run --rm --network=host -e KUBECRAFT_MODE=http -e KUBECRAFT_HTTP_HOST=127.0.0.1 ... kubecraft-mcp:latest

--network=host shares the container's network namespace with the host so 127.0.0.1:53842 resolves correctly. Note: with --network=host you don't need -p 127.0.0.1:8080:8080 (and Docker will reject combining the two).

Fix on Docker Desktop (Windows / macOS) — --network=host is a no-op:

⚠️ TLS gotcha: kind/k3d/minikube apiserver certificates have SANs only for 127.0.0.1, localhost, and kubernetes. After rewriting the URL to host.docker.internal, Python rejects the cert with SSL: CERTIFICATE_VERIFY_FAILED — Hostname mismatch. You must therefore also disable TLS verification in the container-only kubeconfig copy. This is acceptable for local dev because these certs are self-signed anyway — but never do it for production clusters.

  1. Add the host-gateway alias when you docker run:

    docker run --rm -p 127.0.0.1:8080:8080 --add-host=host.docker.internal:host-gateway ...
  2. Make a container-only kubeconfig copy that rewrites the URL and turns off TLS verification:

    # On the host:
    sed -e 's|https://127\.0\.0\.1:|https://host.docker.internal:|' \
        -e '/certificate-authority-data:/d' \
        ~/.kube/config > ~/.kube/config.docker
    sed -i 's|^\(\s*\)server: https://host.docker.internal|\1insecure-skip-tls-verify: true\n\1server: https://host.docker.internal|' \
        ~/.kube/config.docker
  3. Mount the rewritten file:

    docker run --rm -p 127.0.0.1:8080:8080 --add-host=host.docker.internal:host-gateway \
      -v ~/.kube/config.docker:/home/mcp/.kube/config:ro \
      -e KUBECRAFT_MODE=http -e ANTHROPIC_API_KEY=... \
      kubecraft-mcp:latest

💡 WSL2 users: skip this section. WSL2's Docker engine supports --network=host natively — use the Linux fix above. You keep proper TLS verification and your kubeconfig stays untouched.

Fix for remote clusters (EKS / AKS / GKE / OpenShift):

These already have routable hostnames, so this issue only affects local clusters. If you see it against a remote cluster, check whether your kubeconfig has been overridden by a kubectl proxy session.

Requirements

  • Docker

  • A kubeconfig with access to your target cluster

  • Cursor, Claude Desktop, Claude Code, or any MCP-compatible AI assistant

License

The KubeCraft MCP Server Community Edition in this repository is open source under the MIT License — all 73 Community tools, no trial, no license key.

KubeCraft Pro is a separately licensed add-on from CloudCraft Labs that registers 67 additional tools (140 total). Pro includes a 30-day trial and commercial license keys; see cloudcraftlabs.io for details.

  • In the Community build, get_license_info reports the Community edition and register_license explains that registration applies to KubeCraft Pro

  • With Pro installed, the same two tools manage the Pro trial and license

Available Tools

73 tools
argocd_detectDetect ArgoCDA

Detect whether ArgoCD is installed and report application/project counts and REST API config status.

Inputs: no named parameters.

argocd_list_appsList ArgoCD ApplicationsB

List ArgoCD Applications with sync status, health, source repo, revision, and target namespace.

Inputs: namespace.

argocd_list_projectsList ArgoCD ProjectsA

List ArgoCD AppProjects with allowed source repos, destination namespaces, and role count.

Inputs: no named parameters.

count_custom_resourcesCount Custom ResourcesA

Cluster-wide CR census: count instances of every CRD. Catches operator bloat — thousands of abandoned CronJobs, sprawling VirtualServices, stale ApplicationSets. Returns top N by count.

Inputs: group, top_n, min_count.

describe_crdDescribe a CRDA

Detail on a single CRD: full version list, conversion strategy, printer columns, subresources, validation summary, instance count per version, and risk flags (no schema, preserveUnknownFields, multi-version with no conversion webhook).

Inputs: name (required).

describe_resourceDescribe ResourceA

Return the full spec of a Kubernetes resource as YAML or JSON. Supported kinds: pod, service, deployment, replicaset, statefulset, daemonset, configmap, secret, ingress, namespace, node, persistentvolumeclaim.

Inputs: kind (required), name (required), output, namespace.

detect_cniDetect CNI PluginA

Detect the cluster CNI plugin from node annotations, known DaemonSets (Calico, Cilium, Flannel, AWS VPC CNI, Azure CNI, Weave, Antrea, etc.), and pod CIDRs.

Inputs: no named parameters.

detect_operatorsDetect OperatorsA

Detect operators running on the cluster by combining signals: known API groups, OLM ClusterServiceVersions, Deployment naming patterns (*-operator, *-controller, *-manager), and operator-style labels. Reports each operator's source, managed CRDs, ServiceAccount, deployment health.

Inputs: no named parameters.

detect_service_meshDetect Service MeshA

Detect installed service meshes (Istio, Linkerd, Cilium, Contour, Kuma, Consul Connect) by API groups. For Istio/Linkerd: shows namespace injection labels and sidecar container counts from a pod sample.

Inputs: no named parameters.

diagnose_corednsDiagnose CoreDNSA

Check CoreDNS deployment health: replica readiness, Corefile configuration (plugins, forwarding), kube-dns Service ClusterIP and endpoint count. Flags single-replica or degraded states.

Inputs: no named parameters.

diagnose_podDiagnose PodA

Comprehensive pod diagnosis: status, conditions, container states, events, and recent logs in one call.

Inputs: name (required), namespace.

dns_lookupDNS Lookup (cluster view)A

Resolve a hostname from inside the cluster by execing nslookup/getent/python in a running pod. Compares cluster-DNS view to external DNS to detect split-horizon issues.

Inputs: hostname (required), record_type.

flux_detectDetect Flux CDA

Detect whether Flux CD is installed and report source/kustomization/helmrelease counts.

Inputs: no named parameters.

flux_list_helmreleasesList Flux HelmReleasesB

List Flux HelmReleases with ready status, chart name, version, release name, and values summary.

Inputs: namespace.

flux_list_kustomizationsList Flux KustomizationsA

List Flux Kustomizations with ready status, source reference, path, and last applied revision.

Inputs: namespace.

flux_list_sourcesList Flux SourcesA

List Flux GitRepositories and HelmRepositories with ready status, URL, and artifact revision.

Inputs: namespace.

get_cluster_infoGet Cluster InfoA

Return cluster version, node count, API server URL, and overall health status.

Inputs: no named parameters.

get_eventsGet EventsB

Fetch recent Kubernetes events, optionally filtered by namespace, resource, or type.

Inputs: limit, namespace, event_type, resource_name.

get_gpu_promql_referenceGPU PromQL ReferenceA

Markdown reference for DCGM and common GPU-related PromQL examples (no live query). Pair with prometheus_query for execution.

Inputs: no named parameters.

get_license_infoLicense InformationA

Show current KubeCraft license status, type, expiry, hardware ID, email, and purchase/renewal instructions.

Inputs: no named parameters.

get_node_healthGet Node HealthA

Structured node conditions (Ready, memory/disk/PID/network pressure) with unhealthy nodes first and short remediation hints. Read-only.

Inputs: no named parameters.

get_pod_logsGet Pod LogsB

Fetch logs for a specific pod/container.

Inputs: name (required), previous, container, namespace, +1 more.

get_resource_usageGet Resource UsageA

Fetch CPU/memory usage for pods via the metrics API (requires metrics-server).

Inputs: namespace.

get_server_statsGet Server StatsA

Return KubeCraft MCP server stats: total calls, errors, average latency per tool, and uptime.

Inputs: no named parameters.

gpu_cluster_readinessGPU Cluster ReadinessC

Heuristic scan for GPU device plugins, GPU operator workloads, and GPU-related CRDs.

Inputs: no named parameters.

helm_get_valuesGet Helm Release ValuesB

Show user-supplied values for a specific Helm release.

Inputs: release (required), namespace.

helm_listList Helm ReleasesB

List Helm releases with status, chart, app version, and revision number.

Inputs: namespace, all_namespaces.

inspect_rbacInspect RBACA

Read-only RBAC review: heuristics for risky ClusterRole/Role rules (wildcards, escalate/bind/impersonate) and a sample of ClusterRoleBindings.

Inputs: namespace.

list_contextsList Kubeconfig ContextsA

List all kubeconfig contexts with cluster, user, namespace, and which is active.

Inputs: no named parameters.

list_crdsList CustomResourceDefinitionsA

Inventory every CRD with group, kind, scope, served versions, stored version, age, and an owner hint (Helm release / OLM CSV / known operator). Optional count_instances includes per-CRD instance counts (slower).

Inputs: group, count_instances.

list_cronjobsList CronJobsA

List CronJobs with schedule, suspend status, active job count, and last schedule time. Omit namespace for all namespaces. Read-only.

Inputs: namespace.

list_csi_driversList CSI DriversA

List installed CSI drivers with their capabilities (attach, capacity tracking, pod info, fsGroup policy) and per-node registration status from CSINode objects.

Inputs: no named parameters.

list_daemonsetsList DaemonSetsA

List DaemonSets with desired/ready/available/updated counts, node selector, and update strategy. Omit namespace for all namespaces. Read-only.

Inputs: namespace.

list_deploymentsList DeploymentsA

List deployments in a namespace with replica counts, strategy, and age.

Inputs: namespace.

list_gateway_apiList Gateway API ResourcesA

If gateway.networking.k8s.io is installed, list Gateways, HTTPRoutes, and GRPCRoutes. Omit namespace for all namespaces. Read-only.

Inputs: namespace.

list_gpu_workloadsList GPU WorkloadsA

List pods that request or limit GPU extended resources (e.g. nvidia.com/gpu) with node, phase, requests, and limits.

Inputs: namespace.

list_hpasList HPAsA

List HorizontalPodAutoscalers with scaling target, min/max/current replicas, metrics, and current utilization.

Inputs: namespace.

list_ingress_classesList Ingress ClassesA

List IngressClass resources with controller, default status, and parameter references. Identifies which IngressClass is the cluster default.

Inputs: no named parameters.

list_ingressesList IngressesA

List ingress resources in a namespace with hosts, paths, and TLS config.

Inputs: namespace.

list_jobsList JobsA

List Jobs with completion status, duration, and succeeded/failed counts. Omit namespace for all namespaces. Read-only.

Inputs: namespace.

list_namespacesList NamespacesA

List all namespaces with status, age, and labels.

Inputs: no named parameters.

list_nodesList NodesA

List cluster nodes with roles, status, capacity, and allocatable resources.

Inputs: no named parameters.

list_pod_disruption_budgetsList PodDisruptionBudgetsA

List PDBs with minAvailable/maxUnavailable and current vs desired healthy pods. Omit namespace for all namespaces. Read-only.

Inputs: namespace.

list_podsList PodsA

List pods in a namespace with status, restarts, age, and container images.

Inputs: namespace, label_selector.

list_resource_quotasList Resource QuotasB

List ResourceQuotas showing used vs hard limits, and LimitRanges showing min/max/default resource constraints per namespace.

Inputs: namespace.

list_resourcesList Resources (Generic)B

Generic resource lister — fetches any Kubernetes resource by kind and API version.

Inputs: kind (required), namespace, api_version.

list_servicesList ServicesA

List services in a namespace with type, cluster IP, ports, and selectors.

Inputs: namespace.

list_statefulsetsList StatefulSetsA

List StatefulSets with ready/updated/current counts, update strategy, and headless service name. Omit namespace for all namespaces. Read-only.

Inputs: namespace.

list_storage_overviewList Storage OverviewA

StorageClasses, PVCs, PVs, and VolumeAttachments with phase flags (Pending/Lost, Released/Unbound). Omit namespace to list PVCs in all namespaces. Read-only.

Inputs: namespace.

openshift_detectDetect OpenShift ClusterA

Detect whether the cluster is OpenShift and return OCP version, console URL, and registered OpenShift API groups. Works on any cluster.

Inputs: no named parameters.

openshift_list_buildsList OpenShift BuildConfigsA

List OpenShift BuildConfigs with build strategy, source type, git URI, and build count. Returns a compatibility notice on non-OpenShift clusters.

Inputs: namespace.

openshift_list_projectsList OpenShift ProjectsA

List OpenShift Projects with status, requester, and display name. Returns a compatibility notice on non-OpenShift clusters.

Inputs: no named parameters.

openshift_list_routesList OpenShift RoutesA

List OpenShift Routes with host, path, TLS termination, and target service. Returns a compatibility notice on non-OpenShift clusters.

Inputs: namespace.

register_licenseRegister LicenseA

Register or update your email address and optionally apply a new license key. Binds the license to the current machine's hardware fingerprint. Works even when the license is expired.

Inputs: email (required), license_key.

render_app_architectureRender App Architecture (PNG)A

Render the full KubeOrch-style app architecture as a PNG image. Shows Ingress → Service → Deployment → Pod plus ConfigMaps, Secrets, PVCs.

Inputs: namespace.

render_cluster_topologyRender Cluster Topology (PNG)A

Render the cluster topology diagram as a PNG image. Shows nodes, namespaces, and pod distribution as a visual image.

Inputs: no named parameters.

render_gpu_dashboardRender GPU Allocation Dashboard (PNG)A

Render a PNG dashboard of GPU extended resources per node (allocatable) vs sum of pod requests. Requires nodes with GPU resources or workloads requesting GPUs.

Inputs: no named parameters.

render_gpu_metricsRender GPU Utilization Chart (PNG)A

Render a PNG bar chart from Prometheus DCGM metric DCGM_FI_DEV_GPU_UTIL. Requires KUBECRAFT_PROMETHEUS_URL and DCGM exporter.

Inputs: no named parameters.

render_gpu_sparklineRender GPU Metrics Sparkline (PNG)A

PNG sparkline from a Prometheus range query (default DCGM_FI_DEV_GPU_UTIL, last hour). Requires KUBECRAFT_PROMETHEUS_URL.

Inputs: step, query, duration_seconds.

render_namespaceRender Namespace (PNG)A

Render a namespace diagram as a PNG image. Shows deployments, services, pods, and their connections.

Inputs: namespace.

render_networkRender Network Map (PNG)A

Render the service-to-pod network map as a PNG image. Shows how services route to backend pods via label selectors.

Inputs: namespace.

summarize_network_policiesSummarize NetworkPoliciesA

List NetworkPolicies with pod selector summary, ingress/egress rule counts, and a possible default-deny ingress heuristic. Omit namespace for all namespaces. Read-only.

Inputs: namespace.

summarize_policy_enginesSummarize Policy EnginesA

Read-only summary: Kyverno PolicyReports / ClusterPolicyReports and Gatekeeper constraint violation counts when those API groups exist.

Inputs: no named parameters.

switch_contextSwitch Kubeconfig ContextA

Switch the active kubeconfig context. All subsequent tool calls will use this cluster.

Inputs: context (required).

tekton_detectDetect TektonA

Detect whether Tekton is installed and report pipeline/task/run counts.

Inputs: no named parameters.

tekton_list_pipelinesList Tekton PipelinesB

List Tekton Pipelines with task count and last PipelineRun status.

Inputs: namespace.

tekton_list_runsList Tekton PipelineRunsA

List recent Tekton PipelineRuns with status, duration, start time, and task run count.

Inputs: limit, namespace.

tekton_list_tasksList Tekton TasksA

List Tekton Tasks with step count and parameter count.

Inputs: namespace.

visualize_app_architectureVisualize App ArchitectureA

Full KubeOrch-style architecture diagram showing ALL resource types in a namespace: Ingress → Service → Deployment → Pod, plus ConfigMaps, Secrets, PVCs, and how they wire together via selectors, env refs, and volume mounts.

Inputs: namespace.

visualize_cluster_topologyVisualize Cluster TopologyB

Generate a high-level Mermaid diagram of nodes, namespaces, and pod distribution across the cluster.

Inputs: no named parameters.

visualize_fluxVisualize Flux CD (Mermaid)A

Generate a Mermaid diagram of Flux sources flowing into Kustomizations and HelmReleases with ready status colors.

Inputs: namespace.

visualize_namespaceVisualize NamespaceA

Generate a Mermaid diagram showing deployments, services, and pods within a namespace and their connections via selectors.

Inputs: namespace.

visualize_networkVisualize NetworkB

Generate a Mermaid diagram mapping services to their backend pods via label selectors.

Inputs: namespace.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 73 tools

    Disambiguation3/5

    Most tools have distinct purposes, but there are pairs like render_app_architecture/visualize_app_architecture, render_namespace/visualize_namespace, render_network/visualize_network, and render_cluster_topology/visualize_cluster_topology that overlap significantly, causing potential confusion for an agent.

    Naming Consistency4/5

    Tool names predominantly follow verb_noun pattern (e.g., list_pods, describe_crd, diagnose_pod). Some deviations include longer prefixes like argocd_list_apps or get_gpu_promql_reference, but overall the pattern is consistent.

    Tool Count3/5

    73 tools is heavy but justifiable for a comprehensive Kubernetes diagnostics and visualization server. Some tools could be merged (e.g., render/visualize pairs), and a few are very niche (get_gpu_promql_reference), but the count remains within a reasonable range for the scope.

    Completeness4/5

    The tool set is comprehensive for observability and diagnostics: it covers list, describe, diagnose, detect, render, and visualize for a wide range of resources. However, it lacks CRUD operations, which is likely intentional for a read-only diagnostic server, leaving minor gaps in lifecycle management.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      A Model Context Protocol server that enables AI assistants to interact with Kubernetes clusters through natural language, supporting core Kubernetes operations, monitoring, security, and diagnostics.
      169 npm
      972
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      A Model Control Protocol server that extends AI assistants with Kubernetes operations capabilities, allowing for managing deployments, pods, services and other K8s resources.
      2
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that enables AI assistants to interact with Kubernetes clusters by translating natural language into kubectl and Helm operations. It allows users to query, manage, and diagnose Kubernetes resources and cluster states through a seamless integration.
      20
      Apache 2.0