Skip to main content
Glama
tplink-sg1016-mcp

tplink-sg1016-mcp

by daniel-k

tplink-sg1016-mcp

WARNING: This project is in early development. Many tools are based on reverse-engineered API endpoints, not official documentation. Not all tools have been thoroughly tested against real hardware. Write operations (port config, PoE, VLANs, QoS, rebooting, IP changes, etc.) can disrupt your network or make the switch unreachable if used incorrectly. Use at your own risk. Always verify critical changes through the switch's web UI.

MCP server for TP-Link SG1016PE Easy Smart switches. Exposes switch management over the Model Context Protocol (stdio transport), so you can query and configure the switch from Claude Code or any other MCP client.

Prerequisites

  • Python 3.13+

  • uv

  • A TP-Link SG1016PE (or compatible Easy Smart) switch reachable over HTTP

Related MCP server: Omada MCP Server

Configuration

The server is configured via environment variables:

Variable

Default

Description

TPLINK_HOST

192.168.0.1

Switch IP address

TPLINK_PORT

80

Web interface port

TPLINK_USERNAME

admin

Login username

TPLINK_PASSWORD

(empty)

Login password

TPLINK_USE_SSL

false

Use HTTPS

TPLINK_VERIFY_SSL

false

Verify SSL certificate

Running

With uv (development)

uv run tplink-sg1016-mcp

With the PEX executable

Build a self-contained executable:

uv run tox -e pex

This produces dist/tplink-sg1016-mcp.pex. Run it directly:

TPLINK_PASSWORD=secret ./dist/tplink-sg1016-mcp.pex

Claude Code integration

Add to your MCP config (e.g. ~/.claude/settings.json or .claude/settings.json):

{
  "mcpServers": {
    "tplink": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/tplink-sg1016-mcp", "tplink-sg1016-mcp"],
      "env": {
        "TPLINK_HOST": "192.168.0.1",
        "TPLINK_PASSWORD": "your-password"
      }
    }
  }
}

Or using the PEX:

{
  "mcpServers": {
    "tplink": {
      "command": "/path/to/dist/tplink-sg1016-mcp.pex",
      "env": {
        "TPLINK_HOST": "192.168.0.1",
        "TPLINK_PASSWORD": "your-password"
      }
    }
  }
}

Available tools

System

Tool

Description

get_device_info

Model name, MAC, IP, firmware, hardware version

get_ip_settings

Switch management IP config (DHCP/static)

get_led_status

Front-panel LED on/off state

set_device_name

Change the switch's system name

set_ip_settings

Change management IP (DHCP or static)

set_led

Turn front-panel LEDs on/off

reboot_switch

Reboot the switch (saves config first)

Port management

Tool

Description

get_port_states

All 16 ports: admin state, speed, flow control

get_port_statistics

Per-port TX/RX good/bad packet counters

set_port_state

Enable/disable a port, set speed and flow control

PoE (Power over Ethernet)

Tool

Description

get_poe_port_states

Per-port power, voltage, current, PD class, status

get_poe_global_state

Switch-wide power budget, consumption, remaining

get_poe_recovery

PoE auto-recovery (ping watchdog) config

set_poe_global_limit

Set the global PoE power budget (watts)

set_poe_port

Configure per-port PoE: enable, priority, power limit

repower_poe_port

Power-cycle a PoE port to reboot connected device

802.1Q VLANs

Tool

Description

get_vlan_config

All VLANs with tagged/untagged port membership

get_pvid_config

Per-port PVID (native VLAN) assignments

set_vlan_enabled

Enable/disable 802.1Q VLAN mode

create_vlan

Create a new VLAN with optional initial port memberships

add_vlan_members

Add ports to an existing VLAN (reads current state first)

remove_vlan_members

Remove ports from an existing VLAN (reads current state first)

delete_vlan

Delete a VLAN

set_port_pvid

Set a port's native VLAN for untagged traffic

QoS (Quality of Service)

