The mcp-server-kubernetes allows you to programmatically manage and interact with Kubernetes clusters. Key capabilities include:
Connect to a Kubernetes cluster
List resources such as pods, deployments, services, nodes, namespaces, cronjobs, and events
Describe detailed information about nodes, pods, services, and cronjobs
Create resources including pods (using templates like ubuntu, nginx, busybox, alpine), deployments (with configurable ports and replicas), namespaces, services, ConfigMaps, and cronjobs
Delete specific resources such as pods, services, ConfigMaps, and cronjobs
Update existing resources like deployment replicas, services, and ConfigMaps
Retrieve logs from pods, deployments, jobs, and using label selectors
Manage Helm v3 charts (install, uninstall, upgrade)
Support kubectl commands like
explainandapi-resourcesPerform port forwarding
Clean up all managed resources
Operate in non-destructive mode for read and create/update-only access
Docker support is in progress as mentioned in the 'In Progress' section
Support for Helm to install charts is listed as a planned feature
Allows connecting to a Kubernetes cluster to manage it, including listing, creating, deleting, and describing pods, services, deployments, and namespaces
MCP Server Kubernetes
MCP Server that can connect to a Kubernetes cluster and manage it. Supports loading kubeconfig from multiple sources in priority order.
https://github.com/user-attachments/assets/f25f8f4e-4d04-479b-9ae0-5dac452dd2ed
Installation & Usage
Prerequisites
Before using this MCP server with any tool, make sure you have:
kubectl installed and in your PATH
A valid kubeconfig file with contexts configured
Access to a Kubernetes cluster configured for kubectl (e.g. minikube, Rancher Desktop, GKE, etc.)
Helm v3 installed and in your PATH (no Tiller required). Optional if you don't plan to use Helm.
You can verify your connection by running kubectl get pods in a terminal to ensure you can connect to your cluster without credential issues.
By default, the server loads kubeconfig from ~/.kube/config. For additional authentication options (environment variables, custom paths, etc.), see ADVANCED_README.md.
Claude Code
Add the MCP server to Claude Code using the built-in command:
This will automatically configure the server in your Claude Code MCP settings.
Claude Desktop
Add the following configuration to your Claude Desktop config file:
Claude Desktop Connector via mcpb
MCP Server Kubernetes is also available as a mcpb (formerly dxt) extension. In Claude Desktop, go to Settings (Cmd+, on Mac) -> Extensions -> Browse Extensions and scroll to find mcp-server-kubernetes in the modal. Install it & it will install & utilize kubectl via command line & your kubeconfig.
To manually install, you can also get the .mcpb by going to the latest Release and downloading it.
VS Code
For VS Code integration, you can use the MCP server with extensions that support the Model Context Protocol:
Install a compatible MCP extension (such as Claude Dev or similar MCP clients)
Configure the extension to use this server:
Cursor
Cursor supports MCP servers through its AI integration. Add the server to your Cursor MCP configuration:
The server will automatically connect to your current kubectl context. You can verify the connection by asking the AI assistant to list your pods or create a test deployment.
Related MCP server: k8m
Usage with mcp-chat
mcp-chat is a CLI chat client for MCP servers. You can use it to interact with the Kubernetes server.
Alternatively, pass it your existing Claude Desktop configuration file from above (Linux should pass the correct path to config):
Mac:
Windows:
Gemini CLI
Gemini CLI allows you to install mcp servers as extensions. From a shell, install the extension by pointing to this repo:
Features
Connect to a Kubernetes cluster
Unified kubectl API for managing resources
Get or list resources with
kubectl_getDescribe resources with
kubectl_describeList resources with
kubectl_getCreate resources with
kubectl_createApply YAML manifests with
kubectl_applyDelete resources with
kubectl_deleteGet logs with
kubectl_logsManage kubectl contexts with
kubectl_contextExplain Kubernetes resources with
explain_resourceList API resources with
list_api_resourcesScale resources with
kubectl_scaleUpdate field(s) of a resource with
kubectl_patchManage deployment rollouts with
kubectl_rolloutExecute any kubectl command with
kubectl_genericVerify connection with
ping
Advanced operations
Scale deployments with
kubectl_scale(replaces legacyscale_deployment)Port forward to pods and services with
port_forwardRun Helm operations
Install, upgrade, and uninstall charts
Support for custom values, repositories, and versions
Template-based installation (
helm_template_apply) to bypass authentication issuesTemplate-based uninstallation (
helm_template_uninstall) to bypass authentication issues
Pod cleanup operations
Clean up problematic pods (
cleanup_pods) in states: Evicted, ContainerStatusUnknown, Completed, Error, ImagePullBackOff, CrashLoopBackOff
Node management operations
Cordoning, draining, and uncordoning nodes (
node_management) for maintenance and scaling operations
Troubleshooting Prompt (
k8s-diagnose)Guides through a systematic Kubernetes troubleshooting flow for pods based on a keyword and optional namespace.
Non-destructive mode for read and create/update-only access to clusters
Secrets masking for security (masks sensitive data in
kubectl get secretscommands, does not affect logs)
Prompts
The MCP Kubernetes server includes specialized prompts to assist with common diagnostic operations.
/k8s-diagnose Prompt
This prompt provides a systematic troubleshooting flow for Kubernetes pods. It accepts a keyword to identify relevant pods and an optional namespace to narrow the search.
The prompt's output will guide you through an autonomous troubleshooting flow, providing instructions for identifying issues, collecting evidence, and suggesting remediation steps.
Local Development
Make sure that you have bun installed. Clone the repo & install dependencies:
Development Workflow
Start the server in development mode (watches for file changes):
Run unit tests:
Build the project:
Local Testing with Inspector
Local testing with Claude Desktop
Local testing with mcp-chat
Contributing
See the CONTRIBUTING.md file for details.
Advanced
Non-Destructive Mode
You can run the server in a non-destructive mode that disables all destructive operations (delete pods, delete deployments, delete namespaces, etc.):
For Claude Desktop configuration with non-destructive mode:
Commands Available in Non-Destructive Mode
All read-only and resource creation/update operations remain available:
Resource Information:
kubectl_get,kubectl_describe,kubectl_logs,explain_resource,list_api_resourcesResource Creation/Modification:
kubectl_apply,kubectl_create,kubectl_scale,kubectl_patch,kubectl_rolloutHelm Operations:
install_helm_chart,upgrade_helm_chart,helm_template_apply,helm_template_uninstallConnectivity:
port_forward,stop_port_forwardContext Management:
kubectl_context
Commands Disabled in Non-Destructive Mode
The following destructive operations are disabled:
kubectl_delete: Deleting any Kubernetes resourcesuninstall_helm_chart: Uninstalling Helm chartscleanup: Cleanup of managed resourcescleanup_pods: Cleaning up problematic podsnode_management: Node management operations (can drain nodes)kubectl_generic: General kubectl command access (may include destructive operations)
For additional advanced features, see the ADVANCED_README.md and also the docs folder for specific information on helm_install, helm_template_apply, node management & pod cleanup.
Architecture
See this DeepWiki link for a more indepth architecture overview created by Devin.
This section describes the high-level architecture of the MCP Kubernetes server.
Request Flow
The sequence diagram below illustrates how requests flow through the system:
See this DeepWiki link for a more indepth architecture overview created by Devin.
Publishing new release
Go to the releases page, click on "Draft New Release", click "Choose a tag" and create a new tag by typing out a new version number using "v{major}.{minor}.{patch}" semver format. Then, write a release title "Release v{major}.{minor}.{patch}" and description / changelog if necessary and click "Publish Release".
This will create a new tag which will trigger a new release build via the cd.yml workflow. Once successful, the new release will be published to npm. Note that there is no need to update the package.json version manually, as the workflow will automatically update the version number in the package.json file & push a commit to main.
Not planned
Adding clusters to kubectx.
Star History
🖊️ Cite
If you find this repo useful, please cite: