/ 目录 / 演练场 / MKP (Model Kontext for K8s)
● 官方 StacklokLabs ⚡ 即开即用

MKP (Model Kontext for K8s)

作者 StacklokLabs · StacklokLabs/mkp

Kubernetes MCP from Stacklok — native API client, not a kubectl wrapper.

MKP is a Kubernetes MCP server written in Go that talks directly to the API server (not by shelling out to kubectl). That means structured outputs, less prompt pollution, and proper RBAC enforcement based on the agent's serviceaccount.

为什么要用

核心特性

实时演示

实际使用效果

mkp-mcp.replay ▶ 就绪
0/0

安装

选择你的客户端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "mkp-mcp": {
      "command": "mkp",
      "args": [
        "serve"
      ]
    }
  }
}

打开 Claude Desktop → Settings → Developer → Edit Config。保存后重启应用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "mkp-mcp": {
      "command": "mkp",
      "args": [
        "serve"
      ]
    }
  }
}

Cursor 使用与 Claude Desktop 相同的 mcpServers 格式。项目级配置优先于全局。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "mkp-mcp": {
      "command": "mkp",
      "args": [
        "serve"
      ]
    }
  }
}

点击 Cline 侧栏中的 MCP Servers 图标,然后选 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "mkp-mcp": {
      "command": "mkp",
      "args": [
        "serve"
      ]
    }
  }
}

格式与 Claude Desktop 相同。重启 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "mkp-mcp",
      "command": "mkp",
      "args": [
        "serve"
      ]
    }
  ]
}

Continue 使用服务器对象数组,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "mkp-mcp": {
      "command": {
        "path": "mkp",
        "args": [
          "serve"
        ]
      }
    }
  }
}

加入 context_servers。Zed 保存后热重载。

claude mcp add mkp-mcp -- mkp serve

一行命令搞定。用 claude mcp list 验证,claude mcp remove 卸载。

使用场景

实战用法: MKP (Model Kontext for K8s)

Find which pod is OOMKilling and propose a fix

👤 K8s operators ⏱ ~15 min intermediate

何时使用: You're paged for memory pressure and don't have a dashboard up.

前置条件
  • Server/skill installed and authenticated — See repo README
步骤
  1. Spot the OOMs
    Find pods in any namespace with restartCount > 3 in the last hour. Show pod, namespace, last termination reason.✓ 已复制
    → Targeted list, likely with OOMKilled in the reason
  2. Propose the fix
    Get the limits/requests for the worst offender. Tell me what to raise and write an apply_manifest dry-run patch.✓ 已复制
    → Resource diff + a dry-run apply

结果: Targeted patch ready to apply, RBAC-checked.

注意事项
  • MKP only exposes what the bound SA can do — MKP only exposes what the bound SA can do — to enable apply_manifest you must bind an SA with patch permission.
搭配使用: portainer-mcp

组合

与其他 MCP 搭配,撬动十倍杠杆

mkp-mcp + portainer-mcp

Pair with portainer-mcp for complementary capabilities

Use this server together with portainer-mcp to complete a multi-step task.✓ 已复制

工具

此 MCP 暴露的能力

工具输入参数何时调用成本
list_resources kind, namespace, label_selector Inventory any resource type 1 API call
get_logs pod, container, tail_lines Triage a pod 1 API call
apply_manifest yaml, dry_run Deploy a change (dry-run first) 1 API call

成本与限制

运行它的成本

API 配额
See provider docs for rate limits
每次调用 Token 数
Varies by tool
费用
See repo README for pricing details
提示
Cache tool results and avoid repeated identical calls.

安全

权限、密钥、影响范围

凭据存储: Use environment variables; never commit secrets
数据出站: Tool calls go to the provider's API as documented

故障排查

常见错误与修复

Forbidden on list pods

Bind a Role/ClusterRole with pods:get,list,watch to the SA mkp uses. Use kubectl auth can-i to verify.

验证: kubectl auth can-i list pods
context not found

Set KUBECONFIG to a file with the right context, or pass --context.

验证: kubectl config get-contexts

替代方案

MKP (Model Kontext for K8s) 对比其他方案

替代方案何时用它替代权衡
containers/kubernetes-mcp-serverYou want the most-starred optionSimilar feature set; pick by org preference

更多

资源

📖 阅读 GitHub 上的官方 README

🐙 查看未解决的 issue

🔍 浏览全部 400+ MCP 服务器和 Skills