Skip to main content
Glama
README.md
# Kube MCP

[![npm version](https://img.shields.io/npm/v/@icy-r/kube-mcp.svg)](https://www.npmjs.com/package/@icy-r/kube-mcp)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server for Kubernetes cluster management. Enables AI assistants to interact with Kubernetes resources.

## Quick Start

```bash
npx @icy-r/kube-mcp
```

## MCP Configuration

Add to your MCP client (Claude Desktop, Cursor, etc.):

```json
{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
      "args": ["-y", "@icy-r/kube-mcp"],
      "env": {
        "KUBEMCP_DEFAULT_NAMESPACE": "default"
      }
    }
  }
}
```

**Custom kubeconfig:**

```json
{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
      "args": ["-y", "@icy-r/kube-mcp"],
      "env": {
        "KUBEMCP_CONFIG_SOURCE": "custom",
        "KUBEMCP_KUBECONFIG_PATH": "/path/to/kubeconfig"
      }
    }
  }
}
```

## Environment Variables

| Variable | Description | Default |
|----------|-------------|---------|
| `KUBEMCP_CONFIG_SOURCE` | `local` or `custom` | `local` |
| `KUBEMCP_KUBECONFIG_PATH` | Custom kubeconfig path | - |
| `KUBEMCP_DEFAULT_NAMESPACE` | Default namespace | `default` |
| `KUBEMCP_RESPONSE_FORMAT` | `json`, `toon`, `auto` | `auto` |

## Tools

| Tool | Actions |
|------|---------|
| `k8s_deployments` | list, get, scale, restart, get_status, get_metrics |
| `k8s_pods` | list, get, delete, get_logs, summarize_logs, get_status |
| `k8s_services` | list, get, get_endpoints |
| `k8s_configmaps` | list, get, create, update, delete |
| `k8s_secrets` | list, get, create, update, delete |
| `k8s_namespaces` | list, get, create, delete |
| `k8s_metrics` | get_pod_metrics, get_node_metrics |
| `k8s_events` | list, get_resource_events, get_recent_events |
| `k8s_audit` | get_config, configure, get_session_log, clear_session_log |

## Safety Features

Destructive actions require explicit confirmation:

```json
{ "action": "delete", "name": "my-pod", "confirm": true }
```

Preview changes with dry-run:

```json
{ "action": "scale", "name": "my-deployment", "replicas": 5, "dryRun": true }
```

## Development

```bash
git clone https://github.com/icy-r/kubemcp.git
cd kubemcp
pnpm install
pnpm build
pnpm test
```

## License

MIT

TDQS

A3.7/5.0

Scored across 9 tools

Disambiguation5/5

Each tool targets a distinct Kubernetes resource type (e.g., configmaps, deployments, pods) with clear boundaries. The actions within each tool are well-defined for that resource, preventing overlap or confusion between tools. An agent can easily distinguish between managing pods versus deployments versus services.

Naming Consistency5/5

All tool names follow a consistent 'k8s_' prefix with the resource name (e.g., k8s_configmaps, k8s_deployments). Actions within tools use consistent verbs like list, get, create, update, delete. This predictable pattern enhances readability and usability across the entire set.

Tool Count5/5

With 9 tools covering core Kubernetes resources (configmaps, deployments, events, metrics, namespaces, pods, secrets, services, plus audit), this is well-scoped for a Kubernetes management server. Each tool serves a distinct purpose, and the count aligns with typical MCP server ranges (3-15 tools).

Completeness4/5

The tool set provides comprehensive CRUD/lifecycle coverage for key Kubernetes resources, including audit features. Minor gaps exist, such as no update/delete for services or events, but core operations are covered. Agents can handle most Kubernetes management tasks without dead ends.

Maintenance

ActivityInactive
ResponsivenessNo issues