Get the FREE Ultimate OpenClaw Setup Guide →

mcp-k8s-go

MCP server connecting to Kubernetes

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio strowk-mcp-k8s-go mcp-k8s-go

How to use

This MCP server is a Golang-based implementation that connects to your Kubernetes cluster to expose Kubernetes resources through the MCP (Model Context Protocol) interface. It supports listing contexts, namespaces, and a wide range of Kubernetes resources, including pods, services, deployments, nodes, and events, as well as running commands inside pods. The server is designed to integrate with MCP clients such as Claude Desktop or Inspector, enabling conversational or inspector-driven access to cluster data with optional read-only or restricted contexts. To start using it, deploy the binary or run it via Docker, then connect your MCP client using the appropriate server configuration. You can tune access with command-line options and environment variables to control which contexts are available and whether mutating operations are permitted. The server exposes a familiar Kubernetes-centric toolkit, making it convenient for operators and builders who want MCP-based tooling around Kubernetes resources.

How to install

Prerequisites:

  • Go (for building from source) or a pre-built binary
  • Docker (optional, for containerized deployment)
  • Access to a Kubernetes cluster and kubeconfig file

From source (Go):

  1. Install Go (https://golang.org/dl/)
  2. Set up your environment (e.g., GOPATH, GOBIN) as per your platform
  3. Get the module and build: go get github.com/strowk/mcp-k8s-go go install github.com/strowk/mcp-k8s-go
  4. Ensure the binary is in your PATH and configure Claude Desktop or your MCP client with: { "mcpServers": { "mcp_k8s_go": { "command": "mcp-k8s-go", "args": [] } } }

From GitHub Releases (prebuilt binary):

  • Download the latest release for your platform from GitHub releases
  • Place the binary somewhere in your PATH
  • Use the same Claude Desktop configuration as above

Using Docker:

  • Pull and run the image: docker run -i -v ~/.kube/config:/home/nonroot/.kube/config --rm mcpk8s/server:latest
  • Configure Claude Desktop to point to the Docker-based server, for example: { "mcpServers": { "mcp_k8s_go": { "command": "docker", "args": [ "run", "-i", "-v", "~/.kube/config:/home/nonroot/.kube/config", "--rm", "mcpk8s/server:latest" ] } } }

Additional notes

Environment variables and command-line options:

  • KUBECONFIG: Path to your Kubernetes configuration file (optional, defaults to ~/.kube/config)
  • --allowed-contexts=<ctx1,ctx2,...>: Restrict access to specified contexts; if omitted, all contexts are allowed
  • --readonly: Disables any mutating actions in the cluster
  • --help, --version: Display help and version information
  • --mask-secrets: Mask secrets in outputs (default: true); set to false to disable masking

Tips:

  • When using Claude Desktop or Inspector, you can embed the server configuration in claude_desktop_config.json as shown in the README examples.
  • If you run with Docker, ensure that the kubeconfig path is correctly mounted and accessible by the container user. Windows users may need to adjust the kubeconfig path syntax.
  • For full control, consider combining --allowed-contexts with --readonly to tightly constrain environment access while preventing changes.

Related MCP Servers

Sponsor this space

Reach thousands of developers