
kube mcp2
提供与 OpenShift/Kubernetes 集群交互的工具和资源。
Repository Info
About This Server
提供与 OpenShift/Kubernetes 集群交互的工具和资源。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
OpenShift MCP Server
This is a Model Context Protocol (MCP) server that provides tools for interacting with OpenShift/Kubernetes clusters.
Features
- Modular codebase for maintainability (all core logic is under
src/openshift_mcp_server/) - Security checks for deployment manifests (enforced during deployment creation)
- Standardized error handling and logging
- List namespaces, pods, deployments, services, and routes
- Get pod logs and service/route details
- Validate OpenShift manifests for best practices
- Get cluster information and resources
Project Structure
src/openshift_mcp_server/: Main server and tool modulesserver.py: MCP server setup and tool/resource registrationtools.py: All tool/resource implementationsconfig.py: Environment variable and configuration managementerrors.py: Standardized error responseslogging_utils.py: Logging configurationsecurity.py: Security validation for manifests
tests/: Test suite (pytest-based).gitignore: Excludes venvs, caches, and local configs
Setup
- Install dependencies:
pip install -r requirements.txt - Configure cluster access:
- Via
~/.kube/config(default) - Or set these environment variables:
OPENSHIFT_SERVER(API URL)OPENSHIFT_USERNAME/OPENSHIFT_PASSWORD
- Via
Usage
From the project root:
To run the server in development mode:
PYTHONPATH=src mcp dev src/openshift_mcp_server/server.py
To install the server in Claude Desktop:
PYTHONPATH=src mcp install src/openshift_mcp_server/server.py
Available Tools
list_namespaces(ctx): Lists all namespaceslist_pods(namespace, ctx): Lists pods in a namespaceget_pod_logs(namespace, pod_name, ctx, container=None): Gets logs from a podlist_deployments(namespace, ctx): Lists deployments in a namespacelist_services(namespace, ctx): Lists services in a namespaceget_service(namespace, service_name, ctx): Gets details for a servicelist_routes(namespace, ctx): Lists OpenShift routesget_route(namespace, route_name, ctx): Gets details for a routecreate_deployment(namespace, deployment_manifest, ctx): Creates a deployment (with security checks)validate_openshift_manifest(manifest, ctx): Validates a deployment manifest for best practices
Available Resources
cluster://info: Get basic cluster informationcluster://services: List all services across namespaces
Security & Error Handling
- All deployments are validated for dangerous fields (e.g.,
hostNetwork,privileged,hostPath, etc.) - Standardized error responses and logging for all tools
Testing
Run all tests using:
PYTHONPATH=src pytest tests/
Note: Because the source code is inside the src directory, you must set PYTHONPATH=src when running tests. This ensures Python can find the openshift_mcp_server package. If you are on Windows using PowerShell, use:
$env:PYTHONPATH="src"; pytest tests/
Or in CMD:
set PYTHONPATH=src
pytest tests/
Notes
- Ensure your environment variables or kubeconfig are set up before running the server.
- For local development, activate your virtual environment and install requirements first.
Quick Start
Clone the repository
git clone https://github.com/lochgeo/kube-mcp2Install dependencies
cd kube-mcp2
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.