mcp-kubernetes logo

mcp-kubernetes

Organization
Azure

A Model Context Protocol (MCP) server that enables AI assistants to interact with Kubernetes clusters. It serves as a bridge between AI tools (like Claude, Cursor, and GitHub Copilot) and Kubernetes

PublisherAzure
Repositorymcp-kubernetes
LanguageGo
Forks
22
Stars
61
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    mcp-kubernetes exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    61 stars and 22 forks from the linked repository.

mcp-kubernetes

The mcp-kubernetes is a Model Context Protocol (MCP) server that enables AI assistants to interact with Kubernetes clusters. It serves as a bridge between AI tools (like Claude, Cursor, and GitHub Copilot) and Kubernetes, translating natural language requests into Kubernetes operations and returning the results in a format the AI tools can understand.

It allows AI tools 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

How to install

Container images are no longer produced or supported. Install a released binary locally and configure your MCP client to run it as a stdio subprocess.

Local

Install kubectl if it's not installed yet and add it to your PATH, e.g.

bash
# 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 if it's not installed yet and add it to your PATH, e.g.

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

json
{
  "mcpServers": {
    "kubernetes": {
      "command": "<path of binary 'mcp-kubernetes'>",
      "args": ["--transport", "stdio"],
      "env": {
        "KUBECONFIG": "<your-kubeconfig-path>"
      }
    }
  }
}

Options

Environment variables:

  • KUBECONFIG: Path to your kubeconfig file, e.g. /home/<username>/.kube/config.
  • USE_LEGACY_TOOLS: Set to true to use multiple specialized kubectl tools instead of the unified call_kubectl tool (default: false).

Command line arguments:

sh
Usage of ./mcp-kubernetes:
      --access-level string       Access level (readonly, readwrite, or admin) (default "readonly")
      --additional-tools string   Comma-separated list of additional tools to support (kubectl is always enabled). Available: helm,cilium,hubble
      --allow-namespaces string   Comma-separated list of namespaces to allow (empty means all allowed)
      --otlp-endpoint string      OTLP endpoint for OpenTelemetry traces (e.g. localhost:4317, default "")
      --timeout int               Timeout for command execution in seconds, default is 60s (default 60)
      --transport string          Transport mechanism to use (stdio only) (default "stdio")

Unified vs Legacy Tools

By default, mcp-kubernetes uses a single unified call_kubectl tool that consolidates all kubectl operations into one tool interface. This significantly reduces context consumption while maintaining full functionality.

To use the legacy mode with multiple specialized tools (6-7 separate tools), set the environment variable:

json
{
  "mcpServers": {
    "kubernetes": {
      "command": "mcp-kubernetes",
      "env": {
        "USE_LEGACY_TOOLS": "true"
      }
    }
  }
}

Access Levels

The --access-level flag controls what operations are allowed:

  • readonly (default): Only read operations are allowed (get, describe, logs, etc.)
  • readwrite: Read and write operations are allowed (create, delete, apply, etc.)
  • admin: All operations are allowed, including admin operations (cordon, drain, taint, etc.)

Tools and operations are filtered at registration time based on the access level, so AI assistants only see operations they can actually use.

Example configurations:

json
// Read-only access (default)
{
  "mcpServers": {
    "kubernetes": {
      "command": "mcp-kubernetes"
    }
  }
}

// Read-write access
{
  "mcpServers": {
    "kubernetes": {
      "command": "mcp-kubernetes",
      "args": ["--access-level", "readwrite"]
    }
  }
}

// Admin access
{
  "mcpServers": {
    "kubernetes": {
      "command": "mcp-kubernetes",
      "args": ["--access-level", "admin"]
    }
  }
}

Usage

Ask any questions about Kubernetes cluster in your AI client. The MCP tools make it easier for AI assistants to understand and use kubectl operations.

Example Queries

txt
What is the status of my Kubernetes cluster?

What is wrong with my nginx pod?

Show me all deployments in the production namespace

Scale my web deployment to 5 replicas

Check if I have permission to create pods

What is my current kubectl context?

List all available kubectl contexts

Switch to the production context

Available Tools

Unified Tool (Default)

By default, mcp-kubernetes uses a single unified call_kubectl tool that handles all kubectl operations. This approach significantly reduces context consumption compared to the legacy multi-tool approach.

call_kubectl - Execute kubectl commands

  • Available in: All access levels (operations filtered by access level)
  • Parameters:
    • command: The full kubectl command to execute including 'kubectl' prefix (e.g., "kubectl get pods -n default", "kubectl apply -f deployment.yaml")
  • Examples:
    bash
    # Get pods
    command: "kubectl get pods -n default"
    
    # Apply configuration
    command: "kubectl apply -f deployment.yaml"
    
    # Scale deployment
    command: "kubectl scale deployment nginx --replicas=3"

Legacy Tools (Optional)

When USE_LEGACY_TOOLS=true, the mcp-kubernetes server provides multiple specialized kubectl tools that group related operations together. Tools are automatically filtered based on your access level.

Kubectl Tools

Available in: readonly, readwrite, admin

Handles CRUD operations on Kubernetes resources and node management. In readonly mode, only supports get and describe operations. Node operations (cordon, uncordon, drain, taint) are available in admin mode only.

Parameters:

  • operation: The operation to perform (get, describe, create, delete, apply, patch, replace, cordon, uncordon, drain, taint)
  • resource: The resource type (e.g., pods, deployments, services, nodes) or empty for file-based operations
  • args: Additional arguments like resource names, namespaces, and flags

Examples:

bash
# Get all pods
operation: "get"
resource: "pods"
args: "--all-namespaces"

