Sign inSign up

rohitghumare64/kubectl-mcp-server

By rohitghumare64

β€’Updated 1 day ago

MCP server for Kubernetes - AI assistants interact with K8s clusters

Image
Networking
Security
Monitoring & observability
0

50K+

rohitghumare64/kubectl-mcp-server repository overview

kubectl-mcp-server logo
kubectl-mcp-server

Control your entire Kubernetes infrastructure through natural language conversations with AI.
Talk to your clusters like you talk to a DevOps expert. Debug crashed pods, optimize costs, deploy applications, audit security, and manage Helm charts, all through natural language.
Part of CNCF Landscape, Next to Terraform

Screenshot 2026-04-08 at 23 36 21

GitHub Stars License: MIT Python Kubernetes MCP 2026-07-28

PyPI npm Docker Tests Ask DeepWiki agentregistry


⁠Installation

# Run directly without installation - works instantly!
npx -y kubectl-mcp-server

# Or install globally for faster startup
npm install -g kubectl-mcp-server
⁠Or install with pip (Python)
pip install kubectl-mcp-server

# Or run it isolated with uv
uvx --from kubectl-mcp-server kubectl-mcp

β πŸ“‘ Table of Contents


⁠What Can You Do?

Simply ask your AI assistant in natural language:

πŸ’¬ "Why is my pod crashing?"

  • Instant crash diagnosis with logs, events, and resource analysis
  • Root cause identification with actionable recommendations

πŸ’¬ "Deploy a Redis cluster with 3 replicas"

  • Creates deployment with best practices
  • Configures services, persistent storage, and health checks

πŸ’¬ "Show me which pods are wasting resources"

  • AI-powered cost optimization analysis
  • Resource recommendations with potential savings

πŸ’¬ "Which services can't reach the database?"

  • Network connectivity diagnostics with DNS resolution
  • Service chain tracing from ingress to pods

πŸ’¬ "Audit security across all namespaces"

  • RBAC permission analysis
  • Secret security scanning and pod security policies

26 default tools, 209 with every toolset | 14 workflow prompts | 8 resources + 6 resource templates | Stateless MCP 2026-07-28 | Works with all major AI assistants

⁠Why kubectl-mcp-server?

  • πŸš€ Stop context-switching - Manage Kubernetes directly from your AI assistant conversations
  • 🧠 AI-powered diagnostics - Get intelligent troubleshooting, not just raw data
  • πŸ’° Built-in cost optimization - Identify waste and get actionable savings recommendations
  • πŸ”’ Enterprise-ready - OAuth 2.1 auth with per-tool scopes, read-only mode, Secret redaction, fail-closed network binding
  • ⚑ Zero learning curve - Natural language instead of memorizing kubectl commands
  • 🌐 Universal compatibility - Works with Claude, Cursor, Windsurf, Copilot, and 15+ other AI tools
  • ☸️ Production-grade - Stateless HTTP scales behind any load balancer, Helm chart, 516 passing tests

From debugging crashed pods to optimizing cluster costs, kubectl-mcp-server is your AI-powered DevOps companion.

⁠Live Demos

⁠Claude Desktop

Claude MCP

⁠Cursor AI

Cursor MCP

⁠Windsurf

Windsurf MCP

⁠Installation

# Run directly without installation - works instantly!
npx -y kubectl-mcp-server

# Or install globally for faster startup
npm install -g kubectl-mcp-server
⁠Or install with pip (Python)
pip install kubectl-mcp-server

# Or run it isolated with uv
uvx --from kubectl-mcp-server kubectl-mcp
⁠Install from GitHub Release
# Install specific version directly from GitHub release (replace {VERSION} with desired version)
pip install https://github.com/rohitg00/kubectl-mcp-server/releases/download/v{VERSION}/kubectl_mcp_server-{VERSION}-py3-none-any.whl

# Example: Install v2.0.0
pip install https://github.com/rohitg00/kubectl-mcp-server/releases/download/v2.0.0/kubectl_mcp_server-2.0.0-py3-none-any.whl

