/unifi-mcp-server:unifi-protect-toolsfrom unifi-mcp-server
Guides adding, changing, or testing UniFi Protect MCP tools across 16 modules covering cameras, alarms, NVRs, relays, and more. Covers Protect client usage, v7 models, confirm/dry_run patterns, test fixtures, and known API gaps.
Ships in unifi-mcp-server. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Protect tools talk to the Protect integration API on the local console. Read this before you add or change a tool in any src/tools/protect_*.py module. For the general add-a-tool workflow, see unifi-mcp-tool-builder.
16 modules, 80 functions, 80 registered tool names.
| Module | Tools | Examples |
|---|---|---|
src/tools/protect_alarm.py | 8 | list_protect_arm_profiles, set_current_protect_arm_profile, disable_protect_alarm |
src/tools/protect_alarm_hubs.py | 4 | list_protect_alarm_hubs, update_protect_alarm_hub |
src/tools/protect_bridges.py | 3 | get_protect_bridge, update_protect_bridge |
src/tools/protect_cameras.py | 2 | list_protect_cameras, get_protect_camera |
src/tools/protect_devices.py | 13 | list_protect_devices, update_protect_light, get_protect_chime |
src/tools/protect_events.py | 7 | list_protect_events, list_protect_model_updates, send_protect_alarm_webhook |
src/tools/protect_external_arm.py | 7 | list_protect_external_arm_profiles, arm_protect_external_arm_profile |
src/tools/protect_fobs.py | 3 | update_protect_fob |
src/tools/protect_link_stations.py | 3 | update_protect_link_station |
src/tools/protect_nvr.py | 2 | list_protect_nvrs, get_protect_nvr |
src/tools/protect_pos.py | 1 | ingest_pos_transaction |
src/tools/protect_relays.py | 4 | update_protect_relay, activate_protect_relay_output |
src/tools/protect_sirens.py | 6 | play_protect_siren, stop_protect_siren |
src/tools/protect_speakers.py | 5 | update_protect_speaker, stop_protect_speaker_siren |
src/tools/protect_users.py | 4 | list_protect_users, list_protect_ulp_users |
src/tools/protect_views.py | 8 | get_protect_meta_info, create_protect_live_view |
MCP resources for Protect are in src/resources/protect.py. The raw connector_protect_* proxy tools are in src/tools/connector.py and belong to the cloud tool set.
async def in the module is a tool (register_module_tools() in src/tool_registry.py). Name helpers with a leading _._LOCAL_TOOL_MODULES only (src/main.py). They do not exist in cloud modes.src/main.py: _LOCAL_TOOL_MODULES, the protect profile and the system profile.CACHED_MODULES (src/cache.py).ProtectClient from src/api/protect_client.py, not UniFiClient.settings.get_protect_integration_path("<endpoint>"). In local mode that gives /proxy/protect/integration/v1/<endpoint>.await client.authenticate() first; it checks access with a GET to cameras.json_data=, not json=.APIError. A successful 204 or other empty response returns {} rather than attempting JSON decoding./subscribe/devices, /subscribe/events, and /subscribe/updates routes are WebSocket subscriptions even though OpenAPI describes their upgrade handshake as GET. Never issue an ordinary HTTP GET to claim subscription coverage.ProtectClient.sample_model_updates() owns URL conversion, API-key upgrade headers, TLS policy, bounded collection, frame validation, and close cleanup for /subscribe/updates.async with ProtectClient(settings) as client:
await client.authenticate()
response = await client.patch(
settings.get_protect_integration_path(f"relays/{relay_id}"),
json_data=payload,
)
src/models/protect_v7.py and inherit _ProtectV7Base, which sets populate_by_name=True and extra="allow". Unknown fields from newer firmware must not break parsing.alias=. Dump with model_dump(by_alias=True).src/models/protect_camera.py, src/models/protect_nvr.py and others) do not allow extra fields. Do not copy them for new work.src/models/__init__.py.Copy update_protect_relay in src/tools/protect_relays.py. The order is fixed:
validate_confirmation(confirm, "<operation>", dry_run)ValidationError on bad inputNone; raise ValidationError if it is emptyif coerce_bool(dry_run): return {"dry_run": True, "operation": "<tool name>", ..., "payload": payload}ProtectClientDo not write audit code; the registry wrapper audits every mutating call. A tool with a risky word in its name (disable, reset and others) must be in DESTRUCTIVE_TOOLS (src/tool_registry.py) or in RISKY_NAME_EXEMPTIONS (tests/unit/fleet/test_tiers.py).
| Kind | Return |
|---|---|
| List | {"offset", "limit", "count", "totalCount", "data": [...]}; use validate_limit_offset() (default 100, range 1 to 1000) |
| Get or update | Model.model_validate(_extract_item(response)).model_dump(by_alias=True) |
| Action | {"success": True, <ids>, "response": ...} |
_extract_collection and _extract_item accept a bare value or a {"data": ...} wrapper. Each module has its own copy. Log through sanitize_log_message().
tests/unit/tools/test_protect_<module>.py. Representative: tests/unit/tools/test_protect_relays.py.patch("src.tools.protect_relays.ProtectClient", return_value=mock_client), where mock_client is an AsyncMock with __aenter__ returning itself and __aexit__ returning False.mock_client.patch.assert_awaited_once_with(path, json_data=...).confirm (and with confirm="false"), that the client is never created on refusal, and that a dry run makes no call.tests/unit/tools/test_protect_write_gates.py checks every Protect write for confirm and dry_run.UPDATE_TOOL_TIERS=1 pytest tests/unit/fleet/test_tiers.py.scripts/protect-api-spec-v7.4.110.json). Check an endpoint there before you call it. The v7.4.96, v7.3.68 and v7.3.70 snapshots remain for diffs; 7.4.110 changed only the external arm profile PIN fields and the fob keypad indicators.pin_code, pin_codes) are credentials. Keep them in CREDENTIAL_FIELDS (src/utils/sanitize.py), out of dry-run previews, and out of every response.get_protect_arm_profile calls a GET path that is not in the v7.3.68 spec, so it may return 404.nvr.featureFlags.useExternalAlarmManager before choosing local arm-profiles versus external/arm-profiles.docs/UNIFI_API.md still calls Protect v7 "planned" near its start, which contradicts its later Phase 5a section.list_protect_events and list_protect_device_updates still issue ordinary HTTP GETs to /subscribe/events and /subscribe/devices, although the pinned Protect spec classifies both as WebSocket subscriptions. The corrected /subscribe/updates implementation must not be treated as evidence that those two older tools stream successfully.list_protect_device_updates is defined once, in src/tools/protect_devices.py. src/tools/protect_events.py imports it for its two compatibility wrappers; register_module_tools skips imported functions, so it registers once. TestToolModuleSets in tests/unit/test_main_runtime.py fails if a tool name is defined in two modules.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub enuno/unifi-mcp-server --plugin unifi-mcp-server16 skills in this plugin
/unifi-channel-planningBuild an AI-driven low-interference WiFi channel plan from UniFi MCP neighbor observations. Use when the task is RF optimization, channel conflict reduction, co-channel interference mitigation, or per-AP channel assignment.
/unifi-cloud-fleet-toolsUse when adding, changing or testing a cloud or multi-controller MCP tool (Site Manager, the connector proxy, the integration API tools, sites, Mobility, InnerSpace, Carrier Fabric) or the fleet stack (router, registry, pool, read cache, workers, fleet_* and admin tools) - covers API modes, gating, per-call routing, tokens and roles, test fixtures and known gaps./unifi-devicesUniFi device management: inventory, adoption, restarts, firmware upgrades, radio/channel configuration, port profiles, switching/stacks, network topology, and diagnostics. Use when the task involves physical UniFi hardware (APs, switches, gateways, cameras).
Other plugins' skills for the same job