================== /// MCP /// /// K8S /// ================== [server:online] [protocol:ready]
k8s-mcp-server
by alexei-led
Docker-based Model Context Protocol (MCP) server that lets Claude securely execute Kubernetes-related CLI tools (kubectl, helm, istioctl, argocd) against your cluster.
159
28
Specialized01
kubectl
Kubernetes command-line tool for interacting with and managing Kubernetes clusters
02
helm
CLI package manager for Kubernetes applications, used to install and manage Helm charts
03
istioctl
Istio service-mesh command-line tool for inspecting and controlling the Istio environment
04
argocd
Argo CD command-line interface for managing GitOps continuous delivery
05
jq
Lightweight command-line JSON processor for querying and manipulating JSON output
06
grep
Unix text-search utility for filtering command output based on patterns
07
sed
Stream editor for filtering and transforming text in command pipelines
Installation
1. Prerequisites
• Kubernetes cluster reachable from the host running the MCP server
• Python ≥3.9
• kubectl, helm, istioctl and argocd CLIs installed and present in PATH
• KUBECONFIG environment variable pointing at a valid kubeconfig file
2. Clone the repository
git clone https://github.com/alexei-led/k8s-mcp-server.git
cd k8s-mcp-server
3. Create a virtual-environment and install dependencies
python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txt
4. (Optional) Build and run with Docker
-e KUBECONFIG=/kube/config \
-v $HOME/.kube/config:/kube/config:ro \
--network host k8s-mcp-server:latest
docker build -t k8s-mcp-server:latest .
docker run -it \
5. Start the MCP server locally
python -m k8s_mcp_server --host 0.0.0.0 --port 8080
6. Verify
curl http://localhost:8080/healthz # should return 200 OK
7. Configuration (env vars)
• KUBECONFIG – path to kubeconfig (default: ~/.kube/config)
• ALLOWED_NAMESPACES – comma-separated list to restrict operations
• LOG_LEVEL – default: info
8. Reverse-proxy / TLS (production)
Put the service behind nginx/traefik and terminate TLS. Example nginx stanza:
location /mcp/ {
proxy_pass http://mcp:8080/;
proxy_set_header Host $host;
}
Documentation
License: MIT License
Updated 7/30/2025