OpenStack operations automation MCP server
Project description
MCP-OpenStack-Ops
MCP OpenStack Operations Server: A comprehensive MCP (Model Context Protocol) server providing OpenStack cluster management and monitoring capabilities. Optimized for OpenStack Epoxy (2025.1) with SDK version 4.1.0-4.4.0.
🎯 Target Environment: This MCP server is specifically designed and tested for OpenStack Epoxy (2025.1) using OpenStack SDK 4.1.0-4.4.0. For optimal compatibility and performance, ensure your OpenStack environment is running Epoxy release.
Features
- ✅ OpenStack Epoxy Integration: Direct integration with OpenStack SDK 4.1.0-4.4.0 for real-time cluster operations.
- ✅ Comprehensive Monitoring: Enhanced cluster status reports with hypervisor health, resource utilization, and health scoring.
- ✅ Complete Service Coverage: 24 comprehensive tools covering Identity, Compute, Network, Storage, Image, and Orchestration services.
- ✅ Advanced Instance Management: Start, stop, restart, pause/unpause OpenStack instances with pagination support.
- ✅ Large-Scale Environment Support: Pagination and limits for environments with thousands of instances.
- ✅ Enterprise Features: User management, role assignments, keypair management, floating IP operations, volume snapshots.
- ✅ Intelligent Search: Flexible instance search with partial matching and case-sensitive options.
- ✅ Network & Volume Operations: Comprehensive network analysis and volume management capabilities.
- ✅ Connection Optimization: Global connection caching and automatic retry mechanisms.
- ✅ Docker Support: Containerized deployment optimized for OpenStack Epoxy environments.
- ✅ Flexible Transport: Support for both
stdioandstreamable-httptransports with comprehensive logging.
⚠️ Compatibility Notice: This MCP server is developed and optimized for OpenStack Epoxy (2025.1) as the primary target environment. However, it is compatible with most modern OpenStack releases (Dalmatian, Caracal, Bobcat, etc.) as the majority of APIs remain consistent across versions. Only a few specific API endpoints may require adaptation for full compatibility with older releases.
🚧 Coming Soon: Dynamic multi-version OpenStack API compatibility is actively under development and will be available in upcoming releases, providing seamless support for all major OpenStack deployments automatically.
Screenshots
OpenStack Dashboard (Epoxy 2025.1)
MCP Query Example - Cluster Status
MCP Tools Available
🔍 Monitoring & Status Tools
get_cluster_status- Enhanced comprehensive cluster analysis- Compute nodes: hypervisor status, resource utilization (CPU/memory/disk)
- Instance analysis: status distribution, availability zones, detailed info
- Network resources: external networks, floating IPs, routers, security groups
- Storage resources: volumes by status, snapshots, volume types
- Service status: service health, compute services monitoring
- Health scoring: overall cluster health with issue detection
get_service_status- OpenStack service health and API endpoint statusget_instance_details- Detailed information for specific instances with pagination support- Supports filtering by instance names or IDs
- Pagination parameters:
limit(default 50, max 200),offset(default 0) - Performance metrics and processing time tracking
search_instances- Advanced instance search with flexible criteria- Search fields: name, status, host, flavor, image, availability_zone, all
- Partial string matching with case-sensitive options
- Optimized 2-phase search for large environments
get_instance_by_name- Quick lookup for specific instance by nameget_instances_by_status- Filter instances by operational statusmonitor_resources- Real-time resource usage and capacity monitoring
🌐 Network Management Tools
get_network_details- Network, subnet, router, and security group detailsget_floating_ips- Floating IP allocation and status informationmanage_floating_ip- Create, delete, associate/disassociate floating IPsget_routers- Router status and configuration detailsget_security_groups- Security group rules and configuration
💾 Storage Management Tools
manage_volume- Volume management operations (create/delete/list/extend)get_volume_types- Available volume types and specificationsget_volume_snapshots- Volume snapshot status and managementmanage_snapshot- Create, delete, and manage volume snapshots
⚙️ Instance & Compute Management
manage_instance- Instance lifecycle operations (start/stop/restart/pause/unpause)get_keypair_list- SSH keypair management and listingmanage_keypair- Create, delete SSH keypairs for instance access
👥 Identity & Access Management
get_user_list- OpenStack user accounts and detailsget_role_assignments- User role assignments and permissions
🖼️ Image Management
manage_image- Create, delete, list, and manage OpenStack images
🔥 Orchestration (Heat) Tools
get_heat_stacks- Heat stack status and informationmanage_heat_stack- Create, delete, and manage Heat orchestration stacks
Quick Start
1. Environment Setup
# Clone and navigate to project
cd MCP-OpenStack-Ops
# Install dependencies
uv sync
# Configure environment
cp .env.example .env
# Edit .env with your OpenStack credentials
Environment Configuration
Configure your .env file with OpenStack credentials:
# OpenStack Authentication (required)
OS_AUTH_HOST=your-openstack-host
OS_AUTH_PORT=5000
OS_IDENTITY_API_VERSION=3
OS_USERNAME=your-username
OS_PASSWORD=your-password
OS_PROJECT_NAME=your-project
OS_PROJECT_DOMAIN_NAME=default
OS_USER_DOMAIN_NAME=default
OS_REGION_NAME=RegionOne
# OpenStack Service Ports (customizable)
OS_COMPUTE_PORT=8774
OS_NETWORK_PORT=9696
OS_VOLUME_PORT=8776
OS_IMAGE_PORT=9292
OS_PLACEMENT_PORT=8780
OS_HEAT_STACK_PORT=8004
OS_HEAT_STACK_CFN_PORT=8000
# MCP Server Configuration (optional)
MCP_LOG_LEVEL=INFO
ALLOW_MODIFY_OPERATIONS=false
FASTMCP_TYPE=stdio
FASTMCP_HOST=127.0.0.1
FASTMCP_PORT=8080
2. Run Server
# Start all services
docker-compose up -d
# Check logs
docker-compose logs mcp-server
docker-compose logs mcpo-proxy
Container Architecture:
- mcp-server: OpenStack MCP server with tools
- mcpo-proxy: OpenAPI (REST-API)
- open-webui: Web interface for testing and interaction
Service URLs - Docker Internal:
- MCP Server:
localhost:8080(HTTP transport) - MCPO Proxy:
localhost:8000(OpenStack API proxy) - Open WebUI:
localhost:3000(Web interface)
Service URLs - Docker External:
- MCP Server:
host.docker.internal:18005(HTTP transport) - MCPO Proxy:
host.docker.internal:8005(OpenStack API proxy) - Open WebUI:
host.docker.internal:3005(Web interface)
For Claude Desktop Integration
Add to your Claude Desktop configuration:
{
"mcpServers": {
"openstack-ops": {
"command": "uvx",
"args": ["--python", "3.11", "mcp-openstack-ops"],
"env": {
"OS_AUTH_HOST": "your-openstack-host",
"OS_AUTH_PORT": "5000",
"OS_PROJECT_NAME": "your-project",
"OS_USERNAME": "your-username",
"OS_PASSWORD": "your-password",
"OS_USER_DOMAIN_NAME": "Default",
"OS_PROJECT_DOMAIN_NAME": "Default",
"OS_REGION_NAME": "RegionOne",
"OS_IDENTITY_API_VERSION": "3",
"OS_INTERFACE": "internal",
"OS_COMPUTE_PORT": "8774",
"OS_NETWORK_PORT": "9696",
"OS_VOLUME_PORT": "8776",
"OS_IMAGE_PORT": "9292",
"OS_PLACEMENT_PORT": "8780",
"OS_HEAT_STACK_PORT": "8004",
"OS_HEAT_STACK_CFN_PORT": "18888",
"ALLOW_MODIFY_OPERATIONS": "false",
"MCP_LOG_LEVEL": "INFO"
}
}
}
}
Server Configuration
Command Line Options
uv run python -m mcp_openstack_ops --help
Options:
--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
Logging level
--type {stdio,streamable-http}
Transport type (default: stdio)
--host HOST Host address for HTTP transport (default: 127.0.0.1)
--port PORT Port number for HTTP transport (default: 8080)
--auth-enable Enable Bearer token authentication for streamable-http mode
--secret-key SECRET Secret key for Bearer token authentication
Environment Variables
| Variable | Description | Default | Usage |
|---|---|---|---|
| OpenStack Authentication | |||
OS_AUTH_HOST |
OpenStack Identity service host | Required | Authentication host address |
OS_AUTH_PORT |
OpenStack Identity service port | Required | Authentication port |
OS_USERNAME |
OpenStack username | Required | User credentials |
OS_PASSWORD |
OpenStack password | Required | User credentials |
OS_PROJECT_NAME |
OpenStack project name | Required | Project scope |
OS_IDENTITY_API_VERSION |
Identity API version | 3 |
API version |
OS_PROJECT_DOMAIN_NAME |
Project domain name | default |
Domain scope |
OS_USER_DOMAIN_NAME |
User domain name | default |
Domain scope |
OS_REGION_NAME |
OpenStack region | RegionOne |
Regional scope |
| OpenStack Service Ports | |||
OS_COMPUTE_PORT |
Compute service port | 8774 |
Nova endpoint |
OS_NETWORK_PORT |
Network service port | 9696 |
Neutron endpoint |
OS_VOLUME_PORT |
Volume service port | 8776 |
Cinder endpoint |
OS_IMAGE_PORT |
Image service port | 9292 |
Glance endpoint |
OS_PLACEMENT_PORT |
Placement service port | 8780 |
Placement endpoint |
OS_HEAT_STACK_PORT |
Heat orchestration service port | 8004 |
Heat API endpoint |
OS_HEAT_STACK_CFN_PORT |
Heat CloudFormation service port | 18888 |
Heat CFN API endpoint |
| MCP Server Configuration | |||
MCP_LOG_LEVEL |
Logging level | INFO |
Development debugging |
ALLOW_MODIFY_OPERATIONS |
Enable modify operations | false |
Safety control for state modifications |
FASTMCP_TYPE |
Transport type | stdio |
Rarely needed to change |
FASTMCP_HOST |
HTTP host address | 127.0.0.1 |
For HTTP mode only |
FASTMCP_PORT |
HTTP port number | 8080 |
For HTTP mode only |
| Authentication (Optional) | |||
REMOTE_AUTH_ENABLE |
Enable Bearer token authentication for streamable-http mode | false |
Production security |
REMOTE_SECRET_KEY |
Secret key for Bearer token authentication | Required when auth enabled | Production security |
Note: MCP servers typically use stdio transport. HTTP mode is mainly for testing and development.
Safety Controls
Modification Operations Protection
By default, all operations that can modify or delete OpenStack resources are disabled for safety:
# Default setting - Only read-only operations allowed
ALLOW_MODIFY_OPERATIONS=false
Protected Operations (when ALLOW_MODIFY_OPERATIONS=false):
- Instance management (start, stop, restart, pause, unpause)
- Volume operations (create, delete, attach, detach)
- Keypair management (create, delete, import)
- Floating IP operations (create, delete, associate, disassociate)
- Snapshot management (create, delete)
- Image management (create, delete, update)
- Heat stack operations (create, delete, update)
Always Available (Read-Only Operations):
- Cluster status and monitoring
- Resource listings (instances, volumes, networks, etc.)
- Service status checks
- Usage and quota information
- Search and filtering operations
⚠️ To Enable Modify Operations:
# Enable all operations (USE WITH CAUTION)
ALLOW_MODIFY_OPERATIONS=true
Tool Registration Behavior:
- When
ALLOW_MODIFY_OPERATIONS=false: Only read-only tools are registered with the MCP server - When
ALLOW_MODIFY_OPERATIONS=true: All tools (read-only + modify operations) are registered - Tool availability is determined at server startup - restart required after changing this setting
Best Practices:
- Keep
ALLOW_MODIFY_OPERATIONS=falsein production environments - Enable modify operations only in development/testing environments
- Use separate configurations for different environments
- Review operations before enabling modify capabilities
- Restart the MCP server after changing the
ALLOW_MODIFY_OPERATIONSsetting
Example Queries
For comprehensive tool usage examples and query patterns, see: Example Queries in Prompt Template
Performance Optimization
Large-Scale Environment Support
The MCP server is optimized for large OpenStack environments with thousands of instances:
Pagination Features:
- Default limits prevent memory overflow (50 instances per request)
- Configurable safety limits (maximum 200 instances per request)
- Offset-based pagination for browsing large datasets
- Performance metrics tracking (processing time, instances per second)
Search Optimization:
- 2-phase search process (basic info filtering → detailed info retrieval)
- Intelligent caching with connection reuse
- Selective API calls to minimize overhead
- Case-sensitive search options for precise filtering
Connection Management:
- Global connection caching with validity testing
- Automatic retry mechanisms for transient failures
- Connection pooling for high-throughput scenarios
Usage Examples:
# Safe large environment browsing
get_instance_details(limit=50, offset=0) # First 50 instances
get_instance_details(limit=50, offset=50) # Next 50 instances
# Emergency override for small environments
get_instance_details(include_all=True) # All instances (use with caution)
# Optimized search for large datasets
search_instances("web", "name", limit=20) # Search with reasonable limit
Development
Adding New Tools
Edit src/mcp_openstack_ops/mcp_main.py to add new MCP tools:
@mcp.tool()
async def my_openstack_tool(param: str) -> str:
"""
Brief description of the tool's purpose.
Functions:
- List specific functions this tool performs
- Describe the operations it enables
- Mention when to use this tool
Use when user requests [specific scenarios].
Args:
param: Description of the parameter
Returns:
Description of return value format.
"""
try:
logger.info(f"Tool called with param: {param}")
# Implementation using functions.py helpers
result = my_helper_function(param)
response = {
"timestamp": datetime.now().isoformat(),
"result": result
}
return json.dumps(response, indent=2, ensure_ascii=False)
except Exception as e:
error_msg = f"Error: Failed to execute tool - {str(e)}"
logger.error(error_msg)
return error_msg
Helper Functions
Add utility functions to src/mcp_openstack_ops/functions.py:
def my_helper_function(param: str) -> dict:
"""Helper function for OpenStack operations"""
try:
conn = get_openstack_connection()
# OpenStack SDK operations
result = conn.some_service.some_operation(param)
logger.info(f"Operation completed successfully")
return {"success": True, "data": result}
except Exception as e:
logger.error(f"Helper function error: {e}")
raise
Testing & Validation
Local Testing
# Test with MCP Inspector (recommended)
./scripts/run-mcp-inspector-local.sh
# Test with debug logging
MCP_LOG_LEVEL=DEBUG uv run python -m mcp_openstack_ops
# Validate OpenStack connection
uv run python -c "from src.mcp_openstack_ops.functions import get_openstack_connection; print(get_openstack_connection())"
🔐 Security & Authentication
Bearer Token Authentication
For streamable-http mode, this MCP server supports Bearer token authentication to secure remote access. This is especially important when running the server in production environments.
Configuration
Enable Authentication:
# In .env file
REMOTE_AUTH_ENABLE=true
REMOTE_SECRET_KEY=your-secure-secret-key-here
Or via CLI:
uv run python -m mcp_openstack_ops --type streamable-http --auth-enable --secret-key your-secure-secret-key-here
Security Levels
- stdio mode (Default): Local-only access, no authentication needed
- streamable-http + REMOTE_AUTH_ENABLE=false/undefined: Remote access without authentication ⚠️ NOT RECOMMENDED for production
- streamable-http + REMOTE_AUTH_ENABLE=true: Remote access with Bearer token authentication ✅ RECOMMENDED for production
🔒 Default Policy:
REMOTE_AUTH_ENABLEdefaults tofalseif undefined, empty, or null. This ensures the server starts even without explicit authentication configuration.
Client Configuration
When authentication is enabled, MCP clients must include the Bearer token in the Authorization header:
{
"mcpServers": {
"openstack-ops": {
"type": "streamable-http",
"url": "http://your-server:8000/mcp",
"headers": {
"Authorization": "Bearer your-secure-secret-key-here"
}
}
}
}
Security Best Practices
- Always enable authentication when using streamable-http mode in production
- Use strong, randomly generated secret keys (32+ characters recommended)
- Use HTTPS when possible (configure reverse proxy with SSL/TLS)
- Restrict network access using firewalls or network policies
- Rotate secret keys regularly for enhanced security
- Monitor access logs for unauthorized access attempts
Error Handling
When authentication fails, the server returns:
- 401 Unauthorized for missing or invalid tokens
- Detailed error messages in JSON format for debugging
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_openstack_ops-1.1.2.tar.gz.
File metadata
- Download URL: mcp_openstack_ops-1.1.2.tar.gz
- Upload date:
- Size: 47.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
235fdbb5496d20fe6d3dea62b1686e37e3028dac76110e8bc19b91cb0766dfad
|
|
| MD5 |
fcf2a98424e7db74f9184dd65f2dbaaa
|
|
| BLAKE2b-256 |
88f06f15a64422ad5a27cca251c2a17380022d493b8b1540a2227878b4ac466e
|
Provenance
The following attestation bundles were made for mcp_openstack_ops-1.1.2.tar.gz:
Publisher:
pypi-publish.yml on call518/MCP-OpenStack-Ops
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_openstack_ops-1.1.2.tar.gz -
Subject digest:
235fdbb5496d20fe6d3dea62b1686e37e3028dac76110e8bc19b91cb0766dfad - Sigstore transparency entry: 529116472
- Sigstore integration time:
-
Permalink:
call518/MCP-OpenStack-Ops@9565d4af2841a527e72c3f46f1b3dc1eac647e13 -
Branch / Tag:
refs/tags/1.1.2 - Owner: https://github.com/call518
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@9565d4af2841a527e72c3f46f1b3dc1eac647e13 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_openstack_ops-1.1.2-py3-none-any.whl.
File metadata
- Download URL: mcp_openstack_ops-1.1.2-py3-none-any.whl
- Upload date:
- Size: 42.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
351bac67cc3fc415bc1eecd7b2824d3fb2720ab644cda9c7465175f0b32d86aa
|
|
| MD5 |
3cd0551fa2065ddb8008dfbb2b7431ad
|
|
| BLAKE2b-256 |
5387e03eb3961bf7a93369a2a1fbe993a5dcd1de58ab3f08dfa2e1e74c7a9b10
|
Provenance
The following attestation bundles were made for mcp_openstack_ops-1.1.2-py3-none-any.whl:
Publisher:
pypi-publish.yml on call518/MCP-OpenStack-Ops
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_openstack_ops-1.1.2-py3-none-any.whl -
Subject digest:
351bac67cc3fc415bc1eecd7b2824d3fb2720ab644cda9c7465175f0b32d86aa - Sigstore transparency entry: 529116477
- Sigstore integration time:
-
Permalink:
call518/MCP-OpenStack-Ops@9565d4af2841a527e72c3f46f1b3dc1eac647e13 -
Branch / Tag:
refs/tags/1.1.2 - Owner: https://github.com/call518
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@9565d4af2841a527e72c3f46f1b3dc1eac647e13 -
Trigger Event:
push
-
Statement type: