mcpField
L
lancontrol

lancontrol

Local
github.com/CloudCorpRecordsCloud & Infra0Updated 1w ago

About lancontrol

lancontrol is a CLI and stdio MCP server for reading UniFi Network controller state. It provides a focused set of actions for network operators, covering clients, devices, WLANs, health, alarms, events, system information, and identity.

Key features

  1. 01Read connected clients and network devices
  2. 02Inspect WLAN configurations and site health
  3. 03Retrieve alarms and recent events
  4. 04Get controller system information and identity
  5. 05Use the same binary as CLI or MCP server

Use cases

  1. 01Review connected clients and access points
  2. 02Check site health and active alarms
  3. 03Query recent controller events
  4. 04Retrieve UniFi controller identity and system details

MCP support

Exposes one `unifi` tool with an action selector for eight controller queries and local help. The stdio MCP server reads `UNIFI_URL` and `UNIFI_API_KEY` from the environment.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"cloudcorprecords-lancontrol": {
"command": "npx",
"args": [
"-y",
"@reneturcios/lancontrol"
]
}
}
}
Run commandnpx -y @reneturcios/lancontrol

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@reneturcios/lancontrol0.1.0
ocighcr.io/cloudcorprecords/lancontrol:0.1.0

Tools

1

Saved tool list · updated 1w ago

ParameterTypeRequiredDescription
limitintegerNoMaximum number of events to return, as a positive integer, only supported for the events action.
actionenumYesAction to run: clients, devices, wlans, health, alarms, events, sysinfo, me, or help.clients | devices | wlans | health | alarms | events | sysinfo | me | help

Details

From the project README

lancontrol

lancontrol reads UniFi Network controller state through a single action-router tool: connected clients, network devices, WLAN configurations, site health, active alarms, recent events, controller sysinfo, and the authenticated identity. One binary serves a command-line interface and a stdio MCP server.

This is a labelled core subset. The upstream surface defines 267 actions in total; lancontrol builds only the 8 preserved convenience actions plus help (9 action values). The generated families are omitted, on purpose and by name: official_* (78 actions), unifi_* (175 actions), and the 5 hybrid aliases (list_clients, list_devices, list_networks, list_wifi, get_system_info).

Configuration

Both variables are required for every action except help; a missing value errors before any request is made:

VariableRequiredPurpose
UNIFI_URLyesController base URL, e.g. https://unifi.local.
UNIFI_API_KEYyesAPI key, sent as the X-API-KEY header.
UNIFI_SITEnoUniFi site name. Defaults to default.

Never pass the API key as a tool argument; it is read from the environment only.

Install

npx @reneturcios/lancontrol help

Or run the container image:

docker run -i ghcr.io/cloudcorprecords/lancontrol

The container defaults to the MCP server (see below). Pass CLI arguments to use it as a CLI instead.

CLI

lancontrol clients
lancontrol devices
lancontrol wlans
lancontrol health
lancontrol alarms
lancontrol events --limit 25
lancontrol sysinfo
lancontrol me
lancontrol help

lancontrol --version

Action commands print the upstream JSON payload. help prints the local action documentation and needs no configuration and no network. Exit codes: 0 on success, 1 when a call fails (including a missing-config or upstream API error), 2 for usage errors.

MCP server

One bin serves both faces. The mcp subcommand starts a stdio MCP server:

npx -y @reneturcios/lancontrol mcp

MCP client configuration:

{
  "mcpServers": {
    "lancontrol": {
      "command": "npx",
      "args": ["-y", "@reneturcios/lancontrol", "mcp"],
      "env": {
        "UNIFI_URL": "https://unifi.local",
        "UNIFI_API_KEY": "...",
        "UNIFI_SITE": "default"
      }
    }
  }
}
Tool

One tool is exposed:

ToolInputWhat it returns
unifiaction (required, one of the 9 subset values), limit (optional integer, events only)The upstream payload for the chosen action, or local documentation for help.
ActionDescription
clientsConnected wireless and wired clients.
devicesNetwork devices: APs, switches, gateways.
wlansWiFi network configurations.
healthSite health summary.
alarmsActive alarms and alerts.
eventsRecent controller events.
sysinfoController system information.
meAuthenticated UniFi identity.
helpBuilt-in action documentation.

Upstream mapping (documented reconstruction)

The public spec names the actions but does not publish, in its convenience-action table, the exact controller path for each one. Each action is therefore implemented as a GET to a plausible documented UniFi internal endpoint under UNIFI_URL, with the X-API-KEY header:

ActionEndpoint
clientsGET /proxy/network/api/s/{site}/stat/sta
devicesGET /proxy/network/api/s/{site}/stat/device
wlansGET /proxy/network/api/s/{site}/rest/wlanconf
healthGET /proxy/network/api/s/{site}/stat/health
alarmsGET /proxy/network/api/s/{site}/stat/alarm
eventsGET /proxy/network/api/s/{site}/stat/event (plus ?_limit={limit} when a limit is supplied)
sysinfoGET /proxy/network/api/s/{site}/stat/sysinfo
meGET /proxy/network/api/self
helpno request — answered locally

HTTP failures surface the status plus the upstream message (meta.msg, message, or error) when present.

Development

npm install
npm run build   # tsc -> dist/
npm test        # node test runner over test/*.test.ts, no network (fake fetch fixtures)
npm run dev     # run the CLI from source via tsx

License

MIT — see LICENSE.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.