# Or install latest from git
pip install git+https://github.com/rohitg00/kubectl-mcp-server.git
⁠Prerequisites
  • Python 3.10+ or uv⁠ (for pip/uvx installation)
  • Node.js 18+ (for npx installation)
  • kubectl installed and configured
  • Access to a Kubernetes cluster
⁠Docker
# Pull from Docker Hub
docker pull rohitghumare64/kubectl-mcp-server:latest

# Or pull from GitHub Container Registry
docker pull ghcr.io/rohitg00/kubectl-mcp-server:latest

# Run with stdio transport (the image runs as UID 10001 with HOME=/home/mcp)
docker run -i --rm -v $HOME/.kube:/home/mcp/.kube:ro rohitghumare64/kubectl-mcp-server:latest

# Run stateless HTTP on localhost only. The container listens on 0.0.0.0, so it refuses
# to start without OAuth (MCP_AUTH_ENABLED) or an explicit MCP_ALLOW_UNAUTHENTICATED=true.
docker run --rm -p 127.0.0.1:8000:8000 -v $HOME/.kube:/home/mcp/.kube:ro \
  -e MCP_ALLOW_UNAUTHENTICATED=true \
  rohitghumare64/kubectl-mcp-server:latest --transport http

⁠Getting Started

⁠1. Test the Server (Optional)

Before integrating with your AI assistant, verify the installation:

# Check if kubectl is configured
kubectl cluster-info

# Test the MCP server directly
kubectl-mcp-server info

# List all available tools
kubectl-mcp-server tools

# Try calling a tool
kubectl-mcp-server call kubectl_get '{"resource_type": "pods", "namespace": "kube-system"}'
⁠2. Connect to Your AI Assistant

Choose your favorite AI assistant and add the configuration:

⁠Quick Setup with Your AI Assistant

⁠Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
      "args": ["-y", "kubectl-mcp-server"]
    }
  }
}
⁠Cursor AI

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
      "args": ["-y", "kubectl-mcp-server"]
    }
  }
}
⁠Windsurf

Add to ~/.config/windsurf/mcp.json:

{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
      "args": ["-y", "kubectl-mcp-server"]
    }
  }
}
⁠Using Python Instead of npx
{
  "mcpServers": {
    "kubernetes": {
      "command": "python",
      "args": ["-m", "kubectl_mcp_tool.mcp_server"],
      "env": {
        "KUBECONFIG": "/path/to/.kube/config"
      }
    }
  }
}

More integrations: GitHub Copilot, Goose, Gemini CLI, Roo Code, and 15+ other clients⁠ β€”> see full configuration guide⁠ below.

⁠3. Restart Your AI Assistant

After adding the configuration, restart your AI assistant (GitHub Copilot, Claude Code,Claude Desktop, Cursor, etc.) to load the MCP server.

⁠4. Try These Commands

Start a conversation with your AI assistant and try these:

Troubleshooting:

"Show me all pods in the kube-system namespace"
"Why is the nginx-deployment pod crashing?"
"Diagnose network connectivity issues in the default namespace"

Deployments:

"Create a deployment for nginx with 3 replicas"
"Scale my frontend deployment to 5 replicas"
"Roll back the api-server deployment to the previous version"

Cost & Optimization:

"Which pods are using the most resources?"
"Show me idle resources that are wasting money"
"Analyze cost optimization opportunities in the production namespace"

Security:

"Audit RBAC permissions in all namespaces"
"Check for insecure secrets and configurations"
"Show me pods running with privileged access"

Helm:

"List all Helm releases in the cluster"
"Install Redis from the Bitnami chart repository"
"Show me the values for my nginx-ingress Helm release"

Multi-Cluster:

"List all available Kubernetes contexts"
"Switch to the production cluster context"
"Show me cluster information and version"

⁠MCP Client Compatibility

Works seamlessly with all MCP-compatible AI assistants:

ClientStatusClientStatus
Claude Desktopβœ… NativeClaude Codeβœ… Native
Cursorβœ… NativeWindsurfβœ… Native
GitHub Copilotβœ… NativeOpenAI Codexβœ… Native
Gemini CLIβœ… NativeGooseβœ… Native
Roo Codeβœ… NativeKilo Codeβœ… Native
Ampβœ… NativeTraeβœ… Native
OpenCodeβœ… NativeKiro CLIβœ… Native
Antigravityβœ… NativeClawdbotβœ… Native
Droid (Factory)βœ… NativeAny MCP Clientβœ… Compatible

