An MCP (Model Context Protocol) server for OpenShift Baremetal IPI (Installer-Provisioned Infrastructure) cluster provisioning. This tool helps you generate, validate, and manage install-config.yaml files, test BMC connectivity, validate network configurations, and guide you through the cluster installation process.
- Install Config Management: Generate and validate install-config.yaml files
- BMC Testing: Test Redfish/IPMI BMC connectivity
- Network Validation: Validate CIDR ranges, VIPs, and DNS configuration
- Cluster Lifecycle: Extract installer, create manifests, and manage installations
- Templates: Pre-built templates for Compact and HA deployments
ipi-provisioner-mcp/
├── mcp_server/
│ ├── config.py # Configuration and environment variables
│ ├── main.py # FastMCP server setup
│ ├── models/ # Pydantic data models
│ │ ├── install_config.py # InstallConfig models
│ │ ├── baremetal.py # Baremetal host models
│ │ └── network.py # Network configuration models
│ ├── services/ # Business logic
│ │ ├── validation_service.py # Config validation
│ │ ├── bmc_service.py # BMC operations
│ │ ├── network_service.py # Network validation
│ │ └── openshift_service.py # Installer operations
│ ├── tools/ # MCP tool implementations
│ │ ├── config_tools.py # Config generation/validation
│ │ ├── bmc_tools.py # BMC testing
│ │ ├── network_tools.py # Network validation
│ │ └── cluster_tools.py # Cluster lifecycle
│ └── utils/ # Utilities
│ ├── yaml_handler.py # YAML operations
│ └── templates.py # Template management
├── templates/ # Install-config templates
│ ├── baremetal-ipi-compact.yaml
│ └── baremetal-ipi-ha.yaml
└── tests/ # Unit tests
validate_install_config- Validate install-config.yaml contentgenerate_install_config- Generate install-config.yaml from parametersget_config_template- Get a pre-built templatelist_config_templates- List all available templatescreate_baremetal_host_entry- Create a host entry for install-config
test_bmc_connection- Test single BMC connectivity (Redfish)validate_bmc_addresses- Validate multiple BMC addressesparse_bmc_address- Parse and validate BMC address formatgenerate_bmc_test_script- Generate bash script for BMC testing
validate_network_cidr- Validate CIDR notationcheck_ip_in_network- Check if IP is in CIDR rangecheck_network_overlap- Check if two networks overlapvalidate_vip_configuration- Validate VIP configurationgenerate_dns_config- Generate DNS records for clustercalculate_cluster_network_capacity- Calculate pod network capacitygenerate_network_diagram- Generate network diagramvalidate_complete_network_config- Comprehensive network validation
check_installer_binary- Check if openshift-install existsextract_openshift_installer- Extract installer from release imagecreate_installation_manifests- Create Kubernetes manifestsprepare_cluster_installation- Prepare installation commandprepare_cluster_destroy- Prepare cluster destroy commandget_installation_status- Get installation statusget_installation_logs- Get installation logs
cd /Users/jhajyahy/mcp/ipi-provisioner-mcp
uv sync # Creates venv and installs dependencies
source .venv/bin/activate # On Windows: .venv\Scripts\activate# OpenShift Configuration
export OPENSHIFT_RELEASE_IMAGE="quay.io/openshift-release-dev/ocp-release:4.17.0-x86_64"
export PULL_SECRET_PATH="$HOME/pull-secret.json"
export SSH_KEY_PATH="$HOME/.ssh/id_rsa.pub"
# MCP Transport (default: stdio)
export MCP_TRANSPORT="stdio" # or "sse" for web-based integration
export MCP_HOST="127.0.0.1" # for sse transport
export MCP_PORT="8000" # for sse transportAdd to your ~/.config/claude-desktop/mcp.json or ~/.cursor/mcp.json:
{
"mcpServers": {
"ipi-provisioner": {
"command": "uv",
"args": ["run", "python", "/Users/jhajyahy/mcp/ipi-provisioner-mcp/main.py"],
"description": "IPI Cluster Provisioning Assistant for OpenShift Baremetal",
"env": {
"OPENSHIFT_RELEASE_IMAGE": "quay.io/openshift-release-dev/ocp-release:4.17.0-x86_64",
"PULL_SECRET_PATH": "/path/to/pull-secret.json",
"SSH_KEY_PATH": "/path/to/id_rsa.pub"
}
}
}
}User: List available install-config templates
Response shows Compact and HA templates with descriptions.
User: Generate an install-config for a 3-master HA cluster named 'prod-cluster'
with base domain 'example.com', API VIP 192.168.1.10, Ingress VIP 192.168.1.11
User: Validate this install-config.yaml:
[paste your config]
Returns validation errors, warnings, and a summary.
User: Test BMC connection to redfish://192.168.1.100 with username admin and password secret
User: Validate network config with cluster CIDR 10.128.0.0/14, service CIDR 172.30.0.0/16,
machine CIDR 192.168.1.0/24, API VIP 192.168.1.10, Ingress VIP 192.168.1.11
User: Generate DNS config for cluster 'ocp' with base domain 'example.com',
API VIP 192.168.1.10, Ingress VIP 192.168.1.11, and hosts:
- master-0 with IP 192.168.1.20
- master-1 with IP 192.168.1.21
- master-2 with IP 192.168.1.22
This will generate A and PTR records for all cluster components including the API VIP, Ingress VIP, and all hosts.
User: Extract openshift-install from release image
quay.io/openshift-release-dev/ocp-release:4.17.0-x86_64
User: Get installation status for /path/to/install-dir
- Validate config:
validate_install_config(yaml_content) - Validate networks:
validate_complete_network_config(...) - Validate BMCs:
validate_bmc_addresses(hosts) - Generate DNS config:
generate_dns_config(...)
- Check status:
get_installation_status(install_dir) - Get logs:
get_installation_logs(install_dir, lines=100) - Validate network:
validate_complete_network_config(...) - Test BMCs:
validate_bmc_addresses(hosts)
Run the test suite:
uv run pytest tests/ -v-
baremetal-ipi-compact.yaml - Compact Cluster
- 3 master nodes (also act as workers)
- Requires API and Ingress VIPs
- Good for resource-constrained environments
-
baremetal-ipi-ha.yaml - High Availability
- 3 master nodes
- 2+ dedicated worker nodes
- Requires API and Ingress VIPs
- Production-ready configuration
- Physical network for baremetal hosts
- Contains API VIP and Ingress VIP (for HA)
- Example: 192.168.1.0/24
- Virtual network for pod-to-pod communication
- Example: 10.128.0.0/14
- Each node gets a /23 subnet (510 IPs per node)
- Virtual network for Kubernetes services
- Example: 172.30.0.0/16
api.<cluster_name>.<base_domain>→ API VIP*.apps.<cluster_name>.<base_domain>→ Ingress VIP (wildcard)<hostname>.<base_domain>→ Host IP (for each cluster node)
- API VIP →
api.<cluster_name>.<base_domain> - Each host IP →
<hostname>.<base_domain>
Example for cluster 'ocp' with domain 'example.com':
# A Records
api.ocp.example.com. A 10.1.235.200
*.apps.ocp.example.com. A 10.1.235.201
master-0.example.com. A 10.1.235.25
master-1.example.com. A 10.1.235.26
master-2.example.com. A 10.1.235.27
# PTR Records
200.235.1.10.in-addr.arpa. PTR api.ocp.example.com.
25.235.1.10.in-addr.arpa. PTR master-0.example.com.
26.235.1.10.in-addr.arpa. PTR master-1.example.com.
27.235.1.10.in-addr.arpa. PTR master-2.example.com.
- Redfish (recommended)
- Redfish Virtual Media
- IPMI
- iDRAC Virtual Media
- Redfish:
redfish://192.168.1.100orredfish+https://192.168.1.100:443 - IPMI:
ipmi://192.168.1.100
-
BMC Connection Failures
- Use
test_bmc_connectionto verify connectivity - Check BMC credentials
- Verify network connectivity to BMC
- Use
-
Network Validation Errors
- Use
validate_complete_network_configto check for overlaps - Ensure VIPs are in machine network range
- Verify DNS is configured correctly
- Use
-
Installation Failures
- Use
get_installation_logsto check logs - Verify all BMCs are reachable
- Check network configuration
- Ensure DNS records exist (for HA)
- Use
Contributions are welcome! Please ensure:
- All tests pass:
uv run pytest tests/ -v - Code follows existing patterns
- Add tests for new functionality
Apache 2.0
Built for OpenShift Metal Platform Team