Skip to main content
Glama
vandreus

UniFi MCP Server

by vandreus

reconnect_client

Reconnect a client device to the UniFi network to restore connectivity or apply configuration changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'reconnect_client'. Calls the underlying unifi.reconnectClient API and formats the response as MCP content.
    handler: async ({ hostId, siteId, mac }) => {
      const result = await unifi.reconnectClient(hostId, siteId, mac);
      return {
        content: [{ type: 'text', text: `Client ${mac} has been reconnected. ${JSON.stringify(result, null, 2)}` }]
      };
    }
  • Zod schema defining the input parameters for the 'reconnect_client' tool: hostId, siteId, and mac.
    schema: z.object({
      hostId: z.string().describe('The host ID'),
      siteId: z.string().describe('The site ID'),
      mac: z.string().describe('The client MAC address')
    }),
  • src/server.js:28-32 (registration)
    Registration of the clientTools module (which includes 'reconnect_client') to the MCP server using the dynamic registerToolsFromModule function.
    registerToolsFromModule(networkTools);
    registerToolsFromModule(deviceTools);
    registerToolsFromModule(clientTools);
    registerToolsFromModule(protectTools);
    registerToolsFromModule(accessTools);
  • Core helper function implementing the UniFi API call to reconnect a client. Called by the tool handler.
    export async function reconnectClient(hostId, siteId, mac) {
      const response = await cloudApi.post(`/v1/hosts/${hostId}/sites/${siteId}/clients/${mac}/reconnect`);
      return response.data;
    }
  • src/server.js:16-25 (registration)
    Helper function that dynamically registers all tools from a module (like clientTools containing 'reconnect_client') by extracting name, schema, handler, and description.
    const registerToolsFromModule = (toolsModule) => {
      Object.entries(toolsModule).forEach(([name, toolConfig]) => {
        server.tool(
          name,
          toolConfig.schema,
          toolConfig.handler,
          { description: toolConfig.description }
        );
      });
    };

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