Kubernetes MCP

v0.6.1Cloud Servicesstable

This project is intended as a both MCP server connecting to Kubernetes and a library to build more servers for any custom resources in Kubernetes.

kubernetesmcpserverMCP
Share:
382
Stars
0
Downloads
0
Weekly
0/5

What is Kubernetes MCP?

Kubernetes MCP is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to this project is intended as a both mcp server connecting to kubernetes and a library to build more servers for any custom resources in kubernetes.

This project is intended as a both MCP server connecting to Kubernetes and a library to build more servers for any custom resources in Kubernetes.

This server falls under the Cloud Services category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • This project is intended as a both MCP server connecting to

Use Cases

Kubernetes management
Custom resource support
Go-based MCP server
strowk

Maintainer

LicenseMIT License
Languagego
Versionv0.6.1
UpdatedMay 18, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

NPM

npx -y @strowk/mcp-k8s

Manual Installation

npx -y @strowk/mcp-k8s

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Kubernetes MCP

mcp-k8s-go is a Model Context Protocol server written in Go that connects AI assistants directly to your Kubernetes clusters. It lets you list contexts, namespaces, nodes, pods, and events, retrieve pod logs, execute commands inside containers, and create or modify any Kubernetes resource — all from natural language. It also serves as a library for building custom MCP servers that expose your own Kubernetes CRDs.

Prerequisites

  • Node.js 18+ (for npx installation) or Go 1.21+ (for source builds) or Docker
  • A valid kubeconfig file (typically at ~/.kube/config) with access to target clusters
  • kubectl context configured for the clusters you want to manage
  • An MCP-compatible client such as Claude Desktop or Claude Code
1

Verify kubeconfig access

Ensure your kubeconfig is in place and you can reach your cluster. The server reads ~/.kube/config by default; set KUBECONFIG if yours is elsewhere.

kubectl config get-contexts
2

Choose an installation method

The easiest approach is via npm/npx. Alternatively install globally with npm, run via Docker, or build from source with Go.

# Recommended: run directly with npx
npx -y @strowk/mcp-k8s

# Or install globally
npm install -g @strowk/mcp-k8s

# Docker (mounts your kubeconfig read-only)
docker run -i -v ~/.kube/config:/home/nonroot/.kube/config --rm mcpk8s/server:latest

# Build from source
go install github.com/strowk/mcp-k8s-go@latest
3

Add the server to your MCP client configuration

Open your Claude Desktop config file and add the mcp-k8s entry. Use the --allowed-contexts flag to restrict which clusters are visible, and --readonly to prevent write operations.

4

Configure environment and safety flags

Set KUBECONFIG if your config is not at the default path. Pass --allowed-contexts to whitelist specific contexts, and --readonly to make all operations read-only. Secrets are masked by default.

# Example with safety flags
npx -y @strowk/mcp-k8s --allowed-contexts=staging,dev --readonly
5

Restart your MCP client and verify the connection

Restart Claude Desktop (or reload your MCP client). Ask it to list your Kubernetes contexts to confirm the server is connected and responding.

Kubernetes MCP Examples

Client configuration

Add this block to your claude_desktop_config.json. Adjust KUBECONFIG and flags as needed.

{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
      "args": ["-y", "@strowk/mcp-k8s", "--allowed-contexts=production,staging", "--mask-secrets"],
      "env": {
        "KUBECONFIG": "/Users/yourname/.kube/config"
      }
    }
  }
}

Prompts to try

Sample prompts once the server is connected to your MCP client.

- "List all Kubernetes contexts available in my kubeconfig"
- "Show me all pods in the production namespace that are not in Running state"
- "Get the last 100 lines of logs from the api-gateway pod in the default namespace"
- "List all nodes in the cluster and their resource capacity"
- "Show recent events in the staging namespace"
- "Create a ConfigMap named app-config in the default namespace with key LOG_LEVEL=debug"

Troubleshooting Kubernetes MCP

Server starts but cannot find any clusters or contexts

Check that your KUBECONFIG environment variable points to the correct file, or that ~/.kube/config exists and contains valid context entries. Run `kubectl config get-contexts` in a terminal to verify.

Permission denied errors when trying to list or modify resources

The server uses the permissions of your current kubeconfig context. Ensure the service account or user in that context has the required RBAC roles. Remove --readonly if you need write access.

Secrets are showing as masked or redacted

By default --mask-secrets is enabled. If you need to inspect actual secret values, pass --mask-secrets=false explicitly, but treat the output as sensitive.

Frequently Asked Questions about Kubernetes MCP

What is Kubernetes MCP?

Kubernetes MCP is a Model Context Protocol (MCP) server that this project is intended as a both mcp server connecting to kubernetes and a library to build more servers for any custom resources in kubernetes. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Kubernetes MCP?

Install via npm with the command: npx -y @strowk/mcp-k8s. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).

Which AI clients work with Kubernetes MCP?

Kubernetes MCP works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Kubernetes MCP free to use?

Yes, Kubernetes MCP is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.

Browse More Cloud Services MCP Servers

Explore all cloud services servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "mcp-k8s-go": { "command": "npx", "args": ["-y", "@strowk/mcp-k8s"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Kubernetes MCP?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides