{"id":227,"date":"2025-07-15T13:05:47","date_gmt":"2025-07-15T13:05:47","guid":{"rendered":"https:\/\/cloudberry360.com\/blog\/?p=227"},"modified":"2025-07-16T06:22:13","modified_gmt":"2025-07-16T06:22:13","slug":"kubernetes-mcp-server","status":"publish","type":"post","link":"https:\/\/cloudberry360.com\/blog\/kubernetes-mcp-server\/","title":{"rendered":"Kubernetes MCP Server"},"content":{"rendered":"\n<p class=\"has-text-align-left has-medium-font-size\">Kubernetes (K8s) is like the operating system for modern cloud applications. But, even experienced engineers find themselves wrestling with YAML files, complex deployments, and cluster management headaches.<br><br>Enter the Kubernetes MCP Server (K8s MCP) &#8211; a smart, AI-friendly bridge that enables tools and agents to securely interact with your Kubernetes cluster.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"412\" height=\"275\" src=\"https:\/\/cloudberry360.com\/blog\/wp-content\/uploads\/2025\/07\/kubernets-with-ai-resized.png\" alt=\"\" class=\"wp-image-230\" style=\"aspect-ratio:1.3333333333333333;object-fit:cover;width:412px;height:auto\" srcset=\"https:\/\/cloudberry360.com\/blog\/wp-content\/uploads\/2025\/07\/kubernets-with-ai-resized.png 412w, https:\/\/cloudberry360.com\/blog\/wp-content\/uploads\/2025\/07\/kubernets-with-ai-resized-300x200.png 300w\" sizes=\"auto, (max-width: 412px) 100vw, 412px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list has-medium-font-size\">\n<li class=\"has-large-font-size\"><strong>What Is the Kubernetes MCP Server?<\/strong><\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-align-left\">The K8s MCP Server is a lightweight service that uses the <strong>Model Context Protocol (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Model_Context_Protocol\" data-type=\"link\" data-id=\"https:\/\/en.wikipedia.org\/wiki\/Model_Context_Protocol\">MCP<\/a>)<\/strong> to expose Kubernetes operations to AI tools in a safe and auditable way.<\/p>\n\n\n\n<p>Think of it as:<\/p>\n\n\n\n<p>&#8211; A translator between your AI assistants and your Kubernetes cluster.<\/p>\n\n\n\n<p>&#8211; A secure API layer for querying, inspecting, and executing Kubernetes commands.<\/p>\n\n\n\n<p>&#8211; A way to let AI-powered IDEs or agents manage K8s, with access control and logging.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-large-font-size\"><strong>Prerequisites Before You Begin<\/strong><\/li>\n<\/ul>\n\n\n\n<p>Before installing the K8s MCP Server, make sure you have:<\/p>\n\n\n\n<p>&#8211; A Kubernetes cluster (Minikube, EKS, GKE, etc.)<\/p>\n\n\n\n<p>&#8211; kubectl installed and configured<\/p>\n\n\n\n<p>&#8211; Node.js + Bun installed (<a href=\"https:\/\/bun.sh\/\">https:\/\/bun.sh\/<\/a>)<\/p>\n\n\n\n<p>&#8211; (Optional) Helm v3 if you&#8217;re using Helm charts<\/p>\n\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list has-medium-font-size\">\n<li class=\"has-large-font-size\"><strong>How to Set Up the K8s MCP Server<\/strong><\/li>\n<\/ul>\n\n\n\n<p><strong>1. Clone the Repository:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<p>git clone https:\/\/github.com\/Flux159\/mcp-server-kubernetes.git<\/p>\n\n\n\n<p>cd mcp-server-kubernetes<\/p>\n\n\n\n<p><strong>2. Install Dependencies:<\/strong><\/p>\n\n\n\n<p><strong><code>bun install<\/code><\/strong><\/p>\n\n\n\n<p><strong>3. Build the Server:<\/strong><\/p>\n\n\n\n<p><strong><code>bun run build &amp;&amp; bun start<\/code><\/strong><\/p>\n\n\n\n<p><strong>4. Local Testing with <a href=\"https:\/\/github.com\/modelcontextprotocol\/inspector\">Model Context Protocol Inspector<\/a><\/strong><\/p>\n\n\n\n<p><code>npx @modelcontextprotocol\/inspector node dist\/index.js<\/code><br><br>Follow further instructions on terminal for Inspector link<br><br>The MCP Server connects to your current kubectl context. Ensure you&#8217;re connected to the correct cluster.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-large-font-size\"><strong>Testing the Kubernetes MCP  Server with Claude Desktop<\/strong><\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<p>Make sure that you have Claude installed on your machine. <br><br><strong>1. Locate Claude Desktop Configuration:<\/strong><\/p>\n\n\n\n<p id=\"0062\">Find the \u201cclaude_desktop_config.json\u201d file in Claude Desktop\u2019s settings (usually found in a Developer or Advanced section).<\/p>\n\n\n\n<p><strong>2. Add the Model Context Protocol Server Configuration:<\/strong><\/p>\n\n\n\n<p id=\"e9e9\">Add a new entry to the mcp servers section of the \u201cclaude_desktop_config.json\u201d file:<\/p>\n\n\n\n<p><code>{<br>\"mcpServers\": {<br>\"mcp-server-kubernetes\": {<br>\"command\": \"node\",<br>\"args\": [\"\/path\/to\/your\/mcp-server-kubernetes\/dist\/index.js\"]<br>}<br>}<br>}<\/code><\/p>\n\n\n\n<p>Replace \u201c\/path\/to\/your\/mcp-server-kubernetes\/dist\/index.js\u201d with the&nbsp;<em>actual<\/em>&nbsp;absolute path to the \u201cdist\/index.js\u201d file in your cloned repository.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>3.&nbsp;Test with Claude Desktop:<\/strong><\/p>\n\n\n\n<p id=\"c158\">Once you have done with the above configurations, restart Claude Desktop. Now, you should be able to interact with your&nbsp;<strong>Kubernetes<\/strong>&nbsp;cluster through Claude using natural language commands. <\/p>\n\n\n\n<p id=\"c158\">Start by asking Claude to list your pods or create a test deployment to see if the connection to the server works. <\/p>\n\n\n\n<p><strong>a) Ask to list the pods in the default namespace: <\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"600\" src=\"https:\/\/cloudberry360.com\/blog\/wp-content\/uploads\/2025\/07\/list-pods-default-namespace-1.png\" alt=\"\" class=\"wp-image-289\" srcset=\"https:\/\/cloudberry360.com\/blog\/wp-content\/uploads\/2025\/07\/list-pods-default-namespace-1.png 900w, https:\/\/cloudberry360.com\/blog\/wp-content\/uploads\/2025\/07\/list-pods-default-namespace-1-300x200.png 300w, https:\/\/cloudberry360.com\/blog\/wp-content\/uploads\/2025\/07\/list-pods-default-namespace-1-768x512.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/figure>\n\n\n\n<p><strong>b) Create a test pod: <\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"948\" height=\"472\" src=\"https:\/\/cloudberry360.com\/blog\/wp-content\/uploads\/2025\/07\/create-pod.png\" alt=\"\" class=\"wp-image-233\" srcset=\"https:\/\/cloudberry360.com\/blog\/wp-content\/uploads\/2025\/07\/create-pod.png 948w, https:\/\/cloudberry360.com\/blog\/wp-content\/uploads\/2025\/07\/create-pod-300x149.png 300w, https:\/\/cloudberry360.com\/blog\/wp-content\/uploads\/2025\/07\/create-pod-768x382.png 768w\" sizes=\"auto, (max-width: 948px) 100vw, 948px\" \/><\/figure>\n\n\n\n<p><strong>c) Delete the newly created pod: <\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"952\" height=\"407\" src=\"https:\/\/cloudberry360.com\/blog\/wp-content\/uploads\/2025\/07\/delete-pod.png\" alt=\"\" class=\"wp-image-235\" srcset=\"https:\/\/cloudberry360.com\/blog\/wp-content\/uploads\/2025\/07\/delete-pod.png 952w, https:\/\/cloudberry360.com\/blog\/wp-content\/uploads\/2025\/07\/delete-pod-300x128.png 300w, https:\/\/cloudberry360.com\/blog\/wp-content\/uploads\/2025\/07\/delete-pod-768x328.png 768w\" sizes=\"auto, (max-width: 952px) 100vw, 952px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-large-font-size\"><strong>Keep Security in Mind<\/strong><\/li>\n<\/ul>\n\n\n\n<p>Grant least privilege access to AI agents.<\/p>\n\n\n\n<p>Enable HTTPS\/TLS encryption for all communication.<\/p>\n\n\n\n<p>Enable audit logging for all MCP and Kubernetes operations.<\/p>\n\n\n\n<p>Use command whitelisting or rule-based validation before executing any AI-suggested commands.<\/p>\n\n\n\n<p>Manually approve sensitive actions like deleting namespaces or scaling to zero.<\/p>\n\n\n\n<p>Ensure the kubeconfig file used by MCP is readonly or Scoped to a low-privilege user.<\/p>\n\n\n\n<p>Never give AI agents <code>cluster-admin<\/code> access.<\/p>\n\n\n\n<p>Use Kubernetes NetworkPolicies to limit which pods\/services can talk to the MCP server.<\/p>\n\n\n\n<p>Keep all software used by MCP (Node.js, Bun, libraries) up-to-date.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kubernetes (K8s) is like the operating system for modern cloud applications. But, even experienced engineers find themselves wrestling with YAML files, complex deployments, and cluster management headaches. Enter the Kubernetes MCP Server (K8s MCP) &#8211; a smart, AI-friendly bridge that enables tools and agents to securely interact with your Kubernetes cluster. The K8s MCP Server is a lightweight service that uses the Model Context Protocol (MCP) to expose Kubernetes operations to AI tools in a safe and auditable way. Think&#8230;<\/p>\n","protected":false},"author":1,"featured_media":287,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28,16],"tags":[32,31],"class_list":["post-227","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-agents","category-kubernetes","tag-ai-agents","tag-kubernetes"],"acf":[],"_links":{"self":[{"href":"https:\/\/cloudberry360.com\/blog\/wp-json\/wp\/v2\/posts\/227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudberry360.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudberry360.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudberry360.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudberry360.com\/blog\/wp-json\/wp\/v2\/comments?post=227"}],"version-history":[{"count":35,"href":"https:\/\/cloudberry360.com\/blog\/wp-json\/wp\/v2\/posts\/227\/revisions"}],"predecessor-version":[{"id":290,"href":"https:\/\/cloudberry360.com\/blog\/wp-json\/wp\/v2\/posts\/227\/revisions\/290"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudberry360.com\/blog\/wp-json\/wp\/v2\/media\/287"}],"wp:attachment":[{"href":"https:\/\/cloudberry360.com\/blog\/wp-json\/wp\/v2\/media?parent=227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudberry360.com\/blog\/wp-json\/wp\/v2\/categories?post=227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudberry360.com\/blog\/wp-json\/wp\/v2\/tags?post=227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}