{
  "markdown": "# OpenShift MCP Server\n\n[![CI Pipeline](https://github.com/sanjaypsachdev/mcp-server-openshift/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/sanjaypsachdev/mcp-server-openshift/actions/workflows/ci.yml)\n[![CodeQL](https://github.com/sanjaypsachdev/mcp-server-openshift/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/sanjaypsachdev/mcp-server-openshift/actions/workflows/codeql.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Node.js Version](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org/)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.5.0-blue.svg)](https://www.typescriptlang.org/)\n[![OpenShift](https://img.shields.io/badge/OpenShift-4.x-red.svg)](https://www.redhat.com/en/technologies/cloud-computing/openshift)\n[![Kubernetes](https://img.shields.io/badge/Kubernetes-1.25%2B-blue.svg)](https://kubernetes.io/)\n[![MCP](https://img.shields.io/badge/MCP-Model%20Context%20Protocol-purple.svg)](https://modelcontextprotocol.io/)\n[![Test Coverage](https://img.shields.io/badge/coverage-80%25-green.svg)](./coverage)\n[![Tests](https://img.shields.io/badge/tests-99%20passing-brightgreen.svg)](#testing)\n[![npm version](https://img.shields.io/npm/v/mcp-server-openshift.svg)](https://www.npmjs.com/package/mcp-server-openshift)\n[![npm downloads](https://img.shields.io/npm/dm/mcp-server-openshift.svg)](https://www.npmjs.com/package/mcp-server-openshift)\n[![Docker](https://img.shields.io/badge/docker-supported-blue.svg)](https://hub.docker.com/r/sanjaypsachdev/mcp-server-openshift)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](./CONTRIBUTING.md)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/sanjaypsachdev/mcp-server-openshift/graphs/commit-activity)\n\nA Model Context Protocol (MCP) server that provides AI assistants with comprehensive OpenShift/Kubernetes cluster management capabilities through the `oc` command-line interface.\n\n## Demo Video\n\nWatch the `oc-new-app` tool deploy a complete Spring Boot application from GitHub to OpenShift:\n\nhttps://github.com/user-attachments/assets/f4bace3f-755b-462f-8a8a-680e4dc02129\n\n## Features\n\n- **Cluster Information**: Access comprehensive cluster status, nodes and configuration via MCP resources\n- **Resource Description**: Describe any resource with multiple output formats including human-readable summaries\n- **Complete Resource Management**: Create, read, update, delete, and patch all OpenShift/Kubernetes resources\n- **Application Deployment**: Deploy applications from Git repositories with S2I builds and automatic route creation\n- **Operator Management**: Install operators via OLM, Helm, or direct manifests\n- **Cluster Operations**: Scaling, monitoring, troubleshooting and management\n- **Build Operations**: Start and monitor OpenShift builds\n- **Scaling Operations**: Scale deployments, replicasets and statefulsets\n- **Logging**: Retrieve logs from pods and builds\n- **Multi-Transport Support**: STDIO and HTTP/SSE transports for different integration scenarios\n- **Comprehensive Testing**: 99 unit tests ensuring production reliability\n- **Rich Error Handling**: Detailed troubleshooting guidance and actionable error messages\n- **Troubleshooting Prompts**: Interactive troubleshooting guides for common OpenShift scenarios\n- **Log Sampling**: Sample and analyze pod logs with intelligent pattern detection and context\n\n## Prerequisites\n\n- Node.js 18+\n- OpenShift CLI (`oc`) installed and configured\n- Access to an OpenShift cluster\n\n## Installation\n\n```bash\ngit clone https://github.com/sanjaypsachdev/mcp-server-openshift.git\ncd mcp-server-openshift\nnpm install\nnpm run build\n```\n\n## Configuration\n\nAdd to your MCP client configuration:\n\n### Claude Desktop / Cursor\n\n```json\n{\n  \"mcpServers\": {\n    \"openshift\": {\n      \"command\": \"node\",\n      \"args\": [\"/path/to/mcp-server-openshift/dist/index.js\"],\n      \"env\": {\n        \"OPENSHIFT_CONTEXT\": \"your-context-name\",\n        \"OPENSHIFT_NAMESPACE\": \"your-default-namespace\"\n      }\n    }\n  }\n}\n```\n\n### HTTP/SSE Transport (Remote Access)\n\n```bash\n# Start HTTP server\nnpm run start:http\n\n# Connect via MCP remote\nnpx -y mcp-remote http://localhost:3000/sse --transport sse-only\n```\n\n## Tools\n\n### Authentication & Access\n\n- **`oc_login`** - Securely log into OpenShift clusters using token or username/password authentication\n\n### API Discovery & Documentation\n\n- **`oc_api_resources`** - List all available API resources in the cluster with categorization\n- **`oc_explain`** - Explain resource schemas, fields, and API documentation\n\n### Core Resource Management\n\n- **`oc_get`** - Get OpenShift resources (pods, deployments, services, routes, etc.)\n- **`oc_create`** - Create OpenShift resources from manifests or templates\n- **`oc_apply`** - Apply YAML manifests with validation and conflict resolution\n- **`oc_delete`** - Delete resources with safety checks and confirmation options\n- **`oc_patch`** - Patch resources using strategic merge, JSON merge, or JSON patch operations\n- **`oc_describe`** - Describe resources with multiple output formats\n\n### Application Lifecycle\n\n- **`oc_new_app`** - Deploy applications from Git repositories with S2I builds\n- **`oc_scale`** - Scale deployments, deploymentconfigs, replicasets, and statefulsets\n- **`oc_logs`** - Get logs from pods, deployments, builds with filtering options\n\n### Advanced Operations\n\n- **`oc_install_operator`** - Install operators via OLM, Helm, or direct manifests\n\n## Resources\n\nMCP Resources provide read-only access to cluster information:\n\n- **`openshift://cluster-info`** - Comprehensive cluster status, nodes, namespaces, and events\n- **`openshift://project-list`** - Detailed project information with quotas and usage statistics\n- **`openshift://app-templates`** - Application deployment templates and patterns\n\n## Prompts\n\nInteractive troubleshooting and operational guidance:\n\n- **`troubleshoot-openshift-prompt`** - Comprehensive OpenShift troubleshooting guide for all resource types and cluster issues\n- **`monitoring-prompts`** - Monitoring and observability guidance for different scenarios\n\n## Sampling\n\nIntelligent log analysis and pattern detection:\n\n- **Pod Logs Sampling** - Automatic log sampling with error pattern detection and context analysis\n\n## Usage Examples\n\n### Login to Cluster\n\n```bash\n# Login with token (recommended)\noc_login with server: \"https://api.cluster.example.com:6443\",\n         authMethod: \"token\",\n         token: \"sha256~your-token-here\"\n\n# Login with username/password\noc_login with server: \"https://api.cluster.example.com:6443\",\n         authMethod: \"password\",\n         username: \"developer\",\n         password: \"your-password\"\n```\n\n### Discover API Resources\n\n```bash\n# List all available API resources\noc_api_resources\n\n# List resources for specific API group\noc_api_resources with apiGroup: \"apps\"\n\n# List only namespaced resources\noc_api_resources with namespaced: true\n\n# Explain a resource schema\noc_explain with resource: \"deployment\"\n\n# Explain specific field\noc_explain with resource: \"pod\", field: \"spec.containers\"\n```\n\n### Deploy Application\n\n```bash\n# Deploy Node.js app from GitHub\noc_new_app with gitRepo: \"https://github.com/sclorg/nodejs-ex.git\"\n```\n\n### Scale Application\n\n```bash\n# Scale deployment to 3 replicas\noc_scale with name: \"my-app\", replicas: 3\n```\n\n### Patch Resource\n\n```bash\n# Update deployment labels\noc_patch with resourceType: \"deployment\", name: \"my-app\",\n         patch: '{\"metadata\":{\"labels\":{\"environment\":\"production\"}}}'\n```\n\n### Troubleshoot Issues\n\n```bash\n# Get pod troubleshooting guidance\nUse prompt: troubleshoot-openshift-prompt\nArguments: issueType: \"pod\", resourceName: \"my-app-12345\", namespace: \"my-project\"\n\n# Get deployment troubleshooting guidance\nUse prompt: troubleshoot-openshift-prompt\nArguments: issueType: \"deployment\", resourceName: \"my-app\", namespace: \"my-project\"\n\n# Get general cluster troubleshooting guidance\nUse prompt: troubleshoot-openshift-prompt\nArguments: issueType: \"cluster\", symptoms: \"nodes not ready\"\n```\n\n## Development\n\n```bash\n# Setup\nnpm install\n\n# Build\nnpm run build\n\n# Test\nnpm test\n\n# Start (STDIO)\nnpm start\n\n# Start (HTTP)\nnpm run start:http\n\n# Development mode\nnpm run dev\n```\n\n## Transport Modes\n\n### STDIO (Default)\n\n- Direct MCP client integration\n- Lower latency\n- Recommended for local development\n\n### HTTP/SSE\n\n- Remote access capability\n- Web integration friendly\n- Container deployment ready\n\n## Architecture\n\n```\nsrc/\n├── index.ts              # Main server entry point\n├── tools/                # Tool implementations\n├── resources/            # MCP resources\n├── prompts/              # Interactive prompts\n├── sampling/             # Log sampling and analysis\n├── models/               # Zod validation schemas\n└── utils/                # OpenShift CLI wrapper\n```\n\n## Security\n\n### Authentication Security\n\n- **Token Authentication**: Preferred method for automation and production use\n- **Password Authentication**: Available but token authentication is recommended\n- **HTTPS Enforcement**: All cluster connections must use HTTPS\n- **URL Validation**: Server URLs validated to prevent SSRF attacks\n- **Private IP Blocking**: Prevents connections to internal/metadata services\n\n### Operational Security\n\n- **RBAC Compliance**: Respects OpenShift RBAC permissions\n- **No Credential Storage**: Credentials are not stored or transmitted by the server\n- **User Permissions**: Executes with the same permissions as the authenticated user\n- **Input Validation**: Comprehensive validation of all inputs and parameters\n- **Secure Defaults**: Conservative security settings by default\n\n### Best Practices\n\n- **Use Service Account Tokens**: For automation and CI/CD pipelines\n- **Regular Token Rotation**: Rotate authentication tokens regularly\n- **TLS Certificate Validation**: Always validate TLS certificates in production\n- **Least Privilege**: Use accounts with minimal required permissions\n- **Session Management**: Use `oc logout` to clear credentials when done\n\n## License\n\nMIT License - see LICENSE file for details.\n",
  "bytes": 10197,
  "sha": "fa26d2e0f56ec53352b596b97e22ad6149c0352ec83b955c7c1ee3029842cf7c",
  "repo_slug": "sanjaypsachdev/mcp-server-openshift",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_sanjaypsachdev_mcp_server_open_d6470ce2/readme"
}