MCP Server for Unraid API - provides tools to interact with an Unraid server's GraphQL API
Project description
๐ Unraid MCP Server
A powerful MCP (Model Context Protocol) server that provides comprehensive tools to interact with an Unraid server's GraphQL API.
โจ Features
- ๐ง 26 Tools: Complete Unraid management through MCP protocol
- ๐๏ธ Modular Architecture: Clean, maintainable, and extensible codebase
- โก High Performance: Async/concurrent operations with optimized timeouts
- ๐ Real-time Data: WebSocket subscriptions for live log streaming
- ๐ Health Monitoring: Comprehensive system diagnostics and status
- ๐ณ Docker Ready: Full containerization support with Docker Compose
- ๐ Secure: Proper SSL/TLS configuration and API key management
- ๐ Rich Logging: Structured logging with rotation and multiple levels
๐ Table of Contents
- Quick Start
- Installation
- Configuration
- Available Tools & Resources
- Development
- Architecture
- Troubleshooting
๐ Quick Start
Prerequisites
- Docker and Docker Compose (recommended)
- OR Python 3.10+ with uv for development
- Unraid server with GraphQL API enabled
1. Clone Repository
git clone https://github.com/jmagar/unraid-mcp
cd unraid-mcp
2. Configure Environment
cp .env.example .env
# Edit .env with your Unraid API details
3. Deploy with Docker (Recommended)
# Start with Docker Compose
docker compose up -d
# View logs
docker compose logs -f unraid-mcp
OR 3. Run for Development
# Install dependencies
uv sync
# Run development server
./dev.sh
๐ฆ Installation
๐ณ Docker Deployment (Recommended)
The easiest way to run the Unraid MCP Server is with Docker:
# Clone repository
git clone https://github.com/jmagar/unraid-mcp
cd unraid-mcp
# Set required environment variables
export UNRAID_API_URL="http://your-unraid-server/graphql"
export UNRAID_API_KEY="your_api_key_here"
# Deploy with Docker Compose
docker compose up -d
# View logs
docker compose logs -f unraid-mcp
Manual Docker Build
# Build and run manually
docker build -t unraid-mcp-server .
docker run -d --name unraid-mcp \
--restart unless-stopped \
-p 6970:6970 \
-e UNRAID_API_URL="http://your-unraid-server/graphql" \
-e UNRAID_API_KEY="your_api_key_here" \
unraid-mcp-server
๐ง Development Installation
For development and testing:
# Clone repository
git clone https://github.com/jmagar/unraid-mcp
cd unraid-mcp
# Install dependencies with uv
uv sync
# Install development dependencies
uv sync --group dev
# Configure environment
cp .env.example .env
# Edit .env with your settings
# Run development server
./dev.sh
โ๏ธ Configuration
Environment Variables
Create .env file in the project root:
# Core API Configuration (Required)
UNRAID_API_URL=https://your-unraid-server-url/graphql
UNRAID_API_KEY=your_unraid_api_key
# MCP Server Settings
UNRAID_MCP_TRANSPORT=streamable-http # streamable-http (recommended), sse (deprecated), stdio
UNRAID_MCP_HOST=0.0.0.0
UNRAID_MCP_PORT=6970
# Logging Configuration
UNRAID_MCP_LOG_LEVEL=INFO # DEBUG, INFO, WARNING, ERROR
UNRAID_MCP_LOG_FILE=unraid-mcp.log
# SSL/TLS Configuration
UNRAID_VERIFY_SSL=true # true, false, or path to CA bundle
# Optional: Log Stream Configuration
# UNRAID_AUTOSTART_LOG_PATH=/var/log/syslog # Path for log streaming resource
Transport Options
| Transport | Description | Use Case |
|---|---|---|
streamable-http |
HTTP-based (recommended) | Most compatible, best performance |
sse |
Server-Sent Events (deprecated) | Legacy support only |
stdio |
Standard I/O | Direct integration scenarios |
๐ ๏ธ Available Tools & Resources
System Information & Status
get_system_info()- Comprehensive system, OS, CPU, memory, hardware infoget_array_status()- Storage array status, capacity, and disk detailsget_unraid_variables()- System variables and settingsget_network_config()- Network configuration and access URLsget_registration_info()- Unraid registration detailsget_connect_settings()- Unraid Connect configuration
Docker Container Management
list_docker_containers()- List all containers with caching optionsmanage_docker_container(id, action)- Start/stop containers (idempotent)get_docker_container_details(identifier)- Detailed container information
Virtual Machine Management
list_vms()- List all VMs and their statesmanage_vm(id, action)- VM lifecycle (start/stop/pause/resume/reboot)get_vm_details(identifier)- Detailed VM information
Storage & File Systems
get_shares_info()- User shares informationlist_physical_disks()- Physical disk discoveryget_disk_details(disk_id)- SMART data and detailed disk info
Monitoring & Diagnostics
health_check()- Comprehensive system health assessmentget_notifications_overview()- Notification counts by severitylist_notifications(type, offset, limit)- Filtered notification listinglist_available_log_files()- Available system logsget_logs(path, tail_lines)- Log file content retrieval
Cloud Storage (RClone)
list_rclone_remotes()- List configured remotesget_rclone_config_form(provider)- Configuration schemascreate_rclone_remote(name, type, config)- Create new remotedelete_rclone_remote(name)- Remove existing remote
Real-time Subscriptions & Resources
test_subscription_query(query)- Test GraphQL subscriptionsdiagnose_subscriptions()- Subscription system diagnostics
MCP Resources (Real-time Data)
unraid://logs/stream- Live log streaming from/var/log/syslogwith WebSocket subscriptions
Note: MCP Resources provide real-time data streams that can be accessed via MCP clients. The log stream resource automatically connects to your Unraid system logs and provides live updates.
๐ง Development
Project Structure
unraid-mcp/
โโโ unraid_mcp/ # Main package
โ โโโ main.py # Entry point
โ โโโ config/ # Configuration management
โ โ โโโ settings.py # Environment & settings
โ โ โโโ logging.py # Logging setup
โ โโโ core/ # Core infrastructure
โ โ โโโ client.py # GraphQL client
โ โ โโโ exceptions.py # Custom exceptions
โ โ โโโ types.py # Shared data types
โ โโโ subscriptions/ # Real-time subscriptions
โ โ โโโ manager.py # WebSocket management
โ โ โโโ resources.py # MCP resources
โ โ โโโ diagnostics.py # Diagnostic tools
โ โโโ tools/ # MCP tool categories
โ โ โโโ docker.py # Container management
โ โ โโโ system.py # System information
โ โ โโโ storage.py # Storage & monitoring
โ โ โโโ health.py # Health checks
โ โ โโโ virtualization.py # VM management
โ โ โโโ rclone.py # Cloud storage
โ โโโ server.py # FastMCP server setup
โโโ logs/ # Log files (auto-created)
โโโ dev.sh # Development script
โโโ docker-compose.yml # Docker Compose deployment
Code Quality Commands
# Format code
uv run black unraid_mcp/
# Lint code
uv run ruff check unraid_mcp/
# Type checking
uv run mypy unraid_mcp/
# Run tests
uv run pytest
Development Workflow
# Start development server (kills existing processes safely)
./dev.sh
# Stop server only
./dev.sh --kill
๐๏ธ Architecture
Core Principles
- Modular Design: Separate concerns across focused modules
- Async First: All operations are non-blocking and concurrent-safe
- Error Resilience: Comprehensive error handling with graceful degradation
- Configuration Driven: Environment-based configuration with validation
- Observability: Structured logging and health monitoring
Key Components
| Component | Purpose |
|---|---|
| FastMCP Server | MCP protocol implementation and tool registration |
| GraphQL Client | Async HTTP client with timeout management |
| Subscription Manager | WebSocket connections for real-time data |
| Tool Modules | Domain-specific business logic (Docker, VMs, etc.) |
| Configuration System | Environment loading and validation |
| Logging Framework | Structured logging with file rotation |
๐ Troubleshooting
Common Issues
๐ฅ Port Already in Use
./dev.sh # Automatically kills existing processes
๐ง Connection Refused
# Check Unraid API configuration
curl -k "${UNRAID_API_URL}" -H "X-API-Key: ${UNRAID_API_KEY}"
๐ Import Errors
# Reinstall dependencies
uv sync --reinstall
๐ Debug Mode
# Enable debug logging
export UNRAID_MCP_LOG_LEVEL=DEBUG
uv run unraid-mcp-server
Health Check
# Use the built-in health check tool via MCP client
# or check logs at: logs/unraid-mcp.log
๐ 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 - Run tests:
uv run pytest - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
๐ Support
- ๐ Documentation: Check inline code documentation
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: Use GitHub Discussions for questions
Built with โค๏ธ for the Unraid community
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 iflow_mcp_jmagar_unraid_mcp-0.1.0.tar.gz.
File metadata
- Download URL: iflow_mcp_jmagar_unraid_mcp-0.1.0.tar.gz
- Upload date:
- Size: 133.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
902eb3e75bcb3133cf40af286d2ef021ae5fd3b33ff76fe48129e4631724aa0c
|
|
| MD5 |
e4bd411a79e51c8dc74a90ae311f1c71
|
|
| BLAKE2b-256 |
05a25129c297e9df2ac0f78e195f0268acd2b86e5d65fe90cfc1ff870b6a30f4
|
File details
Details for the file iflow_mcp_jmagar_unraid_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: iflow_mcp_jmagar_unraid_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 43.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d93350351354f9b24902722cb50276bdde5219d244f8f73ed1f22d58f38cc575
|
|
| MD5 |
5810e467755e837f42a8927a0c446c2c
|
|
| BLAKE2b-256 |
abefac58089d1c59e365683ee3e64a1cff4e02f409d74b8f1ca2d10c263a3aa6
|