Get the FREE Ultimate OpenClaw Setup Guide →

k8s

MCP server for all of your needs in k8s ☸️

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio mayukhsobo-k8s-mcp-server docker run -i k8s-mcp-server-image

How to use

The Kubernetes MCP Server provides an interactive interface to manage Kubernetes resources and retrieve or format logs via the MCP protocol. It supports CRUD operations for common Kubernetes resource types (pods, services, namespaces, deployments, etc.), along with endpoints to fetch pod logs, search through logs, and export logs in multiple formats such as plaintext, JSON, CSV, and NDJSON. The server exposes a REST API that mirrors standard Kubernetes interactions, enabling you to create, list, read, and delete resources, as well as query and export logs for analysis or downstream processing. Once running, you can use the included endpoints to perform operations programmatically or build tooling around MCP to integrate Kubernetes data into your workflows.

How to install

Prerequisites:

  • Docker (optional for containerized run) or a Go toolchain if building from source
  • Access to a Kubernetes cluster with kubectl configured

Installation steps (containerized run):

  1. Ensure Docker is installed and running.
  2. Pull or build the MCP server image:
    • If you have a prebuilt image: use the image name in the mcp_config (e.g., k8s-mcp-server-image).
    • If you need to build locally, create a Dockerfile for the Go server and build the image.
  3. Run the MCP server (as per mcp_config):

Code block:

# Example: run the MCP server container (adjust image name as needed)
docker run -i k8s-mcp-server-image

Installation steps (from source):

  1. Install Go 1.24+ from the official Go website.
  2. Clone the repository and navigate into it:
git clone https://github.com/mayukhsarkar/k8s-mcp-server.git
cd k8s-mcp-server
  1. Build the binary:
go build -o k8s-mcp-server
  1. Run the server:
./k8s-mcp-server serve

If you prefer containerized deployment, you can adapt the Docker workflow to containerize the Go binary and run it as described in the first section.

Additional notes

Notes:

  • This server requires Go 1.24+ and access to a Kubernetes cluster. Ensure kubectl is configured and can access your cluster.
  • The API endpoints provide standard CRUD operations under /api/v1/resources/{resource_type} and log endpoints under /api/v1/logs. You can extend resource types per Kubernetes API compatibility.
  • When exporting logs, ensure the client can handle the chosen format (plaintext, JSON, CSV, NDJSON).
  • If running in Docker, remember to pass your kubeconfig or cluster credentials into the container if needed, depending on how you configure access (e.g., mounting ~/.kube or configuring in-cluster access).
  • The MCP server image name in mcp_config should match the actual deployed image. Adjust resources, RBAC, and network policies as required for your environment.

Related MCP Servers

Sponsor this space

Reach thousands of developers