kubeview-mcp
Read-only MCP server for AI-powered Kubernetes debugging with support of code execution
KubeView MCP β Kubernetes Model Context Protocol Server
KubeView is a read-only Model Context Protocol (MCP) server that enables AI agents (like Cursor IDE, Claude Code CLI, Codex CLI, Gemini CLI, etc.) to inspect, diagnose, and debug Kubernetes clusters safely. It provides a comprehensive set of tools for Kubernetes, Helm, Argo Workflows, and Argo CD. Learn more about the benefits of code mode and implementation in Evicting MCP tool calls from your Kubernetes cluster.
β¨ Features
- π§ Code Mode: Sandboxed TypeScript environment for complex reasoning and multi-step workflows.
- π‘οΈ Read-Only & Safe: Designed for production safety with zero write access and sensitive data masking.
- βΈοΈ Kubernetes Integration: List/get resources, fetch metrics, stream logs and events, execute commands, and tools to diagnose network issues.
- π¦ Helm Support (API-first): Inspect releases, values, manifests, and history via Kubernetes API first, with the CLI fallback.
- π Argo Ecosystem: Manage Argo Workflows and Argo CD applications using direct Kubernetes API or CLI.
MCP SDK Compatibility
- This project is pinned to
@modelcontextprotocol/sdk@^1.25.3. - Legacy loose type imports (
Tools,Prompts,Resources,Roots,Sampling) are disallowed. - This compatibility pass intentionally excludes Streamable HTTP transport migration and icon metadata rollout.
π Quick Start
Prerequisites
- Node.js β₯ 18
- Access to a Kubernetes cluster
- Optionally, CLIs installed in current $PATH:
helm(fallback only),argo,argocd
Installation
# start the server
npx -y kubeview-mcp
# install as a claude code mcp server
claude mcp add kubernetes -- npx kubeview-mcp
Configuration for MCP Clients
Add to your mcpServers configuration (e.g., in Cursor or Claude Desktop):
{
"mcpServers": {
"kubeview": {
"command": "npx",
"args": ["-y", "kubeview-mcp"]
}
}
}
Environment Variables
Configure the server using environment variables:
| Variable | Description | Default |
|---|---|---|
KUBECONFIG | Path to kubeconfig file | ~/.kube/config |
MCP_MODE | Server mode: all, code, or tools | all |
MCP_LOG_LEVEL | Log level (error, warn, info, debug) | info |
MCP_HIDE_SENSITIVE | Enable global sensitive data masking | false |
π οΈ Tools Overview
Kubernetes
kube_list: List resources or get cluster diagnostics.kube_get: Describe specific resources (supports all K8s types).kube_metrics: Fetch CPU/memory metrics for nodes and pods.kube_logs: Fetch or stream container logs.kube_exec: Execute commands in containers (read-only recommended).kube_port: Port-forward to pods/services.kube_net: Run in-cluster network diagnostics.
Helm
helm_list: List Helm releases (Kubernetes API first, CLI fallback).helm_get: Fetch release values, manifests, notes, hooks, resources, status, and history (Kubernetes API first, CLI fallback).
Helm Execution Strategy
- Helm tools are API-first by default and read Helm release metadata from Kubernetes storage backends (Secrets and ConfigMaps).
- Helm CLI is retained as a compatibility fallback path.
- In normal read-only scenarios with Kubernetes API access, Helm operations do not require the
helmbinary. - If Helm is configured with a non-Kubernetes storage backend (for example SQL), CLI fallback may be required.
- For
helm_get/helm_list, JSON/default behavior uses API first; non-JSON formatting may use CLI fallback.
Argo
argo_list/argo_get: Manage Argo Workflows.argocd_app: Inspect Argo CD applications and resources.
Utilities
run_code: Execute sandboxed TypeScript code for complex tasks.plan_step: Record step-by-step planning state for long, complex investigations.
Why plan_step really helps:
- Stable multi-step planning without bloating chat context.
Instead of dumping a massive plan into the conversation, the agent can store step-by-step progress in
plan_stepand keep user-facing responses clean. - A consistent state machine for long tasks.
Complex workflows usually need: plan -> execute step 1 -> verify -> step 2 -> backtrack -> branch -> finalize.
plan_stepgives the agent a structured way to follow that lifecycle without losing track. - Better tool routing.
Good agents alternate between thinking and acting.
plan_stepencourages that rhythm: log intent, call real tools, capture outcome, decide next step.
π§ Code Mode
Inspired by Code execution with MCP, KubeView ships with a code-mode runtime that allows agents to explore the API, search tools, and execute complex workflows in a sandboxed environment.
What it provides
- MCP Bridge Layer: Seamlessly connects to all registered MCP server tools.
- Dynamic TypeScript Definitions: Automatically converts tool schemas into a strongly-typed
global.d.tsresource, enabling agents to use valid TypeScript patterns and enjoy type safety without hallucinating parameters. - Tool Search Utilities: Runtime helpers like
tools.search()andtools.list()allow agents to progressively discover capabilities without needing to load the entire schema context upfront. - Sandboxed Execution: A locked-down Node.js environment (via
vm) with controlled access to theconsoleand thetoolsglobal object, ensuring safe execution of agent-generated code.
Usage
For complex tasks requiring logic, loops, or data processing, use Code Mode:
"env": { "MCP_MODE": "code" }
π‘ Pro Tip: code-mode MCP Prompt
The server includes a built-in MCP server prompt named code-mode that injects the full TypeScript API documentation, tool overview, and examples into the context.
In Cursor IDE:
Simply type /kubeview/code-mode in the prompt (or select it from the / prompt menu). This gives the AI the exact context it needs to write correct run_code scripts immediately.
π» Local Development
-
Clone & Install:
git clone https://github.com/mikhae1/kubeview-mcp.git cd kubeview-mcp npm install -
Build & Run:
npm run build npm start -
Test:
npm test
CLI Usage
You can test tools directly via the CLI:
npm run command -- kube_list --namespace=default
π License
MIT Β© mikhae1
Related Servers
Paddle Billing
Interact with the Paddle Billing API to manage products, prices, customers, transactions, and subscriptions.
Spotify MCP Node Server
Control Spotify playback and manage playlists using AI assistants and IDEs.
BNBChain MCP
Interact with BNB Chain and other EVM-compatible networks using natural language and AI assistance.
MCP Spotify AI Assistant
An AI assistant that controls Spotify features like playback, playlists, and search using the Model Context Protocol (MCP).
Weather Union
Provides weather data and air quality information using the Weather Union API.
FastlyMCP
Interact with the Fastly API and CLI using an API key.
Strava MCP
Integrate your Strava activity data with AI models using a local SQLite database.
VixMCP.Ai.Bridge
An MCP server that exposes VMware VIX operations for AI assistants and automation workflows.
KYC Verification
A server for comprehensive KYC verification using the SurePass API, supporting document verification, OCR, and face verification.
PayPal Account Updater Subscription Connector
Integrates with PayPal's Account Updater service to maintain fresh payment card information in e-commerce systems.