Skip to content

basebandit/kai

Kai Logo

Kai - Kubernetes MCP Server

A Model Context Protocol (MCP) server for managing Kubernetes clusters through LLM clients like Claude and Ollama.

Overview

Kai provides a bridge between large language models (LLMs) and your Kubernetes clusters, enabling natural language interaction with Kubernetes resources. The server exposes a comprehensive set of tools for managing clusters, namespaces, pods, deployments, services, and other Kubernetes resources.

Features

Core Workloads

  • Pods - Create, list, get, delete, and stream logs
  • Deployments - Create, list, describe, and update
  • Jobs - Batch workload management (create, get, list, delete)
  • CronJobs - Scheduled batch workloads (create, get, list, delete)

Networking

  • Services - Create, get, list, and delete
  • Ingress - HTTP/HTTPS routing, TLS configuration (create, get, list, update, delete)

Configuration

  • ConfigMaps - Configuration management (create, get, list, update, delete)
  • Secrets - Secret management (create, get, list, update, delete)
  • Namespaces - Namespace management (create, get, list, delete)

Cluster Operations

  • Context Management - Switch contexts, list contexts, rename, delete
  • Nodes - Node monitoring, cordoning, and draining
  • Cluster Health - Cluster status and resource metrics

Storage

  • Persistent Volumes - PV and PVC management
  • Storage Classes - Storage class operations

Security

  • RBAC - Roles, RoleBindings, and ServiceAccounts

Advanced

  • Custom Resources - CRD and custom resource operations
  • Utilities - Port forwarding, events, and API exploration

Requirements

The server connects to your current kubectl context by default. Ensure you have access to a Kubernetes cluster configured for kubectl (e.g., minikube, Rancher Desktop, kind, EKS, GKE, AKS).

Installation

go install github.com/basebandit/kai/cmd/kai@latest

Configuration

Claude for Desktop

Edit your Claude Desktop configuration:

# macOS
code ~/Library/Application\ Support/Claude/claude_desktop_config.json

# Linux
code ~/.config/Claude/claude_desktop_config.json

Add the server configuration:

{
  "mcpServers": {
    "kubernetes": {
      "command": "/path/to/kai"
    }
  }
}

Custom Kubeconfig

By default, Kai uses ~/.kube/config. The server automatically loads your current context on startup.

Usage Examples

Once configured, you can interact with your cluster using natural language:

  • "List all pods in the default namespace"
  • "Create a deployment named nginx with 3 replicas using the nginx:latest image"
  • "Show me the logs for pod my-app"
  • "Delete the service named backend"
  • "Create a cronjob that runs every 5 minutes"
  • "Create an ingress for my-app with TLS enabled"

Contributing

Contributions are welcome! Please see our contributing guidelines for more information.

License

This project is licensed under the MIT License.


Kubernetes MCP Server

About

An MCP Server for Kubernetes

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages