Kubernetes MCP server

Enables direct Kubernetes cluster management through a Kotlin-based server that provides tools for monitoring and controlling pods, deployments, services, storage, networking, and Helm releases using the official Kubernetes Java client.
Back to servers
Setup instructions
Provider
Hari Ohm Prasath
Release date
Mar 24, 2025
Language
Kotlin
Stats
12 stars

This system combines AI with Kubernetes management capabilities, allowing you to interact with your Kubernetes cluster using natural language queries instead of memorizing complex commands.

Prerequisites

Before getting started, ensure you have the following requirements installed:

  • JDK 17 or later
  • Maven 3.8 or later
  • A Kubernetes cluster with a configured ~/.kube/config file

Installation

Building from Source

To build the project from source:

# Build all modules
mvn clean package

Setting up Minikube

If you don't have a Kubernetes cluster, you can use Minikube:

# Install minikube (macOS)
brew install minikube

# Start minikube
minikube start

# Make sure kubeconfig is set
kubectl config use-context minikube

# Deploy a test application
kubectl create deployment nginx --image=nginx:latest

# Verify the deployment
kubectl get pods

You should see the nginx pod in the output, confirming your environment is working properly.

Running the Application

Starting the MCP Server

To run the MCP server:

java -jar mcp-server/target/mcp-server-1.0-SNAPSHOT.jar

Running in Agent Mode

Alternatively, you can run the application in agent mode:

java -jar agent/target/agent-*-fat.jar

Usage Examples

The system can understand natural language queries about your Kubernetes cluster. Here are some examples of what you can ask:

Cluster Health and Diagnostics

  • "What's the status of my cluster?"
  • "Show me all pods in the default namespace"
  • "Are there any failing pods in the default namespace?"
  • "What's using the most resources in my cluster?"
  • "Give me a complete health check of the cluster"

Network Analysis

  • "Show me the logs for the payment service"
  • "List all ingresses in the cluster"
  • "Show me all services and their endpoints"
  • "Check if my service 'api-gateway' has any endpoints"

Storage Management

  • "List all persistent volumes in the cluster"
  • "Show me storage claims that are unbound"
  • "What storage classes are available in the cluster?"
  • "Which pods are using persistent storage?"

Job and CronJob Analysis

  • "List all running jobs in the batch namespace"
  • "Show me failed jobs from the last 24 hours"
  • "What CronJobs are scheduled to run in the next hour?"
  • "Show me the execution history of the 'backup' job"

Helm Release Management

  • "List all Helm releases"
  • "Upgrade the MongoDB chart to version 12.1.0"
  • "What values are configured for my Prometheus release?"
  • "Rollback the failed Elasticsearch release"
  • "Show me the revision history for my Prometheus release"

The system uses AI to analyze patterns in logs, events, and resource usage to provide intelligent diagnostics and recommendations based on these natural language queries.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "kubernetes" '{"command":"java","args":["-jar","mcp-server/target/mcp-server-1.0-SNAPSHOT.jar"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "kubernetes": {
            "command": "java",
            "args": [
                "-jar",
                "mcp-server/target/mcp-server-1.0-SNAPSHOT.jar"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "kubernetes": {
            "command": "java",
            "args": [
                "-jar",
                "mcp-server/target/mcp-server-1.0-SNAPSHOT.jar"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later