k8s-mcp-go

k8s-mcp-go

Safe, read-only-by-default Kubernetes access for AI agents via MCP. Provides explicit readonly, readwrite, and dangerous permission modes, plus MCPB bundles for desktop clients.

Category
访问服务器

README

k8s-mcp-go

Safe, read-only-by-default Kubernetes access for AI agents.

A Kubernetes MCP server that lets AI assistants inspect your cluster safely — without giving them unrestricted kubectl.

GitHub release License Go MCP

What makes it different

  • Read-only by default: useful for diagnosis without giving AI permission to mutate the cluster.
  • Explicit permission modes: choose readonly, readwrite, or dangerous before the assistant starts.
  • No Docker required: install via MCPB bundles or a single native binary.
  • Kubernetes-native visibility: inspect pods, deployments, services, logs, events, nodes, and live CPU/memory usage.
  • Registry-ready distribution: published as io.github.kaneg/k8s-mcp-go for MCP Registry consumers and packaged clients.

Distribution

Why

Most AI agents can use Kubernetes tools. The real problem is how to stop them from changing the wrong thing.

Giving an AI raw kubectl access is risky. Even a capable model can:

  • delete the wrong resource
  • restart the wrong workload
  • apply a dangerous change
  • turn a debugging session into a production incident

k8s-mcp-go gives AI agents a guardrailed interface to Kubernetes instead of unrestricted shell access.

It is built for the real-world question:

How can I let AI help with Kubernetes, without letting it break my cluster?

Permission Modes

You choose the boundary up front:

What you want Mode
"Let AI inspect and diagnose, but change nothing" readonly
"Allow safe operational actions like scale and restart" readwrite
"Give it full cluster power" dangerous

readonly (default)

For diagnosis, inspection, and safe exploration.

AI can do things like:

  • list pods, deployments, services, nodes, and namespaces
  • read logs and events
  • inspect cluster state
  • check resource usage

It cannot modify workloads or delete resources.

readwrite

For controlled operational workflows.

AI can do things like:

  • scale deployments
  • restart deployments
  • restart statefulsets
  • update images
  • patch deployments
  • create namespaces

It still cannot perform the most destructive operations.

dangerous

Full access.

Use this only when you explicitly want AI to be able to:

  • delete resources
  • delete namespaces
  • apply arbitrary YAML

If you are unsure, use readonly.

Quick Start

Option 1: MCPB Install (Recommended)

Download the .mcpb bundle for your platform from Releases. MCPB-compatible clients (Claude Desktop, Cursor, etc.) can install it directly — no Docker, no Go, no manual setup.

OS Arch File
Linux x86_64 k8s-mcp-go_*_linux_amd64.mcpb
Linux ARM64 k8s-mcp-go_*_linux_arm64.mcpb
macOS Intel k8s-mcp-go_*_darwin_amd64.mcpb
macOS Apple Silicon k8s-mcp-go_*_darwin_arm64.mcpb
Windows x86_64 k8s-mcp-go_*_windows_amd64.mcpb
Windows ARM64 k8s-mcp-go_*_windows_arm64.mcpb

Option 2: Manual Binary Install

Grab the binary archive from Releases and extract it:

# Example: Linux x86_64
tar xzf k8s-mcp-go_*_linux_amd64.tar.gz
chmod +x k8s-mcp-go
sudo mv k8s-mcp-go /usr/local/bin/

Then add it to your MCP client.

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "k8s": {
      "command": "k8s-mcp-go",
      "args": ["-mode=readonly"]
    }
  }
}

Cursor (.cursor/mcp.json):

{
  "mcpServers": {
    "k8s": {
      "command": "k8s-mcp-go",
      "args": ["-mode=readonly"]
    }
  }
}

Restart your client and start asking questions about your cluster.

Example prompts

Once installed, ask your AI assistant things like:

  • "Show me unhealthy pods in all namespaces."
  • "Which pods are using the most memory?"
  • "Summarize recent warning events."
  • "Inspect this deployment and explain why it is not ready."
  • "Check rollout status for this deployment."

In readonly mode, the assistant can investigate but cannot change the cluster.

Why not just use kubectl?

Because the problem is not whether AI can talk to Kubernetes. The problem is whether it can do so safely.

kubectl is powerful, but it does not give you a product-level permission mode for AI behavior. With k8s-mcp-go, you decide whether the assistant can:

  • inspect only
  • perform limited operational actions
  • or get full control

The permission boundary is the product.

Available Tools (35 total)

Tools are grouped by permission level.

Readonly (24)

Tool Description
server_info Show server version, mode, kubeconfig path, and runtime details
resolve_workload Resolve an app/workload name to matching resources and suggested next tools
list_pods List pods; supports all_namespaces=true
get_pod Get pod details
get_pod_logs Get pod logs
list_deployments List deployments; supports all_namespaces=true
get_deployment Get deployment details
list_statefulsets List StatefulSets; supports all_namespaces=true
get_statefulset Get StatefulSet details
list_services List services; supports all_namespaces=true
get_service Get service details
list_configmaps List ConfigMaps; supports all_namespaces=true
get_configmap Get ConfigMap data
list_secrets List Secrets (keys only); supports all_namespaces=true
get_secret Get Secret metadata and keys
list_pvc List PersistentVolumeClaims; supports all_namespaces=true
list_ingress List Ingress resources; supports all_namespaces=true
list_jobs List Jobs; supports all_namespaces=true
top_nodes Current node CPU and memory usage
top_pods Current pod CPU and memory usage
list_nodes List cluster nodes
list_namespaces List namespaces
cluster_overview Cluster health summary
get_events List events

Readwrite (7)

Tool Description
scale_deployment Scale deployment replicas
restart_deployment Rolling restart a deployment
restart_statefulset Rolling restart a statefulset
set_image Update container image
rollout_status Check rollout progress
create_namespace Create a new namespace
patch_deployment Apply strategic merge patch

Dangerous (4)

Tool Description
delete_pod Delete a pod
delete_deployment Delete a deployment
delete_namespace Delete a namespace and all resources
apply_yaml Apply arbitrary YAML manifest

Environment Variables

Variable Description
KUBECONFIG Path to kubeconfig file (default: ~/.kube/config)

Build from Source

git clone https://github.com/kaneg/k8s-mcp-go.git
cd k8s-mcp-go
go build -o k8s-mcp-go .

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选