MCP Kubernetes Server MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add -e "KUBECONFIG=${KUBECONFIG}" mcp-kubernetes-server -- docker run -i --rm --mount type=bind,src=/home/username/.kube/config,dst=/home/mcp/.kube/config ghcr.io/feiskyer/mcp-kubernetes-server
Required:KUBECONFIG
README.md

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 kubeconfig file correctly configured to access your Kubernetes cluster (the server requires this file for interaction).
  • The kubectl command-line tool installed and in your system's PATH (used by the server to execute many Kubernetes commands).
  • The helm command-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 file

Configuration

claude_desktop_config.json
{"mcpServers": {"kubernetes": {"command": "uvx", "args": ["mcp-kubernetes-server"], "env": {"KUBECONFIG": "<your-kubeconfig-path>"}}}}

Try it

List all pods in the default namespace.
Check the status of the deployment named nginx-app.
Get the logs for the pod named web-server-123.
Describe the service named frontend-service.

Frequently Asked Questions

What are the key features of MCP Kubernetes Server?

Query Kubernetes resources using natural language. Execute kubectl commands through AI assistants. Manage Kubernetes clusters via natural language interactions. Diagnose and interpret the states of Kubernetes resources. Support for Helm chart operations.

What can I use MCP Kubernetes Server for?

Quickly debugging pod failures by asking the AI to fetch logs. Retrieving cluster resource status without manual CLI context switching. Managing Helm releases through conversational prompts. Interpreting complex Kubernetes resource states for faster troubleshooting.

How do I install MCP Kubernetes Server?

Install MCP Kubernetes Server by running: docker run -i --rm --mount type=bind,src=/home/username/.kube/config,dst=/home/mcp/.kube/config ghcr.io/feiskyer/mcp-kubernetes-server

What MCP clients work with MCP Kubernetes Server?

MCP Kubernetes Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep MCP Kubernetes Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare