kube
learn let llm use mcp to manage k8s cluster
claude mcp add --transport stdio boqier-kube-mcp-server docker run -i boqier-kube-mcp-server:latest \ --env LOKI_URL="Loki server URL (default: http://127.0.0.1:3100)" \ --env SERVER_MODE="Server mode (default: stdio; options: stdio, sse, streamable-http)" \ --env SERVER_PORT="Server port (default: 8080)" \ --env PROMETHEUS_URL="Prometheus server URL (default: http://127.0.0.1:9090)"
How to use
kube-mcp-server exposes a multi-functional MCP interface for managing Kubernetes clusters and querying Prometheus and Loki data sources. When running, it can operate in several modes (stdio for local development and AI integrations, SSE for a persistent HTTP interface, or streamable-http for REST-like streaming). The server supports Kubernetes API resource queries, Pod log viewing, resource monitoring metrics, and events/Ingress queries, alongside Prometheus instantaneous and range queries, metric name lookups, and alert information. Loki support adds real-time and range log queries, tag/value discovery, and log stream queries using LogQL. Configure Prometheus and Loki integrations via command line flags or environment variables to enable/disable features and point to your monitoring stack. The server will gracefully disable a failed integration while continuing to operate otherwise.
To start, ensure the Docker image boqier-kube-mcp-server:latest is available, then run the container with the desired environment settings. Access the API as configured by SERVER_PORT and the chosen mode (stdio, sse, or streamable-http).
How to install
Prerequisites:
- Docker installed and running on your host
- Internet access to pull the MCP server image (or a pre-built image available in your registry)
Installation steps:
-
Pull the MCP server image docker pull boqier-kube-mcp-server:latest
-
Run the server with environment configuration (example) docker run -i
-e PROMETHEUS_URL=http://prometheus.example.com:9090
-e LOKI_URL=http://loki.example.com:3100
-e SERVER_PORT=8080
-e SERVER_MODE=stdio
-p 8080:8080
boqier-kube-mcp-server:latest -
Optional: customize via a docker compose file or additional environment variables as needed.
If you instead have a native build or another packaging method, follow the corresponding installation steps and ensure the same environment variables are provided.
Additional notes
Notes and tips:
- Environment variables take effect at startup; command-line arguments override environment variables if both are provided.
- If Prometheus or Loki endpoints are unreachable at startup, the server will log a warning and disable the corresponding integrations rather than failing.
- Modes:
- stdio: communicates via standard I/O, suitable for local development and AI assistant integration.
- sse: uses Server-Sent Events for a persistent HTTP connection, ideal for web apps.
- streamable-http: provides a streaming HTTP interface for REST-like clients.
- Security: you can enable safe-mode (disable write operations) via the -safe-mode flag or equivalent environment setting when building/starting the container.
- Common issues: verify network connectivity to Prometheus/Loki endpoints, correct port mappings, and that the selected mode is supported by your MCP client.
Related MCP Servers
trpc-agent-go
trpc-agent-go is a powerful Go framework for building intelligent agent systems using large language models (LLMs) and tools.
station
Station is our open-source runtime that lets teams deploy agents on their own infrastructure with full control.
tiger-cli
Tiger CLI is the command-line interface for Tiger Cloud. It includes an MCP server for helping coding agents write production-level Postgres code.
gopls
MCP server for golang projects development: Expand AI Code Agent ability boundary to have a semantic understanding and determinisic information for golang projects.
kubernetes
A Model Context Protocol (MCP) server for the Kubernetes API.
gcp-cost
💰 An MCP server that enables AI assistants to estimate Google Cloud costs, powered by Cloud Billing Catalog API and built with Genkit for Go