kubernetes-mcp
MCP server that gives AI assistants full access to Kubernetes clusters and Helm, exposing 73 tools for managing pods, deployments, services, configs, secrets, logs, exec, port-forwarding, Helm lifecycle, and more.
README
kubernetes-mcp
A Model Context Protocol server that gives Claude (or any MCP client) full access to a Kubernetes cluster and Helm. Exposes 73 tools covering pods, deployments, services, config, secrets, events, logs, exec, port-forwarding, manifest apply/delete, Helm lifecycle management, nodes, workloads, storage, ingress, batch jobs, rollouts, RBAC, kubeconfig contexts, metrics, HPAs, and CRDs.
Prerequisites
Installation
git clone https://github.com/Stonepusher/kubernetes-mcp.git
cd kubernetes-mcp
npm install
npm run build
Usage with Claude Code
A .mcp.json is included in the repo root. When you open the project directory in Claude Code the kubernetes server is registered automatically. Run /mcp inside Claude Code to confirm it is active, then talk to Claude naturally:
"List all pods in the default namespace" "Scale the echo-server deployment to 3 replicas" "Show me the logs from the nginx pod" "Install bitnami/nginx as my-release in the staging namespace" "What CRDs are installed in this cluster?" "Show me all ClusterRoles and their rule counts"
Manual registration
To register the server globally (outside this directory) add the following to your Claude Code MCP settings:
{
"mcpServers": {
"kubernetes": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/kubernetes-mcp/dist/index.js"]
}
}
}
Tools
Kubernetes — core resources
| Tool | Description |
|---|---|
k8s_list_namespaces |
List all namespaces |
k8s_list_pods |
List pods in a namespace (optional label selector) |
k8s_get_pod |
Get full details of a pod |
k8s_list_deployments |
List deployments in a namespace |
k8s_get_deployment |
Get full details of a deployment |
k8s_scale_deployment |
Scale a deployment to N replicas |
k8s_list_services |
List services in a namespace |
k8s_get_service |
Get full details of a service |
k8s_list_configmaps |
List ConfigMaps in a namespace |
k8s_get_configmap |
Get a ConfigMap including its data |
k8s_list_secrets |
List Secrets in a namespace (names/types only) |
k8s_get_secret |
Get a Secret (values are base64-encoded) |
k8s_get_events |
Get events in a namespace, optionally filtered by object name |
Kubernetes — operations
| Tool | Description |
|---|---|
k8s_get_pod_logs |
Stream or tail logs from a pod container |
k8s_exec |
Execute a command inside a running pod |
k8s_port_forward_start |
Start a local port-forward tunnel to a pod |
k8s_port_forward_list |
List active port-forward sessions |
k8s_port_forward_stop |
Stop a port-forward session |
k8s_apply_manifest |
Apply a YAML/JSON manifest (kubectl apply -f -) |
k8s_delete_manifest |
Delete resources defined in a manifest |
k8s_delete_resource |
Delete any resource by type, name, and namespace (no manifest needed) |
Kubernetes — nodes
| Tool | Description |
|---|---|
k8s_list_nodes |
List all nodes with status, roles, and version info |
k8s_get_node |
Get full details of a node |
k8s_cordon_node |
Cordon a node to prevent new pod scheduling |
k8s_uncordon_node |
Uncordon a node to re-enable pod scheduling |
k8s_drain_node |
Drain a node by evicting all pods |
Kubernetes — workloads
| Tool | Description |
|---|---|
k8s_list_daemonsets |
List DaemonSets in a namespace |
k8s_get_daemonset |
Get full details of a DaemonSet |
k8s_list_statefulsets |
List StatefulSets in a namespace |
k8s_get_statefulset |
Get full details of a StatefulSet |
Kubernetes — batch
| Tool | Description |
|---|---|
k8s_list_jobs |
List Jobs in a namespace |
k8s_get_job |
Get full details of a Job |
k8s_list_cronjobs |
List CronJobs in a namespace |
k8s_get_cronjob |
Get full details of a CronJob |
k8s_suspend_cronjob |
Suspend a CronJob to stop it scheduling new Jobs |
k8s_resume_cronjob |
Resume a suspended CronJob |
Kubernetes — rollouts
| Tool | Description |
|---|---|
k8s_rollout_restart |
Trigger a rolling restart of a Deployment, DaemonSet, or StatefulSet |
k8s_rollout_status |
Check rollout status and wait for completion |
k8s_rollout_undo |
Roll back to a previous revision |
Kubernetes — storage
| Tool | Description |
|---|---|
k8s_list_persistent_volumes |
List all PersistentVolumes |
k8s_get_persistent_volume |
Get full details of a PersistentVolume |
k8s_list_persistent_volume_claims |
List PersistentVolumeClaims in a namespace |
k8s_get_persistent_volume_claim |
Get full details of a PersistentVolumeClaim |
k8s_list_storage_classes |
List all StorageClasses |
k8s_get_storage_class |
Get full details of a StorageClass |
Kubernetes — networking
| Tool | Description |
|---|---|
k8s_list_ingresses |
List Ingresses in a namespace |
k8s_get_ingress |
Get full details of an Ingress |
Kubernetes — autoscaling
| Tool | Description |
|---|---|
k8s_list_hpas |
List HorizontalPodAutoscalers in a namespace |
k8s_get_hpa |
Get full details of a HorizontalPodAutoscaler |
Kubernetes — RBAC
| Tool | Description |
|---|---|
k8s_list_cluster_roles |
List all ClusterRoles |
k8s_get_cluster_role |
Get full details of a ClusterRole |
k8s_list_cluster_role_bindings |
List all ClusterRoleBindings |
k8s_get_cluster_role_binding |
Get full details of a ClusterRoleBinding |
k8s_list_roles |
List Roles in a namespace |
k8s_get_role |
Get full details of a Role |
k8s_list_role_bindings |
List RoleBindings in a namespace |
k8s_get_role_binding |
Get full details of a RoleBinding |
Kubernetes — custom resources
| Tool | Description |
|---|---|
k8s_list_crds |
List all CustomResourceDefinitions |
k8s_get_crd |
Get full details of a CustomResourceDefinition |
Kubernetes — contexts & metrics
| Tool | Description |
|---|---|
k8s_list_contexts |
List all kubeconfig contexts and show which is active |
k8s_use_context |
Switch the active kubeconfig context |
k8s_top_nodes |
Show CPU/memory usage for all nodes (requires metrics-server) |
k8s_top_pods |
Show CPU/memory usage for pods in a namespace (requires metrics-server) |
Helm
| Tool | Description |
|---|---|
helm_list |
List releases (single namespace or all) |
helm_install |
Install a chart |
helm_upgrade |
Upgrade (or install) a release |
helm_rollback |
Roll back a release to a previous revision |
helm_uninstall |
Uninstall a release |
helm_get_values |
Get values for an installed release |
helm_history |
Get revision history of a release |
helm_show_chart_values |
Show default values for a chart before installing |
helm_repo_add |
Add a Helm chart repository |
helm_repo_update |
Update local Helm repository cache |
Development
npm run build # compile TypeScript → dist/index.js via esbuild
npm run dev # rebuild on file changes
npm run typecheck # tsc --noEmit (type-check only, no emit)
npm test # smoke test — exercises all 73 tools against a live cluster
Smoke test
npm test runs test/smoke-test.mjs, which spawns the MCP server over stdio and exercises all read-only tools against the currently configured cluster. It discovers real resource names dynamically (no hardcoded names) and skips dependent tests gracefully when resources are not found. Write operations (k8s_rollout_restart, k8s_use_context, etc.) are hard-skipped.
Kubernetes MCP Server — Smoke Test
==================================================
── Phase 1: Handshake ──────────────────────────────────────
[PASS] initialize — serverInfo.name === "kubernetes"
── Phase 2: Tool inventory ─────────────────────────────────
[PASS] tools/list — count === 73
── Phase 3: Tool assertions ────────────────────────────────
[PASS] k8s_list_namespaces — returns non-empty array
[PASS] k8s_list_pods — non-empty array in kube-system
...
==================================================
Results (7.3s elapsed)
Passed : 55
Failed : 0
Skipped: 10
Build notes
@kubernetes/client-node v1.x ships ~54 MB of generated TypeScript types that OOM the TypeScript compiler. The project uses esbuild to bundle to a single CJS file (dist/index.js) without type-checking overhead. Use npm run typecheck separately if you need full type validation.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。