⁠All Supported AI Assistants

⁠Claude Code

Add to ~/.config/claude-code/mcp.json:

{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
      "args": ["-y", "kubectl-mcp-server"]
    }
  }
}
⁠GitHub Copilot (VS Code)

Add to VS Code settings.json:

{
  "mcp": {
    "servers": {
      "kubernetes": {
        "command": "npx",
        "args": ["-y", "kubectl-mcp-server"]
      }
    }
  }
}
⁠Goose

Add to ~/.config/goose/config.yaml:

extensions:
  kubernetes:
    command: npx
    args:
      - -y
      - kubectl-mcp-server
⁠Gemini CLI

Add to ~/.gemini/settings.json:

{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
      "args": ["-y", "kubectl-mcp-server"]
    }
  }
}
⁠Roo Code / Kilo Code

Add to ~/.config/roo-code/mcp.json or ~/.config/kilo-code/mcp.json:

{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
      "args": ["-y", "kubectl-mcp-server"]
    }
  }
}

⁠Complete Feature Set

⁠Toolsets

Every tool definition costs context on every request, and models pick tools less reliably as the list grows. The server therefore registers only the core and helm toolsets (26 tools) by default. kubectl_get, kubectl_describe, kubectl_logs, kubectl_apply and friends work for every resource kind, including custom resources, so the default set covers most day-to-day work. Everything else is opt-in; tools outside the enabled toolsets are not registered at all, so they cannot be called.

kubectl-mcp-server                                    # core + helm
kubectl-mcp-server --toolsets default,diagnostics,certs
kubectl-mcp-server --toolsets all                     # all 209 tools
MCP_TOOLSETS=default,gitops kubectl-mcp-server        # same, via environment

detect_ecosystem reports which operators are installed and which toolsets cover them. With many toolsets enabled and a client that cannot search tools itself, add --tool-search (MCP_TOOL_SEARCH=true): the server then lists only the default tools plus search_tools and call_tool, and the rest are discovered on demand. Read-only mode, scopes and redaction still apply to every discovered call.

For deep work in one ecosystem, its project-maintained MCP server is usually a better fit than the opt-in toolset:

