unas-mcp
Provides tools for managing a Ubiquiti UNAS Pro 8 NAS, including health monitoring, storage/disk inventory, NFS export visibility, read-only file inspection, and gated lifecycle operations.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
unas-mcp
MCP server for the Ubiquiti UNAS Pro 8 NAS (10.0.40.4), the primary store for
all media in the homelab. It covers health, storage and disk inventory, NFS
export visibility, read-only file inspection, and a few confirmation-gated
actions. 18 tools. It runs as a container on VM 102 (http://10.0.40.25:8490/mcp)
and is registered by the homelab repo's .mcp.json.
The owner does not run this code; Claude sessions do. This README is written for them.
Design
Two transports, each used only for what it alone can answer:
SSH (
root@<host>, key only,ssh.py):/proc/mdstat,lsblk,smartctl,df,rpcinfo,showmount,exportfs,journalctl,ls,du. Every remote command runs underset -o pipefail, so a broken stage is an error, not an empty answer.UniFi Drive API (
api.py, unofficial; notes indocs/drive-api-findings.md): physical bay numbers (slotId), vendorhealthScore/riskReasons, and per-RAID-group protection. The health verdict never depends on it.
No drive list in code. Drives are discovered on every call (drives.py,
from lsblk: SATA/SAS disks only, so the USB boot stick and flash partitions
are skipped). Completeness is checked against an independent source: every
member drive md lists in /proc/mdstat must have a SMART verdict, or the
summary says unknown, never healthy. Filling bay 8 later needs no code or
config change. A new drive outside the array is listed as unassigned_drives
and is still SMART-checked.
Act on bay and serial, never on sdX. Device letters are kernel discovery
order. Every drive record carries bay (from the Drive API, null with a
note if the API is down), serial and device.
Device arguments are checked twice before reaching a root shell: the name
must be well-formed (sd plus 1-2 letters, safety.validate_device), and it
must be a drive the NAS reports right now (drives.resolve, whose error lists
what is present).
Tolerant but honest parsing: a field missing from a live reply is null
(or raises, for the fields the verdict depends on). It is never defaulted to a
value that reads as healthy.
Related MCP server: unifi-mcp
Tools
Tool | Gate | What it returns |
| read |
|
| read | Each md array: members, failed members, |
| read | SMART for every discovered drive with bay and serial; |
| read | Full SMART record for one drive |
| read | Media volume bytes total/used/free and used % ( |
| read |
|
| read |
|
| read | UniFi OS firmware, unifi-drive and unifi-core versions, kernel, Debian release |
| read | Names of every running systemd service |
| none | Start a short (~2 min) or long (~38 h on these drives) self-test; data is untouched |
| read | A drive's self-test log |
| confirm | Reboots the NAS; all media is down for about 10-14 minutes. Scheduled 5 s out, so a clean return means it will happen. Then poll |
| read | Pool status, capacity, scrub state, per-RAID-group protection |
| read | Every bay: |
| read | Each exported path with every client IP and that client's own options |
| confirm | Recursive |
| read |
|
| read |
|
confirm tools require confirm="yes"; anything else raises PermissionError
and runs nothing. The model fills that argument itself, so the human gate is
Claude Code's permission prompt: the homelab repo's .claude/settings.json
lists unas_reboot and unas_fix_permissions under permissions.ask.
Absent by design: write file operations (NFS clients already cover that,
and a second write path only adds ways to corrupt data), NFS allow-list edits
(only the Drive UI can make them stick), and every pool, array or disk
lifecycle action (create, destroy, format, expand, reshape). Absence is the
protection. tests/test_health_tools.py::test_registers_exactly_the_expected_tool_names
pins the exact tool set, so a new tool fails it until someone adds it on purpose.
It checks names only: review what a new tool actually runs.
Environment
Variable | Purpose |
| NAS address (default |
| SSH private key for root on the NAS (default |
| UniFi Drive API key ( |
| Listen port (default |
Tests
python3 -m venv .venv && .venv/bin/pip install -e '.[dev]'
.venv/bin/pytest -q # unit tests, fixtures captured liveLive check, read-only: run after every UNAS firmware or Drive-app update and after any change here. It would have caught both the hard-coded six-drive list and the three tools UniFi OS 6.0 broke. From the workstation:
K=$(ssh vm-102-monitoring "grep -m1 '^UNAS_API_KEY=' ~/docker-compose/.env | cut -d= -f2-")
UNAS_LIVE=1 UNAS_SSH_KEY=$HOME/.ssh/id_ed25519 UNAS_API_KEY="$K" .venv/bin/pytest -q tests/test_live.pyAll 9 must pass. A failure means an update changed something this server reads.
Deploy
CI (.github/workflows/build-and-push.yaml) runs the unit tests on every push
to main, then builds and pushes ghcr.io/lefty3382/unas-mcp:latest. On VM 102:
ssh vm-102-monitoring "cd ~/docker-compose && docker compose pull unas-mcp && docker compose down unas-mcp && docker compose up -d unas-mcp"Restarting it affects only this tool; media and Kuma alerting do not use it. Then run the live check.
Related
Kuma alerting does not use this server:
automation/scripts/kuma-unas-health/in the homelab repo pages through its own forced-command SSH key, so a failing drive pages even when this container is down.Appliance facts and quirks:
docs/reference/unas-pro-8-capabilities.md(homelab repo).Design review, 2026-11-08:
docs/reviews/2026-11-08-independent-review.md.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
MCP server for Product Management
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server that enables AI assistants to manage UniFi network infrastructure, including cloud management, local network devices, and Protect cameras, through natural language.621MIT
- AlicenseNot gradedqualityCmaintenanceA safety-first MCP server for managing UniFi networks, exposing 17 tools for telemetry, diagnostics, and guarded mutations with dry-run previews and confirm requirements.16MIT
- AlicenseNot gradedqualityBmaintenanceMCP server for UniFi Network Controller enabling AI assistants to manage UniFi infrastructure via natural language. It supports firewall rules, IPv6, and uses lazy/eager tool modes to minimize context usage.7Mozilla Public 2.0
- AlicenseAqualityDmaintenanceMCP server providing typed, safety-gated access to UniFi Network consoles via the official API, enabling management of devices, clients, networks, WiFi, firewall policies, and more.1636 npm2MIT