Skip to main content
Glama
nntkio

UniFi MCP Server

by nntkio

get_devices

Retrieve all UniFi network devices including access points, switches, and gateways for monitoring and management through the UniFi MCP Server.

Instructions

Get all UniFi network devices (access points, switches, gateways)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler logic for the 'get_devices' tool within the @server.call_tool() dispatch in call_tool function.
    case "get_devices": devices = await client.get_devices() return [TextContent(type="text", text=format_devices(devices))]
  • Schema definition (Tool with name, description, inputSchema) for 'get_devices' in the list_tools function.
    Tool( name="get_devices", description="Get all UniFi network devices (access points, switches, gateways)", inputSchema={ "type": "object", "properties": {}, "required": [], }, ),
  • Registration of tools via @server.list_tools() decorator on list_tools function.
    @server.list_tools() async def list_tools() -> list[Tool]:
  • UniFiClient.get_devices() method that fetches devices from the UniFi API.
    async def get_devices(self) -> list[dict[str, Any]]: """Get all network devices. Returns: List of device dictionaries. """ return await self._request("GET", "/api/s/{site}/stat/device")
  • format_devices helper function used to format the device list into readable text output.
    def format_devices(devices: list[dict[str, Any]]) -> str: """Format device list for display.""" if not devices: return "No devices found." lines = [f"Found {len(devices)} device(s):\n"] for device in devices: name = device.get("name", "Unknown") mac = device.get("mac", "Unknown") model = device.get("model", "Unknown") device_type = device.get("type", "Unknown") state = device.get("state", 0) state_str = "Online" if state == 1 else "Offline" ip = device.get("ip", "N/A") version = device.get("version", "N/A") lines.append(f"- {name}") lines.append(f" MAC: {mac}") lines.append(f" Model: {model} ({device_type})") lines.append(f" Status: {state_str}") lines.append(f" IP: {ip}") lines.append(f" Firmware: {version}") lines.append("") return "\n".join(lines)

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