ToolsetDefaultToolsCoversNames
coreyes18Generic kubectl operations for every resource kind, including CRDskubectl_get, kubectl_describe, kubectl_logs, kubectl_top, kubectl_explain, get_api_resources, kubectl_generic, kubectl_apply, kubectl_patch, delete_resource, kubectl_scale, kubectl_rollout, exec_in_pod, list_contexts, health_check, diagnose_pod_crash, detect_pending_pods, detect_ecosystem
helmyes8Helm release lifecyclehelm_list, helm_status, helm_get, helm_history, install_helm_chart, upgrade_helm_chart, uninstall_helm_chart, helm_rollback
helm_dev16Helm charts and repositories: search, show, template, lint, package, dependencieshelm_show, helm_search_repo, helm_search_hub, helm_repo_list, helm_repo_add, helm_repo_remove, helm_repo_update, helm_test, helm_lint, helm_package, helm_dependency_update, helm_dependency_list, helm_dependency_build, helm_pull, helm_create, helm_template
ops10Maintenance: create, label, annotate, taint, cordon/drain, copy files, wait, cleanupkubectl_create, kubectl_cp, backup_resource, label_resource, annotate_resource, taint_node, wait_for_condition, node_management, cleanup_pods, run_pod
diagnostics9Network, DNS, node and pod health diagnosticscheck_pod_health, get_evicted_pods, diagnose_network_connectivity, check_dns_resolution, trace_service_chain, compare_namespaces, get_nodes_summary, node_logs, node_stats_summary
security5RBAC, pod security and secret hygiene auditsanalyze_pod_security, analyze_network_policies, audit_rbac_permissions, check_secrets_security, get_pod_security_info
cost8Resource right-sizing and cost allocationget_resource_recommendations, get_idle_resources, get_resource_quotas_usage, get_cost_analysis, get_overprovisioned_resources, get_resource_trends, get_namespace_cost_allocation, optimize_resource_requests
multicluster7Kubeconfig contexts and cross-cluster queriesget_context_details, kubeconfig_view, switch_context, set_namespace_for_context, multi_cluster_query, multi_cluster_health, multi_cluster_pod_count
crds5CRD discovery and custom resource inspectiondiscover_crds, search_crds, list_custom_resources, get_custom_resource, describe_crd
gitops6Flux and Argo CDgitops_apps_list, gitops_app_get, gitops_app_sync, gitops_app_status, gitops_sources_list, gitops_source_get
certs8cert-manager certificates and issuerslist_certs, get_cert, list_cert_issuers, get_cert_issuer, renew_cert, explain_cert_status, list_cert_challenges, list_cert_requests
policy5Kyverno and Gatekeeper policiesget_policy_list, get_policy, get_policy_violations, explain_policy_denial, audit_policies
backup10Velero backups and restoreslist_backups, get_backup, create_backup, delete_backup, list_restores, create_restore, get_restore, list_backup_locations, list_backup_schedules, create_backup_schedule
keda6KEDA event-driven autoscalingkeda_scaledobjects_list, keda_scaledobject_get, keda_scaledjobs_list, keda_triggerauths_list, keda_triggerauth_get, keda_hpa_list
cilium7Cilium network policies and Hubble flowscilium_list_policies, cilium_get_policy, cilium_list_endpoints, cilium_list_identities, cilium_list_nodes, cilium_get_status, get_hubble_flows
rollouts10Argo Rollouts and Flagger progressive deliveryget_rollouts_list, get_rollout, get_rollout_status, promote_rollout, abort_rollout, retry_rollout, restart_rollout, get_analysis_runs, get_flagger_canaries, get_flagger_canary
capi10Cluster API lifecyclecapi_list_clusters, capi_get_cluster, capi_list_machines, capi_get_machine, capi_list_machinedeployments, capi_scale_machinedeployment, capi_list_machinesets, capi_list_machinehealthchecks, capi_list_clusterclasses, capi_get_cluster_kubeconfig
kubevirt12KubeVirt virtual machineskubevirt_vms_list, kubevirt_vm_get, kubevirt_vmis_list, kubevirt_vm_start, kubevirt_vm_stop, kubevirt_vm_restart, kubevirt_vm_pause, kubevirt_vm_unpause, kubevirt_vm_migrate, kubevirt_datasources_list, kubevirt_instancetypes_list, kubevirt_datavolumes_list
istio9Istio service meshistio_virtualservices_list, istio_virtualservice_get, istio_destinationrules_list, istio_gateways_list, istio_peerauthentications_list, istio_authorizationpolicies_list, istio_proxy_status, istio_analyze, istio_sidecar_status
kind29kind local clusters (runs docker on the server host)kind_list_clusters, kind_get_nodes, kind_get_kubeconfig, kind_export_logs, kind_cluster_info, kind_node_labels, kind_create_cluster, kind_delete_cluster, kind_load_image, kind_load_image_archive, kind_build_node_image, kind_set_kubeconfig, kind_config_validate, kind_config_generate, kind_config_show, kind_available_images, kind_registry_create, kind_registry_connect, kind_registry_status, kind_node_exec, kind_node_logs, kind_node_inspect, kind_node_restart, kind_network_inspect, kind_port_mappings, kind_ingress_setup, kind_cluster_status, kind_images_list, kind_provider_info
vind11vCluster virtual clusters (runs vcluster on the server host)vind_list_clusters, vind_status, vind_get_kubeconfig, vind_create_cluster, vind_delete_cluster, vind_pause, vind_resume, vind_connect, vind_disconnect, vind_upgrade, vind_describe
⁠MCP Resources

Access Kubernetes data as browsable resources:

