
K8M
AI-driven mini Kubernetes dashboard with a built-in MCP server exposing 49 cluster operation tools
Add to your client
Copy the config for your MCP client and paste it into its config file.
Paste into ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"k8m": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"http://localhost:3618/mcp/k8m/sse",
"--header",
"Authorization: <token-from-k8m-个人中心-开放MCP>"
]
}
}
}Claude Desktop connects to remote servers through the `mcp-remote` proxy (installed on first run via npx). Restart Claude Desktop after saving.
Step-by-step guides: Add to Claude Desktop · Add to Cursor · Add to Windsurf
Before you start
- A running, self-hosted K8M instance (single binary or docker-compose; default port 3618)
- One or more Kubernetes clusters registered/managed in K8M
- The built-in 'k8m' MCP server enabled under 平台设置-MCP管理
- An MCP access link and Authorization Token created under 个人中心-开放MCP (the Token is bound to the creating user's cluster permissions)
About K8M
K8M is a single-binary, cross-platform Kubernetes AI dashboard (Go backend, Baidu AMIS frontend) with an embedded MCP server. The MCP server speaks SSE only and exposes 49 tools to operate Kubernetes across every cluster K8M manages. Enable the built-in k8m MCP server in the admin settings, generate a per-user access link/Token, and point an MCP client (Cursor, Trae, CherryStudio, Cline, Claude Desktop, Windsurf, GitHub Copilot, etc.) at the SSE URL. MCP calls execute with the link creator's cluster permissions and are fully audit-logged.
Tools & capabilities (49)
list_clustersList all registered Kubernetes clusters
scale_deploymentScale a Deployment up or down
restart_deploymentRestart a Deployment
stop_deploymentStop a Deployment
restore_deploymentRestore a stopped Deployment
update_tag_deploymentUpdate a Deployment's image tag
rollout_history_deploymentQuery a Deployment's rollout history
rollout_undo_deploymentRoll back a Deployment
rollout_pause_deploymentPause a Deployment rollout
rollout_resume_deploymentResume a paused Deployment rollout
rollout_status_deploymentQuery a Deployment's rollout status
hpa_list_deploymentList the HPAs for a Deployment
list_deployment_podsGet the Pods managed by a Deployment
get_k8s_resourceGet a Kubernetes resource (incl. CRDs)
describe_k8s_resourceDescribe a Kubernetes resource
delete_k8s_resourceDelete a Kubernetes resource
list_k8s_resourceList Kubernetes resources
list_k8s_eventList Kubernetes events
patch_k8s_resourceUpdate a Kubernetes resource via JSON Patch
label_k8s_resourceAdd or remove labels on a Kubernetes resource
annotate_k8s_resourceAdd or remove annotations on a Kubernetes resource
taint_nodeAdd a taint to a node
untaint_nodeRemove a taint from a node
cordon_nodeCordon a node
uncordon_nodeUncordon a node
drain_nodeDrain a node
get_node_resource_usageQuery a node's resource usage
get_node_ip_usageQuery Pod IP usage on a node
get_node_pod_countQuery the number of Pods on a node
list_pod_filesList files in a Pod
list_all_pod_filesList all files in a Pod
delete_pod_fileDelete a file in a Pod
upload_file_to_podUpload a file (text content) into a Pod, stored as a Pod file
get_pod_logsGet Pod logs
run_command_in_podExecute a command inside a Pod
get_pod_linked_serviceGet the Service linked to a Pod
get_pod_linked_ingressGet the Ingress linked to a Pod
get_pod_linked_endpointsGet the Endpoints linked to a Pod
get_pod_linked_pvcGet the PVC linked to a Pod
get_pod_linked_pvGet the PV linked to a Pod
get_pod_linked_envGet Pod runtime environment variables by running env inside the Pod
get_pod_linked_env_from_yamlGet Pod runtime environment variables from the Pod YAML definition
get_pod_resource_usageGet a Pod's resource usage (CPU/memory request, limit, allocatable, usage ratio)
apply_yamlApply a YAML resource
delete_yamlDelete a YAML resource
set_default_storageclassSet the default StorageClass
get_storageclass_pvc_countGet the PVC count for a StorageClass
get_storageclass_pv_countGet the PV count for a StorageClass
set_default_ingressclassSet the default IngressClass
What this server can do
K8M provides tools for these capabilities — tap one to see every MCP server that does the same:
When to use it
- Let an LLM client (Cursor, Trae, CherryStudio, Cline, GitHub Copilot) inspect and operate Kubernetes clusters in natural language
- Scale, restart, roll out, and roll back Deployments through a chat agent
- Diagnose Pods by pulling logs, running commands, and inspecting linked Services/Ingress/PVCs and resource usage
- Perform node maintenance (cordon, drain, taint) via an AI agent with audited, permission-scoped access
- Apply or delete YAML and manage CRDs across multiple registered clusters from one MCP endpoint
Security notes
The MCP server is only reachable after you self-host K8M and create an access link under 个人中心-开放MCP; the URL http://localhost:3618/mcp/k8m/sse is a per-user template — replace localhost with your server IP and use your own generated link. External clients must authenticate by passing the Token (created under 个人中心-开放MCP) in the Authorization header. MCP permissions are bound to the creating user's cluster authorization (read-only / exec / cluster-admin), so scope that user carefully — cluster-admin links can apply YAML, delete resources, drain nodes, and exec into Pods. Change the default k8m/k8m credentials and enable 2FA before exposing the dashboard.
K8M FAQ
What transport does the MCP server use?
SSE only. The docs state the built-in MCP server supports the SSE protocol exclusively; the endpoint is http://<server-ip>:3618/mcp/k8m/sse.
How does authentication work?
Create an access link/Token under 个人中心-开放MCP in the K8M UI, then pass it in the Authorization header from your MCP client. The link inherits the creating user's cluster permissions (read-only, exec, or cluster-admin).
Do I need to install a package?
No npm/pip package. You self-host the K8M binary (or docker-compose), enable the built-in k8m MCP server in admin settings, and connect your client to the SSE URL.
How many tools does it expose?
49 built-in tools covering cluster, deployment, dynamic resource/CRD, node, Pod, YAML, storage, and ingress operations across all clusters K8M manages.
Alternatives to K8M
Compare all alternatives →GitHub's official server for repos, issues, PRs, and Actions — local Docker or hosted remote.
Official AWS Labs server that lets agents call any AWS API via the AWS CLI surface.
Bulk Kubernetes port forwarding with an MCP server that lets AI assistants forward services, inspect pods, and monitor traffic.
Compare K8M with: