Skip to main content
Glama
vandreus

UniFi MCP Server

by vandreus

list_cameras

Retrieve a list of all cameras connected to your UniFi network for monitoring and management purposes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the list_cameras tool logic by calling unifi.listCameras and formatting the response as JSON text.
    handler: async ({ hostId }) => {
      const cameras = await unifi.listCameras(hostId);
      return {
        content: [{ type: 'text', text: JSON.stringify(cameras, null, 2) }]
      };
    }
  • Zod schema defining the input parameters for the list_cameras tool: hostId (string).
    schema: z.object({
      hostId: z.string().describe('The host ID')
    }),
  • Registration of the list_cameras tool within the protectTools object, including description, schema, and handler.
    list_cameras: {
      description: 'List all UniFi Protect cameras for a host',
      schema: z.object({
        hostId: z.string().describe('The host ID')
      }),
      handler: async ({ hostId }) => {
        const cameras = await unifi.listCameras(hostId);
        return {
          content: [{ type: 'text', text: JSON.stringify(cameras, null, 2) }]
        };
      }
    },
  • Supporting function listCameras that performs the actual API request to retrieve cameras for the given hostId.
    export async function listCameras(hostId) {
      const response = await cloudApi.get(`/v1/hosts/${hostId}/cameras`);
      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