MCP Server Kubernetes

3.5.0 · active · verified Sun Apr 19

The `mcp-server-kubernetes` package provides an executable Model Context Protocol (MCP) server designed to facilitate interaction with Kubernetes clusters. It leverages the local `kubectl` installation and `kubeconfig` files to perform operations such as managing pods, deployments, and other Kubernetes resources. The current stable version is 3.5.0, with the project demonstrating an active development cadence through frequent minor and patch releases, as seen with recent updates like 3.4.0 and 3.3.0. A key differentiator is its deep integration into the Claude ecosystem, offering streamlined setup for Claude Code and Claude Desktop through dedicated commands and `.mcpb` extensions. It supports various `kubeconfig` loading strategies, provides an `X-MCP-AUTH` header for basic authentication in streaming server contexts, and includes advanced features like OpenTelemetry distributed tracing support since v3.3.0. This server acts as a crucial bridge for AI agents and developer tools that need programmatic access to Kubernetes management capabilities via the MCP standard, abstracting the complexities of direct `kubectl` interaction.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to install the MCP Kubernetes server globally, run it directly, and integrate it with Claude Code for local development.

// This quickstart demonstrates how to install and run the mcp-server-kubernetes
// as a standalone process and how to integrate it with Claude Code.
// Ensure you have Node.js (>=18) and npm installed.
// Also, `kubectl` and a valid `kubeconfig` must be present and configured.

// Step 1: Install the server globally for easy execution.
// This is typically how you'd make it available for npx or direct command.
// If you prefer local installation, omit `-g` and use `npx mcp-server-kubernetes`.
// In your terminal, run:
// npm install -g mcp-server-kubernetes

// Step 2: Run the server directly (e.g., for testing or custom integrations).
// The server will listen on the specified port, interacting with your Kubernetes cluster.
// For security, consider setting authentication via X-MCP-AUTH environment variables.
// In your terminal, run:
// npx mcp-server-kubernetes --port 8080 --log-level info
// Example with authentication (replace 'mysecrettoken'):
// X_MCP_AUTH_TOKEN="mysecrettoken" npx mcp-server-kubernetes --port 8080

// Step 3: Integrate with Claude Code (if applicable).
// This command registers the server with your Claude Code environment.
// In your terminal, run:
// claude mcp add kubernetes -- npx mcp-server-kubernetes

// The server is now ready to interact with Kubernetes via MCP!

view raw JSON →