OpenShift 4 MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@OpenShift 4 MCP ServerWhy is my pod crashlooping in namespace prod?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
OpenShift & Kubernetes MCP Server
A comprehensive Model Context Protocol (MCP) server that exposes 216 tools, 7 resources, and 10 runbook prompts for cluster operations — all driven by an LLM. Works with OpenShift 4 and vanilla Kubernetes; OpenShift-specific tools (Routes, BuildConfigs, SCCs, OLM, Machines, RHOAI, Virtualization) return a clear error on plain Kubernetes clusters that don't have those APIs.
Connect it to Claude (Desktop, Code, or API) and ask natural-language questions like:
"Why is my pod crashlooping in namespace prod?" "Scale the frontend deployment to 5 replicas." "Show me all firing alerts and create a 4-hour silence for the watchdog." "Live-migrate VM database-0 to another node." "Deploy llama-3 with KServe in the ds-team namespace." "What's the status of my Tekton pipeline run in namespace ci?" "Show me all Konflux components and their latest snapshot status."
Table of Contents
Related MCP server: LUMINO MCP Server
Features
Domain | Tools | What you can do |
Cluster | 17 | ClusterVersion, upgrade status, nodes, cordon/drain, namespaces, etcd health, events |
Workloads | 19 | Pods (logs, exec, describe), Deployments (scale, rollout, undo), StatefulSets, DaemonSets, Jobs, CronJobs, DeploymentConfigs |
Networking | 12 | Services, OpenShift Routes (TLS), Ingress, NetworkPolicies, IngressControllers |
Storage | 10 | PVs, PVCs (create/delete), StorageClasses, VolumeSnapshots |
Config | 8 | ConfigMaps, Secrets (keys only — values never exposed), ServiceAccounts |
RBAC | 13 | OCP Users/Groups, Roles, ClusterRoles, RoleBindings, |
Builds | 8 | BuildConfigs, start/log builds, ImageStreams and tags |
Operators (OLM) | 10 | CSVs, Subscriptions, CatalogSources, InstallPlans (approve), OperatorConditions |
Machines | 11 | MachineSets (scale), Machines, MachineConfigs, MachineConfigPools (pause/unpause) |
Monitoring | 10 | PromQL instant/range queries, Alertmanager alerts/silences (CRUD), PrometheusRules |
Security | 9 | SCCs (list/create/assign), OAuth config, pod security violations |
Autoscaling | 8 | HPA (create/delete), VPA recommendations, ClusterAutoscaler, MachineAutoscaler |
GitOps | 7 | ArgoCD Applications (sync, health, refresh), AppProjects, registered clusters |
Pipelines | 10 | Tekton Pipelines/PipelineRuns/Tasks/TaskRuns, start/cancel, EventListeners |
Service Mesh | 8 | SMCP status, VirtualServices, DestinationRules, PeerAuthentications, Gateways |
OpenShift AI | 13 | DSCI/DSC status, Notebooks (start/stop), KServe InferenceServices, DSP, ModelRegistry |
Virtualization | 15 | VMs (start/stop/restart/pause/create/delete), live migration, DataVolumes, snapshots |
Konflux | 11 | Applications, Components, Snapshots, IntegrationTestScenarios, ReleasePlans |
ACM | 11 | ManagedClusters, Policies, Placements, ManifestWorks (deploy to managed clusters) |
Generic | 6 |
|
MCP Resources | 7 | Live cluster URIs: |
MCP Prompts | 10 | SRE runbooks: troubleshoot pod, upgrade cluster, debug network, deploy ML model, and more |
Requirements
Python 3.11+
ocCLI in PATH (for operations that use it; many tools fall back to direct k8s API calls)virtctlin PATH (for VM pause/unpause; optional)Access to an OpenShift 4.x cluster
Installation
git clone https://github.com/your-org/openshift-mcp-server.git
cd openshift-mcp-server
python3 -m venv .venv
.venv/bin/pip install -e .Authentication
The server supports five auth modes, tried in priority order:
1. OCP_CLUSTERS — multi-cluster JSON (highest priority)
See the Multi-cluster section below.
2. Service Account Token (recommended for CI/CD)
export OCP_API_URL=https://api.mycluster.example.com:6443
export OCP_TOKEN=sha256~xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxGet a long-lived token:
oc create serviceaccount mcp-server -n default
oc adm policy add-cluster-role-to-user cluster-admin -z mcp-server -n default
oc create token mcp-server -n default --duration=8760h3. Username / Password
export OCP_API_URL=https://api.mycluster.example.com:6443
export OCP_USERNAME=kubeadmin
export OCP_PASSWORD=xxxx-xxxx-xxxx-xxxxThe server runs oc login and extracts the resulting bearer token automatically.
4. kubeconfig (default for local dev)
# Uses ~/.kube/config automatically, or:
export OCP_KUBECONFIG=/path/to/kubeconfig
export OCP_KUBECONFIG_CONTEXT=my-cluster-admin # optional context name5. In-cluster (when running inside a pod)
No env vars needed — uses the mounted ServiceAccount token automatically.
TLS verification
# Disable TLS verification for the Kubernetes API connection (k8s client):
export OCP_SKIP_TLS_VERIFY=true # for self-signed certs in dev/lab clusters
# Disable TLS verification for Prometheus/Alertmanager HTTP calls:
export OCP_VERIFY_SSL=falseThese are two independent settings — OCP_SKIP_TLS_VERIFY controls the kubernetes Python client (API calls), OCP_VERIFY_SSL controls HTTP requests to Prometheus and Alertmanager.
Multi-cluster
Set OCP_CLUSTERS to a JSON array of named cluster configs:
export OCP_CLUSTERS='[
{"name": "prod", "api_url": "https://api.prod.example.com:6443", "token": "sha256~prod..."},
{"name": "staging", "api_url": "https://api.staging.example.com:6443", "token": "sha256~staging..."},
{"name": "lab", "api_url": "https://api.lab.example.com:6443", "token": "sha256~lab...", "skip_tls_verify": true}
]'Each cluster config object supports:
Field | Required | Description |
| yes | Logical name used in the |
| yes | API server URL ( |
| one of token/user+pass | Bearer token |
| one of token/user+pass | Credentials for |
| no | Set |
Then pass cluster="prod" to any tool:
list_pods(namespace="kube-system", cluster="prod")
scale_deployment(name="api", replicas=3, namespace="default", cluster="staging")Monitoring / Prometheus
By default the server auto-derives the Alertmanager URL from OCP_PROMETHEUS_URL. Override if needed:
export OCP_PROMETHEUS_URL=https://thanos-querier.openshift-monitoring.svc:9091
export OCP_ALERTMANAGER_URL=https://alertmanager-main.openshift-monitoring.svc:9093
export OCP_PROMETHEUS_TOKEN=sha256~... # defaults to OCP_TOKENEnvironment variables reference
Variable | Default | Purpose |
| — | API server URL for single-cluster token/password auth |
| — | Bearer token for the service account or user |
| — | Username for |
| — | Password for |
|
| Set |
|
| Path to a kubeconfig file |
| — | Named context within the kubeconfig |
| — | JSON array of multi-cluster configs (see above) |
| auto-detected | Prometheus/Thanos querier URL |
| auto-derived | Alertmanager URL |
|
| Token for Prometheus/Alertmanager HTTP calls |
|
| Set |
|
|
|
|
| Bind address for streamable-http transport |
|
| Port for streamable-http transport |
|
| Bind address for the Gradio web UI |
|
| Port for the Gradio web UI |
|
| Set |
| — | Required for the AI Chat tab in the Gradio UI |
|
| Model for the AI Chat tab |
Usage with Claude
Claude Code (this repository)
The .claude/settings.json already wires the server up. Open this directory in Claude Code and the ocp MCP server is available automatically.
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"ocp": {
"command": "/path/to/ocp-mcp-server/.venv/bin/python",
"args": ["-m", "ocp_mcp.server"],
"env": {
"PYTHONPATH": "/path/to/ocp-mcp-server/src",
"OCP_API_URL": "https://api.mycluster.example.com:6443",
"OCP_TOKEN": "sha256~..."
}
}
}
}Streamable HTTP transport (for remote use or web apps)
Note:
MCP_HOSTdefaults to127.0.0.1(loopback-only, with DNS-rebinding protection enabled by the MCP SDK). SetMCP_HOST=0.0.0.0explicitly when you need external access.
export MCP_TRANSPORT=streamable-http
export MCP_HOST=0.0.0.0 # bind to all interfaces for remote access
export MCP_PORT=8080
.venv/bin/ocp-mcp-serverThen point your MCP client at http://your-host:8080/mcp.
Web UI (Gradio)
A browser-based UI with two tabs — no MCP client required.
Install UI dependencies:
.venv/bin/pip install -e ".[ui]"Run:
export OCP_API_URL=https://api.mycluster.example.com:6443
export OCP_TOKEN=sha256~...
.venv/bin/ocp-mcp-ui
# Opens at http://localhost:7860Tab 1 — Tool Playground: Select any of the 216 tools from a searchable dropdown, fill in parameters, and run it directly against your cluster. Results appear instantly — no AI in the loop.
Tab 2 — AI Chat: Natural-language chat backed by Claude. Set ANTHROPIC_API_KEY and ask anything — Claude will automatically call the right OCP tools and show you what it did.
Interactive Chat Client (mcp_chat.py)
mcp_chat.py is a standalone terminal chat client that connects to any running MCP server and drives an agentic loop using the LLM of your choice. All configuration is prompted at startup — no environment variables required, though they are used as defaults when present.
Supported LLM providers
Provider | Auth |
Anthropic API | API key |
Google Vertex AI | GCP project ID + region (GCP ADC — |
Ollama | Base URL (local or remote) |
OpenAI-compatible | Base URL + optional API key (OpenAI, LM Studio, vLLM, llama.cpp, …) |
Install
pip install mcp anthropic "anthropic[vertex]" openai httpxRun
python mcp_chat.pyThe script walks you through setup interactively:
╔══════════════════════════════════════════════════════════════╗
║ MCP Chat — Setup ║
╚══════════════════════════════════════════════════════════════╝
MCP server URL [http://localhost:8080/mcp]:
LLM provider
1. Anthropic API (API key)
2. Google Vertex AI (GCP project ID + region, GCP ADC auth)
3. Ollama (local or remote)
4. OpenAI-compatible (OpenAI / LM Studio / vLLM / llama.cpp / …)
Choice:Self-signed / internal CA certificates
When an HTTPS URL is entered (for the MCP server or the model endpoint) the script asks whether the certificate is CA-signed or self-signed:
The MCP server URL is using HTTPS.
Does it use a valid CA-signed certificate? (answer 'n' for self-signed / internal CA) [Y/n]:Answering n disables SSL verification for that endpoint automatically. This is the correct answer for:
CRC (CodeReady Containers) — uses a self-signed router CA
Self-hosted OpenShift clusters with internal PKI
Local Ollama or OpenAI-compatible servers fronted by nginx with a self-signed cert
Note: For the MCP server connection, SSL verification is disabled by patching
httpx.AsyncClientfor the duration of the session (the MCP SDK does not expose averify=parameter directly). For Ollama/OpenAI-compatible clients,httpx.Client(verify=False)is passed directly. Anthropic API and Google Vertex AI always use CA-signed certificates and are never prompted.
Environment variable defaults
All prompts use environment variables as pre-filled defaults so repeat runs need fewer keystrokes:
Prompt | Env var |
MCP server URL |
|
Anthropic API key |
|
Model (Anthropic / Vertex) |
|
GCP project ID |
|
GCP region |
|
Ollama base URL |
|
Ollama model |
|
OpenAI base URL |
|
OpenAI API key |
|
OpenAI model |
|
Example session (Vertex AI + CRC cluster)
# Port-forward the deployed MCP server
oc port-forward svc/ocp-mcp-server 8080:8080 -n ocp-mcp &
python mcp_chat.py
# MCP server URL [http://localhost:8080/mcp]: https://ocp-mcp-server-ocp-mcp.apps-crc.testing/mcp
# The MCP server URL is using HTTPS.
# Does it use a valid CA-signed certificate? [Y/n]: n
# ⚠ SSL verification disabled for MCP server (self-signed cert).
# LLM provider → 2 (Google Vertex AI)
# GCP project ID: my-gcp-project
# Region [us-east5]:
# Model [claude-opus-4-8]:
# Ready — 216 tools available | provider: vertex | model: claude-opus-4-8
You: What nodes are in my cluster and are any under memory pressure?
→ list_nodes({})
→ get_node_conditions({"node":"crc-xxxxx-master-0"})Container & OpenShift Deployment
This section covers building the container image and deploying to OpenShift or any Kubernetes cluster.
Prerequisites
Podman or Docker for building/pushing the image
Access to a container registry (Quay.io, OpenShift internal registry, etc.)
ocCLI logged in to your cluster
1. Build the image
# Clone and enter the repo
git clone https://github.com/your-org/openshift-mcp-server.git
cd openshift-mcp-server
# Build with Podman (recommended for OpenShift)
podman build -f Containerfile -t quay.io/your-org/ocp-mcp-server:latest .
# Multi-arch build (amd64 + arm64)
podman buildx build \
--platform linux/amd64,linux/arm64 \
-f Containerfile \
-t quay.io/your-org/ocp-mcp-server:latest .
podman push quay.io/your-org/ocp-mcp-server:latestBuild arguments:
Argument | Default | Description |
|
| OpenShift CLI version; e.g. |
|
| KubeVirt virtctl version |
|
| CPU architecture: |
# Pin specific CLI versions
podman build -f Containerfile \
--build-arg OC_VERSION=4.16.3 \
--build-arg VIRTCTL_VERSION=v1.4.0 \
-t quay.io/your-org/ocp-mcp-server:4.16.3 .2. Push the image
podman push quay.io/your-org/ocp-mcp-server:latestFor the OpenShift internal registry:
# Log in to the internal registry
oc registry login
IMAGE="$(oc registry info)/ocp-mcp/ocp-mcp-server:latest"
podman build -f Containerfile -t "$IMAGE" .
podman push "$IMAGE"3. Deploy to OpenShift
3a. Create the namespace
oc new-project ocp-mcp
# or:
oc apply -f deploy/namespace.yaml3b. Create the credentials Secret
The Secret holds cluster auth and the optional Anthropic API key. Never commit real values.
In-cluster deployment (server manages the same cluster it runs in — no credentials needed):
# Only set ANTHROPIC_API_KEY if you want the Gradio AI Chat tab
oc create secret generic ocp-mcp-server-credentials \
--from-literal=ANTHROPIC_API_KEY=sk-ant-xxxxxxxx \
-n ocp-mcp
# If no Anthropic key either, create an empty secret:
oc create secret generic ocp-mcp-server-credentials -n ocp-mcpExternal cluster (server is deployed elsewhere and manages a remote cluster):
# Single cluster — token auth (recommended)
oc create secret generic ocp-mcp-server-credentials \
--from-literal=OCP_API_URL=https://api.cluster.example.com:6443 \
--from-literal=OCP_TOKEN=sha256~xxxxxxxxxxxxxxxxxxxxxxxx \
--from-literal=ANTHROPIC_API_KEY=sk-ant-xxxxxxxx \
-n ocp-mcp
# Multi-cluster
oc create secret generic ocp-mcp-server-credentials \
--from-literal=OCP_CLUSTERS='[
{"name":"prod", "api_url":"https://api.prod.example.com:6443", "token":"sha256~prod..."},
{"name":"staging", "api_url":"https://api.staging.example.com:6443", "token":"sha256~staging..."}
]' \
--from-literal=ANTHROPIC_API_KEY=sk-ant-xxxxxxxx \
-n ocp-mcpTip: Generate a long-lived ServiceAccount token for the MCP server:
oc create serviceaccount mcp-server -n default oc adm policy add-cluster-role-to-user cluster-admin -z mcp-server -n default oc create token mcp-server -n default --duration=8760h
3c. Edit the image reference
Open deploy/deployment.yaml and replace the placeholder image:
image: quay.io/your-org/ocp-mcp-server:latest3d. Apply all resources
# Using kustomize (recommended)
oc apply -k deploy/
# Or apply individually
oc apply -f deploy/serviceaccount.yaml
oc apply -f deploy/clusterrolebinding.yaml
oc apply -f deploy/configmap.yaml
oc apply -f deploy/deployment.yaml
oc apply -f deploy/service.yaml
oc apply -f deploy/route.yaml3e. Verify the deployment
# Check pod status
oc get pods -n ocp-mcp -l app.kubernetes.io/name=ocp-mcp-server
# Check logs
oc logs -n ocp-mcp -l app.kubernetes.io/name=ocp-mcp-server -f
# Get the public MCP URL
oc get route ocp-mcp-server -n ocp-mcp -o jsonpath='{.spec.host}'The server is ready when you see a line like:
INFO: Started server process
INFO: Uvicorn running on http://0.0.0.0:80803b. Deploy to vanilla Kubernetes
The same manifests work on any Kubernetes cluster. The differences from the OpenShift steps above:
Use
kubectlinstead ofocUse
deploy/ingress.yamlinstead ofdeploy/route.yaml(Ingress requires an ingress controller such as nginx-ingress)Skip
deploy/namespace.yamlif your cluster auto-creates namespaces; otherwisekubectl create namespace ocp-mcp
Create the namespace and credentials
kubectl create namespace ocp-mcp
# Token auth (replace with your cluster API URL and token)
kubectl create secret generic ocp-mcp-server-credentials \
--from-literal=OCP_API_URL=https://api.k8s.example.com:6443 \
--from-literal=OCP_TOKEN=<serviceaccount-token> \
-n ocp-mcpGenerate a long-lived ServiceAccount token:
kubectl create serviceaccount mcp-server -n default
kubectl create clusterrolebinding mcp-server-admin \
--clusterrole=cluster-admin --serviceaccount=default:mcp-server
kubectl create token mcp-server -n default --duration=8760hApply the manifests
# Apply all resources except the OpenShift Route
kubectl apply -f deploy/serviceaccount.yaml
kubectl apply -f deploy/clusterrolebinding.yaml
kubectl apply -f deploy/configmap.yaml
kubectl apply -f deploy/deployment.yaml
kubectl apply -f deploy/service.yaml
kubectl apply -f deploy/ingress.yaml # Kubernetes Ingress (not Route)Edit deploy/ingress.yaml first to set the correct hostname for your cluster.
Verify
kubectl get pods -n ocp-mcp -l app.kubernetes.io/name=ocp-mcp-server
kubectl logs -n ocp-mcp -l app.kubernetes.io/name=ocp-mcp-server -f
kubectl get ingress -n ocp-mcpKubernetes compatibility note: Core tools (workloads, networking, storage, RBAC, config, monitoring, Tekton Pipelines) work on any Kubernetes cluster. Tools for OpenShift-specific APIs (Routes, BuildConfigs, SCCs, OLM, Machines, OpenShift AI, Virtualization, Service Mesh, ACM) return a clear "API not available" message on clusters where those CRDs are absent — they do not crash the server.
4. Connect an MCP client
Once deployed, point your MCP client at the Route URL:
https://<route-host>/mcpClaude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"ocp": {
"transport": "http",
"url": "https://<route-host>/mcp"
}
}
}Claude Code (.claude/settings.json in your project):
{
"mcpServers": {
"ocp": {
"type": "http",
"url": "https://<route-host>/mcp"
}
}
}5. MCP Inspector
The MCP Inspector is a browser-based UI for exploring MCP tools, resources, and prompts at the protocol level.
Route access is not possible with the standard inspector package. Its proxy backend binds to
127.0.0.1(loopback) by design, and the browser-side JS connects to the proxy atlocalhost:SERVER_PORT. Via a Route,localhostresolves to the user's machine — not the pod — so the proxy is never reachable.oc port-forwardis required.For remote browser-based tool exploration without port-forward, use the Gradio web UI instead (see section 7 below) — it has a Tool Playground tab covering all 216 tools and works via a standard Route.
Deploy:
oc apply -f deploy/inspector.yaml -n ocp-mcpAccess via port-forward (required):
# Forward both ports — UI (6274) and proxy backend (6277)
oc port-forward svc/mcp-inspector 6274:6274 6277:6277 -n ocp-mcpOpen http://localhost:6274 in your browser, then connect with:
Field | Value |
Transport | Streamable HTTP |
URL |
|
Use the internal ClusterIP service name — the inspector proxy (inside the pod) makes the actual connection to the MCP server, not the browser.
Remove when done:
oc delete -f deploy/inspector.yaml -n ocp-mcp6. Deploy the Gradio web UI
The Gradio UI runs as a separate Deployment using the same image with OCP_MODE=ui.
Edit deploy/deployment.yaml, add a second Deployment (or patch the existing one):
# Add to the container's env section:
- name: OCP_MODE
value: "ui"
# Change containerPort to 7860 and update the Service/Route accordingly.Or run it locally:
docker compose --profile ui up7. Environment variables reference (container)
All variables from Environment variables reference apply. Container-specific additions:
Variable | Default | Purpose |
|
|
|
|
| Always set to |
|
| Set to |
8. Production checklist
Image pushed to a private registry with image pull secret configured
Credentials Secret created with real values (not the template YAML)
OCP_SKIP_TLS_VERIFYandOCP_VERIFY_SSLset correctly for your cluster's TLS postureClusterRoleBinding scoped to the minimum permissions your use case needs (see
deploy/clusterrolebinding.yaml)Route has TLS edge termination with
insecureEdgeTerminationPolicy: RedirectMCP Inspector NOT deployed (or behind port-forward only) in production
ANTHROPIC_API_KEYrotated on the schedule required by your org's secret management policyResource
requests/limitstuned to observed usage (checkoc top pod)NetworkPolicy applied to restrict ingress to the MCP port from known LLM clients only
MCP Resources
Resources expose live cluster state as URI-addressable read-only content. MCP clients can subscribe to them and display them alongside tool results.
URI | Description |
| Cluster version, infrastructure name, API URL, platform, topology, upgrade history, and available updates |
| All nodes with role, ready status, OS image, kubelet version, and age |
| All ClusterOperators sorted degraded-first with Available/Progressing/Degraded columns |
| Currently firing Alertmanager alerts, severity-sorted, with summary |
| Pods in a namespace: phase, ready containers, restarts, IP, node, age |
| Last 50 events in a namespace sorted most-recent-first |
| Deployments in a namespace: desired/ready/available/updated replicas and health conditions |
MCP Prompts
Prompts are pre-built operational runbooks that the LLM can invoke to get step-by-step guidance. Each prompt returns a structured multi-step plan that chains together the right tools automatically.
Prompt | Parameters | Purpose |
|
| Diagnose a failing or crashlooping pod: inspect status, read logs, check events, diagnose by failure pattern (CrashLoopBackOff, OOMKilled, ImagePullBackOff, Pending) |
|
| Diagnose network connectivity between pods/services: verify selectors, check endpoints, test DNS, test TCP, inspect NetworkPolicies, check Routes |
|
| Diagnose node MemoryPressure/DiskPressure/PIDPressure: check conditions, review resource usage, surface events, cordon/drain if needed |
|
| Safe upgrade pre-flight + procedure: verify operators, nodes, etcd, alerts; pause MCPs; initiate upgrade; monitor rollout; verify completion |
|
| Provision a new OpenShift project with ResourceQuota, LimitRange, default-deny NetworkPolicy, RoleBindings, and a dedicated ServiceAccount |
|
| Deploy an ML model via OpenShift AI/RHOAI: verify RHOAI, find serving runtime, create InferenceService, monitor readiness, test endpoint, configure HPA |
| — | Systematic triage for a degraded cluster: survey operators, check nodes, verify etcd, list alerts, scan events, deep-dive degraded operators |
|
| Live-migrate a KubeVirt VM: verify running state, check RWX storage, initiate VMIM, monitor progress, verify success, troubleshoot if stuck |
|
| Diagnose a stuck operator install: inspect Subscription, InstallPlan, CSV status, approve pending plans, check pod logs, verify CatalogSource |
|
| Deploy via ArgoCD: verify GitOps operator, create AppProject, configure namespace access, create Application CR, trigger sync, verify health |
Example prompts
# Cluster health
"Give me a full health summary of the cluster"
"Which ClusterOperators are degraded and why?"
"Are there any nodes in NotReady state?"
# Workloads
"List all crashlooping pods across all namespaces"
"Scale the checkout deployment to 10 replicas in namespace shop"
"Get the last 200 log lines from pod api-xyz-abc in namespace backend"
"Roll back the frontend deployment to the previous version"
# Monitoring
"Show me all critical alerts currently firing"
"Query: rate(http_requests_total[5m]) for the last hour"
"Create a 2-hour silence for AlertName=Watchdog"
# RBAC / Security
"What permissions does user john.doe have in namespace dev?"
"Grant the edit role to group platform-team in namespace staging"
"List all SCCs and which service accounts use them"
"Create a non-privileged SCC for a workload that needs setuid binaries"
# OpenShift AI
"What's the status of the DataScienceCluster?"
"List all running notebooks in the ml-team namespace"
"Deploy a scikit-learn model from s3://models/lr-v1 using KServe"
# Virtualization
"List all VMs and their current status"
"Live-migrate VM postgres-main to node worker-3"
"Take a snapshot of VM database-0 before the upgrade"
# Konflux
"What's the build status of my component frontend in workspace team-a?"
"Show me the latest snapshot and its integration test results"
# ACM
"Which managed clusters are not compliant with the security policy?"
"Show me all placements and which clusters they selected"Repository structure
ocp-mcp-server/
├── pyproject.toml # package metadata and dependencies
├── .env.example # environment variable reference
├── Containerfile # multi-stage UBI9 container image build
├── entrypoint.sh # container entrypoint (server or Gradio UI mode)
├── mcp_chat.py # universal interactive chat client (multi-provider)
├── deploy/ # OpenShift / Kubernetes manifests
│ ├── kustomization.yaml
│ ├── namespace.yaml
│ ├── serviceaccount.yaml
│ ├── clusterrolebinding.yaml
│ ├── configmap.yaml
│ ├── secret.yaml # template only — create via oc create secret
│ ├── deployment.yaml
│ ├── service.yaml
│ ├── route.yaml
│ └── inspector.yaml # optional MCP Inspector pod (port-forward access)
├── .claude/
│ └── settings.json # Claude Code MCP configuration
└── src/
└── ocp_mcp/
├── __init__.py
├── app.py # shared FastMCP server instance + port/host config
├── server.py # entry point — imports all tool modules
├── ui.py # Gradio web UI entry point (ocp-mcp-ui)
├── client.py # multi-cluster k8s client management
├── tools/
│ ├── cluster.py # ClusterVersion, nodes, namespaces, etcd
│ ├── workloads.py # Pods, Deployments, StatefulSets, Jobs
│ ├── networking.py # Services, Routes, Ingress, NetworkPolicies
│ ├── storage.py # PVs, PVCs, StorageClasses, VolumeSnapshots
│ ├── config.py # ConfigMaps, Secrets, ServiceAccounts
│ ├── rbac.py # Users, Groups, Roles, RoleBindings
│ ├── builds.py # BuildConfigs, Builds, ImageStreams
│ ├── operators.py # OLM — CSVs, Subscriptions, InstallPlans
│ ├── machines.py # MachineSets, MachineConfigs, MCPs
│ ├── monitoring.py # Prometheus queries, Alertmanager
│ ├── security.py # SCCs, OAuth, pod security
│ ├── autoscaling.py # HPA, VPA, ClusterAutoscaler
│ ├── gitops.py # ArgoCD Applications, AppProjects
│ ├── pipelines.py # Tekton Pipelines, PipelineRuns, Tasks
│ ├── service_mesh.py # SMCP, VirtualServices, DestinationRules
│ ├── ocp_ai.py # RHOAI, Notebooks, KServe, ModelRegistry
│ ├── virtualization.py # KubeVirt VMs, live migration, snapshots
│ ├── konflux.py # Konflux Applications, Components, Releases
│ ├── acm.py # ACM ManagedClusters, Policies, ManifestWorks
│ └── generic.py # apply_manifest, run_oc_command, list_crds
├── resources/
│ └── __init__.py # MCP resource URIs (ocp://cluster/info, etc.)
└── prompts/
└── __init__.py # SRE runbook prompt templatesArchitecture
LLM (Claude)
│
│ MCP protocol (stdio or streamable-http)
▼
ocp-mcp-server
│
├── client.py ──────────────────────────────────────────┐
│ ClusterRegistry │
│ ├── ClusterClient("prod") → kubernetes Python SDK │
│ ├── ClusterClient("staging") │
│ └── ClusterClient("lab") │
│ │
├── tools/*.py → @mcp.tool() │
│ All 216 tools call get_client(cluster) ───────────────┘
│ then use: k8s typed APIs (CoreV1, AppsV1, …)
│ CustomObjectsApi for OCP/OLM/RHOAI/Virt CRDs
│ subprocess oc CLI for operations not in k8s API
│
├── resources/__init__.py → @mcp.resource("ocp://…")
│ Live cluster state as URI-addressable content
│
└── prompts/__init__.py → @mcp.prompt()
SRE runbook templates the LLM can invokeAuth flow
ClusterRegistry._load() — tried in order, first success wins:
1. OCP_CLUSTERS → JSON array → one ClusterClient per entry
2. OCP_API_URL + OCP_TOKEN → bearer-token ClusterClient
3. OCP_API_URL + OCP_USERNAME + OCP_PASSWORD → oc login → extract token
4. OCP_KUBECONFIG / OCP_KUBECONFIG_CONTEXT → load_kube_config
5. In-cluster ServiceAccount tokenDesign principles
No mock data — every tool makes real API calls or runs
oc.Safe defaults — secrets never expose values, only key names. Destructive tools have
WARNINGin their docstrings so the LLM knows to confirm before executing.Graceful degradation — tools catch
ApiExceptionand return readable errors. Missing CRDs (e.g. KubeVirt not installed) return a helpful message instead of crashing.Multi-cluster first — every tool accepts a
clusterparameter. The default cluster is whichever config loaded first.Escape hatches —
apply_manifest,run_oc_command, andlist_custom_resourceslet the LLM reach anything not covered by a typed tool.
Adding a new tool
Find the relevant module in
src/ocp_mcp/tools/or create a new one.Add a function decorated with
@mcp.tool():
from ocp_mcp.app import mcp
from ocp_mcp.client import format_error, get_client
@mcp.tool()
def my_new_tool(name: str, namespace: str = "default", cluster: str = "") -> str:
"""One-sentence description shown to the LLM."""
c = get_client(cluster)
try:
result = c.core_v1.read_namespaced_something(name, namespace)
return f"Result: {result.metadata.name}"
except Exception as e:
return format_error(e)If you created a new file, add
import ocp_mcp.tools.your_moduletoserver.py.
Conventions:
Always accept
cluster: str = ""as the last parameter before any cluster-specific args.Call
get_client(cluster)and usec.oc_args()when buildingrun_ocinvocations — never callrun_ocwithout the cluster auth args, or multi-cluster calls will silently target the wrong cluster.Return strings only — tool output is text surfaced directly to the LLM.
Catch all exceptions and return
format_error(e)rather than letting them propagate.
Tool highlights
Security tools (security.py)
Tool | Description |
| List all SCCs sorted by priority |
| Full SCC detail: volumes, capabilities, users, groups |
| Create a custom SCC with parameters: |
| Grant an SCC to a ServiceAccount via |
| Revoke an SCC from a ServiceAccount |
| Grant a ClusterRole to a user |
| Grant a ClusterRole to a group |
| Get OAuth configuration and identity providers |
| Surface FailedCreate events matching SCC/security keywords |
create_scc parameters:
Parameter | Default | Description |
| required | SCC name |
|
| Allow containers to run as fully privileged (root with all capabilities) |
|
| Allow containers to use the host network namespace |
|
| Allow containers to use the host PID namespace |
|
| Sets |
|
| Allow processes to gain more privileges than their parent (required for setuid binaries like |
|
| Named cluster to target |
Generic escape-hatch tools (generic.py)
Tool | Description |
| Apply YAML/JSON manifest via |
| Get any resource in YAML, JSON, wide, or describe format |
| Delete any resource by type and name |
| List any CRD by group/version/plural |
| Escape hatch: run any |
| List all CustomResourceDefinitions |
Tekton Pipelines (pipelines.py)
Works on any Kubernetes cluster with Tekton installed (including OpenShift Pipelines).
Tool | Description |
| List Pipelines in a namespace |
| Full Pipeline spec: tasks, params, workspaces |
| List PipelineRuns with status; filter by label selector |
| PipelineRun detail: task statuses, params, start/end time, duration |
| Trigger a new PipelineRun with optional params and workspaces |
| Cancel a running PipelineRun |
| List Tasks in a namespace |
| List TaskRuns with status |
| List TriggerTemplates (webhook-driven pipeline triggers) |
| List EventListeners and their trigger bindings |
Example prompts:
"List all pipeline runs in namespace ci and show me which ones failed"
"Get the full log context for pipeline run build-frontend-xyz"
"Start pipeline build-and-push in namespace ci with IMAGE=quay.io/org/app:latest"
"Cancel the running pipeline run deploy-staging-abc"
"What triggers are configured in the platform namespace?"Konflux / RHTAP (konflux.py)
Konflux (Red Hat Trusted Application Pipeline) tools. Requires the Konflux CRDs (appstudio.redhat.com) installed on your cluster.
Tool | Description |
| List Konflux Applications in a workspace/namespace |
| Application detail: components, environments, status |
| List Components; filter by application |
| Component detail: source repo, build pipeline, container image |
| Register a new Component from a git repository |
| List Snapshots; filter by application |
| Snapshot status including all integration test results |
| List IntegrationTestScenarios for an application |
| List ReleasePlans; filter by application |
| List Releases with status and target environment |
| List PipelineRuns for a component (build history) |
Example prompts:
"What Konflux applications exist in namespace team-a?"
"Show me the latest snapshot for application frontend and its integration test results"
"List all components in application backend-api and their source repos"
"What's the build history for component api-gateway?"
"Are there any failed releases in namespace platform?"
"Show me all integration test scenarios configured for application my-app"Dependencies
Package | Purpose |
| Model Context Protocol SDK (FastMCP + streamable-http transport) |
| Kubernetes Python client (typed APIs + dynamic client) |
| HTTP client for Prometheus/Alertmanager API calls |
| YAML parsing for |
| Timestamp parsing for |
| Alternative table formatting |
| Browser-based web UI (optional — |
| Claude AI for the Chat tab (optional — included in |
Security considerations
Secrets —
get_secret_keyslists key names only.list_secretsshows type and count. Values are never returned.Destructive ops —
delete_namespace,drain_node,delete_virtual_machine, etc. includeDESTRUCTIVEwarnings in their docstrings so the LLM knows to confirm before executing.run_oc_command— usesshlex.split(no shell=True) so shell metacharacters (|,>,;) are inert literal arguments. Blocked verbs:delete,rm,exec,replace— these have typed tools with confirmation prompts.apply_manifest— applies arbitrary YAML; the LLM should show the manifest to the user before calling this in agentic contexts. The-n namespaceflag does not restrict cluster-scoped resources.Bearer token redaction —
run_ocredacts--token <value>to--token <redacted>in all error messages, preventing credential exposure in LLM context or logs.Multi-cluster routing — all
ocCLI calls prependc.oc_args()(injects--serverand--token) so the correct cluster is always targeted when multiple clusters are configured.RBAC — create a minimal ServiceAccount with only the permissions your use case needs. The tools work with whatever RBAC the token has.
License
Apache License 2.0 — see LICENSE for details.
Contributing
Issues and PRs welcome. The tool modules are intentionally kept flat and simple — one domain per file, one @mcp.tool() per operation, no shared state between tools.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceA toolkit of 256 MCP servers for SRE incident diagnosis with Claude. One agent per tech (Postgres, Kafka, Istio, Kubernetes, Prometheus, MongoDB, Redis, Cassandra, ...) with failure modes, key metrics, and runbooks baked in. Plus telemetry MCPs (PromQL/LogQL/Elasticsearch), SSH-via-bastion executor, and 33 discovery adapters across 9 clouds. Apache 2.0, runs locally. Reproducible 5/5 scenariApache 2.0
- Alicense-qualityCmaintenanceAn open source MCP server empowering SREs with intelligent observability, predictive analytics, and AI-driven automation across Kubernetes, OpenShift, and Tekton environments.11Apache 2.0
- FlicenseAqualityDmaintenanceAI-powered MCP server for enterprise OpenShift/Kubernetes cluster management, providing diagnostic tools, RAG knowledge retrieval, and autonomous remediation recommendations.9
- Flicense-qualityCmaintenanceAn MCP server exposing Kubernetes-style diagnostic tools to an LLM agent, with a safety approval gate for destructive actions, all backed by a mock cluster for local testing.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ay-garg/openshift-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server