Get the FREE Ultimate OpenClaw Setup Guide →

k8s

K8s-mcp-server is a Model Context Protocol (MCP) server that enables AI assistants like Claude to securely execute Kubernetes commands. It provides a bridge between language models and essential Kubernetes CLI tools including kubectl, helm, istioctl, and argocd, allowing AI systems to assist with cluster management, troubleshooting, and deployments

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio alexei-led-k8s-mcp-server docker run -i --rm -v /Users/YOUR_USER_NAME/.kube:/home/appuser/.kube:ro ghcr.io/alexei-led/k8s-mcp-server:latest \
  --env K8S_MCP_TRANSPORT="transport type (stdio, streamable-http, or sse). default is stdio"

How to use

The K8s MCP Server runs Kubernetes CLI tools (kubectl, helm, istioctl, and argocd) inside a secure container and exposes them to Claude via the MCP protocol. This enables you to ask natural language questions about your Kubernetes clusters and have Claude execute the appropriate commands through the MCP server, then receive formatted results and explanations. The server is designed to run in a Docker container and uses your local kubeconfig to access your cluster, so you can manage contexts, pods, deployments, services, and Helm releases without leaving your Claude session. Tools available include kubectl for cluster operations, helm for package management, istioctl for service mesh tasks, and argocd for GitOps workflows. Transport options allow you to choose how results are streamed back to Claude (stdio by default, with streamable-http and SSE as alternatives).

How to install

Prerequisites:

  • Docker installed and running on your host
  • Access to your Kubernetes cluster (kubeconfig)

Installation steps:

  1. Ensure Docker is installed and running on your machine.
  2. Pull the MCP server image (optional if you use the docker run command directly): docker pull ghcr.io/alexei-led/k8s-mcp-server:latest
  3. Run the MCP server with your kubeconfig mounted: docker run -i --rm
    -v ~/.kube:/home/appuser/.kube:ro
    ghcr.io/alexei-led/k8s-mcp-server:latest Note: If you follow the exact example from the README Quick Start, you can use: docker run -i --rm -v /Users/YOUR_USER_NAME/.kube:/home/appuser/.kube:ro ghcr.io/alexei-led/k8s-mcp-server:latest
  4. (Optional) Configure Claude Desktop to point to the MCP server using the provided example configuration snippet under the kubernetes key.
  5. Start Claude Desktop and test a simple command like: kubectl get pods --all-namespaces to verify the integration.

Tips:

  • If you use streamable-http or SSE transports, set K8S_MCP_TRANSPORT accordingly in the environment.
  • Ensure your kubeconfig path is correct and accessible inside the container mount.
  • Use the exact image tag (latest or a specific version) as needed.

Additional notes

Tips and troubleshooting:

  • Transport behavior: stdio is the default and simplest; streamable-http is recommended for remote clients, and SSE is deprecated. When using HTTP transports in Docker, the server binds to 0.0.0.0 for proper port mapping.
  • Security: The MCP server runs CLI tools inside a container. Ensure your kubeconfig permissions are appropriate and limit access to the Claude integration.
  • Volume mounts: Mount your kubeconfig as read-only to prevent accidental modifications from the MCP environment.
  • Troubleshooting: If kubectl commands fail, verify kubeconfig context availability inside the container (kubectl config view) and ensure the MCP process has network access to the Kubernetes API server.
  • Claude Integration: The Quick Start example shows how to configure Claude Desktop to reference the MCP server under the kubernetes key. You can customize the server name as needed in Claude’s config.

Related MCP Servers

Sponsor this space

Reach thousands of developers