ocp-mcp
Provides tools for managing Kubernetes clusters, including pods, deployments, statefulsets, services, ingresses, jobs, configmaps, secrets, nodes, and more, with support for multi-cluster management and OAuth authentication.
Allows management of Prometheus monitoring resources such as PrometheusRules, ServiceMonitors, PodMonitors, and AlertmanagerConfigs for observability and alerting configuration.
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., "@ocp-mcplist pods in namespace my-app"
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.
ocp-mcp
An MCP (Model Context Protocol) server for managing multiple OpenShift Container Platform (OCP) clusters through AI assistants like GitHub Copilot, Windsurf, or any MCP-compatible client.
Features
Multi-cluster management — register and switch between dev, UAT, and production clusters
Built-in org cluster map — pre-configured aliases for standard environments
Dedicated OAuth support — works with separate
oauth-openshift.*hostnames60+ tools covering the full range of OpenShift/Kubernetes operations
Real-time metrics — CPU/memory usage for pods and nodes (
top_pods,top_nodes)Observability — PrometheusRules, ServiceMonitors, PodMonitors, AlertmanagerConfigs
OCP-native — Routes, DeploymentConfigs, Builds, BuildConfigs, ImageStreams
Operational — force-delete stuck pods, find failing pods, rollback deployments
Secure — secrets are never returned in plain text; tokens are in-memory only
Related MCP server: mcp-kubernetes-server
Prerequisites
Python 3.11+
uv package manager
Access to one or more OpenShift 4.x clusters
Installation
# Clone the repository
git clone <repo-url>
cd ocp-mcp
# Install dependencies
uv syncCorporate Artifactory Setup
If your organization requires downloading packages through Artifactory:
Option 1: Environment variables
export UV_INDEX_URL="https://<artifactory-host>/artifactory/api/pypi/<pypi-repo>/simple"
export UV_INDEX_USERNAME="<your-username>"
export UV_INDEX_PASSWORD="<your-password-or-token>"
uv syncOption 2: Project-level config (add to pyproject.toml)
[[tool.uv.index]]
name = "artifactory"
url = "https://<artifactory-host>/artifactory/api/pypi/<pypi-repo>/simple"
default = trueThen run uv sync as normal.
Running the MCP Server
uv run ocp-mcpThe server runs over stdio transport, which is what VS Code, Windsurf, and other MCP clients expect.
Client Configuration
VS Code (GitHub Copilot)
Add to your VS Code MCP settings (.vscode/mcp.json or user settings):
{
"mcpServers": {
"ocp-mcp": {
"command": "uv",
"args": ["run", "--directory", "/path/to/ocp-mcp", "ocp-mcp"]
}
}
}Windsurf
Add to your Windsurf MCP configuration:
{
"mcpServers": {
"ocp-mcp": {
"command": "uv",
"args": ["run", "--directory", "/path/to/ocp-mcp", "ocp-mcp"]
}
}
}Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"ocp-mcp": {
"command": "uv",
"args": ["run", "--directory", "/path/to/ocp-mcp", "ocp-mcp"]
}
}
}Replace
/path/to/ocp-mcpwith the absolute path to this repository.
Built-in Cluster Map
The server ships with pre-configured aliases for standard org environments:
Alias | API URL | OAuth URL |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Quick Start
Once the MCP server is connected to your AI client, use these commands in chat:
Register all standard clusters at once
register_standard_clusters(username="your-user", password="your-pass", set_default_alias="dev")Register with per-environment credentials
register_standard_clusters(
username="shared-user",
password="shared-pass",
credentials_by_alias={
"prod-g1": {"username": "prod-admin", "password": "prod-pass"},
"prod-g2": {"username": "prod-admin", "password": "prod-pass"}
},
set_default_alias="dev"
)Register a single custom cluster
register_cluster(
alias="custom",
api_url="https://api.my-cluster.com:6443",
oauth_url="https://oauth-openshift.my-cluster.com:6443",
username="admin",
password="secret"
)Switch default cluster
set_default_cluster(alias="uat-g1")Target a specific cluster (any tool)
list_pods(namespace="my-app", cluster_alias="prod-g1")Available Tools
Cluster Management
Tool | Description |
| Register an OpenShift cluster with credentials and optional OAuth URL |
| Register all built-in org clusters in one call |
| List all registered clusters |
| List built-in cluster aliases and URLs |
| Set the default cluster for subsequent commands |
| Remove a registered cluster |
| Re-authenticate and refresh an expired OAuth token |
Namespaces / Projects
Tool | Description |
| List all namespaces (projects) in a cluster |
Pods
Tool | Description |
| List all Pods in a namespace |
| Get detailed Pod info (status, containers, IPs, resource requests/limits) |
| Get logs from a Pod (container, tail lines, since_seconds, timestamps, previous) |
| Get logs from ALL containers in a multi-container Pod |
| Get logs from the previous crashed/terminated instance |
| Get events for a specific Pod |
Pod Operations
Tool | Description |
| List pods stuck in Terminating state |
| Force-delete a single stuck Terminating pod (grace_period=0) |
| Force-delete ALL stuck Terminating pods in a namespace |
| Find pods in CrashLoopBackOff, ImagePullBackOff, OOMKilled, etc. |
| List pods where at least one container is not ready |
Deployments
Tool | Description |
| List all Deployments in a namespace |
| Get detailed Deployment info (strategy, containers, conditions) |
| Scale a Deployment to N replicas |
| Trigger a rolling restart of a Deployment |
| Get rollout progress, conditions, and generation info |
| List revision history (ReplicaSets) with images and change cause |
| Roll back a Deployment to a previous revision |
| Get image repo/tag/version for a Deployment |
| Get image info for all Deployments in a namespace |
DeploymentConfigs (OpenShift)
Tool | Description |
| List all OpenShift DeploymentConfigs in a namespace |
| Get detailed DeploymentConfig info (triggers, strategy, containers) |
| Scale a DeploymentConfig to N replicas |
StatefulSets
Tool | Description |
| List all StatefulSets in a namespace |
| Get detailed StatefulSet info (volumes, service name) |
| Scale a StatefulSet to N replicas |
DaemonSets
Tool | Description |
| List all DaemonSets in a namespace |
| Get detailed DaemonSet info (node selector, containers) |
ReplicaSets
Tool | Description |
| List all ReplicaSets in a namespace |
Services
Tool | Description |
| List all Services in a namespace (ports, selectors, type) |
Routes (OpenShift)
Tool | Description |
| List all OpenShift Routes in a namespace |
| Get detailed Route info (host, TLS, backends) |
Ingresses
Tool | Description |
| List all Ingresses in a namespace |
| Get detailed Ingress info (rules, TLS, annotations) |
Horizontal Pod Autoscalers
Tool | Description |
| List all HPAs in a namespace |
| Get detailed HPA info (target ref, min/max/current replicas) |
Jobs & CronJobs
Tool | Description |
| List all Jobs in a namespace |
| Get detailed Job info (completions, conditions, containers) |
| List all CronJobs in a namespace |
| Get detailed CronJob info (schedule, concurrency, history) |
ConfigMaps
Tool | Description |
| List all ConfigMaps in a namespace |
| Get a ConfigMap including its data |
Secrets
Tool | Description |
| List Secrets in a namespace (metadata only, no values) |
| Get Secret metadata (type, keys, labels — no values) |
Nodes
Tool | Description |
| List all nodes (roles, capacity, conditions) |
| Get detailed node info (taints, allocatable, OS/runtime info) |
Storage
Tool | Description |
| List all PersistentVolumeClaims in a namespace |
| Get detailed PVC info (capacity, storage class, conditions) |
Network Policies
Tool | Description |
| List all NetworkPolicies in a namespace |
Events
Tool | Description |
| List events in a namespace (sorted by time) |
| Get events for a specific Pod |
Metrics (Observe)
Tool | Description |
| Real-time CPU/memory usage for all pods in a namespace |
| Real-time CPU/memory usage for a specific pod |
| Real-time CPU/memory usage for all cluster nodes |
| Compare actual usage vs requests/limits for right-sizing |
Monitoring (Observe)
Tool | Description |
| List PrometheusRules (alerting/recording rules) in a namespace |
| Get detailed rule groups, expressions, severity, and summaries |
| List ServiceMonitors (Prometheus scrape targets) |
| List PodMonitors (Prometheus pod scrape targets) |
| List AlertmanagerConfig resources |
Builds (OpenShift)
Tool | Description |
| List all BuildConfigs in a namespace |
| Get detailed BuildConfig info (strategy, source, triggers) |
| List all Builds in a namespace |
| Get detailed Build info (phase, duration, output image, log snippet) |
ImageStreams (OpenShift)
Tool | Description |
| List all ImageStreams in a namespace |
| Get detailed ImageStream info with all tags and image references |
Quotas & Limits
Tool | Description |
| List ResourceQuotas with used vs hard limits |
| List LimitRanges (default requests, limits, min, max) |
| List ServiceAccounts in a namespace |
Resource Deletion
Tool | Description |
| Delete a resource by kind and name |
Supported kinds for deletion: Pod, Deployment, StatefulSet, DaemonSet, ReplicaSet, Service, ConfigMap, Secret, Job, CronJob, PersistentVolumeClaim, Ingress, NetworkPolicy, HorizontalPodAutoscaler.
Usage Examples
Here are some common tasks you can ask the AI to perform:
Debugging a failing pod:
"Show me the logs for pod my-app-xyz in namespace production on prod-g1"
Find all crashing pods:
"List all failing pods in namespace my-app on prod-g1"
Force-delete stuck pods:
"Force-delete all terminating pods in namespace my-app on uat-g1"
Get logs from all containers in a pod:
"Get logs from all containers in pod my-app-xyz in namespace production"
Check resource usage (Observe > Metrics):
"Show me CPU and memory usage for all pods in namespace my-app on prod-g1"
Right-size pods:
"Compare actual resource usage vs requests for pods in namespace my-app on dev"
Check node capacity and usage:
"Show me top nodes by CPU usage on prod-g1"
Comparing deployments across environments:
"List the image tags for all deployments in namespace my-app on dev and uat-g1"
Rollback a bad deployment:
"Roll back deployment api-server in namespace my-app on prod-g1 to the previous revision"
Scaling for load:
"Scale deployment api-server to 5 replicas in namespace my-app on prod-g1"
Checking routes:
"List all routes in namespace my-app on uat-g1"
Investigating events:
"Show me recent events in namespace my-app on prod-g2"
Check alerting rules (Observe > Alerting):
"List all PrometheusRules in namespace openshift-monitoring on prod-g1"
View builds:
"List recent builds in namespace my-app on dev"
Check image streams:
"Show me all tags for imagestream my-app in namespace my-app on dev"
Check quotas:
"Show me resource quotas and usage in namespace my-app on prod-g1"
Token Management
Tokens are acquired via OCP's OAuth implicit flow and stored in memory only.
If a token expires, use
refresh_cluster_token(alias="dev")to re-authenticate.Restarting the MCP server clears all tokens — re-register clusters on restart.
Security Notes
No secrets exposed:
list_secretsandget_secret_metadatareturn only metadata (type, keys, labels) — never secret values.No persistent credentials: Tokens and passwords are held in-memory for the server process lifetime only.
SSL verification: Enabled by default. Set
verify_ssl=Falseonly for test clusters with self-signed certificates.
Development
# Install with dev dependencies
uv sync --extra dev
# Run tests
uv run pytest
# Run linter
uv run ruff check src/ tests/Project Structure
ocp-mcp/
├── pyproject.toml
├── README.md
├── src/ocp_mcp/
│ ├── server.py # MCP server entry point
│ ├── cluster_manager.py # Multi-cluster registry and API client management
│ ├── auth.py # OCP OAuth token acquisition
│ ├── models.py # Pydantic response models
│ ├── exceptions.py # Custom exceptions
│ └── tools/
│ ├── registry.py # Cluster registration tools
│ ├── deployments.py # Deployment operations + rollout + rollback
│ ├── ocp_deploymentconfigs.py # DeploymentConfig operations (OCP)
│ ├── workloads.py # StatefulSets, DaemonSets, ReplicaSets
│ ├── jobs.py # Jobs and CronJobs
│ ├── resources.py # Pods, Namespaces, Services, delete_resource
│ ├── pod_ops.py # Force-delete, terminating/failing/not-ready pods
│ ├── logs.py # Pod log retrieval (single, all containers, previous)
│ ├── events.py # Namespace and Pod events
│ ├── metrics.py # Real-time pod/node metrics + usage vs requests
│ ├── monitoring.py # PrometheusRules, ServiceMonitors, PodMonitors
│ ├── hpa.py # Horizontal Pod Autoscalers
│ ├── configmaps.py # ConfigMap operations
│ ├── secrets.py # Secret metadata (no values)
│ ├── quotas.py # ResourceQuotas, LimitRanges, ServiceAccounts
│ ├── image_info.py # Deployment image/tag inspection
│ ├── nodes.py # Node listing and details
│ ├── storage.py # PersistentVolumeClaim operations
│ ├── routes.py # OpenShift Route operations
│ ├── ocp_builds.py # Builds, BuildConfigs, ImageStreams (OCP)
│ └── networking.py # Ingresses and NetworkPolicies
└── tests/
├── test_auth.py
└── test_cluster_manager.pyLicense
Internal use.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- 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/badin017/ocp-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server