mcp-unifi-drive
Reads and monitors a Ubiquiti UNAS running UniFi Drive through the console's own web API (/proxy/drive/api). Provides tools for storage pools, RAID state, disk health and SMART data, shared and personal drives with quotas, snapshots, users and groups, SMB/NFS/Time Machine services, remote and Microsoft 365 backup tasks, system log rendering and filtering, throughput/temperature I/O history, and a ranked health-check verdict. Also supports remote access via api.ui.com Site Manager in cloud mode, and optional write tools (snapshots, fan mode, SMART tests, backup runs) when writes are enabled.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-unifi-drive is my NAS healthy? check disks and storage pools"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@mgcrea/mcp-unifi-drive
Model Context Protocol server for UniFi Drive on a UNAS: storage pools, RAID and disk health, shared and personal drives, snapshots, backups, the system log, and I/O history. Read-only by default: the tools that change anything are not registered at all unless you ask for them.
Features
One health verdict.
unifi_drive_health_checkreads about ten endpoints and returns ranked findings in plain words: a full pool, degraded RAID, disks at risk or running hot, snapshot schedules that have quietly stopped, missing or failing remote backups, a waiting Drive update, and the high-severity log events of the last week, with repeats collapsed into counts.Storage that reads like the dashboard. Sizes are in decimal units, as the web app shows them. Quotas, which the console stores in GB, are converted. A pool whose target RAID level is above its current one is described as what it is: a plan that adding disks completes, not a migration in progress.
Logs you can read. Each entry is rendered from the console's own message templates, and sign-ins are excluded by default, because on a busy UNAS they are 99 out of every 100 lines.
Shaped responses. Raw disk statistics arrive as hundreds of samples per disk. The I/O tool returns average, peak (with its time), and latest value instead, plus any bad sectors added during the window.
Starts with no credentials, and
unifi_drive_auth_statussays what to configure, instead of the server exiting and showing up in your client as a bareConnection closed.
Related MCP server: unas-mcp
Setup
A UNAS is its own UniFi OS console with its own accounts. A user created on your gateway
(UDM, UCG, Cloud Key) does not exist on the UNAS, and logging in with it fails with
AUTHENTICATION_FAILED_INVALID_CREDENTIALS.
On the UNAS: UniFi OS → Admins & Users → Add Admin → Restrict to Local Access Only, without 2FA. Then:
UNIFI_DRIVE_HOST=192.168.1.2 # the UNAS, not the gateway
UNIFI_DRIVE_USERNAME=mcp
UNIFI_DRIVE_PASSWORD=…{
"mcpServers": {
"unifi-drive": {
"command": "npx",
"args": ["-y", "@mgcrea/mcp-unifi-drive"],
"env": {
"UNIFI_DRIVE_HOST": "192.168.1.2",
"UNIFI_DRIVE_USERNAME": "mcp",
"UNIFI_DRIVE_PASSWORD": ""
}
}
}
}TLS needs nothing extra. The console's self-signed certificate (CN=unifi.local, no IP SAN)
is pinned on the first request and checked on every later one. The fingerprint is printed at
startup; set UNIFI_DRIVE_FINGERPRINT to it if you want the trust stated explicitly instead
of learned on first contact.
Cloud mode (UNIFI_DRIVE_API_KEY + UNIFI_DRIVE_CONSOLE_ID) goes through api.ui.com's
Site Manager connector, the same way mcp-unifi-protect does. It has not been verified
against Drive yet; unifi_drive_auth_status makes a real call, so it will tell you.
Every setting can also go in ~/.config/unifi-drive/config.json (camelCase keys). The
environment takes precedence, setting by setting. See .env.example for the full
list.
Tools
Tool | What it answers |
| Can the server reach the UNAS, which one answered, TLS and session state |
| Is the NAS OK? Ranked findings plus recent high-severity events |
| Model, UniFi OS and Drive versions, pending update, uptime, CPU, memory, links, fan |
| Pools, RAID current/target, usage breakdown, SSD cache, scrubbing, every disk |
| Throughput over 1h / 24h / 7d / 30d, per pool and per disk, with temperatures |
| Shared and personal drives: usage, quota, encryption, backup, snapshot state |
| The snapshots kept for one drive |
| The system log, rendered and filtered by severity, category, type and time |
| Users, groups, and the size of each personal drive |
| SMB, NFS, Time Machine, rsync, share links |
| Remote backup and Microsoft 365 backup tasks |
| Escape hatch: any |
| Supply a 2FA code once / drop the cached session (local mode only) |
With UNIFI_DRIVE_ALLOW_WRITES=1, these are registered as well, and each one requires
confirm: true:
Tool | Effect |
| Snapshot a shared drive now (refused while under 10% free) |
| Delete one snapshot of a shared drive. Irreversible. |
|
|
| Start a quick or extended SMART test on one disk |
| Run a remote backup task now |
Snapshot writes only work on shared drives. Drive lets an admin read a personal drive's snapshots, but only the drive's owner, signed in as themselves, can create or delete them.
The API
Drive has no documented API. This server uses the one its web app calls, which is mounted under
UniFi OS's proxy at /proxy/drive/api. It has two generations, and the web app uses both:
v1/...wraps every answer in{err, type, data, offset, limit, total}. A failure can arrive inside an HTTP 200, and the useful part of an error is usually inerr.metadata.error(for example, "bad interval value") rather than inerr.msg("Bad Request").v2/...returns the object directly.
Traps found while building it, each handled where it occurs in the code:
Times are Unix seconds, not milliseconds as in Protect.
after,before,startandendall take seconds.Quotas are gigabytes, and
-1means unlimited.Stats need an interval the console accepts. The four used here (60, 900, 3600 and 21600 seconds) are the ones the web app uses. Any other value gets "bad interval value".
Snapshot endpoints address shared drives by name (
v1/snapshots/shared/Shared_Drive), while everything else uses the id. A personal drive with no snapshots answers 404, not an empty list.Every drive reports
paused: trueonce the pool is low on space, including drives that have no schedule. Only a pause on a scheduled drive means anything.The pending Drive update is not available from the Drive API at all. It comes from UniFi OS's
/api/system.
Ubiquiti moves these endpoints between releases. unifi_drive_get_system reports the running
Drive version, and unifi_drive_request can reach any endpoint without waiting for a new
release of this server. The traffic was mapped against Drive 4.4.31 on a UNAS Pro 4.
Login, CSRF handling, the cached session and certificate pinning come from
@mgcrea/unifi-protect. Despite the
name, that code is generic UniFi OS. Its ProtectClient hard-codes the Protect path, so Drive
has its own small client with the same retry rules.
Development
pnpm install
pnpm lint && pnpm format:check && pnpm typecheck && pnpm test && pnpm buildThe test fixtures in test/fixtures are real responses from a live UNAS, with personal details
replaced.
License
MIT
Available Tools
12 toolsunifi_drive_auth_statusUniFi Drive: Auth StatusARead-only
Check whether this server can actually reach your UniFi Drive console (the UNAS). By default it logs in and makes a real call, so the answer reflects the console rather than cached state — this is the tool to run when something is not working. Reports the host, the account, which UNAS answered (name, model, Drive version), whether TLS is verified, and whether writes are enabled; when nothing is configured it returns the exact setup steps instead. Call this first when a tool you expected is not listed: an absent tool means missing configuration or writes being off, not a bug.
Inputs: probe.
unifi_drive_get_io_statsUniFi Drive: Get I/O StatsARead-only
Throughput over a window, reduced to average / peak (with when) / latest: pool read and write KB/s and IOPS, plus per-disk throughput, temperature range and any bad sectors added during the window. Also the live network rate. Use it for 'is the NAS busy?', 'what is hammering it?', or 'did a disk heat up overnight?'. Returns summaries, not the raw series, unless points is set.
Inputs: disks, points, window.
unifi_drive_get_storageUniFi Drive: Get StorageARead-only
Storage pools, RAID and disks. Per pool: status, current and target RAID level (a target above the current one is reached by adding disks, not a migration in flight unless progressPercent is set), capacity, used and free space with a breakdown by personal / shared drives / system, SSD cache hit rates, and scrubbing. Per disk: model, size, state, health score, temperature, power-on time, bad and uncorrectable sectors, SSD life remaining. Includes findings for anything that needs attention.
Inputs: no named parameters.
unifi_drive_get_systemUniFi Drive: Get SystemARead-only
The UNAS itself: name, model, UniFi OS and Drive versions (and whether a Drive update is waiting), uptime, CPU load and temperature, memory, network links and fan mode. For disks and RAID use unifi_drive_get_storage; for an overall verdict use unifi_drive_health_check.
Inputs: no named parameters.
unifi_drive_health_checkUniFi Drive: Health CheckARead-only
One verdict on the whole UNAS, as ranked findings: pool full or nearly full, degraded RAID, a RAID level short of its target, disks at risk or hot or growing bad sectors, SSD cache problems, snapshot schedules that have silently stopped, failed or missing remote backups, a waiting Drive update, and the high-severity log events of the last days. Start here for 'is my NAS OK?' — it reads about ten endpoints in parallel so you do not have to, and each finding says what it means rather than echoing a status code.
Inputs: days.
unifi_drive_list_backupsUniFi Drive: List BackupsARead-only
Off-device backups: remote backup tasks (to Google Drive, OneDrive, Dropbox, S3, Wasabi, B2 or UniFi Cloud Storage) with their destination accounts, and Microsoft 365 backup tasks with their tenants. Each task's last run says whether it succeeded. An empty list means every drive's only copy is on this UNAS.
Inputs: no named parameters.
unifi_drive_list_drivesUniFi Drive: List DrivesARead-only
Every shared and personal drive: usage, quota (and how full it is), member count, encryption, whether remote backup and the SMB recycle bin are on, and its snapshot state — schedule, how many are kept, the last and next one, and whether snapshots are paused and why. Use it to answer 'what is using the space?' and 'are my snapshots running?'. Quotas are reported in real units; the console stores them as GB.
Inputs: no named parameters.
unifi_drive_list_logsUniFi Drive: List LogsARead-only
The UNAS system log, newest first, each entry rendered as the sentence the web app shows ("A scheduled snapshot for Shared_Drive was skipped due to insufficient storage space."). Filter by severity, category, type and time. Sign-ins and file activity are EXCLUDED by default because they bury everything else — one line per SMB reconnect — so set include_access to see who connected from where. For a verdict rather than a log, use unifi_drive_health_check. Page with cursor.
Inputs: limit, since, types, until, +4 more.
unifi_drive_list_servicesUniFi Drive: List ServicesARead-only
Which file services the UNAS offers: SMB, NFS, Time Machine, rsync and public share links, each on or off, plus the addresses clients reach it on.
Inputs: no named parameters.
unifi_drive_list_snapshotsUniFi Drive: List SnapshotsARead-only
The snapshots kept for one drive, newest first: id, when it was taken, its description, and whether it is locked against automatic rotation. Use the ids with unifi_drive_delete_snapshot (when writes are enabled). For whether snapshots are running at all, unifi_drive_list_drives is cheaper.
Inputs: drive (required), limit.
unifi_drive_list_usersUniFi Drive: List UsersARead-only
Drive users with their username, name, email, groups, and how much their personal drive holds; then the groups with their members by name. Users are the people with file access; console admins who never use Drive may not appear.
Inputs: no named parameters.
unifi_drive_requestUniFi Drive: RequestARead-only
Escape hatch: call any private Drive API endpoint directly, relative to /proxy/drive/api. The path carries the API generation: v1/... answers wrapped in {err, type, data}, v2/... answers bare. This exists because the API is undocumented and Ubiquiti moves endpoints between Drive releases — when a wrapped tool starts returning 404, this reaches the replacement without waiting for a new version of this server. Responses are RAW and unshaped (v2/systems/log-definitions alone is 79 KB); prefer the wrapped tools, which summarize. Writes are DISABLED: only GET is permitted. Set UNIFI_DRIVE_ALLOW_WRITES=1 to allow mutations.
Inputs: path (required), body, query, method.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool targets a distinct facet of the NAS — services, auth, system, storage, IO, drives, snapshots, logs, users, backups — and descriptions actively cross-reference siblings (get_system vs get_storage vs health_check, list_drives vs list_snapshots vs list_logs), which removes most confusion. The only soft overlaps are the aggregate health_check/io_stats versus the raw get_storage/get_system reads, but the guidance on when to pick each resolves them.
All twelve tools share the unifi_drive_ prefix and mostly follow verb_noun (list_services, get_system, get_storage, list_drives, list_backups). A few deviate into noun phrases (auth_status, health_check, request), which is a minor inconsistency but still readable and predictable.
Twelve tools is well within the sweet spot and each earns its place: one per resource family plus a deliberate health aggregate and a documented escape hatch. Nothing looks redundant or padded.
Read/inspect coverage is excellent, but the lifecycle is one-sided: no snapshot create/restore, no drive/share creation or quota update, no user management, and no way to trigger a backup. Worse, list_snapshots points at 'unifi_drive_delete_snapshot' when writes are enabled, yet no such tool appears in the set, and the generic request tool only permits GET by default — so mutation workflows dead-end.
Maintenance
Related MCP Connectors
Read-only MCP access to a documented IT fleet: state, changes, posture. 15 tools.
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
Linux server administration over OAuth MCP: shell, Docker, systemd, files and monitoring.
Read-only checks for DIDs, credentials, MCP servers, A2A cards and agent delegation.
Related MCP Servers
- AlicenseBqualityDmaintenanceExposes tools to manage and inspect an OpenMediaVault NAS, running on the NAS and communicating over SSH with any MCP-capable coding harness.48MIT
- FlicenseNot gradedqualityCmaintenanceMCP server for managing a Ubiquiti UNAS Pro NAS, providing health monitoring, storage and disk inventory, NFS export visibility, read-only file inspection, and gated lifecycle operations via SSH and the UniFi Drive API.-
- FlicenseNot gradedqualityDmaintenanceRead-only Azure storage intelligence MCP server enabling scoped investigations, risk analytics, cost savings simulation, data health checks, and admin tenant-wide discovery across a synthetic storage estate.-
- FlicenseNot gradedqualityCmaintenanceEnables MCP clients to inspect Synology NAS system, storage, and utilization, and manage Docker containers via the Synology Web API with automatic session handling.-