UniFi Drive MCP Server
A Model Context Protocol server for UniFi Drive, the storage application on UniFi NAS consoles (UNAS Pro, UNAS Pro 8, and similar). It lets an AI assistant read storage pools, RAID state, disk SMART health and shared drives, and manage the NAS's file services: turn SMB, NFS or Time Machine on or off, and add, change or remove NFS client connections.
Status: beta, not yet released
UniFi Drive has no published API. The endpoints this server uses were read from the Drive web app on a UNAS Pro 8 running UniFi OS 5.0.12, and every read was checked against that console. Another firmware may answer differently; a field the server does not recognize is left out rather than failing the call.
What it will not do
Nothing here can lose data on the NAS. There are no tools to erase a disk, delete or create a storage pool, or delete a shared drive. The write tools only change who can reach the data (file services and NFS clients), and each one previews the change before it is made.
The NAS is its own console
A UNAS is a separate UniFi OS console, not part of the gateway, and it is not reachable through the Network application. Point this server at the NAS itself and log in with a local UniFi OS account on it. A UI.com account with MFA cannot log in here.
Install
# From source (needs uv and Python 3.13+)
git clone https://github.com/sirkirby/unifi-mcp.git
cd unifi-mcp
uv sync
UNIFI_DRIVE_HOST=192.168.1.20 \
UNIFI_DRIVE_USERNAME=mcp \
UNIFI_DRIVE_PASSWORD_FILE="$HOME/.config/unifi-mcp/drive-password" \
uv run --package unifi-drive-mcp unifi-drive-mcp
Without a host the server still starts. It answers the client in setup mode, offers only drive_setup_status, explains what to set, and makes no request. With a host it also makes no request at startup: the first tool call logs in.
MCP client configuration
{
"mcpServers": {
"unifi-drive": {
"command": "uv",
"args": ["run", "--directory", "/path/to/unifi-mcp", "--package", "unifi-drive-mcp", "unifi-drive-mcp"],
"env": {
"UNIFI_DRIVE_HOST": "192.168.1.20",
"UNIFI_DRIVE_USERNAME": "mcp",
"UNIFI_DRIVE_PASSWORD_FILE": "/Users/you/.config/unifi-mcp/drive-password"
}
}
}
}
Configuration
| Variable | Default | Description |
|---|---|---|
UNIFI_DRIVE_HOST |
unset | IP or hostname of the NAS. UNIFI_HOST is not used, because it names the gateway. |
UNIFI_DRIVE_USERNAME |
unset | Local UniFi OS username on the NAS (UNIFI_USERNAME is not used) |
UNIFI_DRIVE_PASSWORD |
unset | Its password (UNIFI_PASSWORD is not used). _FILE and _COMMAND spellings work. |
UNIFI_DRIVE_PORT |
443 |
HTTPS port of the NAS (UNIFI_PORT is not used) |
UNIFI_DRIVE_VERIFY_SSL |
false |
Verify the NAS certificate against the system CAs |
UNIFI_DRIVE_SSL_FINGERPRINT |
unset | SHA-256 fingerprint of the NAS certificate; pins it and overrides UNIFI_DRIVE_VERIFY_SSL. UNIFI_SSL_FINGERPRINT is not used. |
UNIFI_DRIVE_TIMEOUT_SECONDS |
30 |
Seconds to wait for one response |
UNIFI_DRIVE_TOOL_PERMISSION_MODE |
confirm |
bypass skips the previews (falls back to UNIFI_TOOL_PERMISSION_MODE) |
UNIFI_DRIVE_MCP_CONTENT_MODE |
adaptive |
MCP content mode for this server |
UNIFI_DRIVE_REDACT_SENSITIVE_FIELDS |
true |
Redact secret-named fields in responses |
HTTP transport, tool registration modes and diagnostics use the same UNIFI_MCP_* settings as the other servers; the Drive server's default HTTP port is 3004.
NAS operation gate
Every tool call takes a read slot at this server's operation gate for the NAS before it reaches the NAS. Reads run side by side up to a cap. The guarantee is per server process: two servers, or two copies of one, pointed at the same NAS do not coordinate. Unlike the connection settings, these fall back to the shared UNIFI_* value, because they tune this process rather than name a console.
| Variable | Default | Description |
|---|---|---|
UNIFI_DRIVE_WRITE_HOLD_SECONDS / UNIFI_WRITE_HOLD_SECONDS |
120 |
How long one write may hold its turn (10 to 3600). Once it has held longer, calls queued behind it are refused as busy, with nothing sent; a write's own requests to the NAS stop at this budget. |
UNIFI_DRIVE_CALL_WAIT_SECONDS / UNIFI_CALL_WAIT_SECONDS |
25 |
How long a direct tool call waits for its turn before it is refused as busy (1 to 3600). Batch jobs wait as long as the queue keeps moving. |
UNIFI_DRIVE_READ_CONCURRENCY / UNIFI_READ_CONCURRENCY |
8 |
Reads that may run at once (1 to 64). |
A value that is not a number in range stops the server at startup, naming the variable. A call refused as busy returns success: false with the reason, plus mutation_applied: false for a confirmed write; nothing is sent to the NAS. A confirmed write whose budget runs out before its change is sent also returns mutation_applied: false; one cut off after the change was sent, or never answered, returns mutation_applied: null, and the NAS should be read back before retrying.
Tools
Read-only:
| Tool | What it returns |
|---|---|
drive_get_system_info |
Console name, model, MAC, firmware and available update, state, uptime, CPU, memory |
drive_list_storage_pools |
Pools with capacity and usage, and RAID groups: level in effect vs. configured, protection, rebuild/expansion progress |
drive_list_disks |
Drive bays and cache slots with model, serial, size, temperature, pool, hot-spare flags and SMART counters |
drive_list_shared_drives |
Shared drives with pool, usage, quota, encryption, snapshot and remote-backup flags |
drive_get_shared_drive |
One shared drive |
drive_get_file_services |
Whether SMB, NFS and Time Machine are on, and the interfaces clients connect to |
drive_list_nfs_connections |
NFS clients, the shared drives each may mount (rw/ro) and the export path to mount |
Write (preview first; confirm=true applies):
| Tool | Permission category | What it changes |
|---|---|---|
drive_set_file_service |
file_services (update) |
Turns SMB, NFS or Time Machine on or off |
drive_add_nfs_connection |
nfs_connections (create) |
Lets a new client mount one or more shared drives |
drive_update_nfs_connection |
nfs_connections (update) |
Changes a client's shared drives or async writes |
drive_remove_nfs_connection |
nfs_connections (delete) |
Stops a client from mounting anything |
See docs/tools.md for parameters and behavior.
No support bundle
The Drive server has no drive_get_support_bundle tool. Support bundles are one closed privacy schema shared by the Network, Protect and Access servers (unifi_core/support_bundle.py), and Drive isn't part of it. Adding it would change that contract for all three servers. For a Drive problem, run drive_get_system_info for the firmware version, use drive_setup_status when the server is in setup mode, and fill in the bug form's fields by hand.
NFS on UniFi Drive
- Drive keeps every NFS client in one list, and its API replaces that list as a whole. Each NFS tool reads the list, changes one client and writes the list back with every other client exactly as it was read, then reads it back to check. Confirmed writes from one server run one at a time, and a write stops without writing if the list changed since it was planned.
- Before saving a new or changed client, the tools run Drive's own hostname check, as the web app does.
- A client mounts
<nas>:/var/nfs/shared/<Shared Drive Name>over NFSv3. Drive maps every client user to one Drive user; there is no squash option to set. - Turning NFS off with
drive_set_file_servicekeeps the client list, so it applies again when NFS comes back on. The Drive web app clears the list instead.
Policy gates
Writes can be switched off per category, for example:
UNIFI_POLICY_DRIVE_NFS_CONNECTIONS_DELETE=false # no NFS client removal
UNIFI_POLICY_DRIVE_FILE_SERVICES_UPDATE=false # no SMB/NFS/Time Machine toggles
UNIFI_POLICY_DRIVE_UPDATE=false # no updates of any kind on this server
Usage examples
"How full is the NAS, and is the pool protected yet?"
"Show me the SMART health of every disk and flag anything with bad sectors."
"Let 192.168.1.50 mount the Media shared drive read-only over NFS."
"Which NFS clients can mount Shared_Drive?"
Metadata
Release files for unifi-drive-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| unifi_drive_mcp-0.1.0.tar.gz | 22.2 kB | With provenance | Details for unifi_drive_mcp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| unifi_drive_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for unifi_drive_mcp-0.1.0-py3-none-any.whl |
Total release size: 50.7 kB
Release files / unifi_drive_mcp-0.1.0.tar.gz
| Download URL | unifi_drive_mcp-0.1.0.tar.gz |
|---|---|
| Size | 22.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c84c6dc6d5342c227c18c86f3e5cf5a34717630a1edc37060ca312c50f205534
|
|
BLAKE2b-256 checksum How to use checksums |
7300a2d459b22a154da8d0679ebcd775d3a21a0c1c3f60ba7dd26de971f33f67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logRelease files / unifi_drive_mcp-0.1.0-py3-none-any.whl
| Download URL | unifi_drive_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 28.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f94c6d7f7067beabd302353bfb0b0e055ef3a00faf2665eb86349d5c97e99219
|
|
BLAKE2b-256 checksum How to use checksums |
df0bb2704eaf983cd439616374ca51181253982fde93034a3d123f7d221beec3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logSecurity for unifi-drive-mcp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for unifi_drive_mcp-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.