Back to MCP Catalog

Kubernetes MCP Server

Cloud PlatformsGo
Connect to and manage Kubernetes clusters through natural language
Available Tools

listContexts

List available Kubernetes contexts from kubeconfig

listNamespaces

List namespaces in the Kubernetes cluster

context

listResources

List Kubernetes resources of a specific type

contextnamespaceresourceType

getResource

Get details of a specific Kubernetes resource

contextnamespaceresourceTyperesourceName

listNodes

List nodes in the Kubernetes cluster

context

listPods

List pods in a namespace

contextnamespace

getEvents

Get Kubernetes events

contextnamespaceresourceTyperesourceName

getPodLogs

Get logs from a Kubernetes pod

contextnamespacepodNamecontainerNametailLinesprevious

runCommandInPod

Run a command in a Kubernetes pod

contextnamespacepodNamecontainerNamecommand

Kubernetes MCP is a Model Context Protocol server that provides AI assistants with the ability to interact with Kubernetes clusters. It enables models to list and manage resources, check pod logs, run commands in pods, and navigate between different Kubernetes contexts and namespaces. Built in Go for performance and reliability, this tool bridges the gap between natural language interfaces and Kubernetes operations, making cluster management more accessible through conversational AI. It supports a wide range of Kubernetes resources and operations, allowing AI assistants to help with cluster monitoring, troubleshooting, and management tasks.

Overview

Kubernetes MCP provides a bridge between AI assistants and Kubernetes clusters, allowing natural language interaction with your Kubernetes resources. This tool enables AI models to help you manage, monitor, and troubleshoot your Kubernetes environments through conversation.

Installation

Using NPM

The simplest way to install Kubernetes MCP is through NPM:

npm install -g @strowk/mcp-k8s

Using the Go binary

You can also download the pre-built binary from the GitHub releases page.

Running with Docker

docker run -v ~/.kube:/home/nonroot/.kube strowk/mcp-k8s-go

Configuration

Kubernetes MCP uses your existing kubeconfig file to connect to clusters. By default, it will use the configuration at ~/.kube/config.

Context Allowlist

For security reasons, you may want to restrict which Kubernetes contexts the MCP can access. You can specify an allowlist using the --context-allowlist flag:

mcp-k8s-go --context-allowlist=context1,context2

Usage

Once installed and configured, you can use Kubernetes MCP with compatible AI assistants like Claude. The MCP provides several capabilities:

  1. Context Management: List and switch between Kubernetes contexts
  2. Namespace Navigation: List and select namespaces within a cluster
  3. Resource Management: List, get, and interact with Kubernetes resources
  4. Pod Operations: View pod logs and execute commands in pods
  5. Event Monitoring: Retrieve Kubernetes events for troubleshooting

Using with Claude

To use with Claude Desktop or other Claude interfaces, you'll need to configure the MCP server in your Claude settings. See the Claude documentation for detailed instructions.

Using with Inspector

For testing or demonstration purposes, you can run the MCP with Inspector:

npx @modelcontextprotocol/inspector npx @strowk/mcp-k8s

Security Considerations

When using Kubernetes MCP:

  1. Consider using the context allowlist to restrict access to specific clusters
  2. Be aware that the AI assistant will have the same permissions as your kubeconfig
  3. For production environments, create a dedicated service account with appropriate RBAC permissions

Troubleshooting

If you encounter issues:

  1. Verify your kubeconfig is correctly set up and accessible
  2. Check that you have appropriate permissions for the operations you're attempting
  3. Examine the MCP server logs for error messages
  4. For more help, open an issue on the GitHub repository

Related MCPs

AWS CLI
Cloud PlatformsPython

Execute AWS CLI commands securely through AI assistants

Cloudflare
Cloud PlatformsTypeScript

A Model Context Protocol server for Cloudflare services

Kubernetes Management
Cloud PlatformsTypeScript

Manage Kubernetes clusters directly from your AI assistant

About Model Context Protocol

Model Context Protocol (MCP) allows AI models to access external tools and services, extending their capabilities beyond their training data.

Generate Cursor Documentation

Save time on coding by generating custom documentation and prompts for Cursor IDE.