Skip to main content
Glama

tplinkcli

next time imma flash my own openwrt so i dont have to do this shit

A CLI + MCP tool for TP-Link Archer/AX routers, so you can manage the router from the terminal instead of the web UI. Reverse-engineered from the site's JS.

Install

With uv, install it as a global tool - puts tplink and tplink-mcp on your PATH:

uv tool install '.[mcp]'          # from a local checkout
# uv tool install 'tplinkcli[mcp]'  # once published to PyPI

Then put your credentials in ~/.config/tplink/.env:

ROUTER_IP=192.168.0.1
ROUTER_USERNAME=admin
ROUTER_PASSWORD=your-router-password

Credentials are also read from environment variables, a project-local .env, or a file pointed to by $TPLINK_ENV (precedence, low → high: user config → project .env → $TPLINK_ENV → env vars → --host/--password flags).

Related MCP server: miwifi-mcp

CLI

The router only allows one admin session at a time, so each tplink <command> logs in, runs, and logs out, releasing the session for the web UI. For several commands in a row, use the interactive session instead:

tplink                   # interactive session:
tplink> clients
tplink> raw status?form=internet --op read   # no quoting needed in here
tplink> exit           # logs out

One-shot commands:

tplink clients          # connected devices with IP + MAC
tplink status           # mode, WAN IP, uptime, CPU/mem, SSIDs
tplink wifi             # SSID + on/off per band (passwords hidden; --reveal-secrets)
tplink stats            # per-client wireless signal (dBm), PHY rate, band
tplink ports            # physical ethernet port link status
tplink dhcp             # DHCP leases
tplink watch clients|leases  # live poll: print join/leave/IP-change diffs (Ctrl-C to stop)
tplink dhcp-config      # DHCP server pool / lease time / DNS
tplink reservations     # DHCP address reservations
tplink syslog --level ERROR --limit 50   # system log (DHCP/SAE/DFS events)
tplink radio 5g         # radio settings for a band (channel, width, security)
tplink wifi-adv 5g      # advanced: WMM, beacon/DTIM/RTS, tx power, OFDMA, TWT, band steering
tplink firmware         # firmware/hardware version + cloud update check
tplink wan              # WAN/internet status (JSON)
tplink ipv6             # IPv6 WAN + LAN status
tplink session          # session age / login count
tplink dump -o snap.json # full-state snapshot (config-drift diffing)
tplink reboot           # reboot (asks to confirm; --yes to skip)

tplink raw 'status?form=client_status' --op load --json  # call any endpoint directly

Quote the raw path in your shell (the ? is a glob) — not needed inside the interactive session. Add --json to most commands for machine-readable output.

MCP server

Exposes the router to an AI agent — 24 tools including get_syslog, get_client_stats, get_dhcp_settings/set_dhcp_settings, list_reservations/add_reservation, get_wifi_radio/set_wifi_channel/set_wifi_security, get_wps/set_wps, get_guest_network/set_guest_network, session_info, list_endpoints, and raw_request. Wi-Fi passwords are redacted by default (reveal_secrets=true to opt in); radio-restarting writes require confirm=true.

tplink-mcp

Example Claude Code config (credentials via ~/.config/tplink/.env or inline env):

{
  "mcpServers": {
    "tplink": {
      "command": "tplink-mcp",
      "env": { "ROUTER_IP": "192.168.0.1", "ROUTER_PASSWORD": "..." }
    }
  }
}

Development

Work on the code from a checkout without installing globally:

uv sync --extra mcp    # dev tools (pytest) are in the default dependency group
uv run pytest -q       # crypto tests run offline (synthetic vectors only)
uv run tplink status   # run against the router without a global install

uv tool install --force '.[mcp]'   # reinstall the global tool after changes

Available Tools

33 tools
add_reservationA

Reserve an IP for a MAC (AA-BB-CC-DD-EE-FF). The correct fix for a device stuck in static-in-pool limbo — reserve it instead of relying on a static IP inside the pool.

Inputs: ip (required), mac (required), comment.

check_firmware_updateA

Ask the TP-Link cloud whether a firmware update is available (update_number>0 = yes).

Inputs: no named parameters. Returns: object

dhcp_leasesB

Current DHCP leases (hostname, IP, MAC, lease time).

