KU

Kubernetes and OpenShift MCP Server Resource CRUD Tools

Manage Kubernetes and OpenShift resources with an MCP server offering CRUD operations and specialized cluster tools.

Quick Install
npx -y @manusa/kubernetes-mcp-server

Overview

The MCP (Model Context Protocol) server provides a simple HTTP-based bridge to Kubernetes and OpenShift clusters that exposes CRUD operations and a set of higher-level cluster tools. It is intended for developer tooling, CI/CD systems, self-service portals and automation that need a compact, protocol-oriented way to create, read, update and delete Kubernetes resources without embedding the full client libraries in each integration.

Running as a standalone service or in-cluster, the MCP server handles API calls on behalf of clients, maps requests to the Kubernetes/OpenShift API, and can optionally apply platform-specific behavior (for example, OpenShift Routes or Projects). This centralizes cluster interaction, simplifies RBAC and auditing, and reduces duplication across different integrations.

Features

  • Generic CRUD API for Kubernetes and OpenShift resources (create, read, update, delete, list, watch)
  • Support for core resources: Namespaces/Projects, Pods, Deployments, Services, ConfigMaps, Secrets
  • OpenShift-specific support: Routes, Projects, and other platform resources
  • Works in-cluster or with external kubeconfig
  • Simple HTTP/JSON interface intended for use by tools, scripts and web frontends
  • Configurable RBAC via Kubernetes ServiceAccount, ClusterRole and ClusterRoleBinding
  • Logging and basic request auditing for operations
  • Extensible: can proxy arbitrary API groups and CustomResourceDefinitions (CRDs)

GitHub repository: https://github.com/manusa/kubernetes-mcp-server

Installation / Configuration

You can run the MCP server locally for development or deploy it to your cluster. Below are example ways to run it.

Run locally (using kubeconfig):

git clone https://github.com/manusa/kubernetes-mcp-server.git
cd kubernetes-mcp-server
# build (if Go project)
go build -o mcp-server ./cmd/mcp-server
# run with your kubeconfig
./mcp-server --kubeconfig="$HOME/.kube/config" --port=8080

Run with Docker:

docker build -t manusa/mcp-server:latest .
docker run -e KUBECONFIG="/root/.kube/config" \
  -v $HOME/.kube/config:/root/.kube/config:ro \
  -p 8080:8080 manusa/mcp-server:latest

Deploy to a cluster (example manifest):

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mcp-server
  namespace: kube-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mcp-server
  template:
    metadata:
      labels:
        app: mcp-server
    spec:
      serviceAccountName: mcp-server-sa
      containers:
      - name: mcp-server
        image: manusa/mcp-server:latest
        args:
        - --port=8080
        - --log-level=info
        ports:
        - containerPort: 8080

ServiceAccount / RBAC (minimal):

apiVersion: v1
kind: ServiceAccount
metadata:
  name: mcp-server-sa
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: mcp-server-role
rules:
- apiGroups: ["*"]
  resources: ["*"]
  verbs: ["get","list","watch","create","update","patch","delete"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: mcp-server-binding
subjects:
- kind: ServiceAccount
  name: mcp-server-sa
  namespace: kube-system
roleRef:
  kind: ClusterRole
  name: mcp-server-role
  apiGroup: rbac.authorization.k8s.io

Environment variables and flags (common):

  • KUBECONFIG: path to kubeconfig file (if running outside cluster)
  • PORT: HTTP listening port (default 8080)
  • LOG_LEVEL: debug|info|warn|error
  • OPENSHIFT: enable OpenShift-specific behavior

Available Tools / Resources

The MCP server treats Kubernetes APIs as resources and exposes standard operations over HTTP. Typical resource coverage includes:

  • Core: Namespace, Pod, Service, Deployment, ReplicaSet, StatefulSet, DaemonSet
  • Config: ConfigMap, Secret
  • Networking: Service, Ingress (Kubernetes), Route (OpenShift)
  • RBAC: Role, ClusterRole, RoleBinding, ClusterRoleBinding
  • CustomResourceDefinitions (CRDs): proxied as-is
  • Cluster tools: rollouts (patch/scale), resource metrics retrieval (if metrics available), event queries

The exact endpoints are HTTP/JSON and map resource paths to familiar API group/version/kind semantics. The server is designed to proxy arbitrary API groups; CRDs are supported when present in the target cluster.

Use Cases

  • CI/CD integration: Let CI pipelines create temporary namespaces, deploy test workloads and tear them down via a small HTTP client calling the MCP server instead of using kubectl.
    • Example: create a temp namespace for tests, apply manifests, run tests, then delete the namespace.
  • Self-service developer portals: Provide a central backend that enforces RBAC and auditing while developers request deployments or environment provisioning through a web UI.
  • Multi-tenant platforms: Expose a constrained subset of cluster operations to tenant services while centralizing cluster credentials in the MCP server.
  • Automation and tooling: Small automation scripts (Python, Node, Bash) can perform CRUD operations against the MCP server without embedding heavy K8s SDKs.
    • curl example (create namespace):
      curl -X POST http://mcp.example.local:8080/v1/resource/core/v1/namespace \
        -H 'Content-Type: application/json' \
        -d '{"metadata":{"name