Kubernetes Monitor

Kubernetes Monitor

A read-only MCP server for Kubernetes that allows querying cluster information and diagnosing issues through natural language interfaces like Claude.

vlttnv

Monitoring
Cloud Platforms
Developer Tools
Python
Visit Server

README

<img src="./assets/logo.svg" alt="Allseer Logo" width="400" height="400" />

k8s-mcp

smithery badge

A Python-based, read-only Model Context Protocol (MCP) server for Kubernetes clusters that exposes a comprehensive API to retrieve cluster information and diagnose issues.

Example chat using Claude

Installation

Prerequisites

  • Python 3.8+
  • Access to a Kubernetes cluster (via kubeconfig or in-cluster configuration)
  • Required Python packages (see dependencies in pyproject.toml)
  • uv - https://github.com/astral-sh/uv
# To install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone the repository
git clone git@github.com:vlttnv/k8s-mcp.git
cd k8s-mcp

# Install dependencies
uv venv
source .venv/bin/activate
uv sync

If using Claude configure open your Claude for Desktop App configuration at ~/Library/Application Support/Claude/claude_desktop_config.json in a text editor. Make sure to create the file if it doesn’t exist.

code ~/Library/Application\ Support/Claude/claude_desktop_config.json
{
    "mcpServers": {
        "k8s-mcp": {
            "command": "uv",
            "args": [
                "--directory",
                "/ABSOLUTE/PATH/TO/PARENT/FOLDER/k8s-mcp",
                "run",
                "server.py"
            ]
        }
    }
}

You may need to put the full path to the uv executable in the command field. You can get this by running which uv on MacOS/Linux or where uv on Windows.

Configuration

The application automatically tries two methods to connect to your Kubernetes cluster:

  1. Kubeconfig File: Uses your local kubeconfig file (typically located at ~/.kube/config)
  2. In-Cluster Configuration: If running inside a Kubernetes pod, uses the service account token

No additional configuration is required if your kubeconfig is properly set up or if you're running inside a cluster with appropriate RBAC permissions.

Usage

Examples

Here are some useful example prompts you can ask Claude about your Kubernetes cluster and its resources:

General Cluster Status

  • "What's the overall health of my cluster?"
  • "Show me all namespaces in my cluster"
  • "What nodes are available in my cluster and what's their status?"
  • "How is resource utilization across my nodes?"

Pods and Deployments

  • "List all pods in the production namespace"
  • "Are there any pods in CrashLoopBackOff state?"
  • "Show me pods with high restart counts"
  • "List all deployments across all namespaces"
  • "What deployments are failing to progress?"

Debugging Issues

  • "Why is my pod in the staging namespace failing?"
  • "Get the YAML configuration for the service in the production namespace"
  • "Show me recent events in the default namespace"
  • "Are there any pods stuck in Pending state?"
  • "What's causing ImagePullBackOff errors in my cluster?"

Resource Management

  • "Show me the resource consumption of nodes in my cluster"
  • "Are there any orphaned resources I should clean up?"
  • "List all services in the production namespace"
  • "Compare resource requests between staging and production"

Specific Resource Inspection

  • "Show me the config for the coredns deployment in kube-system"
  • "Get details of the reverse-proxy service in staging"
  • "What containers are running in the pod xyz?"
  • "Show me the logs for the failing pod"

API Reference

Namespaces

  • get_namespaces(): List all available namespaces in the cluster

Pods

  • list_pods(namespace=None): List all pods, optionally filtered by namespace
  • failed_pods(): List all pods in Failed or Error state
  • pending_pods(): List all pods in Pending state with reasons
  • high_restart_pods(restart_threshold=5): Find pods with restart counts above threshold

Nodes

  • list_nodes(): List all nodes and their status
  • node_capacity(): Show available capacity on all nodes

Deployments & Services

  • list_deployments(namespace=None): List all deployments
  • list_services(namespace=None): List all services
  • list_events(namespace=None): List all events

Resource Management

  • orphaned_resources(): List resources without owner references
  • get_resource_yaml(namespace, resource_type, resource_name): Get YAML configuration for a specific resource

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
DuckDuckGo MCP Server

DuckDuckGo MCP Server

A Model Context Protocol (MCP) server that provides web search capabilities through DuckDuckGo, with additional features for content fetching and parsing.

Featured
Python
contentful-mcp

contentful-mcp

Update, create, delete content, content-models and assets in your Contentful Space

Featured
TypeScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
YouTube Transcript MCP Server

YouTube Transcript MCP Server

This server retrieves transcripts for given YouTube video URLs, enabling integration with Goose CLI or Goose Desktop for transcript extraction and processing.

Featured
Python
Supabase MCP Server

Supabase MCP Server

A Model Context Protocol (MCP) server that provides programmatic access to the Supabase Management API. This server allows AI models and other clients to manage Supabase projects and organizations through a standardized interface.

Featured
JavaScript