Inputs: no named parameters. Returns: result

ethernet_portsB

Physical ethernet port link status (WAN/LAN, up/down, speed, duplex).

Inputs: no named parameters. Returns: result

get_client_statsA

Per-client wireless stats for online clients: signal_dbm (RSSI), tx/rx_rate_kbps (negotiated PHY rate), band, online_seconds, packet counts. Turns "wifi is slow" into a one-call diagnosis (weak RSSI vs low PHY rate vs a specific band).

Inputs: no named parameters. Returns: result

get_dhcp_settingsA

DHCP server config: enable, pool ipaddr_start/end, leasetime (minutes), gateway, DNS.

Inputs: no named parameters. Returns: object

get_firmware_infoB

Current firmware version, hardware version, and model.

Inputs: no named parameters. Returns: object

get_guest_networkA

Guest network config for a band. PSK redacted unless reveal_secrets=True.

Inputs: band, reveal_secrets. Returns: object

get_ipv6_statusB

IPv6 WAN + LAN status: connection type/enable, LAN address & prefix, DNS, assign type.

Inputs: no named parameters. Returns: object

get_syslogA

System log (newest first): [{time, level, type, content}]. Shows DHCP DECLINE loops, SAE/WPA handshake failures, DFS radar events, session kicks, etc. Filter by level (INFO/WARNING/ERROR) and/or log_type (see the router's categories).

Inputs: level, limit, log_type. Returns: result

get_wifi_radioA

Full radio settings for a band ('2g','5g','5g_2','6g'): ssid, channel, htmode (width), encryption, txpower, mu_mimo, airtime_fairness. PSK redacted unless reveal_secrets=True.

Inputs: band, reveal_secrets. Returns: object

get_wireless_advancedC

Advanced radio settings ("Additional Settings"): tx power, MU-MIMO, WMM, AP isolation, airtime fairness, short GI, beacon interval, DTIM, RTS/fragmentation threshold, group-key update, plus the Wi-Fi 6 toggles OFDMA, TWT (Target Wake Time — phone power-save), and Smart Connect band steering.

Inputs: band. Returns: object

get_wpsC

WPS global state ({wps: on/off}).

Inputs: no named parameters. Returns: object

list_clientsA

List devices currently connected to the router (wired, wireless, guest).

Inputs: no named parameters. Returns: object

list_endpointsA

Known API endpoints for raw_request: [{form_path, operations, purpose, read_safe}]. Optionally filter to form paths/purposes containing a substring (e.g. 'dhcp', 'wireless').

Inputs: contains. Returns: result

list_reservationsC

DHCP address reservations: [{mac, ip, comment, hostname, enable}].

Inputs: no named parameters. Returns: result

raw_requestA

Call any router endpoint, e.g. form_path='status?form=client_status', operation='load'.

An escape hatch — many forms need a specific operation ('load'/'write'/... not 'read').
Use list_endpoints() to discover valid form paths, operations, and shapes for this model.

Inputs: form_path (required), params, operation.

reboot_routerA

Reboot the router. Must be called with confirm=True to actually reboot.

Inputs: confirm. Returns: result

remove_reservationC

Delete the DHCP reservation for a MAC.

Inputs: mac (required).

router_statusA

Router overview: firmware/hardware version, operation mode, WAN IP, uptime, CPU/memory usage, SSIDs. Wi-Fi PSKs are redacted unless reveal_secrets=True.

Inputs: reveal_secrets. Returns: object

session_infoA

Session observability: age_seconds, login_count, stok_prefix — lets you see the auto-recovery (re-login) happen instead of trusting it silently.

Inputs: no named parameters. Returns: object

set_dhcp_settingsA

Update DHCP server settings (only the given fields). Restarts the DHCP server; existing leases keep their IP until renewal. leasetime is in minutes.

Inputs: enable, gateway, pri_dns, snd_dns, +3 more.

set_guest_networkC

Turn a band's guest network on or off.

Inputs: band (required), enabled (required). Returns: result

set_ofdmaA

Enable/disable OFDMA (Wi-Fi 6). ⚠️ Restarts the radios; clients drop briefly. confirm=True.

Inputs: enabled (required), confirm. Returns: result

set_smart_connectA

Enable/disable Smart Connect band steering (single SSID across bands). ⚠️ Restarts the radios; clients drop briefly. Requires confirm=True.

Inputs: enabled (required), confirm. Returns: result

set_twtA

Enable/disable Target Wake Time (Wi-Fi 6 power-save; eases iOS/phone battery drain). ⚠️ Restarts the radios; clients drop briefly. Requires confirm=True.

Inputs: enabled (required), confirm. Returns: result

set_wifi_bandB

Enable or disable a wireless band ('2g', '5g', '5g_2', '6g').

Inputs: band (required), enabled (required). Returns: result

set_wifi_channelA

Set a band's channel (channel='auto' to auto-select) and optional width (htmode '20'/'40'/'80'). ⚠️ Restarts the radio: clients on that band drop for ~10 s; a DFS 5 GHz channel adds a ~60 s radar-scan quiet period. Requires confirm=True.

Inputs: band (required), channel (required), htmode, confirm. Returns: result

set_wifi_securityA

Set a band's security mode / PSK. ⚠️ Restarts the radio and disconnects EVERY client on that band until they re-auth with the new settings. Requires confirm=True.

Inputs: band (required), encryption (required), confirm, password. Returns: result

set_wireless_advancedA

Set per-band tx power ('high'/'mid'/'low'), MU-MIMO, and/or airtime fairness. ⚠️ Restarts the radio; clients on the band drop briefly. Requires confirm=True.

Inputs: band (required), confirm, mu_mimo, txpower, +1 more. Returns: result

set_wireless_sysparaA

Set the advanced radio parameters for a band — WMM, AP isolation, beacon interval, DTIM period, RTS/fragmentation threshold, group-key update interval. ⚠️ Restarts the radio; clients on the band drop briefly. Requires confirm=True.

Inputs: band (required), wmm, dtim, confirm, +5 more. Returns: result

set_wpsB

Enable or disable WPS globally.

Inputs: enabled (required). Returns: result

wifi_infoA

SSID, security and on/off state per band. Passwords redacted unless reveal_secrets=True.

Inputs: reveal_secrets. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 33 tools

    Disambiguation3/5

    The Wi-Fi read surface is split across wifi_info, get_wifi_radio, get_wireless_advanced, and router_status with overlapping SSID/security/txpower/MU-MIMO fields; set_wireless_advanced vs set_wireless_syspara also require close reading. Descriptions are detailed enough to resolve most cases, so overlap exists but is usually manageable.

    Naming Consistency3/5

    Most names are snake_case and action-oriented, but the set mixes verb_noun patterns (get_firmware_info, list_clients, set_wifi_band) with noun-only names (router_status, wifi_info, dhcp_leases, ethernet_ports, session_info). It remains readable, but there is no single predictable naming convention throughout.

    Tool Count2/5

    33 tools is beyond the 25-tool threshold and many are granular setters (set_ofdma, set_twt, set_smart_connect, set_wireless_syspara) that could plausibly be consolidated. The router domain is broad, but the tool surface feels heavy for what an agent can reliably select among.

    Completeness3/5

    Core Wi-Fi, DHCP, client diagnostics, reservations, and reboot workflows are covered, and raw_request/list_endpoints provide an escape hatch. However, common router administration areas like port forwarding, firewall/MAC filtering, LAN settings, VPN/QoS, and device blocking are absent as first-class tools.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to monitor and control Nokia G-2425G-A GPON home routers (e.g., Airtel) via natural language, including listing connected devices, and blocking or unblocking internet access for specific devices.
      3
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to interact with Xiaomi/Redmi routers, providing read-only queries and management capabilities such as device listing, port forwarding, DHCP reservations, and reboot control.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables LLM/MCP clients to read and, when explicitly allowed, modify TP-Link Archer AX53 router settings directly over the LAN using the router's own web protocol, without a browser or cloud account. It is read-first, write-gated, and lockout-aware, with tools for clients, DHCP, Wi-Fi, access control, presence history, and other router operations.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables LLM clients to inspect and manage a TP-Link Deco mesh Wi-Fi network, covering mesh nodes, connected devices, SSIDs and radio settings, internet status, blocked clients, and DHCP address reservations. Runs entirely against the router on the local network without any cloud account.
      15
      33 PyPI
      MIT