MCP HubMCP Hub
manusa

kubernetes-mcp-server

by: manusa

Model Context Protocol (MCP) server for Kubernetes and OpenShift

97created 11/02/2025
Visit
Kubernetes
OpenShift

πŸ“ŒOverview

Purpose: The Kubernetes MCP Server aims to provide a robust and flexible implementation of the Model Context Protocol (MCP) for Kubernetes, specifically enhancing interoperability with OpenShift.

Overview: This server offers a powerful alternative to traditional Kubernetes management tools, enabling seamless interaction with Kubernetes resources without needing additional dependencies. It supports automated updates to configuration and allows users to perform various operations on Kubernetes resources efficiently.

Key Features:

  • Configuration Management: Automatically detects configuration changes in Kubernetes, ensuring the MCP server is always up-to-date while allowing users to manage their Kubernetes configuration seamlessly.

  • Generic Resource Operations: Facilitates CRUD operations across any Kubernetes resources, empowering users to manage their environment effortlessly.

  • Pod Management: Provides specialized pod operations, including listing, retrieving, deleting pods, accessing logs, and running container images directly within a pod.

  • Event Monitoring: Enables users to view Kubernetes events across all namespaces or filter to specific ones, aiding in monitoring cluster activity effectively.

Overall, the Kubernetes MCP Server enhances Kubernetes management through its native capabilities while ensuring ease of use and broader accessibility.


Kubernetes MCP Server

GitHub License
npm
GitHub release (latest SemVer)
Build

✨ Features | πŸš€ Getting Started | πŸŽ₯ Demos | βš™οΈ Configuration | πŸ› οΈ Tools | πŸ§‘β€πŸ’» Development


✨ Features

A powerful and flexible Kubernetes Model Context Protocol (MCP) server implementation with support for Kubernetes and OpenShift.

  • Configuration:
    • Automatically detect changes in the Kubernetes configuration and update the MCP server.
    • View and manage the current Kubernetes .kube/config or in-cluster configuration.
  • Generic Kubernetes Resources: Perform operations on any Kubernetes or OpenShift resource (Create or Update, Get, List, Delete).
  • Pods Operations:
    • List pods in all or specific namespaces.
    • Get, delete pods by name and namespace.
    • Show pod logs.
    • Exec into a pod and run commands.
    • Run a container image in a pod and optionally expose it.
  • Namespaces: List Kubernetes Namespaces.
  • Events: View Kubernetes events in all or specific namespaces.
  • Projects: List OpenShift Projects.

Unlike other Kubernetes MCP server implementations, this is not just a wrapper around kubectl or helm. There is no need for external dependencies or tools to be installed.


πŸš€ Getting Started

Requirements

  • Access to a Kubernetes cluster.

Claude Desktop

Using npx

Add the MCP server to the mcpServers list in your claude_desktop_config.json:

{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
      "args": [
        "-y",
        "kubernetes-mcp-server@latest"
      ]
    }
  }
}

VS Code / VS Code Insiders

Install the Kubernetes MCP server extension by running:

# For VS Code
code --add-mcp '{"name":"kubernetes","command":"npx","args":["kubernetes-mcp-server@latest"]}'
# For VS Code Insiders
code-insiders --add-mcp '{"name":"kubernetes","command":"npx","args":["kubernetes-mcp-server@latest"]}'

Goose CLI

Goose CLI is an easy way to get started with AI agents.

Add the MCP server to your Goose config.yaml:

extensions:
  kubernetes:
    command: npx
    args:
      - -y
      - kubernetes-mcp-server@latest

πŸŽ₯ Demos

Diagnosing and automatically fixing an OpenShift Deployment

Demo showcasing how Kubernetes MCP server is leveraged by Claude Desktop to automatically diagnose and fix a deployment in OpenShift without user assistance.

Vibe Coding a simple game and deploying it to OpenShift

Walkthrough using VS Code, Podman MCP server, and Kubernetes MCP server to develop and deploy a simple game on OpenShift.

Watch on YouTube


βš™οΈ Configuration

The Kubernetes MCP server can be configured with CLI arguments.

Run with npx or download the latest binary.

npx kubernetes-mcp-server@latest --help
./kubernetes-mcp-server --help

Configuration Options

OptionDescription
--sse-portStart MCP server in Server-Sent Event (SSE) mode on the specified port.
--log-levelSet logging level (values from 0-9). Similar to kubectl logging levels.
--kubeconfigPath to Kubernetes configuration file. If not provided, resolves from in-cluster or default locations.

πŸ› οΈ Tools

configuration_view

Get the current Kubernetes configuration as kubeconfig YAML.

  • minified (boolean, optional, default true): Return a minified version including only the current-context and relevant pieces.

events_list

List Kubernetes events in the current cluster.

  • namespace (string, optional): Namespace to list events from; all namespaces if omitted.

namespaces_list

List Kubernetes namespaces.

pods_delete

Delete a Kubernetes Pod.

  • name (string, required): Pod name.
  • namespace (string, required): Namespace.

pods_exec

Execute a command in a Kubernetes Pod.

  • command (string[], required): Command and arguments.
  • name (string, required): Pod name.
  • namespace (string, required): Namespace.

pods_get

Get a Kubernetes Pod.

  • name (string, required): Pod name.
  • namespace (string, required): Namespace.

pods_list

List all Kubernetes pods.

pods_list_in_namespace

List pods in a specific namespace.

  • namespace (string, required): Namespace.

pods_log

Get logs of a Kubernetes Pod.

  • name (string, required): Pod name.
  • namespace (string, required): Namespace.
  • container (string, optional): Container name.

pods_run

Run a Kubernetes Pod.

  • image (string, required): Container image.
  • namespace (string, required): Namespace.
  • name (string, optional): Pod name.
  • port (number, optional): Port to expose.

projects_list

List OpenShift projects.

resources_create_or_update

Create or update a Kubernetes resource by providing YAML or JSON.

  • resource (string, required): JSON or YAML representation including apiVersion, kind, metadata, and spec.

Common kinds: Pod (v1), Service (v1), Deployment (apps/v1), Ingress (networking.k8s.io/v1).

resources_delete

Delete a Kubernetes resource.

  • apiVersion (string, required)
  • kind (string, required)
  • name (string, required)
  • namespace (string, optional)

resources_get

Get a Kubernetes resource.

  • apiVersion (string, required)
  • kind (string, required)
  • name (string, required)
  • namespace (string, optional)

resources_list

List Kubernetes resources.

  • apiVersion (string, required)
  • kind (string, required)
  • namespace (string, optional)

πŸ§‘β€πŸ’» Development

Running with mcp-inspector

Compile and inspect the MCP server with mcp-inspector.

make build
npx @modelcontextprotocol/inspector@latest $(pwd)/kubernetes-mcp-server