Kubernetes MCP Server: Manage Pods, Deployments, Services
Manage pods, deployments, and services with the MCP server by connecting to Kubernetes clusters, monitoring health, and deploying updates securely.
npx mcp-server-kubernetesOverview
The MCP (Model Context Protocol) Kubernetes server provides a lightweight HTTP API to manage Kubernetes workloads — specifically pods, deployments, and services — through a consistent, scriptable interface. It acts as a bridge between operator tooling (or other control planes) and a Kubernetes cluster, allowing you to inspect resource state, push updates, and observe health without embedding Kubernetes client libraries in every consumer.
This server is useful when you need a small, language-agnostic control endpoint for cluster operations: CI/CD runners can trigger rollouts, monitoring systems can probe health and uptime, and automation scripts can query or reconcile deployments. The server supports both out-of-cluster operation using a kubeconfig and in-cluster operation using the Kubernetes service account, and it can be configured to require TLS and token-based authentication for secure access.
Features
- Manage core Kubernetes resources: pods, deployments, and services
- Read and list resource state and metadata
- Trigger updates/rollouts to deployments (image updates)
- Expose health and readiness endpoints for monitoring
- Support for in-cluster and kubeconfig authentication
- Optional TLS and token-based authentication for secure access
- Simple HTTP/JSON API usable from curl, CI systems, and scripting languages
Installation / Configuration
Build from source (Go required):
Run locally using a kubeconfig:
Run inside a cluster (in-cluster RBAC must be configured):
# Example Kubernetes Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: mcp-server
spec:
replicas: 1
template:
spec:
containers:
- name: mcp-server
image: your-registry/mcp-server:latest
args:
- --listen-addr=0.0.0.0:8080
- --use-incluster=true
env:
- name: AUTH_TOKEN
valueFrom:
secretKeyRef:
name: mcp-auth
key: token
---
apiVersion: v1
kind: Service
metadata:
name: mcp-server
spec:
selector:
app: mcp-server
ports:
- protocol: TCP
port: 8080
targetPort: 8080
Common environment variables / flags:
| Flag / Env | Purpose | Default |
|---|---|---|
| –kubeconfig | Path to kubeconfig for out-of-cluster access | “” |
| –use-incluster | Enable in-cluster service account authentication | false |
| –listen-addr | TCP address to bind the HTTP server | 0.0.0.0:8080 |
| –tls-cert, –tls-key | TLS certificate and key paths (optional) | “” |
| –auth-token / AUTH_TOKEN | Token required for API calls (optional) | “” |
Available Resources
The server exposes a concise REST-like API for common operations. Example endpoints (prefix /v1):
- GET /v1/pods — list pods (optionally filter by namespace/label)
- GET /v1/pods/{namespace}/{name} — get a specific pod
- GET /v1/deployments — list deployments
- GET /v1/deployments/{namespace}/{name} — get deployment details
- POST /v1/deployments/{namespace}/{name}/update — trigger a rollout (e.g., set image)
- GET /v1/services — list services
- GET /health — health/readiness probe
- GET /metrics — Prometheus-style metrics (if enabled)
Authentication is typically via a header (Authorization: Bearer Example: update a deployment image This MCP server is intended as a small, pragmatic control API for Kubernetes clusters — suitable for automation, CI/CD, and lightweight orchestration layers that need stable, scriptable access to pods, deployments, and services.
Use Cases
Security and Best Practices
Resources