Tool

Description

get_qos_config

QoS mode and per-port priority queues

get_bandwidth_limits

Per-port ingress/egress rate limits

get_storm_control

Per-port storm control settings

set_qos_mode

Set QoS mode (port-based, 802.1p, DSCP)

set_port_qos_priority

Set a port's priority queue

set_bandwidth_limit

Set per-port ingress/egress rate limits

set_storm_control

Configure per-port storm control

Security

Tool

Description

get_igmp_snooping

IGMP snooping config and multicast groups

get_loop_prevention

Loop prevention enabled/disabled

set_igmp_snooping

Enable/disable IGMP snooping

set_loop_prevention

Enable/disable loop prevention

Diagnostics

Tool

Description

run_cable_test

Run TDR cable test on selected ports and return results

LAG / Mirroring

Tool

Description

get_lag_config

Link aggregation groups and member ports

get_port_mirror_config

Port mirroring setup (source/destination)

create_lag

Create/modify a link aggregation group

delete_lag

Delete a link aggregation group

set_port_mirror

Configure port mirroring for traffic analysis

Development

Install dev dependencies:

uv sync

Run all checks:

uv run tox

Individual tox environments:

uv run tox -e lint      # ruff linter
uv run tox -e format    # ruff format check
uv run tox -e pex       # build PEX executable

Format code:

uv run ruff format src/

Format tox.ini:

uv run tox-ini-fmt tox.ini

Available Tools

41 tools
add_vlan_membersA

Add ports to an existing 802.1Q VLAN.

Reads the current VLAN state and adds the specified ports without affecting other existing members. A port can be changed from tagged to untagged (or vice versa) by including it in the desired list.

Args: vid: VLAN ID of the existing VLAN to modify. tagged_ports: Ports to add as tagged members. untagged_ports: Ports to add as untagged (access) members.

Inputs: vid (required), tagged_ports, untagged_ports. Returns: result

create_lagB

Create or modify a link aggregation group (LAG / port trunk).

Member ports are bonded into a single logical link. Ports in a LAG must have identical speed and duplex settings.

Args: group_id: LAG group ID (1-8). ports: Member port numbers to bond together.

Inputs: ports (required), group_id (required). Returns: result

create_vlanA

Create a new 802.1Q VLAN with optional initial port memberships.

Ports not listed become non-members. Use add_vlan_members / remove_vlan_members to modify port memberships on existing VLANs.

Args: vid: VLAN ID (2-4094). VLAN 1 already exists as the default. name: VLAN name (alphanumeric only, max 10 characters). tagged_ports: Ports that send/receive frames with an 802.1Q VLAN tag. untagged_ports: Ports that send frames without a VLAN tag (access ports).

Inputs: vid (required), name (required), tagged_ports, untagged_ports. Returns: result

delete_lagA

Delete a link aggregation group, releasing its member ports.

Args: group_id: LAG group ID to delete (1-8).

Inputs: group_id (required). Returns: result

delete_vlanA

Delete an 802.1Q VLAN. VLAN 1 (Default) cannot be deleted.

Args: vid: VLAN ID to delete (2-4094).

Inputs: vid (required). Returns: result

get_bandwidth_limitsA

Get per-port ingress and egress bandwidth rate limits in kbps.

A value of 0 means no rate limit (unlimited).

Inputs: no named parameters. Returns: result

get_device_infoA

Get basic switch identity: model name, MAC, IP, firmware and hardware version.

Inputs: no named parameters. Returns: object

get_igmp_snoopingB

Get IGMP snooping configuration and the current multicast group table.

IGMP snooping constrains multicast traffic to only the ports with interested receivers, instead of flooding it to all ports.

Inputs: no named parameters. Returns: object

get_ip_settingsA

Get the switch management IP config: DHCP/static mode, IP, subnet mask, gateway.

Inputs: no named parameters. Returns: object

get_lag_configB

Get link aggregation (LAG / port trunking) configuration.

