Multi Cluster Kubernetes MCP Server
Provides tools for managing multiple Kubernetes clusters simultaneously, including cluster operations, resource management, monitoring, RBAC, storage, networking, and more.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Multi Cluster Kubernetes MCP Servershow cluster health for all clusters"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 claudeManual 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.pyDocker
docker build -t k8s-mcp .
docker run -v ~/.kube:/root/.kube k8s-mcpConfiguration
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 |
|
| 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 contextsPartial Name Matching: Use
prodinstead ofarn:aws:eks:us-east-1:123456:cluster/prod-clusterCross-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 |
| List all available contexts across all kubeconfig files |
| List all namespaces in a cluster |
| Create a new namespace with optional labels/annotations |
| Delete a namespace (protects system namespaces) |
| List all nodes with status, roles, capacity, and version |
| Comprehensive cluster health summary (nodes, pods, deployments, warnings) |
Resource Discovery & Inspection (7 tools)
Tool | Description |
| List resources of any kind (pods, deployments, services, ingress, etc.) |
| Get the complete definition of a single resource |
| Get pod logs with duration filtering and container selection |
| List cluster events in a namespace, sorted by most recent |
| Detailed resource description similar to |
| List all available API groups and resources in the cluster |
| List all Custom Resource Definitions with versions and scope |
Metrics & Monitoring (3 tools)
Tool | Description |
| Display node CPU/memory usage alongside capacity |
| Display pod/container CPU/memory usage |
| Comprehensive app diagnostics with issue detection and recommendations |
Rollout Management (6 tools)
Tool | Description |
| Get rollout status for deployment/statefulset/daemonset |
| Get revision history |
| Roll back to a previous revision |
| Trigger a rolling restart |
| Pause an in-progress rollout |
| Resume a paused rollout |
Scaling (3 tools)
Tool | Description |
| Scale deployment/statefulset/replicaset to N replicas |
| Configure Horizontal Pod Autoscaler (HPA) |
| Update CPU/memory requests and limits for a container |
Resource CRUD (6 tools)
Tool | Description |
| Create a resource from YAML/JSON content |
| Apply configuration (create or update, like |
| Delete any resource type with optional force/grace period |
| Update specific fields with strategic merge patch |
| Add or update labels on a resource |
| Add or update annotations on a resource |
Workload Management (3 tools)
Tool | Description |
| Expose a deployment/pod as a new Service |
| Create and run a pod with a specified image |
| Set resource limits/requests for containers |
Node Management (5 tools)
Tool | Description |
| Mark a node as unschedulable |
| Mark a node as schedulable |
| Drain a node by evicting pods (for maintenance) |
| Add taints to a node |
| Remove taints from a node |
Pod Operations (1 tool)
Tool | Description |
| Execute a command in a container (supports quoted arguments) |
Secrets & ConfigMaps (6 tools)
Tool | Description |
| List secrets with metadata (values hidden for security) |
| Get a secret; optionally decode values |
| Create a new secret (auto base64-encodes values) |
| List ConfigMaps with their key names |
| Get a ConfigMap with full data contents |
| Create a new ConfigMap |
RBAC (5 tools)
Tool | Description |
| List RBAC Roles with permission rules |
| List RBAC ClusterRoles |
| List RoleBindings (who has what role) |
| List ClusterRoleBindings |
| List ServiceAccounts |
Storage (3 tools)
Tool | Description |
| List PersistentVolumeClaims with status, capacity, and storage class |
| List PersistentVolumes with capacity and bound claims |
| List StorageClasses with provisioner and default status |
Networking (1 tool)
Tool | Description |
| List NetworkPolicies with pod selectors and rule counts |
Job Management (2 tools)
Tool | Description |
| List Jobs with completion status and timing |
| 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: 80Architecture
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.yamlWhat'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 handlingPerformance: 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
fastapianduvicorndependenciesSecurity: Namespace deletion protects system namespaces; secret values hidden by default
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
This server cannot be installed
Maintenance
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/razvanmacovei/k8s-multicluster-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server