OpenShift MCP Server
This server lets AI assistants manage OpenShift/Kubernetes clusters via the oc CLI.
Authenticate to clusters using token or username/password.
Discover API resources and explain resource schemas/fields.
Get, create, apply, patch, describe, and delete OpenShift/Kubernetes resources.
Deploy applications from Git repositories using S2I builds and create routes.
Scale deployments, deploymentconfigs, replicasets, and statefulsets.
Retrieve and sample pod/build logs with filtering and pattern detection.
Install operators via OLM, Helm, or direct manifests.
Expose services/deployments with edge, passthrough, or reencrypt routes.
Access read-only cluster/project/template information through MCP resources.
Use interactive troubleshooting and monitoring prompts.
Run over STDIO or HTTP/SSE transports with RBAC-respecting, validated operations.
Supports installing operators via Helm charts.
Provides comprehensive OpenShift/Kubernetes cluster management capabilities through the oc CLI, including resource management, scaling, logging, and application deployment.
Click on "Deploy 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 MCP Server list pods in the default namespace"
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 MCP Server
A Model Context Protocol (MCP) server that provides AI assistants with comprehensive OpenShift/Kubernetes cluster management capabilities through the oc command-line interface.
Demo Video
Watch the oc-new-app tool deploy a complete Spring Boot application from GitHub to OpenShift:
https://github.com/user-attachments/assets/f4bace3f-755b-462f-8a8a-680e4dc02129
Related MCP server: OpenShift MCP Server
Features
Cluster Information: Access comprehensive cluster status, nodes and configuration via MCP resources
Resource Description: Describe any resource with multiple output formats including human-readable summaries
Complete Resource Management: Create, read, update, delete, and patch all OpenShift/Kubernetes resources
Application Deployment: Deploy applications from Git repositories with S2I builds and automatic route creation
Operator Management: Install operators via OLM, Helm, or direct manifests
Cluster Operations: Scaling, monitoring, troubleshooting and management
Build Operations: Start and monitor OpenShift builds
Scaling Operations: Scale deployments, replicasets and statefulsets
Logging: Retrieve logs from pods and builds
Multi-Transport Support: STDIO and HTTP/SSE transports for different integration scenarios
Comprehensive Testing: 99 unit tests ensuring production reliability
Rich Error Handling: Detailed troubleshooting guidance and actionable error messages
Troubleshooting Prompts: Interactive troubleshooting guides for common OpenShift scenarios
Log Sampling: Sample and analyze pod logs with intelligent pattern detection and context
Prerequisites
Node.js 20+
OpenShift CLI (
oc) installed and configuredAccess to an OpenShift cluster
Installation
git clone https://github.com/sanjaypsachdev/mcp-server-openshift.git
cd mcp-server-openshift
npm install
npm run buildConfiguration
Add to your MCP client configuration:
Claude Desktop / Cursor
{
"mcpServers": {
"openshift": {
"command": "node",
"args": ["/path/to/mcp-server-openshift/dist/index.js"],
"env": {
"OPENSHIFT_CONTEXT": "your-context-name",
"OPENSHIFT_NAMESPACE": "your-default-namespace"
}
}
}
}HTTP/SSE Transport (Remote Access)
# Start HTTP server
npm run start:http
# Connect via MCP remote
npx -y mcp-remote http://localhost:3000/sse --transport sse-onlyTools
Authentication & Access
oc_login- Securely log into OpenShift clusters using token or username/password authentication
API Discovery & Documentation
oc_api_resources- List all available API resources in the cluster with categorizationoc_explain- Explain resource schemas, fields, and API documentation
Core Resource Management
oc_get- Get OpenShift resources (pods, deployments, services, routes, etc.)oc_create- Create OpenShift resources from manifests or templatesoc_apply- Apply YAML manifests with validation and conflict resolutionoc_delete- Delete resources with safety checks and confirmation optionsoc_patch- Patch resources using strategic merge, JSON merge, or JSON patch operationsoc_describe- Describe resources with multiple output formats
Application Lifecycle
oc_new_app- Deploy applications from Git repositories with S2I buildsoc_scale- Scale deployments, deploymentconfigs, replicasets, and statefulsetsoc_logs- Get logs from pods, deployments, builds with filtering options
Advanced Operations
oc_install_operator- Install operators via OLM, Helm, or direct manifests
Resources
MCP Resources provide read-only access to cluster information:
openshift://cluster-info- Comprehensive cluster status, nodes, namespaces, and eventsopenshift://project-list- Detailed project information with quotas and usage statisticsopenshift://app-templates- Application deployment templates and patterns
Prompts
Interactive troubleshooting and operational guidance:
troubleshoot-openshift-prompt- Comprehensive OpenShift troubleshooting guide for all resource types and cluster issuesmonitoring-prompts- Monitoring and observability guidance for different scenarios
Sampling
Intelligent log analysis and pattern detection:
Pod Logs Sampling - Automatic log sampling with error pattern detection and context analysis
Usage Examples
Login to Cluster
# Login with token (recommended)
oc_login with server: "https://api.cluster.example.com:6443",
authMethod: "token",
token: "sha256~your-token-here"
# Login with username/password
oc_login with server: "https://api.cluster.example.com:6443",
authMethod: "password",
username: "developer",
password: "your-password"Discover API Resources
# List all available API resources
oc_api_resources
# List resources for specific API group
oc_api_resources with apiGroup: "apps"
# List only namespaced resources
oc_api_resources with namespaced: true
# Explain a resource schema
oc_explain with resource: "deployment"
# Explain specific field
oc_explain with resource: "pod", field: "spec.containers"Deploy Application
# Deploy Node.js app from GitHub
oc_new_app with gitRepo: "https://github.com/sclorg/nodejs-ex.git"Scale Application
# Scale deployment to 3 replicas
oc_scale with name: "my-app", replicas: 3Patch Resource
# Update deployment labels
oc_patch with resourceType: "deployment", name: "my-app",
patch: '{"metadata":{"labels":{"environment":"production"}}}'Troubleshoot Issues
# Get pod troubleshooting guidance
Use prompt: troubleshoot-openshift-prompt
Arguments: issueType: "pod", resourceName: "my-app-12345", namespace: "my-project"
# Get deployment troubleshooting guidance
Use prompt: troubleshoot-openshift-prompt
Arguments: issueType: "deployment", resourceName: "my-app", namespace: "my-project"
# Get general cluster troubleshooting guidance
Use prompt: troubleshoot-openshift-prompt
Arguments: issueType: "cluster", symptoms: "nodes not ready"Development
# Setup
npm install
# Build
npm run build
# Test
npm test
# Start (STDIO)
npm start
# Start (HTTP)
npm run start:http
# Development mode
npm run devTransport Modes
STDIO (Default)
Direct MCP client integration
Lower latency
Recommended for local development
HTTP/SSE
Remote access capability
Web integration friendly
Container deployment ready
Architecture
src/
├── index.ts # Main server entry point
├── tools/ # Tool implementations
├── resources/ # MCP resources
├── prompts/ # Interactive prompts
├── sampling/ # Log sampling and analysis
├── models/ # Zod validation schemas
└── utils/ # OpenShift CLI wrapperSecurity
Authentication Security
Token Authentication: Preferred method for automation and production use
Password Authentication: Available but token authentication is recommended
HTTPS Enforcement: All cluster connections must use HTTPS
URL Validation: Server URLs validated to prevent SSRF attacks
Private IP Blocking: Prevents connections to internal/metadata services
Operational Security
RBAC Compliance: Respects OpenShift RBAC permissions
No Credential Storage: Credentials are not stored or transmitted by the server
User Permissions: Executes with the same permissions as the authenticated user
Input Validation: Comprehensive validation of all inputs and parameters
Secure Defaults: Conservative security settings by default
Best Practices
Use Service Account Tokens: For automation and CI/CD pipelines
Regular Token Rotation: Rotate authentication tokens regularly
TLS Certificate Validation: Always validate TLS certificates in production
Least Privilege: Use accounts with minimal required permissions
Session Management: Use
oc logoutto clear credentials when done
License
MIT License - see LICENSE file for details.
Available Tools
14 toolsoc_api_resourcesA
List all available API resources in the OpenShift cluster with their details
Inputs: verbs, output, context, apiGroup, +2 more.
oc_applyC
Apply YAML manifests to OpenShift cluster with comprehensive error handling and validation for all scenarios
Inputs: url, wait, force, prune, +16 more.
oc_createC
Create OpenShift resources like projects, deploymentconfigs, routes, etc.
Inputs: name, image, dryRun, context, +9 more.
oc_deleteB
Delete OpenShift resources with comprehensive safety checks, validation, and error handling
Inputs: all, url, name, wait, +16 more.
oc_describeB
Describe any OpenShift resource and share the output in various formats including human-readable summary
Inputs: name (required), resourceType (required), output, context, +1 more.
oc_explainB
Explain OpenShift/Kubernetes resource schemas, fields, and API documentation
Inputs: resource (required), field, output, context, +2 more.
oc_exposeC
Expose an OpenShift resource (service, deployment, etc.) with secure route endpoints supporting SSL/TLS termination
Inputs: name (required), resourceType (required), key, path, +16 more.
oc_getC
Get OpenShift resources like pods, deploymentconfigs, routes, projects, etc.
Inputs: resourceType (required), name, output, context, +4 more.
oc_install_operatorA
Install an Operator on the OpenShift/Kubernetes cluster using OLM, Helm, or direct manifests
Inputs: operatorName (required), source, channel, context, +6 more.
oc_loginB
Securely log into an OpenShift cluster using username/password or token authentication
Inputs: server (required), authMethod (required), token, context, +6 more.
oc_logsB
Get logs from OpenShift resources like pods, deployments, builds, etc. with advanced filtering and streaming options
Inputs: name (required), tail, since, follow, +11 more.
oc_new_appB
Create a new application from a GitHub repository using S2I build and expose it with an edge-terminated route
Inputs: gitRepo (required), env, gitRef, labels, +9 more.
oc_patchC
Patch OpenShift resources with strategic merge, JSON merge, or JSON patch operations
Inputs: name (required), patch (required), resourceType (required), force, +7 more.
oc_scaleA
Scale the number of pods in a deployment, deploymentconfig, replicaset, or statefulset to the specified number of replicas
Inputs: name (required), replicas (required), context, namespace, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
Each tool maps to a distinct OpenShift operation (get vs. describe vs. create vs. apply, etc.) with clear boundaries. The functions are well-separated and unlikely to be confused.
All tools follow a consistent oc_ prefix with snake_case verb or noun forms (e.g., oc_describe, oc_new_app, oc_api_resources). The naming pattern is uniform and predictable.
14 tools is well within the ideal range for a domain-specific server covering common OpenShift operations. Each tool serves a necessary purpose without redundancy.
The set covers the full lifecycle: authentication (login), resource discovery (api_resources, explain), creation/updating (create, apply, patch, new_app), inspection (get, describe, logs), scaling, exposure, and deletion. Operators are also supported. No critical gaps for typical cluster management.
Maintenance
Related MCP Connectors
Deploy, monitor, and manage your OpenClaw AI assistants via natural language.
Fail-closed policy guardrails for AI agents running kubectl, terraform, helm, and argocd.
Provides capabilities that let LLM agents perform a range of infrastructure management tasks.
Query your team's drift, vulnerability, and upgrade data from any AI assistant. OAuth 2.1, 51 tools.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables managing Kubernetes clusters through natural language by providing tools to list resources, view logs, port-forward services, scale deployments, and execute kubectl operations via AI assistants.81MIT
- FlicenseAqualityDmaintenanceEnables diagnostics and troubleshooting of OpenShift clusters through storage analysis, resource monitoring, GPU utilization tracking, and pod health checks using Prometheus metrics and the oc CLI.11-
- AlicenseNot gradedqualityDmaintenanceEnables LLMs like Claude to securely execute Kubernetes CLI tools (kubectl, helm, istioctl, argocd) across multiple clusters through dynamic kubeconfig support, allowing natural language Kubernetes management and operations.5MIT
- FlicenseNot gradedqualityDmaintenanceEnables management of Red Hat OpenShift clusters through the OpenShift Cluster Manager API, allowing users to interact with cluster resources using natural language.8-