Resource URIDescription
kubeconfig://contextsList all available kubectl contexts
kubeconfig://current-contextGet current active context
namespace://currentGet current namespace
namespace://listList all namespaces
cluster://infoGet cluster information
cluster://nodesGet detailed node information
cluster://versionGet Kubernetes version
cluster://api-resourcesList available API resources
manifest://deployments/{ns}/{name}Get deployment YAML
manifest://services/{ns}/{name}Get service YAML
manifest://pods/{ns}/{name}Get pod YAML
manifest://configmaps/{ns}/{name}Get ConfigMap YAML
manifest://secrets/{ns}/{name}Get secret YAML (data masked)
manifest://ingresses/{ns}/{name}Get ingress YAML
⁠MCP Prompts

Pre-built workflow prompts for common Kubernetes operations:

PromptDescription
troubleshoot_workloadComprehensive troubleshooting guide for pods/deployments
deploy_applicationStep-by-step deployment workflow
security_auditSecurity scanning and RBAC analysis workflow
cost_optimizationResource optimization and cost analysis workflow
disaster_recoveryBackup and recovery planning workflow
debug_networkingNetwork debugging for services and connectivity
scale_applicationScaling guide with HPA/VPA best practices
upgrade_clusterKubernetes cluster upgrade planning
cluster_health_checkCluster-wide health review
debug_workloadStep-by-step debugging for a named workload
resource_usageResource consumption and right-sizing review
security_postureNamespace or cluster security posture review
deployment_checklistPre-deployment checklist for an application
incident_responseIncident runbook by incident type

Add your own prompts in ~/.config/kubectl-mcp/prompts.toml; same-named prompts override the built-ins.

⁠Key Capabilities
  • πŸ€– 26 default tools, 209 opt-in - Generic kubectl and Helm by default, ecosystem toolsets on demand
  • 🎯 14 Workflow Prompts - Pre-built workflows for common operations
  • πŸ“Š 8 Resources + 6 Templates - Browsable Kubernetes data exposure
  • πŸ”„ Opt-in ecosystem toolsets - GitOps, cert-manager, policy, Velero, KEDA, Cilium, Rollouts, CAPI, KubeVirt, Istio, kind, vCluster
  • ⚑ Stateless MCP 2026-07-28 - stdio and Streamable HTTP, older clients negotiated automatically
  • πŸ” Security First - Read-only mode, per-call confirmation, Secret redaction, flag-injection guard
  • πŸ₯ Advanced Diagnostics - AI-powered troubleshooting and cost optimization
  • ☸️ Multi-Cluster - Target any cluster via context parameter in every tool
  • 🎑 Full Helm v3 - Complete chart lifecycle management
  • πŸ”§ Powerful CLI - Shell-friendly tool discovery and direct calling
  • 🐳 Cloud Native - Deploy in-cluster with kMCP or kagent

⁠Using the CLI

The built-in CLI lets you explore and test tools without an AI assistant:

# List all tools with descriptions
kubectl-mcp-server tools -d

# Search for pod-related tools
kubectl-mcp-server grep "*pod*"

# Show specific tool schema
kubectl-mcp-server tools kubectl_get

# Call a tool directly
kubectl-mcp-server call kubectl_get '{"resource_type": "pods", "namespace": "kube-system"}'

# Pipe JSON from stdin
echo '{"resource_type": "pods"}' | kubectl-mcp-server call kubectl_get

# Check dependencies
kubectl-mcp-server doctor

# Show/switch Kubernetes context
kubectl-mcp-server context
kubectl-mcp-server context minikube

# List resources and prompts
kubectl-mcp-server resources
kubectl-mcp-server prompts

# Show server info
kubectl-mcp-server info
⁠CLI Features
  • Structured errors: Actionable error messages with suggestions
  • Colorized output: Human-readable with JSON mode for scripting (--json)
  • NO_COLOR support: Respects NO_COLOR environment variable
  • Stdin support: Pipe JSON arguments to commands

⁠Advanced Configuration

⁠Transport Modes
# stdio (default) - Claude Desktop, Cursor, Windsurf, Claude Code
kubectl-mcp-server

# Streamable HTTP, stateless, at http://127.0.0.1:8000/mcp
kubectl-mcp-server --transport http --port 8000

# SSE - deprecated by the

Tag summary

Content type

Image

Digest

sha256:f1f57aa5d…

Size

150.4 MB

Last updated

1 day ago

docker pull rohitghumare64/kubectl-mcp-server