kubeview-mcp

Read-only MCP server for AI-powered Kubernetes debugging with support of code execution

KubeView MCP – Kubernetes Model Context Protocol Server

npm version License: MIT Node.js Version TypeScript

KubeView is a read-only Model Context Protocol (MCP) server that lets AI agents (Cursor, Claude Code, Codex CLI, Gemini CLI, etc.) safely inspect, diagnose, and debug Kubernetes clusters. It covers Kubernetes core, Helm, Argo Workflows, and Argo CD.

Read more: Evicting MCP tool calls from your Kubernetes cluster


✨ Features

  • 🧠 Code Mode – Sandboxed TypeScript runtime for complex reasoning and multi-step workflows.
  • πŸ›‘οΈ Read-Only & Safe – Zero write access; sensitive data masking for production clusters.
  • ☸️ Kubernetes – List/get resources, fetch metrics, stream logs and events, exec into containers, diagnose network issues.
  • πŸ“¦ Helm (API-first) – Inspect releases, values, manifests, and history via the Kubernetes API with CLI fallback.
  • πŸ™ Argo Ecosystem – Manage Argo Workflows and Argo CD via the Kubernetes API or CLI.

πŸš€ Quick Start

Prerequisites

  • Node.js β‰₯ 18
  • Access to a Kubernetes cluster
  • Optional CLIs in $PATH: helm (fallback only), argo, argocd

Installation

# Run the server directly
npx -y kubeview-mcp

# Add to Claude Code
claude mcp add kubernetes -- npx kubeview-mcp

MCP Client Configuration

Add to your mcpServers config (Cursor, Claude Desktop, etc.):

{
  "mcpServers": {
    "kubeview": {
      "command": "npx",
      "args": ["-y", "kubeview-mcp"]
    }
  }
}

Environment Variables

VariableDescriptionDefault
KUBECONFIGPath to kubeconfig file~/.kube/config
MCP_MODEServer mode: all, code, or toolsall
MCP_LOG_LEVELLog level: error, warn, info, debuginfo
MCP_HIDE_SENSITIVEMask sensitive data globallyfalse

πŸ› οΈ Tools

Kubernetes

ToolDescription
kube_listList resources or get cluster diagnostics
kube_getDescribe a specific resource (all K8s types supported)
kube_metricsFetch CPU/memory metrics for nodes and pods
kube_logsFetch or stream container logs
kube_execExecute commands inside containers
kube_portPort-forward to pods or services
kube_netRun in-cluster network diagnostics

Helm

ToolDescription
helm_listList Helm releases (Kubernetes API first, CLI fallback)
helm_getFetch release values, manifests, notes, hooks, status, history

Helm execution strategy: Tools read Helm metadata directly from Kubernetes storage (Secrets / ConfigMaps) by default β€” no helm binary needed for standard read-only use. CLI fallback is used for non-JSON formatting or non-Kubernetes storage backends (e.g. SQL).

Argo

ToolDescription
argo_listList Argo Workflows
argo_getInspect a specific Argo Workflow
argocd_appInspect Argo CD applications

Utilities

ToolDescription
run_codeExecute sandboxed TypeScript for complex tasks
plan_stepPersist step-by-step planning state across long investigations

Why plan_step? It keeps the chat context clean by storing progress externally, gives agents a structured state machine (plan β†’ execute β†’ verify β†’ branch), and encourages the think-then-act rhythm that produces better results on complex workflows.


🧠 Code Mode

Inspired by Code execution with MCP, KubeView ships a sandboxed code runtime for agents to explore the API and run complex workflows.

  • MCP Bridge – All registered MCP tools are callable from within run_code.
  • Dynamic TypeScript Definitions – Tool schemas are auto-converted to a typed global.d.ts, preventing hallucinated parameters.
  • Tool Discovery – tools.search() and tools.list() let agents find capabilities at runtime without loading the full schema.
  • Sandboxed Execution – Locked-down Node.js vm environment with access only to console and the tools global.

Enable code-only mode:

"env": { "MCP_MODE": "code" }

Built-in code-mode Prompt

The server includes a code-mode MCP prompt that injects full TypeScript API docs and examples into the agent context. In Cursor, type /kubeview/code-mode in the prompt bar to activate it.


πŸ’» Local Development

# Clone and install
git clone https://github.com/mikhae1/kubeview-mcp.git
cd kubeview-mcp
npm install

# Build and run
npm run build
npm start

# Test
npm test

# Run a tool directly via CLI
npm run command -- kube_list --namespace=default

πŸ“„ License

MIT Β© mikhae1

Related Servers