LAGs bond multiple physical ports into a single logical link for increased bandwidth and redundancy. Up to 8 groups supported.

Inputs: no named parameters. Returns: object

get_led_statusA

Check whether the switch's front-panel port LEDs are turned on or off.

Inputs: no named parameters. Returns: object

get_loop_preventionB

Check whether loop prevention is enabled.

Loop prevention detects and blocks Layer 2 loops caused by incorrect cabling or misconfiguration.

Inputs: no named parameters. Returns: object

get_poe_global_stateA

Get the switch-wide PoE power budget in watts: limit, consumption, remaining.

Inputs: no named parameters. Returns: result

get_poe_port_statesA

Get PoE status for all PoE-capable ports (ports 1-8 on the SG1016PE).

Per port: enabled, priority (HIGH/MIDDLE/LOW), power_limit (AUTO or CLASS_1-4), power_watts (current draw), current_ma, voltage_v, pd_class (detected device class, NO_PD if nothing connected), power_status (OFF/TURNING_ON/ON/OVERLOAD/SHORT/etc).

Inputs: no named parameters. Returns: result

get_poe_recoveryA

Get PoE auto-recovery (ping watchdog) configuration.

When enabled, the switch periodically pings the IP of a PoE-powered device and automatically power-cycles the port if the device stops responding.

Inputs: no named parameters. Returns: object

get_port_mirror_configA

Get port mirroring configuration.

Port mirroring copies traffic from source ports to a destination (monitoring) port for packet capture or analysis. Shows which ports are mirrored for ingress (incoming) and/or egress (outgoing) traffic.

Inputs: no named parameters. Returns: object

get_port_statesA

Get configuration and link status for all 16 switch ports.

Per port: enabled (admin state), speed_config (configured speed), speed_actual (negotiated link speed, LINK_DOWN if no link), flow_control_config/actual. Speed values: LINK_DOWN, AUTO, HALF_10M, FULL_10M, HALF_100M, FULL_100M, FULL_1000M.

Inputs: no named parameters. Returns: result

get_port_statisticsB

Get per-port packet counters (TX/RX good and bad packets).

Counters are cumulative since last reboot and wrap at 2^32 (4 billion). Also includes each port's enabled state and link_status (negotiated speed).

Inputs: no named parameters. Returns: result

get_pvid_configA

Get the per-port PVID (Port VLAN ID / native VLAN) assignments.

Each port has a PVID that determines which VLAN incoming untagged frames are classified into. Defaults to VLAN 1 for all ports.

Inputs: no named parameters. Returns: object

get_qos_configA

Get the QoS configuration: scheduling mode and per-port priority queues.

mode: PORT_BASED (priority set per port), DOT1P_BASED (from 802.1p VLAN tag), or DSCP_BASED (from IP header DSCP field). Per-port priority (PORT_BASED only): LOWEST, NORMAL, MEDIUM, HIGHEST.

Inputs: no named parameters. Returns: object

get_storm_controlA

Get per-port storm control settings.

Storm control rate-limits broadcast, multicast, and/or unknown unicast traffic to prevent network flooding. Shows rate (kbps) and which traffic types are controlled per port.

Inputs: no named parameters. Returns: result

get_vlan_configA

Get the full 802.1Q VLAN configuration.

Returns: enabled (whether 802.1Q mode is active), max_vlans (device limit, typically 32), and a list of VLANs each with vid, name, tagged_ports, and untagged_ports. VLAN 1 ('Default') always exists with all ports as untagged members by default.

Inputs: no named parameters. Returns: object

reboot_switchA

Reboot the switch. Running configuration is saved to flash before rebooting.

The switch will be unreachable for approximately 30 seconds.

Inputs: no named parameters. Returns: result

remove_vlan_membersA

Remove ports from an existing 802.1Q VLAN.

Reads the current VLAN state and removes the specified ports (sets them to non-member) without affecting other existing members.

