An MCP (Model Context Protocol) server that provides AI assistants with comprehensive Kubernetes cluster management capabilities. Built with the official Kubernetes client-node library and MCP SDK, it exposes eight tools for listing pods, deployments, and services, retrieving pod logs, applying manifests, listing namespaces, getting cluster events, and scaling deployments. The server uses kubeconfig or in-cluster authentication and communicates via stdio transport for integration with Claude Desktop and other MCP clients.
| Component | File | Purpose | Key Dependencies |
|---|---|---|---|
| Server Entry | src/index.ts | MCP server initialization, tool registration, stdio transport | @modelcontextprotocol/sdk |
| Kube Config | src/kube.ts | Kubernetes client configuration (kubeconfig or in-cluster) | @kubernetes/client-node |
| List Pods | src/tools/list_pods.ts | List pods with namespace and label selector filtering | CoreV1Api |
| List Deployments | src/tools/list_deployments.ts | List deployments with optional namespace filtering | AppsV1Api |
| List Services | src/tools/list_services.ts | List services with optional namespace filtering | CoreV1Api |
| Get Pod Logs | src/tools/get_pod_logs.ts | Retrieve pod logs with container and tail line options | CoreV1Api |
| Apply Manifest | src/tools/apply_manifest.ts | Apply a YAML manifest to the cluster | KubernetesObjectApi, yaml |
| List Namespaces | src/tools/list_namespaces.ts | List all namespaces in the cluster | CoreV1Api |
| Get Events | src/tools/get_events.ts | Get cluster events with optional namespace filtering | CoreV1Api |
| Scale Deployment | src/tools/scale_deployment.ts | Scale a deployment to a specified replica count | AppsV1Api |
| Control | Implementation |
|---|---|
| Authentication | Kubeconfig file or in-cluster service account token |
| RBAC | Kubernetes RBAC controls which resources the service account can access |
| Input Validation | Zod schema validation on all tool parameters; YAML parsing for manifests |
| Transport Security | TLS for Kubernetes API server communication; stdio for local MCP transport |
| Namespace Isolation | Tools support namespace filtering to restrict operations |
| Manifest Validation | YAML manifests are parsed and validated before application |
Monitor HIPAA-compliant workloads on AKS/EKS/GKE, scale healthcare applications, retrieve pod logs for compliance auditing.
Manage PCI-DSS scoped Kubernetes workloads, monitor deployment status for financial applications, audit cluster events.
Deployment management, pod troubleshooting via logs, manifest application for GitOps workflows, auto-scaling operations.
Multi-cluster management, namespace provisioning, event monitoring for platform health, deployment scaling for capacity management.
npm run build)| Variable | Required | Default | Description |
|---|---|---|---|
KUBECONFIG | No | ~/.kube/config | Path to kubeconfig file (auto-detected in-cluster) |
git clone https://github.com/kogunlowo123/mcp-server-kubernetes.git
cd mcp-server-kubernetes
npm install
npm run build
npm start
docker build -t mcp-server-kubernetes .
docker run \
-v ~/.kube/config:/root/.kube/config:ro \
mcp-server-kubernetes
| Repository | github.com/kogunlowo123/mcp-server-kubernetes |
| README | README.md |
| Changelog | CHANGELOG.md |
| License | MIT License |