home / mcp / kubernetes mcp server

Kubernetes MCP Server

Provides an MCP bridge to operate Kubernetes clusters via natural language requests

Installation
Add the following to your MCP client configuration file.

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.

How to use

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.

How to install

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 | bash

MCP server configuration examples

Configure 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>"
      }
    }
  }
}

MCP Server Options

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.

Usage with AI clients

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.

Troubleshooting

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.

Available tools

kubectl

Run any kubectl command and return the output

helm

Run any helm command and return the output

k8s_get

Fetch a Kubernetes object or list as JSON string

k8s_describe

Show detailed information about a resource or group of resources

k8s_logs

Print logs for a container in a pod

k8s_events

List events in the cluster

k8s_apis

List all APIs available in the cluster

k8s_crds

List all Custom Resource Definitions in the cluster

k8s_top_nodes

Display CPU/memory usage of nodes

k8s_top_pods

Display CPU/memory usage of pods

k8s_rollout_status

Get rollout status for deployments/daemonsets/statefulsets

k8s_rollout_history

Get rollout history for deployments/daemonsets/statefulsets

k8s_auth_can_i

Check whether an action is allowed

k8s_auth_whoami

Show the authenticated user/subject

k8s_create

Create a Kubernetes resource from YAML/JSON content

k8s_apply

Apply a configuration to a resource by file or stdin

k8s_expose

Expose a resource as a service

k8s_run

Create and run a pod with a specified image

k8s_set_resources

Set resource limits and requests for containers

k8s_set_image

Set the image for a container

k8s_set_env

Set environment variables for a container

k8s_rollout_undo

Undo a rollout to a previous revision

k8s_rollout_restart

Restart a rollout

k8s_rollout_pause

Pause a rollout

k8s_rollout_resume

Resume a rollout

k8s_scale

Scale a resource

k8s_autoscale

Autoscale a deployment/replica set/stateful set

k8s_cordon

Mark a node as unschedulable

k8s_uncordon

Mark a node as schedulable

k8s_drain

Drain a node for maintenance

k8s_taint

Update taints on nodes

k8s_untaint

Remove taints from a node

k8s_exec_command

Execute a command in a container

k8s_port_forward

Forward ports to a pod

k8s_cp

Copy files to/from containers

k8s_patch

Patch a resource

k8s_label

Update labels on a resource

k8s_annotate

Update annotations on a resource