# Apply a configuration
operation: "apply"
resource: ""
args: "-f deployment.yaml"

# Drain a node (admin only)
operation: "drain"
resource: "node"
args: "worker-1 --ignore-daemonsets"

# Add a taint (admin only)
operation: "taint"
resource: "nodes"
args: "worker-1 key=value:NoSchedule"

Available in: readwrite, admin

Manages deployment lifecycle operations including scaling and rollouts.

Parameters:

  • operation: The operation to perform (run, expose, scale, autoscale, rollout)
  • resource: For rollout operations, the subcommand (status, history, undo, restart, pause, resume)
  • args: Additional arguments

Examples:

bash
# Scale a deployment
operation: "scale"
resource: "deployment"
args: "nginx --replicas=3"

# Check rollout status
operation: "rollout"
resource: "status"
args: "deployment/nginx"

Available in: readwrite, admin

Updates labels, annotations, and other metadata on resources.

Parameters:

  • operation: The operation to perform (label, annotate, set)
  • resource: The resource type
  • args: Resource name and metadata changes

Examples:

bash
# Add a label
operation: "label"
resource: "pods"
args: "nginx-pod app=web"

# Set image
operation: "set"
resource: "image"
args: "deployment/nginx nginx=nginx:latest"

Available in: readonly, readwrite, admin

Provides debugging and monitoring capabilities.

Parameters:

  • operation: The operation to perform (logs, events, top, exec, cp)
  • resource: The resource type or specific resource
  • args: Additional arguments

Examples:

bash
# View logs
operation: "logs"
resource: ""
args: "nginx-pod -f"

# Execute command in pod
operation: "exec"
resource: ""
args: "nginx-pod -- ls /app"

Available in: readonly, readwrite, admin

Provides cluster-level information and API discovery.

Parameters:

  • operation: The operation to perform (cluster-info, api-resources, api-versions, explain)
  • resource: For explain operation, the resource to document
  • args: Additional flags

Examples:

bash
# Get cluster info
operation: "cluster-info"
resource: ""
args: ""

# Explain pod spec
operation: "explain"
resource: "pod.spec"
args: "--recursive"

Available in: readonly, readwrite, admin

Handles configuration validation, security operations, and kubectl context management. In readonly mode, supports diff, auth can-i, and read-only config operations.

Parameters:

  • operation: The operation to perform (diff, auth, certificate, config)
  • resource: Subcommand for auth/certificate/config operations
  • args: Operation-specific arguments

Examples:

bash
# Check permissions
operation: "auth"
resource: "can-i"
args: "create pods"

# Approve certificate
operation: "certificate"
resource: "approve"
args: "csr-name"

# Get current context
operation: "config"
resource: "current-context"
args: ""

# List all contexts
operation: "config"
resource: "get-contexts"
args: ""

# Switch context (readwrite/admin only)
operation: "config"
resource: "use-context"
args: "my-cluster-context"

Config Operations:

  • current-context: Display the current context (readonly, readwrite, admin)
  • get-contexts: List all available contexts (readonly, readwrite, admin)
  • use-context: Switch to a different context (readwrite, admin only)

Additional Tools

Available when: --additional-tools=helm is specified

Run Helm commands for managing Kubernetes applications.

Parameters:

  • command: The helm command to execute

Example:

bash
command: "list --all-namespaces"

Available when: --additional-tools=cilium is specified

Run Cilium commands for network policies and observability.

Parameters:

  • command: The cilium command to execute

Example:

bash
command: "status"

Available when: --additional-tools=hubble is specified

Run Hubble commands for network monitoring and debugging in Cilium-enabled clusters.

Parameters:

  • command: The hubble command to execute

Example:

bash
command: "status"
command: "observe observe --namespace backend-jobs  --from-label 'app=web'"
command: "list nodes"

Telemetry

Telemetry collection is on by default.

To opt out, set the environment variable KUBERNETES_MCP_COLLECT_TELEMETRY=false.

OpenTelemetry Support

The mcp-kubernetes server supports exporting telemetry data using OpenTelemetry Protocol (OTLP). You can configure an OTLP endpoint to send traces to any OpenTelemetry-compatible backend:

json
{
  "mcpServers": {
    "kubernetes": {
      "command": "mcp-kubernetes",
      "args": ["--otlp-endpoint", "localhost:4317"]
    }
  }
}

Development

How to inspect MCP server requests and responses:

sh
npx @modelcontextprotocol/inspector <path of binary 'mcp-kubernetes'>

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Installation

TypingMind
{
  "mcpServers": {
    "mcp-kubernetes": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--mount",
        "type=bind,src={{config.KUBECONFIG}},dst=/home/mcp/.kube/config",
        "ghcr.io/azure/mcp-kubernetes"
      ],
      "env": {
        "KUBECONFIG": "<KUBECONFIG>"
      }
    }
  }
}

Use mcp-kubernetes MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once mcp-kubernetes is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add mcp-kubernetes as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the mcp-kubernetes MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "mcp-kubernetes": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the mcp-kubernetes MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the mcp-kubernetes MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use mcp-kubernetes to help me with this task?
mcp-kubernetes
Sure. I read it.
Here is what I found using mcp-kubernetes.

Frequently asked questions

What is the mcp-kubernetes MCP server used for?

mcp-kubernetes is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use mcp-kubernetes MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use mcp-kubernetes with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use mcp-kubernetes MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With mcp-kubernetes connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect mcp-kubernetes MCP to TypingMind?

mcp-kubernetes runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does mcp-kubernetes MCP provide in TypingMind?

mcp-kubernetes exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use mcp-kubernetes MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If mcp-kubernetes requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