tplink-easy-smart-switch-mcp

tplink-easy-smart-switch-mcp

MCP server for managing TP-Link and Mercury Easy Smart switches via their web interface, enabling read-only status checks and VLAN/trunk configuration with dry-run support.

Category
访问服务器

README

TP-Link Easy Smart Switch MCP

TypeScript + Bun MCP server for TP-Link and Mercury Easy Smart switches. It works through the switch Web UI and does not depend on SNMP.

Default target: http://192.168.3.10

Tested Models

The current implementation has been tested against these Web UI snapshots and read-only status calls:

  • TP-Link TL-SE2106 at 192.168.3.10, firmware 1.8.1 Build 20251128 Rel.57341
  • Mercury SE106 Pro at 192.168.3.11, firmware 1.0.0 Build 20240812 Rel.65021

Other TP-Link or Mercury Easy Smart switches may work if they use the same Web UI pages and CGI endpoints, but they have not been verified yet.

Confirmed Device Traits

  • Management UI is available on HTTP 80
  • Login form posts to POST /logon.cgi
  • Login fields are username and encrypted password
  • Login page loads /cryp_new.js
  • Known Web UI variables include g_product, g_year, and encryptType
  • Some firmware exposes the request token as a bare numeric assignment such as g_tid=1320064778; instead of a quoted string. Other pages may only reference top.g_tid, so parsers must distinguish assignments from references.

Tools

Read-only tools:

  • get_switch_status: Return a switch status summary
  • get_port_status: Return port status
  • get_vlan_status: Return port VLAN, 802.1Q VLAN, PVID, and MTU VLAN status
  • get_trunk_status: Return port trunking/LAG status
  • search_mac_address: Query mac_address_search.cgi for one MAC address and return the learned port/VLAN when the switch has an entry
  • analyze_topology: Analyze two or more cascaded switches and report the inter-switch link port, the upstream/downstream relationship, and the VLAN relationship across the link

Topology analysis works by logging into each switch and querying the MAC search CGI for the peer switch's management MAC. If a switch reports the peer MAC on a port, that port is used as inter-switch link evidence. When MAC search cannot confirm the link, detection falls back to active SFP/10G port pairs as a low-confidence guess, preferring VLAN overlap and using live traffic as a tiebreaker. These Easy Smart switches have no LLDP, so this in-band correlation is the available signal.

Configuration CGI tools:

  • configure_mtu_vlan: Generate or submit mtuVlanSet.cgi from VlanMtuRpm.htm
  • configure_port_vlan: Generate or submit pvlanSet.cgi from VlanPortBasicRpm.htm
  • configure_8021q_vlan: Generate or submit qvlanSet.cgi from Vlan8021QRpm.htm
  • configure_vlan_pvid: Generate or submit vlanPvidSet.cgi from Vlan8021QPvidRpm.htm
  • configure_trunk_group: Generate or submit port_trunk_set.cgi / port_trunk_display.cgi from PortTrunkRpm.htm
  • save_configuration: Generate or submit POST savingconfig.cgi from SavingConfigRpm.htm

Configuration tools default to apply: false, which returns a dry-run request preview and submits nothing. Real writes require all of the following:

  • apply: true
  • confirm: "APPLY"
  • Successful login
  • Web UI rule validation passed
  • A readable token/top.g_tid

Install

bun install

Run During Development

bun run src/index.ts

Build A Binary

Windows:

bun run build:win

Current platform:

bun run build

Build output is written to dist/.

If an MCP client still reports an older server version during initialize, its command probably points to an old executable. Update it to dist/tplink-easy-smart-switch-mcp.exe and restart the client.

Debug MCP

List MCP tools:

bun run debug

Call the switch status tool:

bun run debug -- --tool get_switch_status --host 192.168.3.10 --username admin --password your-password
bun run debug -- --tool get_switch_status --host 192.168.3.11

Call the port status tool:

bun run debug -- --tool get_port_status --host 192.168.3.10 --username admin --password your-password

Preview configuration requests without submitting them:

bun run debug -- --tool configure_mtu_vlan --params '{ "enabled": true }'
bun run debug -- --tool configure_port_vlan --params '{ "mode": "set", "vid": 1, "ports": "1,2" }'
bun run debug -- --tool configure_8021q_vlan --params '{ "mode": "set", "vid": 20, "name": "main", "untaggedPorts": "3", "taggedPorts": "5,6" }'
bun run debug -- --tool configure_vlan_pvid --params '{ "pvid": 20, "ports": "3" }'
bun run debug -- --tool configure_trunk_group --params '{ "mode": "set", "group": 1, "ports": "1,2" }'
bun run debug -- --tool save_configuration --params '{}'

Page Samples

Read-only development snapshots are stored in:

  • examples/tplink-192.168.3.10: TP-Link Easy Smart switch at 192.168.3.10
  • examples/mercury-192.168.3.11: Mercury SE106 Pro at 192.168.3.11

They include VLAN, trunking, configuration backup/restore, save-configuration pages, plus pvlan.js, qvlan.js, and menuList.js. These samples do not contain SessionID values or passwords.

You can also send raw JSON-RPC:

bun run debug -- --raw '{ "jsonrpc": "2.0", "id": 99, "method": "tools/list", "params": {} }'

MCP Client Example

{
  "mcpServers": {
    "tplink-easy-smart-switch": {
      "command": "C:\\path\\to\\tplink-easy-smart-switch-mcp.exe",
      "env": {
        "TPLINK_HOST": "192.168.3.10",
        "TPLINK_USERNAME": "admin",
        "TPLINK_PASSWORD": "your-password"
      }
    }
  }
}

Notes

Page content is parsed with a DOM parser and normalized into title, form, frame, link, table, and text summaries. Status data is mainly extracted from JavaScript variables in pages such as MainRpm.htm, VlanPortBasicRpm.htm, Vlan8021QRpm.htm, Vlan8021QPvidRpm.htm, VlanMtuRpm.htm, and PortTrunkRpm.htm.

On the tested TP-Link TL-SE2106 and Mercury SE106 Pro firmware, MacSearchRpm.htm is a search form rather than a full forwarding-table dump. The supported MAC feature is therefore search_mac_address, which follows the page logic and calls mac_address_search.cgi with txt_macAddress_search, txt_vid_search, and token.

Token extraction supports quoted g_tid, bare numeric g_tid, and hidden token inputs. The capture script redacts both quoted and bare g_tid assignments before saving development samples.

Configuration CGI calls use an explicit confirmation flow. Development and debugging default to dry-run. save_configuration is also a write action; it follows the page logic from SavingConfigRpm.htm and uses POST savingconfig.cgi, but it does not submit unless explicitly confirmed.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选