Skip to main content
Glama
vandreus

UniFi MCP Server

by vandreus

get_devices_for_site

Retrieve all network devices associated with a specific UniFi site to monitor and manage your network infrastructure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler function that invokes the UniFi client to fetch devices for a specific site and returns a formatted JSON response in the MCP content format.
    handler: async ({ hostId, siteId }) => { const devices = await unifi.getDevicesForSite(hostId, siteId); return { content: [{ type: 'text', text: JSON.stringify(devices, null, 2) }] }; }
  • Zod input schema defining the required parameters: hostId and siteId as strings.
    schema: z.object({ hostId: z.string().describe('The host ID'), siteId: z.string().describe('The site ID') }),
  • Registration of the get_devices_for_site tool within the deviceTools object exported from devices.js, which includes description, schema, and handler. This module is imported and registered to the MCP server.
    get_devices_for_site: { description: 'Get all devices for a specific site', schema: z.object({ hostId: z.string().describe('The host ID'), siteId: z.string().describe('The site ID') }), handler: async ({ hostId, siteId }) => { const devices = await unifi.getDevicesForSite(hostId, siteId); return { content: [{ type: 'text', text: JSON.stringify(devices, null, 2) }] }; }
  • Core helper function in the UniFi client that performs the actual API request to retrieve devices for a given host and site.
    export async function getDevicesForSite(hostId, siteId) { const response = await cloudApi.get(`/v1/hosts/${hostId}/sites/${siteId}/devices`); 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