mcp-kubernetes
mcp-kubernetes
Model Context Protocol 用の Kubernetes サーバーです。MCP 対応クライアント(Claude Desktop、Claude Code など)が、複数のコンテキストにわたって Kubernetes クラスターを検査・操作できるようにします。動作はすべてフラグで制御されます。
設計方針は デフォルトで安全 です。読み取り専用から始まり、名前空間とコンテキストの許可リストで範囲を制限できます。システム名前空間を変更から保護し、危険な操作(delete、apply、exec)は明示的な板オプトインをオンにしないと実行できないようになっています。
機能
マルチクラスター — すべてのツールはオプションの
contextを受け付け、許可リストで使用可能なコンテキストの範囲を制限できます。アクセスモード —
read-only→read-write→adminとレイヤー化。上位レベルのツールが下位のモードで公開されることはありません。セキュリティフラグ — 名前空間の許可リスト、保護名前空間、コンテキストの許可リストに加え、delete / apply / exec、dry-run、JSON 監査ログの各オプトイン(下記参照)。
標準認証 — 手元の kube-config(またはクラスタ内サービスアカウント)とさせていただきます。サーバー側で認証情報は保存せません。
Related MCP server: k8s-mcp-go
セキュリティモデル
項目 | フラグ | デフォルトの値 | 動作 |
そもそもサーバーに何を実行させるのか |
|
|
|
どの名前空間を対象にするのか |
| (すべて) | 設定すると、そのリストに含まれない名前空間でのすべての操作を拒否します。 |
どの名前空間を常に読み取り専用にするのか |
|
| モードの値に関係なく、読み取り専用で、変更や削除は一切できません。 |
どのクラスタに接続できるのか |
| (すべて) | 設定すると、指定された kubeconfig や ctx のみをターゲットにできます。 |
削除を許可するか |
|
|
|
マニフェストの適用を許可するか |
|
|
|
ポッド内での exec を許可するか |
|
|
|
クラスタに触れずにプレビューするか |
|
| 書き込み/管理ツールは意図を検証してログに保存し、API を呼び出さずに戻ります。 |
監査ログ |
|
| 保護対象の操作( |
これらはレイヤーとして独立しています。たとえば、admin モードなのに 3 つすべてのオプトインが false の場合、デプロイメントの再起動やスケーリングはできますが、リソースの削除も Pod への exec も行うことはできません。
ツール
読み取り(read-only以上): list_contexts、list_namespaces、list_pods、get_pod、get_pod_logs、list_deployments、list_services、list_nodes、list_events、get_resource
書き込み(read-write以上): scale_deployment、restart_deployment、set_deployment_image、create_namespace、apply_manifest(K8S_ALLOW_APPLY が必要)
管理(admin): delete_resource(K8S_ALLOW_DELETE が必要)、exec_in_pod(K8S_ALLOW_EXEC が必要)
MCP クライアントでの使用
Claude Code、Claude Desktop、Cursor、OpenAI Codex CLI、Windsurf、VS Code(Copilot)、その他の MCP クライアントで動作します。クライアントごとの設定方法については docs/CLIENTS.md をご覧ください。
インストール
npm install
npm run buildClaude Desktop / Claude Code で実行する
MCP クライアントの設定に以下を追加します:
{
"mcpServers": {
"kubernetes": {
"command": "node",
"args": ["/absolute/path/to/mcp-kubernetes/dist/index.js"],
"env": {
"KUBECONFIG_PATH": "/Users/you/.kube/config",
"K8S_MODE": "read-only",
"K8S_CONTEXT_ALLOWLIST": "staging",
"K8S_NAMESPACE_ALLOWLIST": "app,web"
}
}
}
}スケーリングや再起動を行う場合は K8S_MODE を read-write に、削除や exec を許可する場合のみ admin(および関連する K8S_ALLOW_* フラグ)に変更して設定します。
開発
npm run dev # watch mode
npm test # unit tests for the security policy
npm run typecheck公開
このサーバーは、公式 MCP レジストリ向けの server.json と、npm の所有権検証用の mcpName を同梱しています。npm への公開、MCP レジストリ・Smithery・Glama・Cursor・PulseMCP への掲載については PUBLISHING.md を参照してください。
ライセンス
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server that enables interaction with multiple Kubernetes clusters simultaneously, providing comprehensive tools for cluster management, resource operations, and diagnostics across different environments.
- AlicenseNot gradedqualityAmaintenanceSafe, 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.2MIT
- FlicenseNot gradedqualityDmaintenanceEnables Kubernetes cluster introspection via MCP tools, such as listing pods, namespaces, nodes, and events.4
- AlicenseNot gradedqualityCmaintenanceAn MCP server for generating Kubernetes manifests (deployments, services, configmaps, secrets, ingresses, namespaces) and performing kubectl operations like apply, delete, get, describe, logs, and exec.MIT
Related MCP Connectors
Managed Keycloak from any MCP client: clusters, realms, apps, SSO, users, domains, audit events.
Remote MCP for A2A caller identity, scope policy, verdict receipts, and audit history.
Remote MCP for Copilot CLI switch gate MCP, structured receipts, audit logs, and reviewer-ready evid
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/dockndevai/mcp-kubernetes'
If you have feedback or need assistance with the MCP directory API, please join our Discord server