$git clone https://github.com/Flux159/mcp-server-kubernetesMCP Server that can connect to a Kubernetes cluster and manage it. Supports loading kubeconfig from multiple sources in priority order.
| 1 | # MCP Server Kubernetes |
| 2 | |
| 3 | [](https://github.com/yourusername/mcp-server-kubernetes/actions/workflows/ci.yml) |
| 4 | [](https://github.com/yourusername/mcp-server-kubernetes) |
| 5 | [](https://kubernetes.io/) |
| 6 | [](https://www.docker.com/) |
| 7 | [](https://github.com/Flux159/mcp-server-kubernetes/stargazers) |
| 8 | [](https://github.com/Flux159/mcp-server-kubernetes/issues) |
| 9 | [](https://github.com/Flux159/mcp-server-kubernetes/pulls) |
| 10 | [](https://github.com/Flux159/mcp-server-kubernetes/commits/main) |
| 11 | |
| 12 | <p align="center"> |
| 13 | <img src="https://raw.githubusercontent.com/Flux159/mcp-server-kubernetes/refs/heads/main/icon.png" width="200"> |
| 14 | </p> |
| 15 | |
| 16 | MCP Server that can connect to a Kubernetes cluster and manage it. Supports loading kubeconfig from multiple sources in priority order. |
| 17 | |
| 18 | https://github.com/user-attachments/assets/f25f8f4e-4d04-479b-9ae0-5dac452dd2ed |
| 19 | |
| 20 | ## Installation & Usage |
| 21 | |
| 22 | ### Prerequisites |
| 23 | |
| 24 | Before using this MCP server with any tool, make sure you have: |
| 25 | |
| 26 | 1. kubectl installed and in your PATH |
| 27 | 2. A valid kubeconfig file with contexts configured |
| 28 | 3. Access to a Kubernetes cluster configured for kubectl (e.g. minikube, Rancher Desktop, GKE, etc.) |
| 29 | 4. Helm v3 installed and in your PATH (no Tiller required). Optional if you don't plan to use Helm. |
| 30 | |
| 31 | You can verify your connection by running `kubectl get pods` in a terminal to ensure you can connect to your cluster without credential issues. |
| 32 | |
| 33 | By default, the server loads kubeconfig from `~/.kube/config`. For additional authentication options (environment variables, custom paths, etc.), see [ADVANCED_README.md](ADVANCED_README.md). |
| 34 | |
| 35 | ### Claude Code |
| 36 | |
| 37 | Add the MCP server to Claude Code using the built-in command: |
| 38 | |
| 39 | ```bash |
| 40 | claude mcp add kubernetes -- npx mcp-server-kubernetes |
| 41 | ``` |
| 42 | |
| 43 | This will automatically configure the server in your Claude Code MCP settings. |
| 44 | |
| 45 | ### Codex |
| 46 | |
| 47 | Add the MCP server to [Codex CLI](https://developers.openai.com/codex/cli/) using the built-in command: |
| 48 | |
| 49 | ```bash |
| 50 | codex mcp add kubernetes -- npx mcp-server-kubernetes |
| 51 | ``` |
| 52 | |
| 53 | This registers the server globally in `~/.codex/config.toml` and makes its tools available in all Codex sessions. |
| 54 | |
| 55 | ### Claude Desktop |
| 56 | |
| 57 | Add the following configuration to your Claude Desktop config file: |
| 58 | |
| 59 | ```json |
| 60 | { |
| 61 | "mcpServers": { |
| 62 | "kubernetes": { |
| 63 | "command": "npx", |
| 64 | "args": ["mcp-server-kubernetes"] |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | ``` |
| 69 | |
| 70 | ### Claude Desktop Connector via mcpb |
| 71 | |
| 72 | MCP Server Kubernetes is also available as a [mcpb](https://github.com/anthropics/mcpb) (formerly dxt) extension. In Claude Desktop, go to Settings (`Cmd+,` on Mac) -> Extensions -> Browse Extensions and scroll to find mcp-server-kubernetes in the modal. Install it & it will install & utilize kubectl via command line & your kubeconfig. |
| 73 | |
| 74 | To manually install, you can also get the .mcpb by going to the latest [Release](https://github.com/Flux159/mcp-server-kubernetes/releases) and downloading it. |
| 75 | |
| 76 | ### VS Code |
| 77 | |
| 78 | [](vscode:mcp/install?%7B%22name%22%3A%20%22kubernetes%22%2C%20%22type%22%3A%20%22stdio%22%2C%20%22command%22%3A%20%22npx%22%2C%20%22args%22%3A%20%5B%22mcp-server-kubernetes%22%5D%7D) |
| 79 | |
| 80 | For VS Code integration, you can use the MCP server with extensions that support the Model Context Protocol: |
| 81 | |
| 82 | 1. Inst |