Skip to main content
Glama
nntkio

UniFi MCP Server

by nntkio

block_client

Block network access for a specific client device using its MAC address to restrict unauthorized connections or manage network security.

Instructions

Block a client from accessing the network

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
macYesMAC address of the client to block

Implementation Reference

  • Registration of the block_client MCP tool, defining its name, description, and input schema requiring a 'mac' string.
    Tool( name="block_client", description="Block a client from accessing the network", inputSchema={ "type": "object", "properties": { "mac": { "type": "string", "description": "MAC address of the client to block", } }, "required": ["mac"], }, ),
  • Handler in @server.call_tool() that processes the tool call by extracting the MAC address, calling UniFiClient.block_client, and returning a success message.
    case "block_client": mac = arguments.get("mac", "") await client.block_client(mac) return [ TextContent( type="text", text=f"Client {mac} has been blocked from the network.", ) ]
  • Core UniFiClient method implementing the block logic by sending a POST request to the UniFi controller's stamgr endpoint with the 'block-sta' command.
    async def block_client(self, mac: str) -> bool: """Block a client from the network. Args: mac: Client MAC address. Returns: True if block command was sent successfully. """ await self._request( "POST", "/api/s/{site}/cmd/stamgr", json={"cmd": "block-sta", "mac": mac.lower()}, ) return True

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