Interact with Kubernetes clusters using natural language via MCP
mcp-kubernetes-server
The mcp-kubernetes-server is a server implementing the Model Context Protocol (MCP) to enable AI assistants (such as Claude, Cursor, and GitHub Copilot) to interact with Kubernetes clusters. It acts as a bridge, translating natural language requests from these assistants into Kubernetes operations and returning the results.
It allows AI assistants to:
- Query Kubernetes resources
- Execute kubectl commands
- Manage Kubernetes clusters through natural language interactions
- Diagnose and interpret the states of Kubernetes resources
How It Works
The mcp-kubernetes-server acts as an intermediary between AI assistants (that support the Model Context Protocol) and your Kubernetes cluster. It receives natural language requests from these assistants, translates them into kubectl commands or direct Kubernetes API calls, and executes them against the target cluster. The server then processes the results and returns a structured response, enabling seamless interaction with your Kubernetes environment via the AI assistant.

How To Install
Prerequisites
Before installing mcp-kubernetes-server, ensure you have the following:
- A working Kubernetes cluster.
- A
kubeconfigfile correctly configured to access your Kubernetes cluster (the server requires this file for interaction). - The
kubectlcommand-line tool installed and in your system's PATH (used by the server to execute many Kubernetes commands). - The
helmcommand-line tool installed and in your system's PATH (used by the server for Helm chart operations). - Python >= 3.11, if you plan to install and run the server directly using
uvx(without Docker).
Docker
Get your kubeconfig file for your Kubernetes cluster and setup in the mcpServers (replace src path with your kubeconfig path):
{
"mcpServers": {
"kubernetes": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--mount", "type=bind,src=/home/username/.kube/config,dst=/home/mcp/.kube/config",
"ghcr.io/feiskyer/mcp-kubernetes-server"
]
}
}
}
UVX
To run the server using uvx (a tool included with uv, the Python packager), first ensure uv is installed:
Install uv
Install uv if it's not installed yet and add it to your PATH, e.g. using curl:
# For Linux and MacOS
curl -LsSf https://astral.sh/uv/install.sh | sh
Install kubectl
Install kubectl if it's not installed yet and add it to your PATH, e.g.
# For Linux
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
# For MacOS
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl"
Install helm
Install helm if it's not installed yet and add it to your PATH, e.g.
curl -sSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
Config your MCP servers in Claude Desktop, Cursor, ChatGPT Copilot, Github Copilot and other supported AI clients, e.g.
{
"mcpServers": {
"kubernetes": {
"command": "uvx",
"args": [
"mcp-kubernetes-server"
],
"env": {
"KUBECONFIG": "<your-kubeconfig-path>"
}
}
}
}
MCP Server Options
Environment Variables
Environment variables:
KUBECONFIG: Path to your kubeconfig file, e.g./home/<username>/.kube/config.
Command line arguments
Command-line Arguments:
usage: main.py [-h] [--disable-kubectl] [--disable-helm] [--disable-write]
[--disable-delete] [--transport {stdio,sse,streamable-http}]
[--host HOST] [--port PORT]
MCP Kubernetes Server
options:
-h, --help show this help message and exit
--disable-kubectl Disable kubectl command execution
--disable-helm Disable helm command execution
--disable-write Disable write operat
Environment Variables
KUBECONFIGrequiredPath to your kubeconfig fileConfiguration
{"mcpServers": {"kubernetes": {"command": "uvx", "args": ["mcp-kubernetes-server"], "env": {"KUBECONFIG": "<your-kubeconfig-path>"}}}}