Skip to main content
Glama
vandreus

UniFi MCP Server

by vandreus

get_camera

Retrieve camera details and settings from UniFi network infrastructure to monitor and manage surveillance devices through the Cloud API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler for 'get_camera'. Calls unifi.getCamera(hostId, cameraId) and returns formatted JSON response.
    handler: async ({ hostId, cameraId }) => { const camera = await unifi.getCamera(hostId, cameraId); return { content: [{ type: 'text', text: JSON.stringify(camera, null, 2) }] }; }
  • Input validation schema for the 'get_camera' tool using Zod, requiring hostId and cameraId.
    schema: z.object({ hostId: z.string().describe('The host ID'), cameraId: z.string().describe('The camera ID') }),
  • Definition of the 'get_camera' tool within the protectTools module, which is later registered in the MCP server.
    get_camera: { description: 'Get details of a specific camera', schema: z.object({ hostId: z.string().describe('The host ID'), cameraId: z.string().describe('The camera ID') }), handler: async ({ hostId, cameraId }) => { const camera = await unifi.getCamera(hostId, cameraId); return { content: [{ type: 'text', text: JSON.stringify(camera, null, 2) }] }; } },
  • src/server.js:31-31 (registration)
    Batch registration of all protectTools (including get_camera) into the MCP server via registerToolsFromModule.
    registerToolsFromModule(protectTools);
  • Supporting function getCamera that performs the actual UniFi Cloud API call to retrieve specific camera details.
    export async function getCamera(hostId, cameraId) { const response = await cloudApi.get(`/v1/hosts/${hostId}/cameras/${cameraId}`); 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