K8s MCP Server logo

K8s MCP Server

by alexei-led

K8s MCP Server is a server for Anthropic's MCP (Model Context Protocol) that allows running Kubernetes CLI tools such as `kubectl`, `istioctl`, `helm`, and `argocd` in a safe, containerized environment. It acts as a secure bridge between language models and Kubernetes CLI tools.

View on GitHub

Last updated: N/A

What is K8s MCP Server?

K8s MCP Server is a secure bridge between language models (like Claude) and Kubernetes CLI tools. It enables language models to execute validated Kubernetes commands, retrieve command documentation, and process command output in a structured way.

How to use K8s MCP Server?

To use K8s MCP Server, you need Docker installed, a valid Kubernetes configuration, and the Claude Desktop application. Configure the server in Claude Desktop by editing the claude_desktop_config.json file to include the Docker run command for the K8s MCP Server image, mounting your Kubernetes configuration. You can then interact with Kubernetes through Claude by asking it to perform Kubernetes operations, which will be executed via the K8s MCP Server.

Key features of K8s MCP Server

  • Execute Kubernetes CLI commands securely with proper validation, timeouts and error handling

  • Support for multiple Kubernetes CLI tools: kubectl, istioctl, helm, argocd

  • Command piping capabilities with popular Linux CLI tools

  • Detailed command validation and safety checks

  • Configurable timeouts and output limits

  • Comprehensive documentation and help retrieval

  • Context and namespace management

  • Pre-built prompt templates for common Kubernetes operations

Use cases of K8s MCP Server

  • Deploying and managing Kubernetes applications using natural language commands

  • Troubleshooting Kubernetes deployments through language model interaction

  • Automating Kubernetes tasks with language models

  • Providing a secure interface for language models to interact with Kubernetes clusters

FAQ from K8s MCP Server

What is the Model Context Protocol (MCP)?

The Model Context Protocol (MCP) is a protocol that allows language models to interact with external tools and services in a structured way.

What Kubernetes CLI tools are supported?

The server supports kubectl, istioctl, helm, and argocd.

How do I configure the server?

The server can be configured via environment variables passed to the Docker container, such as K8S_CONTEXT, K8S_NAMESPACE, K8S_MCP_TIMEOUT, etc.

How do I integrate with Claude Desktop?

Edit the claude_desktop_config.json file to include the K8s MCP Server configuration, specifying the Docker run command and mounting the Kubernetes configuration.

How does the server ensure security?

The server includes isolation through Docker, read-only access to Kubernetes configuration, non-root execution, command validation, and context separation. It also supports strict and permissive security modes with customizable security rules.