Args: vid: VLAN ID of the existing VLAN to modify. ports: Port numbers to remove from the VLAN.

Inputs: vid (required), ports (required). Returns: result

repower_poe_portA

Power-cycle a PoE port: briefly cuts and restores power without changing config.

Useful for remotely rebooting a PoE-powered device (AP, camera, etc).

Args: port: Port number (1-8 on the SG1016PE).

Inputs: port (required). Returns: result

run_cable_testA

Start cable diagnostics (TDR test) on specified ports and return results.

Tests cable quality and estimates length. Returns per-port results immediately: status (NOT_TESTED, NO_CABLE, NORMAL, OPEN, SHORT, OPEN_SHORT, CROSSTALK) and length_m (estimated cable length in meters).

Args: ports: Port numbers to test (1-16).

Inputs: ports (required). Returns: result

set_bandwidth_limitB

Set per-port ingress and egress bandwidth rate limits.

Args: port: Port number (1-16). ingress_rate: Max incoming traffic rate in kbps. 0 for unlimited. egress_rate: Max outgoing traffic rate in kbps. 0 for unlimited.

Inputs: port (required), egress_rate (required), ingress_rate (required). Returns: result

set_device_nameB

Change the switch's system name (shown in the web UI and device info).

Args: name: New device name/description.

Inputs: name (required). Returns: result

set_igmp_snoopingA

Enable or disable IGMP snooping.

Args: enabled: True to enable IGMP snooping. report_suppression: True to suppress duplicate IGMP membership reports (reduces multicast control traffic on the uplink).

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

set_ip_settingsB

Change the switch management IP configuration.

WARNING: This may make the switch unreachable if misconfigured.

Args: dhcp: True for DHCP (auto), False for static IP. ip: Static IP address (only used when dhcp=False). netmask: Subnet mask (only used when dhcp=False). gateway: Default gateway (only used when dhcp=False).

Inputs: dhcp (required), ip, gateway, netmask. Returns: result

set_ledB

Turn the switch's front-panel port LEDs on or off.

Args: on: True to turn LEDs on, False to turn them off.

Inputs: on (required). Returns: result

set_loop_preventionB

Enable or disable loop prevention.

Args: enabled: True to enable loop detection and blocking.

Inputs: enabled (required). Returns: result

set_poe_global_limitA

Set the switch-wide PoE power budget limit in watts.

The switch enforces a maximum total power draw across all PoE ports.

Args: limit: Power budget in watts. Must be within the device's supported range.

Inputs: limit (required). Returns: result

set_poe_portA

Configure PoE on a specific port.

Args: port: Port number (1-8 on the SG1016PE). enabled: True to supply power, False to cut PoE power. priority: Power allocation priority when budget is constrained. HIGH, MIDDLE, or LOW. power_limit: Max power class. AUTO (negotiated), CLASS_1 (4W), CLASS_2 (7W), CLASS_3 (15.4W), CLASS_4 (30W), or a float 0.1-30.0 for custom wattage.

Inputs: port (required), enabled (required), priority, power_limit. Returns: result

set_port_mirrorA

Configure port mirroring for traffic analysis.

Copies traffic from source ports to a destination port where a packet sniffer or analyzer can be connected.

Args: enabled: True to enable mirroring. destination_port: The monitoring port that receives copied traffic. ingress_ports: Source ports to mirror incoming traffic from. egress_ports: Source ports to mirror outgoing traffic from.

Inputs: enabled (required), egress_ports, ingress_ports, destination_port. Returns: result

set_port_pvidA

Set a port's PVID (native VLAN for untagged ingress traffic).

All untagged frames arriving on this port will be assigned to this VLAN. The port must be an untagged or tagged member of the target VLAN.

Args: port: Port number (1-16). pvid: VLAN ID to assign as the port's native VLAN.

Inputs: port (required), pvid (required). Returns: result

set_port_qos_priorityA

Set a port's QoS priority queue. Only effective when QoS mode is PORT_BASED.

