# mcp-kubernetes [Health: Active]

**Category:** ☁️ Cloud Platforms  
**Repository:** https://github.com/dockndevai/mcp-kubernetes  
**GitHub Stars:** 3  
**npm Downloads (last month):** 778  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mcp-kubernetes

## Description
Kubernetes monitoring & ops for AI agents — safe-by-default access modes and guards.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "mcp-kubernetes": {
    "command": "npx",
    "args": ["-y","@dockndevai/mcp-kubernetes"]
  }
}
```

## Documentation

## What mcp-kubernetes does

The mcp-kubernetes MCP server connects an MCP-capable client to Kubernetes clusters and exposes tools for cluster inspection and operations. Each tool can target an optional kubeconfig context, allowing one server process to work with multiple clusters when those contexts are permitted.

The default access level is read-only. In this mode, an agent can inspect contexts, namespaces, pods, deployments, services, nodes, events, and individual resources. It can also retrieve pod details and logs. Higher access modes add selected operational tools rather than exposing every capability at once.

This arrangement suits teams that want an agent to investigate cluster state without granting it unrestricted mutation rights. It can also support controlled operational workflows where write or administrative actions are enabled deliberately.

## How it works

The mcp-kubernetes MCP server runs as an npm package through `npx`, using the standard MCP process connection expected by configured clients. Authentication comes from the local kubeconfig or an in-cluster service account; the server does not store credentials.

Access is layered through `K8S_MODE`:

- `read-only` registers read tools only.
- `read-write` adds deployment scaling, restarts, image changes, namespace creation, and permitted manifest application.
- `admin` adds the destructive and pod-execution tools, subject to their separate gates.

Namespace and context allowlists restrict where operations may run. The default protected namespaces—`kube-system`, `kube-public`, and `kube-node-lease`—remain readable but cannot be changed or deleted. Delete, apply, and exec each have independent opt-ins, so enabling admin mode alone does not enable those actions.

Write and administrative operations can run in dry-run mode. Guarded activity is emitted as JSON lines to stderr, including allowed, denied, or dry-run outcomes. Destructive and high-impact actions request human approval through MCP elicitation when the client supports it. An optional local laya-guard daemon can further classify apply, delete, and exec requests; it can restrict actions but cannot grant access.

## Setup and configuration

The published package is `@dockndevai/mcp-kubernetes`. Configure an MCP client to run `npx -y @dockndevai/mcp-kubernetes` and provide the relevant environment settings. The README gives configurations for Claude Desktop, Claude Code, Cursor, Windsurf, OpenAI Codex CLI, and VS Code. A typical starting configuration sets `KUBECONFIG_PATH` and `K8S_MODE=read-only`.

For source-based development, install dependencies, build the project, and run `node dist/index.js`. The repository also provides development, test, and type-check scripts.

## Tools and capabilities

Read tools include context and namespace listing, pod listing and details, pod logs, deployment and service listing, node and event listing, and generic resource retrieval.

Write tools include deployment scaling, deployment restarts, image updates, namespace creation, and manifest application. Applying a manifest additionally requires `K8S_ALLOW_APPLY`.

Administrative tools include resource deletion and execution inside a pod. They require admin mode plus `K8S_ALLOW_DELETE` or `K8S_ALLOW_EXEC`, respectively. The server also supports namespace and context scoping, dry-run behavior, JSON audit logging, and optional laya-guard checks.

## Limitations and notes

The server does not provide its own credential store or authentication system; access depends on the kubeconfig or in-cluster service account available to the process. All namespaces and contexts are reachable by default unless allowlists are configured, so deployments should set those restrictions when a narrower scope is required.

Operational permissions are intentionally split across mode settings and action-specific flags. Clients without MCP elicitation use the corresponding allow gates instead of interactive approval. The optional laya-guard integration requires a separately running local daemon and only tightens decisions; it does not bypass the server’s existing permissions.

_Full upstream README: https://allmcps.com/mcp/mcp-kubernetes/readme_

