Skip to main content
Glama
vandreus

UniFi MCP Server

by vandreus

set_camera_privacy

Control camera privacy settings to enable or disable video recording and streaming for UniFi Protect cameras.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/server.js:28-32 (registration)
    Registration of the protectTools module (containing set_camera_privacy) into the MCP server via registerToolsFromModule
    registerToolsFromModule(networkTools); registerToolsFromModule(deviceTools); registerToolsFromModule(clientTools); registerToolsFromModule(protectTools); registerToolsFromModule(accessTools);
  • The MCP tool handler for 'set_camera_privacy'. It checks confirmation and delegates to unifi.setCameraPrivacy
    handler: async ({ hostId, cameraId, enabled, confirm }) => { if (!confirm) { return { content: [{ type: 'text', text: `Privacy mode change cancelled. Set confirm=true to ${enabled ? 'enable' : 'disable'} privacy mode.` }] }; } const result = await unifi.setCameraPrivacy(hostId, cameraId, enabled); return { content: [{ type: 'text', text: `Camera privacy mode ${enabled ? 'enabled' : 'disabled'}. ${JSON.stringify(result, null, 2)}` }] }; }
  • Zod input schema definition for the set_camera_privacy tool
    schema: z.object({ hostId: z.string().describe('The host ID'), cameraId: z.string().describe('The camera ID'), enabled: z.boolean().describe('Enable or disable privacy mode'), confirm: z.boolean().describe('Confirm this action') }),
  • Low-level helper function that calls the UniFi Cloud API to set camera privacy mode
    export async function setCameraPrivacy(hostId, cameraId, enabled) { const response = await cloudApi.patch(`/v1/hosts/${hostId}/cameras/${cameraId}`, { privacyMode: enabled }); return response.data; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vandreus/Unifi-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server