Kubernetes MCP Server Cluster (2026)
Managing Kubernetes clusters at scale presents significant challenges for development teams. From monitoring pod health to automating deployments, the operational overhead can quickly become overwhelming. Model Context Protocol (MCP) servers can bridge Claude and your Kubernetes cluster and provide a powerful solution for extending Claude’s capabilities into your cluster management workflows, enabling intelligent automation and real-time cluster interaction.
This guide covers practical approaches to integrating MCP servers with Kubernetes, with code examples you can apply immediately to your own infrastructure.
Why MCP Servers Change Kubernetes Operations
Before MCP, working with Kubernetes meant context-switching between terminal windows, dashboards, runbooks, and chat tools. An incident at 2 AM required an engineer to pull up several kubectl commands from memory, cross-reference log output manually, and write a summary to post in Slack. Every step was manual and error-prone under pressure.
MCP servers collapse that workflow into a single conversational interface. You describe what you need in natural language, and Claude translates that into cluster API calls, interprets the results, and surfaces actionable findings. The underlying kubectl operations still happen, but you no longer have to compose them yourself or mentally parse raw YAML output.
This is not just a convenience feature. Consistent, templated operations reduce the chance of operator error during high-stress incidents. Teams that standardize around MCP-driven runbooks report fewer mistyped namespace flags and forgotten --dry-run arguments during production changes.
Setting Up Your First Kubernetes MCP Server Connection
Establishing a secure connection between Claude and your Kubernetes cluster is the first step. Most teams use the official Kubernetes MCP server, which authenticates using your existing ~/.kube/config context.
Install the Kubernetes MCP server
npm install -g @modelcontextprotocol/server-kubernetes
Configure your cluster connection
export KUBECONFIG=~/.kube/config
export CONTEXT=production
After installation, configure Claude Code to use this server by adding it to your settings:
{
"mcpServers": {
"kubernetes": {
"command": "npx",
"args": ["@modelcontextprotocol/server-kubernetes"]
}
}
}
This configuration grants Claude the ability to query cluster state, inspect resources, and execute management operations directly through natural language prompts.
Multi-Context Configuration
Production teams typically manage multiple clusters: development, staging, and production at minimum. You can expose all of them through a single MCP server configuration with context switching:
{
"mcpServers": {
"kubernetes-dev": {
"command": "npx",
"args": ["@modelcontextprotocol/server-kubernetes"],
"env": {
"KUBECONFIG": "/home/user/.kube/config",
"CONTEXT": "dev-cluster"
}
},
"kubernetes-prod": {
"command": "npx",
"args": ["@modelcontextprotocol/server-kubernetes"],
"env": {
"KUBECONFIG": "/home/user/.kube/config",
"CONTEXT": "prod-cluster"
}
}
}
}
With separate MCP server entries per cluster, you can ask Claude to compare state between environments: “Show me the deployment versions in staging and production side by side.” That kind of cross-cluster visibility would previously require running separate kubectl commands and diffing the output manually.
Practical Cluster Management Tasks
Once your MCP server connects, you can perform common operational tasks without switching between tools. Here are three high-value use cases with concrete examples.
- Pod Monitoring and Troubleshooting
When a service experiences issues, quickly identifying affected pods saves critical time. Ask Claude to diagnose the problem:
"Show me all pods in the production namespace with error events in the last hour"
Claude queries your cluster through the MCP server and returns structured output:
NAMESPACE POD STATUS RESTARTS AGE
production api-server-7d9f4 Running 3 2h
production api-server-8f2a1 Error 12 2h
production worker-5c3e2 Running 0 5h
For deeper investigation, request specific container logs:
"Get the last 50 lines of logs from the failing api-server pod"
Claude does not just retrieve the logs. it can analyze them and surface the most relevant error messages. A prompt like “Summarize the root cause of failures in api-server-8f2a1 based on the last 100 log lines” gives you a synthesized explanation rather than raw output to parse yourself.
For recurring issues, the pattern of high restarts combined with specific log signatures often points to OOMKilled events or missing environment variables. Claude can identify these patterns and suggest remediation steps:
"The api-server pod has 12 restarts. Check its resource limits and recent OOMKilled events and suggest what to change."
- Resource Scaling Operations
Scaling deployments horizontally requires accurate replica management. MCP servers can handle this directly:
Scale a deployment to 5 replicas
kubectl scale deployment api-gateway --replicas=5 -n production
If you need intelligent recommendations based on current load, Claude can analyze resource metrics and suggest optimal scaling values. For teams running workloads on cloud providers, combining the Kubernetes MCP server with monitoring tools like Prometheus creates powerful autoscaling workflows.
A practical scaling workflow with MCP looks like this:
- Ask Claude to check current HPA status: “What is the current replica count and CPU usage for the api-gateway deployment?”
- Review the output alongside your traffic metrics.
- Ask for a scaling recommendation: “Based on the CPU usage trend, what replica count would handle a 3x traffic spike?”
- Execute the scale operation through Claude with an explicit confirmation step.
This workflow keeps a human in the loop for production scaling decisions while offloading the data-gathering and analysis steps to Claude.
- Namespace and Resource Cleanup
Stale resources accumulate in development environments over time. MCP servers enable safe bulk operations:
"List all deployments in the dev namespace that haven't been updated in 30 days"
After review, you can safely remove unused resources. This practice reduces cluster clutter and lowers compute costs.
A cleanup workflow that teams find useful is a weekly audit session where Claude generates a report of stale resources across all non-production namespaces. The prompt chain looks like this:
"List all resources in the dev and staging namespaces older than 30 days with no recent activity"
[review output]
"Generate the kubectl delete commands for the resources listed above, but do not execute them yet"
[review generated commands]
"Execute the cleanup for the dev namespace only"
This step-by-step approach gives you full visibility before anything is deleted. The intermediate step of generating commands without executing them is especially useful for training junior engineers on what a cleanup operation actually does.
Integrating Multiple MCP Servers
For comprehensive cluster management, combining multiple MCP servers delivers the best results. Pair the Kubernetes server with specialized tools:
- Supermemory for logging conversation context and maintaining operational runbooks
- PDF skill for generating cluster health reports
- TDD skill for writing integration tests against your cluster API
This combination lets you document issues, generate reports, and test infrastructure changes without leaving your Claude workflow.
A powerful pattern is to use the supermemory skill alongside Kubernetes MCP to build a living runbook. Every time you diagnose a new class of issue through Claude, save the successful diagnostic prompt chain and the resolution steps. Over time, this becomes a searchable knowledge base that new team members can query directly.
Combining Kubernetes MCP with Prometheus
Kubernetes MCP surfaces resource state, but performance trends require metrics. Pairing it with a Prometheus MCP server gives you both:
{
"mcpServers": {
"kubernetes": {
"command": "npx",
"args": ["@modelcontextprotocol/server-kubernetes"]
},
"prometheus": {
"command": "npx",
"args": ["@modelcontextprotocol/server-prometheus"],
"env": {
"PROMETHEUS_URL": "http://prometheus.monitoring.svc:9090"
}
}
}
}
With both servers active, you can ask questions that span cluster state and metrics: “Which pods are consuming more CPU than their requests specify, and what does their CPU trend look like over the past 24 hours?” This type of cross-source analysis would normally require jumping between the Kubernetes dashboard and Grafana.
Security Considerations
When granting Claude cluster access through MCP, follow the principle of least privilege. Create a dedicated service account with minimal permissions:
apiVersion: v1
kind: ServiceAccount
metadata:
name: claude-mcp
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: claude-mcp-role
rules:
- apiGroups: [""]
resources: ["pods", "services", "configmaps"]
verbs: ["get", "list", "watch"]
- apiGroups: ["apps"]
resources: ["deployments"]
verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: claude-mcp-binding
subjects:
- kind: ServiceAccount
name: claude-mcp
roleRef:
kind: Role
name: claude-mcp-role
apiGroup: rbac.authorization.k8s.io
This configuration restricts Claude to read-only operations except where write access is explicitly required.
Environment-Specific Permissions
A common pattern is to give Claude broader permissions in development clusters and restrict it more tightly in production. This lets development teams iterate freely while enforcing safety boundaries where it matters most:
| Permission | Development | Staging | Production |
|---|---|---|---|
| Pod read | Yes | Yes | Yes |
| Pod logs | Yes | Yes | Yes |
| Deployment scale | Yes | Yes | No |
| Deployment update | Yes | No | No |
| Namespace create/delete | Yes | No | No |
| Secret read | Yes | No | No |
In production, a separate approval workflow. triggered by Claude generating the kubectl command for human review. maintains the safety boundary while still automating the analysis work.
For additional security hardening, run the MCP server inside your cluster rather than exposing the Kubernetes API externally. A pod in the monitoring namespace with appropriate RBAC is more secure than routing traffic through your firewall:
apiVersion: apps/v1
kind: Deployment
metadata:
name: claude-mcp-server
namespace: monitoring
spec:
replicas: 1
selector:
matchLabels:
app: claude-mcp-server
template:
metadata:
labels:
app: claude-mcp-server
spec:
serviceAccountName: claude-mcp
containers:
- name: mcp-server
image: your-registry/mcp-server-kubernetes:latest
ports:
- containerPort: 3000
Advanced Patterns for Production Teams
Mature teams extend their MCP workflows with custom scripts. For example, create automated runbooks that Claude executes when triggered:
// Custom MCP tool: health-check.js
export async function healthCheck(cluster, namespace) {
const pods = await getPods(cluster, namespace);
const deployments = await getDeployments(cluster, namespace);
const results = {
pods: pods.filter(p => p.status !== 'Running').length,
deployments: deployments.filter(d => d.readyReplicas !== d.replicas).length
};
return results;
}
This pattern enables Claude to perform consistent health checks across multiple clusters, returning actionable summaries rather than raw data.
For frontend development teams working on Kubernetes-native applications, combining the frontend-design skill with cluster management creates consistent developer experiences. You can preview changes against running services while simultaneously monitoring deployment status.
Automated Incident Triage
One of the highest-value applications of Kubernetes MCP in production is automated incident triage. When an alert fires, Claude can execute a standard first-response checklist automatically:
// incident-triage.js
export async function triageIncident(namespace, service) {
const steps = [
() => getPodStatus(namespace, service),
() => getRecentEvents(namespace, service, '30m'),
() => getContainerLogs(namespace, service, 100),
() => getResourceUsage(namespace, service),
() => getHPAStatus(namespace, service)
];
const results = await Promise.all(steps.map(fn => fn()));
return {
podHealth: results[0],
recentEvents: results[1],
logSummary: results[2],
resourceUsage: results[3],
scalingStatus: results[4],
generatedAt: new Date().toISOString()
};
}
Feeding this structured output to Claude gives you a complete incident brief in seconds rather than the five to ten minutes it typically takes an engineer to gather the same information manually. The triage report can be piped directly to the pdf skill to generate a formatted incident summary for stakeholders.
Deployment Safety Gates
Rather than preventing Claude from touching production deployments entirely, some teams implement a safety gate pattern. Claude proposes the change, generates the deployment YAML, runs a diff, and requires an explicit human approval string before applying:
Proposed change: Update api-gateway image from v1.4.2 to v1.5.0
Diff:
image: myregistry/api-gateway:v1.4.2
+ image: myregistry/api-gateway:v1.5.0
This will trigger a rolling deployment affecting 3 replicas.
Estimated downtime: 0 (rolling update with 1 pod buffer)
Type CONFIRM to proceed, or describe any changes needed.
This pattern gives engineers the analysis and planning work for free while keeping the final decision and confirmation firmly in human hands.
Conclusion
Kubernetes MCP server integration transforms cluster management from a series of manual kubectl commands into conversational workflows. Start with read-only operations, establish security boundaries, then gradually add automation for routine tasks.
The investment in setting up these connections pays dividends through reduced context-switching, consistent operational procedures, and faster incident response. As your team matures, layering additional MCP servers like pdf for documentation and supermemory for institutional knowledge creates a comprehensive infrastructure command center.
The most impactful gains come not from replacing human judgment, but from eliminating the tedious data-gathering steps that precede every decision. When Claude handles the assembly of facts and Claude handles the formatting of reports, your engineers spend their time on analysis, architecture, and decisions. the work that actually requires human expertise.
Try it: Estimate your monthly spend with our Cost Calculator.
Related Reading
- Claude Code MCP Server Setup: Complete Guide 2026
- AWS MCP Server Cloud Automation with Claude Code
- Securing MCP Servers in Production Environments
- Integrations Hub
Built by theluckystrike. More at zovo.one
Configure it → Build your MCP config with our MCP Config Generator.