Get the FREE Ultimate OpenClaw Setup Guide →

kubectl

A Model Context Protocol (MCP) server for Kubernetes. Install: npx kubectl-mcp-server or pip install kubectl-mcp-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio rohitg00-kubectl-mcp-server python -m kubectl_mcp_server

How to use

kubectl-mcp-server lets you manage and diagnose your Kubernetes clusters through natural language conversations. The server acts as an AI-enabled assistant that can interpret your requests and translate them into Kubernetes actions, from debugging crashed pods and analyzing resource usage to deploying applications, managing Helm charts, auditing security, and visualizing dashboards. You can ask it to diagnose pod crashes with logs and events, identify cost-waste across namespaces, validate RBAC configurations, or surface interactive dashboards for live metrics. The toolset includes AI-powered diagnostics, cost optimization guidance, and browser-based dashboards as part of its optional features, enabling you to operate complex clusters without memorizing kubectl commands.

To use it, install the Python package and run the MCP server. Connect your preferred AI assistant or chat interface to it; you can then issue natural language prompts like: "Explain why this pod is crashing and propose a fix", "Deploy a Redis cluster with 3 replicas", or "Show me a dashboard of CPU usage over the last 24 hours". The server supports interactive dashboards, optional UI dashboards, and browser automation to interact with web-based tools as part of its feature set.

Note that the server requires a working Kubernetes cluster and kubectl configuration. It can be run locally for zero-install via npx in the JavaScript ecosystem, but this particular Python MCP server is typically invoked via Python execution or within an environment where pip-installed packages are available.

How to install

Prerequisites:

  • Python 3.9 or newer
  • kubectl installed and configured to access your cluster
  • Network access to your Kubernetes API server

Installation steps (Python):

  1. Install the MCP server package from PyPI:

    pip install kubectl-mcp-server

  2. (Optional) Install with interactive dashboards/UI components:

    pip install kubectl-mcp-server[ui]

  3. Run the MCP server using Python module invocation:

    python -m kubectl_mcp_server

  4. If you prefer to run via npx/npm (usage from the JavaScript ecosystem):

    npx -y kubectl-mcp-server npm install -g kubectl-mcp-server

  5. Verify the server is running and listening on the default port (adjust as needed in your environment). You may need to configure environment variables for authentication, cluster access, or UI features depending on your deployment.

Additional notes

Environment considerations:

  • Ensure kubectl is properly configured and has access to the target cluster.
  • If using UI dashboards, you may need to install optional dependencies (pip install kubectl-mcp-server[ui]).
  • In production, consider running the MCP server inside a secured environment with appropriate IAM/OAuth configurations and secret masking.

Common issues:

  • Connectivity errors to the Kubernetes API: verify kubeconfig path and cluster access.
  • Missing Python dependencies: ensure you installed with the correct extras (e.g., [ui]).
  • API rate limits or authentication failures: configure credentials or OAuth tokens as required by your deployment.

Configuration tips:

  • Use a dedicated namespace or restricted RBAC to limit the MCP server’s access scope.
  • Enable non-destructive mode if you want safe, auditable interactions during discovery or debugging tasks.
  • Activate browser automation or dashboards only in trusted environments to avoid exposing cluster data publicly.

Related MCP Servers

Sponsor this space

Reach thousands of developers