home / mcp / kubernetes mcp server
Provides an MCP bridge to operate Kubernetes clusters via natural language requests
Configuration
View docs{
"mcpServers": {
"feiskyer-mcp-kubernetes-server": {
"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"
],
"env": {
"KUBECONFIG": "<your-kubeconfig-path>"
}
}
}
}You can connect AI assistants to your Kubernetes clusters through the MCP Kubernetes Server. It translates natural language requests into Kubernetes actions, letting you query resources, run kubectl-like commands, and manage clusters using conversational prompts.
You interact with the MCP Kubernetes Server from your MCP client (such as Claude Desktop, Cursor, or GitHub Copilot) by asking natural language questions or giving tasks. The server interprets your requests, executes the corresponding Kubernetes operations, and returns structured results that you can review directly in your AI chat.
Prerequisites You need a working Kubernetes cluster and a kubeconfig file that grants access to that cluster. The server also relies on kubectl and helm for command execution and Helm chart operations. You install Python 3.11 or newer if you plan to run directly with uvx.
Docker setup to run the MCP Kubernetes Server Use a kubeconfig path you already have and configure the container to expose your cluster credentials inside the container.
{
"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 (recommended for local development) you first install uv, then run the server with uvx. Install uv if needed, install kubectl and helm, and make sure they are in your PATH.
# Install uv (example flow shown here). The exact steps may vary by platform.
curl -LsSf https://astral.sh/uv/install.sh | sh
```
```bash
# Ensure kubectl is installed
# For Linux
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
```
```bash
# Ensure helm is installed
curl -sSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bashConfigure your MCP clients to use the server you run. The following example shows how to point a client to the local UVX-based MCP server.
{
"mcpServers": {
"kubernetes": {
"command": "uvx",
"args": [
"mcp-kubernetes-server"
],
"env": {
"KUBECONFIG": "<your-kubeconfig-path>"
}
}
}
}Environment variables Any MCP server that uses your kubeconfig can rely on KUBECONFIG to locate the configuration. Set KUBECONFIG to the path of your kubeconfig file.
Command line arguments The server exposes a set of flags to tailor its transport, host, and port. These are used when you start the server directly.
After you have installed and configured the MCP server, start a session from your AI client. You can ask questions like: “What is the status of my nginx pod?” or “Show pods in the default namespace.” The server handles the interpretation and returns results that you can review in the chat.
If you encounter connectivity or authentication issues, verify your kubeconfig is correct and that the path in your MCP configuration points to the right file. Ensure your Kubernetes credentials have the needed permissions for the requested actions. If you see errors about missing kubectl or helm, confirm they are installed and in your PATH. For UDP or SSE transports, verify host and port reachability and network rules between the AI client and the MCP server.
Run any kubectl command and return the output
Run any helm command and return the output
Fetch a Kubernetes object or list as JSON string
Show detailed information about a resource or group of resources
Print logs for a container in a pod
List events in the cluster
List all APIs available in the cluster
List all Custom Resource Definitions in the cluster
Display CPU/memory usage of nodes
Display CPU/memory usage of pods
Get rollout status for deployments/daemonsets/statefulsets
Get rollout history for deployments/daemonsets/statefulsets
Check whether an action is allowed
Show the authenticated user/subject
Create a Kubernetes resource from YAML/JSON content
Apply a configuration to a resource by file or stdin
Expose a resource as a service
Create and run a pod with a specified image
Set resource limits and requests for containers
Set the image for a container
Set environment variables for a container
Undo a rollout to a previous revision
Restart a rollout
Pause a rollout
Resume a rollout
Scale a resource
Autoscale a deployment/replica set/stateful set
Mark a node as unschedulable
Mark a node as schedulable
Drain a node for maintenance
Update taints on nodes
Remove taints from a node
Execute a command in a container
Forward ports to a pod
Copy files to/from containers
Patch a resource
Update labels on a resource
Update annotations on a resource