Skip to main content
Glama
vandreus

UniFi MCP Server

by vandreus

get_wireless_clients

Retrieve connected wireless clients from UniFi network infrastructure to monitor device activity and manage network access.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Full tool definition including schema and handler. The handler fetches all clients using unifi.listAllClients(), filters for wireless clients (those without isWired or is_wired flag), and returns a JSON summary with counts and list.
    get_wireless_clients: {
      description: 'Get all wireless (WiFi) clients',
      schema: z.object({}),
      handler: async () => {
        const allClients = await unifi.listAllClients();
        const clients = allClients.data || [];
    
        const wireless = clients.filter(c => !c.isWired && !c.is_wired);
    
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({
              wirelessCount: wireless.length,
              totalClients: clients.length,
              wirelessClients: wireless
            }, null, 2)
          }]
        };
      }
    },
  • src/server.js:28-32 (registration)
    Registers the clientTools module (containing get_wireless_clients) by calling registerToolsFromModule(clientTools). This function iterates over the tools object and calls server.tool() for each.
    registerToolsFromModule(networkTools);
    registerToolsFromModule(deviceTools);
    registerToolsFromModule(clientTools);
    registerToolsFromModule(protectTools);
    registerToolsFromModule(accessTools);
  • src/server.js:16-25 (registration)
    Helper function that registers all tools from a module object (like clientTools) into the MCP server using server.tool(name, schema, handler).
    const registerToolsFromModule = (toolsModule) => {
      Object.entries(toolsModule).forEach(([name, toolConfig]) => {
        server.tool(
          name,
          toolConfig.schema,
          toolConfig.handler,
          { description: toolConfig.description }
        );
      });
    };
  • Helper function called by the handler to retrieve all clients across hosts and sites from UniFi API.
    export async function listAllClients() {
      const response = await cloudApi.get('/v1/clients');
      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