Kubernetes MCP Server

Connect your AI assistant to Kubernetes clusters for cluster management, pod inspection, deployment automation, and troubleshooting.

April 14, 2026
MCP ServerDevelopment Tools & DevOpsKubernetes MCP Server

Kubernetes MCP Server

Connect your AI assistant directly to Kubernetes clusters for real-time cluster management and troubleshooting. The Kubernetes MCP server provides natural language interfaces for inspecting cluster resources, managing deployments, and diagnosing issues across your entire Kubernetes estate.

This server is invaluable for platform engineers managing multiple clusters, DevOps teams debugging production incidents, and developers who need quick access to Kubernetes resources without context-switching to kubectl.

What it Does

  • Cluster Inspection: List nodes, namespaces, and cluster resources
  • Pod Management: View pod status, logs, and descriptions
  • Deployment Operations: Create, update, and scale deployments
  • Service Management: Inspect and manage services, ingress, and networking
  • Troubleshooting: Get events, describe resources, and diagnose issues

Installation

# Using npx
npx -y @anthropic-ai/mcp-server-kubernetes

# Using Docker
docker run -i --rm -v ~/.kube:/root/.kube mcp/kubernetes

Configuration

{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
      "args": ["-y", "@anthropic-ai/mcp-server-kubernetes"],
      "env": {
        "KUBECONFIG": "${HOME}/.kube/config"
      }
    }
  }
}

Available Tools

ToolPurposeCategory
list_nodesList all nodes in the clusterCluster
list_namespacesList all namespacesCluster
list_podsList pods filtered by namespace and labelsPods
get_pod_logsFetch logs from a specific podPods
describe_podGet detailed pod descriptionPods
list_deploymentsList deployments in a namespaceDeployments
scale_deploymentScale a deployment to a specific replica countDeployments
list_servicesList all servicesNetworking
get_eventsGet cluster events for troubleshootingDebugging

Common Workflows

Investigating a Pod Crash Loop

  1. List pods in the affected namespace to identify the crashing pod
  2. Get the pod description to check recent events and status
  3. Fetch the logs from the crashing container
  4. Check cluster events for broader infrastructure issues
  5. Ask "What is causing this pod to crash loop based on the logs and events?"

Scaling for Traffic

  1. List deployments to find the target service
  2. Check current replica count and pod status
  3. Scale the deployment to handle increased load
  4. Monitor the new pods as they come online
  5. Verify service endpoints are routing to healthy pods

Cluster Health Check

  1. List all nodes and check their status
  2. Review cluster events for recent issues
  3. Check pod distribution across nodes
  4. Inspect any pending or failing pods
  5. Generate a cluster health summary

Example Prompts

  • "Show me all pods in the default namespace"
  • "What deployments are failing in production?"
  • "Get logs from the api-server pod"
  • "Scale the web deployment to 5 replicas"
  • "List all services with external IPs"
  • "Check events for the last hour across all namespaces"

Troubleshooting

IssueLikely CauseSolution
"Connection refused"Cluster not accessible from MCP hostVerify kubeconfig context and cluster endpoint reachability
"Unauthorized"Kubeconfig lacks permissionsUse a service account token with appropriate RBAC bindings
"Pod not found"Wrong namespace or pod nameVerify the namespace with list_namespaces first
"Context deadline exceeded"Cluster is unreachable or overloadedCheck cluster health and network connectivity

Security Notes

  • Use read-only service accounts for production clusters
  • Limit RBAC permissions to only required resources
  • Never expose kubeconfig with admin credentials to AI assistants