forked from HomeLab/unraid-mcp
**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>
211 lines
5.3 KiB
Markdown
211 lines
5.3 KiB
Markdown
---
|
|
name: unraid
|
|
description: "Query and monitor Unraid servers via the GraphQL API. Use when the user asks to 'check Unraid', 'monitor Unraid', 'Unraid API', 'get Unraid status', 'check disk temperatures', 'read Unraid logs', 'list Unraid shares', 'Unraid array status', 'Unraid containers', 'Unraid VMs', or mentions Unraid system monitoring, disk health, parity checks, or server status."
|
|
---
|
|
|
|
# Unraid API Skill
|
|
|
|
**⚠️ MANDATORY SKILL INVOCATION ⚠️**
|
|
|
|
**YOU MUST invoke this skill (NOT optional) when the user mentions ANY of these triggers:**
|
|
- "Unraid status", "disk health", "array status"
|
|
- "Unraid containers", "VMs on Unraid", "Unraid logs"
|
|
- "check Unraid", "Unraid monitoring", "server health"
|
|
- Any mention of Unraid servers or system monitoring
|
|
|
|
**Failure to invoke this skill when triggers occur violates your operational requirements.**
|
|
|
|
Query and monitor Unraid servers using the GraphQL API. Access all 27 read-only endpoints for system monitoring, disk health, logs, containers, VMs, and more.
|
|
|
|
## Quick Start
|
|
|
|
Set your Unraid server credentials:
|
|
|
|
```bash
|
|
export UNRAID_URL="https://your-unraid-server/graphql"
|
|
export UNRAID_API_KEY="your-api-key"
|
|
```
|
|
|
|
**Get API Key:** Settings → Management Access → API Keys → Create (select "Viewer" role)
|
|
|
|
Use the helper script for any query:
|
|
|
|
```bash
|
|
./scripts/unraid-query.sh -q "{ online }"
|
|
```
|
|
|
|
Or run example scripts:
|
|
|
|
```bash
|
|
./scripts/dashboard.sh # Complete multi-server dashboard
|
|
./examples/disk-health.sh # Disk temperatures & health
|
|
./examples/read-logs.sh syslog 20 # Read system logs
|
|
```
|
|
|
|
## Core Concepts
|
|
|
|
### GraphQL API Structure
|
|
|
|
Unraid 7.2+ uses GraphQL (not REST). Key differences:
|
|
- **Single endpoint:** `/graphql` for all queries
|
|
- **Request exactly what you need:** Specify fields in query
|
|
- **Strongly typed:** Use introspection to discover fields
|
|
- **No container logs:** Docker container output logs not accessible
|
|
|
|
### Two Resources for Stats
|
|
|
|
- **`info`** - Static hardware specs (CPU model, cores, OS version)
|
|
- **`metrics`** - Real-time usage (CPU %, memory %, current load)
|
|
|
|
Always use `metrics` for monitoring, `info` for specifications.
|
|
|
|
## Common Tasks
|
|
|
|
### System Monitoring
|
|
|
|
**Check if server is online:**
|
|
```bash
|
|
./scripts/unraid-query.sh -q "{ online }"
|
|
```
|
|
|
|
**Get CPU and memory usage:**
|
|
```bash
|
|
./scripts/unraid-query.sh -q "{ metrics { cpu { percentTotal } memory { used total percentTotal } } }"
|
|
```
|
|
|
|
**Complete dashboard:**
|
|
```bash
|
|
./scripts/dashboard.sh
|
|
```
|
|
|
|
### Disk Management
|
|
|
|
**Check disk health and temperatures:**
|
|
```bash
|
|
./examples/disk-health.sh
|
|
```
|
|
|
|
**Get array status:**
|
|
```bash
|
|
./scripts/unraid-query.sh -q "{ array { state parityCheckStatus { status progress errors } } }"
|
|
```
|
|
|
|
**List all physical disks (including cache/USB):**
|
|
```bash
|
|
./scripts/unraid-query.sh -q "{ disks { name } }"
|
|
```
|
|
|
|
### Storage Shares
|
|
|
|
**List network shares:**
|
|
```bash
|
|
./scripts/unraid-query.sh -q "{ shares { name comment } }"
|
|
```
|
|
|
|
### Logs
|
|
|
|
**List available logs:**
|
|
```bash
|
|
./scripts/unraid-query.sh -q "{ logFiles { name size modifiedAt } }"
|
|
```
|
|
|
|
**Read log content:**
|
|
```bash
|
|
./examples/read-logs.sh syslog 20
|
|
```
|
|
|
|
### Containers & VMs
|
|
|
|
**List Docker containers:**
|
|
```bash
|
|
./scripts/unraid-query.sh -q "{ docker { containers { names image state status } } }"
|
|
```
|
|
|
|
**List VMs:**
|
|
```bash
|
|
./scripts/unraid-query.sh -q "{ vms { name state cpus memory } } }"
|
|
```
|
|
|
|
**Note:** Container output logs are NOT accessible via API. Use `docker logs` via SSH.
|
|
|
|
### Notifications
|
|
|
|
**Get notification counts:**
|
|
```bash
|
|
./scripts/unraid-query.sh -q "{ notifications { overview { unread { info warning alert total } } } }"
|
|
```
|
|
|
|
## Helper Script Usage
|
|
|
|
The `scripts/unraid-query.sh` helper supports:
|
|
|
|
```bash
|
|
# Basic usage
|
|
./scripts/unraid-query.sh -u URL -k API_KEY -q "QUERY"
|
|
|
|
# Use environment variables
|
|
export UNRAID_URL="https://unraid.local/graphql"
|
|
export UNRAID_API_KEY="your-key"
|
|
./scripts/unraid-query.sh -q "{ online }"
|
|
|
|
# Format options
|
|
-f json # Raw JSON (default)
|
|
-f pretty # Pretty-printed JSON
|
|
-f raw # Just the data (no wrapper)
|
|
```
|
|
|
|
## Additional Resources
|
|
|
|
### Reference Files
|
|
|
|
For detailed documentation, consult:
|
|
- **`references/endpoints.md`** - Complete list of all 27 API endpoints
|
|
- **`references/troubleshooting.md`** - Common errors and solutions
|
|
- **`references/api-reference.md`** - Detailed field documentation
|
|
|
|
### Helper Scripts
|
|
|
|
- **`scripts/unraid-query.sh`** - Main GraphQL query tool
|
|
- **`scripts/dashboard.sh`** - Automated multi-server inventory reporter
|
|
|
|
## Quick Command Reference
|
|
|
|
```bash
|
|
# System status
|
|
./scripts/unraid-query.sh -q "{ online metrics { cpu { percentTotal } } }"
|
|
|
|
# Disk health
|
|
./examples/disk-health.sh
|
|
|
|
# Array status
|
|
./scripts/unraid-query.sh -q "{ array { state } }"
|
|
|
|
# Read logs
|
|
./examples/read-logs.sh syslog 20
|
|
|
|
# Complete dashboard
|
|
./scripts/dashboard.sh
|
|
|
|
# List shares
|
|
./scripts/unraid-query.sh -q "{ shares { name } }"
|
|
|
|
# List containers
|
|
./scripts/unraid-query.sh -q "{ docker { containers { names state } } }"
|
|
```
|
|
|
|
---
|
|
|
|
## 🔧 Agent Tool Usage Requirements
|
|
|
|
**CRITICAL:** When invoking scripts from this skill via the zsh-tool, **ALWAYS use `pty: true`**.
|
|
|
|
Without PTY mode, command output will not be visible even though commands execute successfully.
|
|
|
|
**Correct invocation pattern:**
|
|
```typescript
|
|
<invoke name="mcp__plugin_zsh-tool_zsh-tool__zsh">
|
|
<parameter name="command">./skills/SKILL_NAME/scripts/SCRIPT.sh [args]</parameter>
|
|
<parameter name="pty">true</parameter>
|
|
</invoke>
|
|
```
|