Manage Multiple Kubernetes Clusters
An MCP server exposing 57 tools across 13 categories for managing multiple Kubernetes clusters from one AI assistant interface.
1.0.5Add to Favorites
Why it matters
Streamline your Kubernetes operations by providing a unified API to interact with multiple clusters simultaneously. Manage deployments, monitor resources, and scale applications across your entire infrastructure from a single point.
Outcomes
What it gets done
Interact with multiple Kubernetes clusters using a single, standardized API.
Manage deployments, including status checks, rollbacks, and restarts.
Monitor resource usage and performance across all connected clusters.
Automate cross-cluster operations and resource management tasks.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-k8s-multicluster-mcp | bash Capabilities
Tools your agent gets
Get a list of all available Kubernetes contexts
Get a list of all namespaces in the specified context
Get a list of all nodes in the cluster
Get a list of resources of the specified type
Get detailed information about a specific resource
Get logs from a specific pod
Show detailed information about a specific resource or group of resources
Get a list of all available APIs in the Kubernetes cluster
Overview
k8s-multicluster-mcp MCP Server
An MCP server exposing 57 tools across 13 categories for managing multiple Kubernetes clusters - context discovery, resource CRUD, rollouts, scaling, RBAC, secrets, and node management - through an AI assistant. Use to centrally manage dev/staging/production clusters via natural language; metrics tools need metrics-server installed, and mutating tools warrant scoped credentials.
What it does
This MCP server manages multiple Kubernetes clusters simultaneously through AI assistants like Claude Desktop, exposing 57 tools across 13 categories: cluster and context management (6), resource discovery and inspection (7), metrics and monitoring (3), rollout management (6), scaling (3), resource CRUD (6), workload management (3), node management (5), pod operations (1), secrets and configmaps (6), RBAC (5), storage (3), networking (1), and job management (2). It is purpose-built for multi-cluster work: it automatically discovers all contexts across every kubeconfig file in a configured directory, supports partial cluster-name matching so prod can stand in for a full ARN like arn:aws:eks:us-east-1:123456:cluster/prod-cluster, enables cross-cluster comparison of resources, health, and configuration, and caches discovered contexts with a 30-second TTL to avoid re-reading kubeconfig files on every call.
When to use - and when NOT to
Use this to centrally manage dev, staging, and production clusters from a single AI assistant interface - diagnosing application issues, comparing resource counts across environments, executing rollouts and scaling, or performing node maintenance (cordon, drain, taint) via natural language instead of switching kubectl contexts by hand.
The k8s_top_* metrics tools and k8s_cluster_info require metrics-server installed in the target clusters to return data. Several tools are mutating and destructive by nature - resource deletion, node draining, secret creation - so the server should run with credentials scoped no more broadly than necessary; namespace deletion does protect system namespaces, and secret values are hidden by default unless explicitly decoded.
Capabilities
Cluster and context tools list contexts, namespaces, and nodes, and produce a comprehensive cluster health summary. Resource discovery tools list and inspect any resource kind, fetch pod logs with duration and container filtering, list events, and provide a kubectl describe-equivalent plus API/CRD discovery. Metrics tools show node and pod CPU/memory usage and run k8s_diagnose_application for issue detection with recommendations. Rollout tools cover status, history, rollback, restart, pause, and resume for deployments, statefulsets, and daemonsets. Scaling tools set replica counts, configure horizontal pod autoscaling, and update container resource requests/limits. CRUD tools create, apply, delete, patch, label, and annotate any resource from YAML or JSON. Workload tools expose a deployment as a service, run a pod from an image, and set container resources. Node management tools cordon, uncordon, drain, taint, and untaint nodes. k8s_pod_exec runs a command inside a container, with support for quoted arguments. Secrets and ConfigMap tools list and inspect both (secret values hidden by default, optionally decoded), and create new ones. RBAC tools list roles, clusterroles, rolebindings, clusterrolebindings, and service accounts. Storage tools cover PersistentVolumeClaims, PersistentVolumes, and StorageClasses. Networking exposes NetworkPolicies. Job management lists Jobs and CronJobs with status and schedule detail. Version 2.0.0 added 20+ of these tools (deletion, namespace management, secrets/configmaps, RBAC, storage/network visibility, job management, cluster health, pod creation) plus fixes for resource pluralization (Ingress now correctly becomes ingresses) and pod-exec command splitting with quoted arguments.
How to install
Install via Smithery with npx -y @smithery/cli install @razvanmacovei/k8s-multicluster-mcp --client claude, or manually by cloning the repository, creating a virtual environment, running pip install -r requirements.txt, and starting python3 app.py; a Dockerfile is also provided (docker build -t k8s-mcp . then docker run -v ~/.kube:/root/.kube k8s-mcp). The MCP client configuration points at app.py and sets KUBECONFIG_DIR (default ~/.kube) to the directory containing kubeconfig files, each of which can hold one or more contexts that the server discovers automatically. Requires Python 3.11 or higher and one or more kubeconfig files with valid cluster credentials. The project is Apache-2.0-licensed.
Who it's for
Platform and DevOps teams managing multiple Kubernetes clusters who want centralized, cross-cluster operations, diagnostics, and maintenance available directly through an AI assistant instead of juggling kubectl contexts.
Source README
Multi Cluster Kubernetes MCP Server
An MCP (Model Context Protocol) server for managing multiple Kubernetes clusters simultaneously. Provides 60+ tools covering cluster operations, resource management, monitoring, RBAC, storage, networking, and more -- all accessible through AI assistants like Claude Desktop.
Quick Start
Installing via Smithery
npx -y @smithery/cli install @razvanmacovei/k8s-multicluster-mcp --client claude
Manual Installation
git clone https://github.com/razvanmacovei/k8s-multicluster-mcp.git
cd k8s-multicluster-mcp
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
python3 app.py
Docker
docker build -t k8s-mcp .
docker run -v ~/.kube:/root/.kube k8s-mcp
Configuration
Claude Desktop / MCP Client
Add to your MCP client configuration:
{
"mcpServers": {
"kubernetes": {
"command": "python3",
"args": ["/path/to/k8s-multicluster-mcp/app.py"],
"env": {
"KUBECONFIG_DIR": "/path/to/your/kubeconfigs"
}
}
}
}
Environment Variables
| Variable | Default | Description |
|---|---|---|
KUBECONFIG_DIR |
~/.kube |
Directory containing kubeconfig files. Each file can contain one or more contexts. |
Place your kubeconfig files in the configured directory. The server discovers all contexts across all files automatically.
Prerequisites
- Python 3.11 or higher
- One or more kubeconfig files with valid cluster credentials
metrics-serverinstalled in clusters fork8s_top_*andk8s_cluster_infotools
Multi-Cluster Management
This server is purpose-built for managing multiple Kubernetes clusters:
- Automatic Discovery: Scans all kubeconfig files in
KUBECONFIG_DIRand aggregates contexts - Partial Name Matching: Use
prodinstead ofarn:aws:eks:us-east-1:123456:cluster/prod-cluster - Cross-Cluster Operations: Compare resources, health, and configurations across clusters
- Context Caching: Efficient 30-second TTL cache avoids re-reading kubeconfig files on every call
- Centralized Management: Manage dev, staging, and production from a single interface
Tools Reference (60+ tools)
Cluster & Context Management (6 tools)
| Tool | Description |
|---|---|
k8s_get_contexts |
List all available contexts across all kubeconfig files |
k8s_get_namespaces |
List all namespaces in a cluster |
k8s_create_ns |
Create a new namespace with optional labels/annotations |
k8s_delete_ns |
Delete a namespace (protects system namespaces) |
k8s_get_nodes |
List all nodes with status, roles, capacity, and version |
k8s_cluster_info |
Comprehensive cluster health summary (nodes, pods, deployments, warnings) |
Resource Discovery & Inspection (7 tools)
| Tool | Description |
|---|---|
k8s_get_resources |
List resources of any kind (pods, deployments, services, ingress, etc.) |
k8s_get_resource |
Get the complete definition of a single resource |
k8s_get_pod_logs |
Get pod logs with duration filtering and container selection |
k8s_get_events |
List cluster events in a namespace, sorted by most recent |
k8s_describe |
Detailed resource description similar to kubectl describe |
k8s_apis |
List all available API groups and resources in the cluster |
k8s_crds |
List all Custom Resource Definitions with versions and scope |
Metrics & Monitoring (3 tools)
| Tool | Description |
|---|---|
k8s_top_nodes |
Display node CPU/memory usage alongside capacity |
k8s_top_pods |
Display pod/container CPU/memory usage |
k8s_diagnose_application |
Comprehensive app diagnostics with issue detection and recommendations |
Rollout Management (6 tools)
| Tool | Description |
|---|---|
k8s_rollout_status |
Get rollout status for deployment/statefulset/daemonset |
k8s_rollout_history |
Get revision history |
k8s_rollout_undo |
Roll back to a previous revision |
k8s_rollout_restart |
Trigger a rolling restart |
k8s_rollout_pause |
Pause an in-progress rollout |
k8s_rollout_resume |
Resume a paused rollout |
Scaling (3 tools)
| Tool | Description |
|---|---|
k8s_scale_resource |
Scale deployment/statefulset/replicaset to N replicas |
k8s_autoscale_resource |
Configure Horizontal Pod Autoscaler (HPA) |
k8s_update_resources |
Update CPU/memory requests and limits for a container |
Resource CRUD (6 tools)
| Tool | Description |
|---|---|
k8s_create_resource |
Create a resource from YAML/JSON content |
k8s_apply_resource |
Apply configuration (create or update, like kubectl apply) |
k8s_delete_resource |
Delete any resource type with optional force/grace period |
k8s_patch_resource |
Update specific fields with strategic merge patch |
k8s_label_resource |
Add or update labels on a resource |
k8s_annotate_resource |
Add or update annotations on a resource |
Workload Management (3 tools)
| Tool | Description |
|---|---|
k8s_expose_resource |
Expose a deployment/pod as a new Service |
k8s_run_pod |
Create and run a pod with a specified image |
k8s_set_resources_for_container |
Set resource limits/requests for containers |
Node Management (5 tools)
| Tool | Description |
|---|---|
k8s_cordon_node |
Mark a node as unschedulable |
k8s_uncordon_node |
Mark a node as schedulable |
k8s_drain_node |
Drain a node by evicting pods (for maintenance) |
k8s_taint_node |
Add taints to a node |
k8s_untaint_node |
Remove taints from a node |
Pod Operations (1 tool)
| Tool | Description |
|---|---|
k8s_pod_exec |
Execute a command in a container (supports quoted arguments) |
Secrets & ConfigMaps (6 tools)
| Tool | Description |
|---|---|
k8s_list_secret |
List secrets with metadata (values hidden for security) |
k8s_get_secret_detail |
Get a secret; optionally decode values |
k8s_create_secret_resource |
Create a new secret (auto base64-encodes values) |
k8s_list_configmap |
List ConfigMaps with their key names |
k8s_get_configmap_detail |
Get a ConfigMap with full data contents |
k8s_create_configmap_resource |
Create a new ConfigMap |
RBAC (5 tools)
| Tool | Description |
|---|---|
k8s_get_roles |
List RBAC Roles with permission rules |
k8s_get_clusterroles |
List RBAC ClusterRoles |
k8s_get_rolebindings |
List RoleBindings (who has what role) |
k8s_get_clusterrolebindings |
List ClusterRoleBindings |
k8s_get_service_accounts |
List ServiceAccounts |
Storage (3 tools)
| Tool | Description |
|---|---|
k8s_get_pvcs |
List PersistentVolumeClaims with status, capacity, and storage class |
k8s_get_pvs |
List PersistentVolumes with capacity and bound claims |
k8s_get_storage_classes |
List StorageClasses with provisioner and default status |
Networking (1 tool)
| Tool | Description |
|---|---|
k8s_get_network_policies |
List NetworkPolicies with pod selectors and rule counts |
Job Management (2 tools)
| Tool | Description |
|---|---|
k8s_get_jobs |
List Jobs with completion status and timing |
k8s_get_cronjobs |
List CronJobs with schedule, suspend status, and last run |
Usage Examples
Cluster Health Check
Give me a health overview of my production cluster.
Multi-Cluster Comparison
Compare the number of pods running in the 'backend' namespace between my 'prod' and 'staging' contexts.
Diagnose Application Issues
My deployment 'my-app' in the 'production' namespace is having issues. Can you diagnose what's wrong?
Scale Resources
Scale the 'backend' deployment in the 'default' namespace to 5 replicas.
Resource Management
Delete the failed job 'data-migration-v1' in the 'batch' namespace.
Create a new namespace called 'staging' with the label environment=staging.
Secret Management
List all secrets in the 'production' namespace and show me the keys in the 'api-credentials' secret.
RBAC Inspection
Show me all role bindings in the 'default' namespace -- who has access to what?
Storage Overview
List all PVCs in the cluster and show which ones are Pending.
Node Maintenance
Cordon node 'worker-3', drain it ignoring DaemonSets, then uncordon when maintenance is complete.
Rollback Deployment
Roll back the 'api-gateway' deployment in the 'services' namespace to the previous version.
Execute in Pod
Run 'ls -la /app/config' inside the 'app' container of pod 'web-app-xyz' in the 'default' namespace.
Create Resources
Create a new deployment with this YAML:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: default
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.27
ports:
- containerPort: 80
Architecture
k8s-multicluster-mcp/
├── app.py # MCP server entry point & tool registration
├── src/
│ ├── utils/
│ │ ├── k8s_client.py # Multi-cluster client with context caching
│ │ └── pluralize.py # Kubernetes resource kind pluralization
│ └── tools/
│ ├── contexts.py # Context listing
│ ├── namespaces.py # Namespace listing
│ ├── namespace_management.py # Namespace create/delete
│ ├── nodes.py # Node listing
│ ├── pods.py # Resource listing & pod logs
│ ├── resources.py # Single resource retrieval
│ ├── events.py # Event listing
│ ├── describe.py # kubectl describe equivalent
│ ├── api_discovery.py # API & CRD discovery
│ ├── metrics.py # Node/pod metrics (top)
│ ├── diagnosis.py # Application diagnostics
│ ├── cluster_health.py # Cluster health summary
│ ├── rollouts.py # Rollout management
│ ├── scaling.py # Scale & autoscale & resource updates
│ ├── resource_management.py # Create, apply, patch, label, annotate
│ ├── delete_resource.py # Resource deletion
│ ├── workload_management.py # Expose, run pod, set resources
│ ├── node_management.py # Cordon, drain, taint
│ ├── pod_operations.py # Exec into pods
│ ├── secret_configmap.py # Secret & ConfigMap management
│ ├── rbac.py # Roles, bindings, service accounts
│ ├── storage_network.py # PVC, PV, StorageClass, NetworkPolicy
│ └── job_management.py # Jobs & CronJobs
├── requirements.txt
├── pyproject.toml
├── Dockerfile
└── smithery.yaml
What's New in v2.0.0
- 20+ new tools: Resource deletion, namespace management, secrets & configmaps, RBAC inspection, storage & network visibility, job management, cluster health summary, pod creation
- Bug fixes: Fixed resource pluralization (e.g.,
Ingress->ingressesnotingresss), fixed pod exec command splitting to handle quoted arguments, fixed timeout parameter handling - Performance: Context discovery now uses a 30-second TTL cache with direct context-to-file mapping, eliminating redundant file scanning
- Improved tool descriptions: All 60+ tools have detailed descriptions for better AI assistant integration
- Dependency cleanup: Removed unused
fastapianduvicorndependencies - Security: Namespace deletion protects system namespaces; secret values hidden by default
FAQ
Common questions
Trust
How it checks out
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.