K8s MCP Server logo

K8s MCP Server

by reza-gholizade

Connects AI agents to Kubernetes for resource inspection, logs, metrics, events, and controlled cluster changes.

Install K8s MCP Server

Run the project’s own setup commands, in order.

Setup steps from the project

reza-gholizade/k8s-mcp-server installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Install
    git clone https://github.com/reza-gholizade/k8s-mcp-server.git
    
  2. 2. Install
    cd k8s-mcp-server
    
  3. 3. Install
    go mod download
    
  4. 4. Install
    go build -o k8s-mcp-server .
    
  5. 5. Start the server
    ./k8s-mcp-server --mode stdio
    
  6. 6. Start the server
    SERVER_MODE=stdio ./k8s-mcp-server
    

Overview

reza-gholizade/k8s-mcp-server exposes Kubernetes cluster operations through MCP, including resource discovery, listing, inspection, logs, metrics, events, and manifest-based changes. It connects through kubeconfig, direct API credentials, or an in-cluster service account, then runs over stdio, SSE, or streamable HTTP. Use it when an agent needs to investigate or manage Kubernetes resources through a standardized tool interface. Read-only mode can disable cluster-changing operations.

Use cases

  • Inspect Kubernetes resources and API types
  • Review pod logs and cluster events
  • Monitor node and pod resource metrics
  • Apply or update resources from manifests
  • Manage Helm releases through an MCP client

Key features

  • Kubernetes API resource discovery
  • Namespace and label-filtered resource listing
  • Pod logs, metrics, and event queries
  • YAML or JSON resource creation and updates
  • Helm release and repository operations
  • Stdio, SSE, and streamable HTTP transports

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

25/26 checks healthy over the last 111d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars191Stargazers on the source repository.
Last commit6d agoMost recent push to the default branch.
Directory activity10 viewsConfig copies, upvotes, and views on AllMCPs.

How K8s MCP Server works

What reza-gholizade/k8s-mcp-server does

reza-gholizade/k8s-mcp-server gives MCP-compatible clients access to Kubernetes cluster data and operations. Its Kubernetes tools can discover API resources, list objects with optional namespace and label filters, retrieve individual resources, and produce descriptions comparable to kubectl describe.

Operational inspection is also covered. Agents can retrieve pod logs, including logs for a selected container or all containers, query node resource usage, inspect CPU and memory metrics for pods, and list events for a namespace or a particular resource.

The server also supports resource changes from YAML or JSON manifests. It can create or update resources and delete resources using the supplied Kubernetes parameters. Helm-related tools include installing, upgrading, uninstalling, and rolling back releases, as well as adding Helm repositories; these operations are referenced by the server's read-only controls.

How it works

The server uses the Model Context Protocol to expose Kubernetes operations as agent tools. It can communicate through standard input and output for local client integrations, Server-Sent Events for HTTP applications, or streamable HTTP at the /mcp endpoint. With no mode selected, it uses stdio.

Kubernetes authentication is selected automatically in this order: kubeconfig content from KUBECONFIG_DATA, a Kubernetes API URL and bearer token, an in-cluster service account, and finally a kubeconfig file. The file-based fallback uses KUBECONFIG or the default ~/.kube/config location. Kubernetes permissions still come from the credentials or service account used by the process.

HTTP modes require a bearer token and bind to loopback by default. The unauthenticated /healthz endpoint is available for health checks. Browser access requires explicitly configured allowed origins.

Setup and configuration

Building locally requires Go 1.23 or newer and access to a Kubernetes cluster. A typical build is:

bash
git clone https://github.com/reza-gholizade/k8s-mcp-server.git
cd k8s-mcp-server
go mod download
go build -o k8s-mcp-server .

Start a local stdio server with:

bash
./k8s-mcp-server --mode stdio

For SSE or streamable HTTP, set MCP_AUTH_TOKEN and optionally choose SERVER_PORT. HTTP listeners use port 8080 by default for streamable HTTP and can be moved with the port flag or environment variable. Set SERVER_HOST=0.0.0.0 only when external network access is intentional, and include Authorization: Bearer <token> with every MCP request.

To reduce the risk of unintended changes, start with --read-only. This disables resource creation and updates plus Helm install, upgrade, uninstall, rollback, and repository-addition operations. Kubernetes and Helm tool groups can also be disabled with --no-k8s and the corresponding Helm-category flag.

Tools and capabilities

  • Discover API resources available in the connected cluster.
  • List resources by type, namespace, and labels.
  • Retrieve resource details and descriptive output.
  • Read pod logs for selected or all containers.
  • Query node and pod metrics.
  • List namespace or resource-specific events.
  • Create, update, and delete Kubernetes resources.
  • Manage Helm releases and repositories.
  • Run in stdio, SSE, or streamable-HTTP modes.

Limitations and notes

The server's effective capabilities are constrained by Kubernetes RBAC permissions. A deployment example uses a service account with broad permissions, but production deployments should assign only the access required by the tools in use. Setting KUBERNETES_INSECURE=true skips TLS verification and is intended for cases where that risk is acceptable. The Docker deployment example runs the process as a non-root user.

A hosted deployment is available through Fronteir AI. Local deployments require Go and Kubernetes access, while in-cluster deployments can use the mounted service account credentials.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about K8s MCP Server

reza-gholizade/k8s-mcp-server is an MCP server that connects AI clients to Kubernetes clusters. Its main tools discover and list API resources, inspect objects, read pod logs, query node and pod metrics, list events, manage resources from manifests, and perform Helm operations when permitted.

Install it by cloning the repository, downloading Go modules, and building the binary with Go 1.23 or newer. Run `go mod download`, then `go build -o k8s-mcp-server .`. The process also needs access to a Kubernetes cluster.

It authenticates first from `KUBECONFIG_DATA`, then from `KUBERNETES_SERVER` and `KUBERNETES_TOKEN`, then from an in-cluster service account, and finally from a kubeconfig file. The file path can come from `KUBECONFIG`; otherwise it defaults to `~/.kube/config`.

Run it with the `--read-only` flag, optionally alongside `--mode stdio`, `--mode sse`, or `--mode streamable-http`. Read-only mode disables resource creation and updates as well as Helm install, upgrade, uninstall, rollback, and repository-addition tools.

Yes, it can be used with Cursor through its MCP transport. Run the server in stdio mode for a local integration, or use SSE or streamable HTTP when connecting through an HTTP deployment.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewK8s MCP Server AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/reza-gholizade-k8s-mcp-server?style=directory)](https://allmcps.com/mcp/reza-gholizade-k8s-mcp-server)
HTML Embed
<a href="https://allmcps.com/mcp/reza-gholizade-k8s-mcp-server"><img src="https://allmcps.com/api/badge/reza-gholizade-k8s-mcp-server?style=directory" alt="K8s MCP Server on AllMCPs" /></a>