**Critical Fixes (7 issues):**
- Fix GraphQL schema field names in users tool (role→roles, remove email)
- Fix GraphQL mutation signatures (addUserInput, deleteUser input)
- Fix dict(None) TypeError guards in users tool (use `or {}` pattern)
- Fix FastAPI version constraint (0.116.1→0.115.0)
- Fix WebSocket SSL context handling (support CA bundles, bool, and None)
- Fix critical disk threshold treated as warning (split counters)
**High Priority Fixes (11 issues):**
- Fix Docker update/remove action response field mapping
- Fix path traversal vulnerability in log validation (normalize paths)
- Fix deleteApiKeys validation (check response before success)
- Fix rclone create_remote validation (check response)
- Fix keys input_data type annotation (dict[str, Any])
- Fix VM domain/domains fallback restoration
**Changes by file:**
- unraid_mcp/tools/docker.py: Response field mapping
- unraid_mcp/tools/info.py: Split critical/warning counters
- unraid_mcp/tools/storage.py: Path normalization for traversal protection
- unraid_mcp/tools/users.py: GraphQL schema + null handling
- unraid_mcp/tools/keys.py: Validation + type annotations
- unraid_mcp/tools/rclone.py: Response validation
- unraid_mcp/tools/virtualization.py: Domain fallback
- unraid_mcp/subscriptions/manager.py: SSL context creation
- pyproject.toml: FastAPI version fix
- tests/*: New tests for all fixes
**Review threads resolved:**
PRRT_kwDOO6Hdxs5uu70L, PRRT_kwDOO6Hdxs5uu70O, PRRT_kwDOO6Hdxs5uu70V,
PRRT_kwDOO6Hdxs5uu70e, PRRT_kwDOO6Hdxs5uu70i, PRRT_kwDOO6Hdxs5uu7zn,
PRRT_kwDOO6Hdxs5uu7z_, PRRT_kwDOO6Hdxs5uu7sI, PRRT_kwDOO6Hdxs5uu7sJ,
PRRT_kwDOO6Hdxs5uu7sK, PRRT_kwDOO6Hdxs5uu7Tk, PRRT_kwDOO6Hdxs5uu7Tn,
PRRT_kwDOO6Hdxs5uu7Tr, PRRT_kwDOO6Hdxs5uu7Ts, PRRT_kwDOO6Hdxs5uu7Tu,
PRRT_kwDOO6Hdxs5uu7Tv, PRRT_kwDOO6Hdxs5uu7Tw, PRRT_kwDOO6Hdxs5uu7Tx
All tests passing.
Co-authored-by: docker-fixer <agent@pr-fixes>
Co-authored-by: info-fixer <agent@pr-fixes>
Co-authored-by: storage-fixer <agent@pr-fixes>
Co-authored-by: users-fixer <agent@pr-fixes>
Co-authored-by: config-fixer <agent@pr-fixes>
Co-authored-by: websocket-fixer <agent@pr-fixes>
Co-authored-by: keys-rclone-fixer <agent@pr-fixes>
Co-authored-by: vm-fixer <agent@pr-fixes>
11 KiB
🚀 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
- Claude Code Plugin
- Quick Start
- Installation
- Configuration
- Available Tools & Resources
- Development
- Architecture
- Troubleshooting
🎯 Claude Code Plugin
The easiest way to use Unraid MCP is through the Claude Code marketplace:
# Add the marketplace
/plugin marketplace add jmagar/unraid-mcp
# Install the Unraid skill
/plugin install unraid @unraid-mcp
This provides instant access to Unraid monitoring and management through Claude Code with:
- 27 GraphQL API endpoints
- Real-time system metrics
- Disk health monitoring
- Docker and VM management
See .claude-plugin/README.md for detailed plugin documentation.
🚀 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 ty check 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