A Model Context Protocol (MCP) server for XenServer/XCP-ng administration. This server enables AI assistants to interact with XenServer infrastructure through natural language.
- Multi-cluster support: Manage multiple XenServer clusters from a single server
- Comprehensive VM management: List, control, snapshot, and monitor virtual machines
- Host management: Monitor and manage XenServer hosts
- Storage operations: List and manage storage repositories and virtual disks
- Network management: View and manage network configurations
- Pool management: Get pool information and statistics
- Template management: List and work with VM templates
# Clone the repository
git clone https://github.com/acefei/xenserver-mcp.git
cd xenserver-mcp
# Install with uv
uv sync
# Or install in editable mode
uv pip install -e .# Run directly from the repository
uvx --from /path/to/xenserver-mcp xenserver-mcpThe server loads configuration from a JSON file. By default, it looks for config/clusters.json in the project directory. You can specify a custom location using the XENSERVER_CONFIG environment variable.
Create a configuration file:
# Copy the example configuration
cp config/clusters.json.example config/clusters.json
# Edit with your credentials
nano config/clusters.jsonExample configuration:
{
"production": {
"host": "xenserver1.example.com",
"username": "root",
"password": "your-secure-password"
},
"development": {
"host": "xenserver2.example.com",
"username": "root",
"password": "another-password"
}
}Security Note: Ensure this file has restricted permissions and is not committed to version control:
chmod 600 config/clusters.json# Run with default configuration (uses config/clusters.json)
xenserver-mcp
# Or run directly with uv
uv run xenserver-mcp
# Run with Python module
python -m xenserver_mcp.server
# Use custom config file via environment variable
XENSERVER_CONFIG=/path/to/custom/clusters.json xenserver-mcp# Run from local repository (uses default config/clusters.json)
uvx --from /path/to/xenserver-mcp xenserver-mcp
# With custom config via environment variable
XENSERVER_CONFIG=/path/to/clusters.json uvx --from /path/to/xenserver-mcp xenserver-mcpAdd to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows):
Using uvx (Recommended):
{
"mcpServers": {
"xenserver": {
"command": "uvx",
"args": [
"--from",
"/home/feis/repos/xenserver-mcp",
"xenserver-mcp"
],
"env": {
"XENSERVER_CONFIG": "/path/to/your/config/clusters.json"
}
}
}
}If you see "Not connected to any cluster":
- Verify
config/clusters.jsonexists and is valid JSON - Check cluster credentials are correct
- Ensure XenServer host is reachable
- Verify firewall allows HTTPS (443) connections
The server automatically reconnects on session timeout. If persistent:
- Check XenServer logs for authentication issues
- Verify user account has appropriate permissions
- Check for network instability
Ensure the XenServer user has appropriate permissions:
- Pool Admin role for full management
- VM Admin role for VM operations only
- Read-only role for monitoring
-
Credential Storage: Configuration file contains plaintext passwords
- Use restricted file permissions (600)
- Never commit
config/clusters.jsonto version control - Consider using environment variables for CI/CD
- Keep config/ directory in .gitignore
-
Network Security: All communication is over HTTPS
- Verify SSL certificates in production
- Use VPN for remote access
-
Audit Logging: All operations are logged
- Review logs regularly
- Monitor for unexpected operations
Contributions are welcome! Please:
- Follow the existing code style (ruff formatting)
- Add tests for new features
- Update documentation
- Submit pull requests