Skip to main content
Glama
nntkio

UniFi MCP Server

by nntkio

disconnect_client

Force disconnect a client from a UniFi network by providing its MAC address to manage network access and resolve connectivity issues.

Instructions

Force disconnect a client from the network

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
macYesMAC address of the client to disconnect

Implementation Reference

  • Tool registration including name, description, and input schema for disconnect_client tool.
    Tool( name="disconnect_client", description="Force disconnect a client from the network", inputSchema={ "type": "object", "properties": { "mac": { "type": "string", "description": "MAC address of the client to disconnect", } }, "required": ["mac"], }, ),
  • MCP tool handler logic within the main call_tool function: extracts MAC from arguments, calls UniFiClient.disconnect_client, and returns success message.
    case "disconnect_client": mac = arguments.get("mac", "") await client.disconnect_client(mac) return [ TextContent( type="text", text=f"Client {mac} has been disconnected.", ) ]
  • Core UniFiClient method that performs the actual API call to disconnect (kick-sta) the client by MAC address.
    async def disconnect_client(self, mac: str) -> bool: """Force disconnect a client. Args: mac: Client MAC address. Returns: True if disconnect command was sent successfully. """ await self._request( "POST", "/api/s/{site}/cmd/stamgr", json={"cmd": "kick-sta", "mac": mac.lower()}, ) return True
  • Modular tool handler function for disconnect_client (potentially alternative or exported implementation).
    async def disconnect_client(mac: str) -> list[TextContent]: """Disconnect a client. Args: mac: MAC address of the client. Returns: List of text content with result. """ try: async with UniFiClient() as client: await client.disconnect_client(mac) return [ TextContent( type="text", text=f"Client {mac} has been disconnected.", ) ] except UniFiError as e: return [TextContent(type="text", text=f"Error: {e}")]
  • Tool registration definition within list_client_tools for modular client tools.
    Tool( name="disconnect_client", description="Force disconnect a client from the network", inputSchema={ "type": "object", "properties": { "mac": { "type": "string", "description": "MAC address of the client to disconnect", } }, "required": ["mac"], }, ),

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/nntkio/unifiMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server