Args: port: Port number (1-16). priority: LOWEST (queue 0), NORMAL (queue 1), MEDIUM (queue 2), or HIGHEST (queue 3).

Inputs: port (required), priority (required). Returns: result

set_port_stateA

Enable or disable a switch port, and optionally set its speed and flow control.

Args: port: Port number (1-16). enabled: True to enable the port, False to administratively shut it down. speed: Link speed. One of: AUTO, HALF_10M, FULL_10M, HALF_100M, FULL_100M, FULL_1000M. flow_control: True to enable 802.3x flow control (pause frames).

Inputs: port (required), enabled (required), speed, flow_control. Returns: result

set_qos_modeB

Set the global QoS scheduling mode.

Args: mode: PORT_BASED (manual per-port priority), DOT1P_BASED (from 802.1p tag), or DSCP_BASED (from IP header).

Inputs: mode (required). Returns: result

set_storm_controlA

Configure storm control on a port to rate-limit flooding traffic.

Args: port: Port number (1-16). enabled: True to activate storm control on this port. rate: Maximum allowed rate in kbps for controlled traffic types. broadcast: Rate-limit broadcast traffic (e.g. ARP storms). multicast: Rate-limit multicast traffic. unknown_unicast: Rate-limit unknown unicast traffic (flooded frames).

Inputs: port (required), rate (required), enabled (required), broadcast, +2 more. Returns: result

set_vlan_enabledA

Enable or disable 802.1Q VLAN mode on the switch.

WARNING: Disabling 802.1Q removes all VLAN separation. Only one VLAN mode (802.1Q, MTU, or port-based) can be active at a time.

Args: enabled: True to enable 802.1Q VLANs, False to disable.

Inputs: enabled (required). Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 41 tools

    Disambiguation4/5

    Tools are organized by distinct sub-domain (ports, PoE, VLAN, QoS, LAG, mirroring, storm control), and descriptions make the boundaries clear, e.g. set_bandwidth_limit vs. set_storm_control vs. set_port_state. Minor potential confusion exists between get_port_states and get_port_statistics, and between create_vlan and add_vlan_members, but the descriptions resolve these.

    Naming Consistency4/5

    Predominantly consistent snake_case with verb_noun structure (get_*, set_*, create_*, delete_*, add_*, remove_*). A few deviations like repower_poe_port and create_lag (no _config suffix while its getter is get_lag_config) slightly break the pattern but remain readable and predictable.

    Tool Count3/5

    41 tools is heavy for a single 16-port switch and pushes beyond comfortable agent selection, though the device genuinely spans many feature areas (PoE, VLAN, QoS, LAG, mirroring, diagnostics). Each tool mostly earns its place as a natural get/set pair, but consolidation (e.g. combined config getters) would help.

    Completeness4/5

    Coverage is broad and largely lifecycle-complete: CRUD for VLANs, LAGs, PoE, QoS, mirroring, plus diagnostics (cable test) and system ops (reboot, IP config). Gaps exist for firmware upgrade, config backup/restore, factory reset, and the non-802.1Q VLAN modes referenced in descriptions but not exposed.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      C
      maintenance
      Enables managing TP-Link Omada SDN controllers through MCP, exposing 72 tools for sites, devices, clients, networks, switch ports, firewalls, schedules, and site settings, including reboot and PoE scheduling.
      72
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Lets an MCP client read port, statistics, VLAN and PoE status from TP-Link Easy Smart switches and, when explicitly gated, power-cycle a wedged PoE camera over the LAN without opening the switch's web UI. It talks the switch's HTML/cgi protocol directly, with double-gated writes, dry-run, protected ports, and lockout-aware failure handling.
      13
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables discovery, state inspection, and safe plan-then-apply configuration changes for two legacy smart switch families, including VLAN, port, trunk, mirror, and maintenance operations, with read-back verification and rollback.
      13
      59 PyPI
      MIT