tplink-easy-smart-switch-mcp
TP-Link Easy Smart Switch MCP
适用于 TP-Link 和 Mercury Easy Smart 交换机的 TypeScript + Bun MCP 服务器。它通过交换机 Web UI 工作,不依赖 SNMP。
默认目标:http://192.168.3.10
作为 Codex 插件安装
先安装 Bun,然后添加独立的 network-tools 市场和本插件:
codex plugin marketplace add qwe7002-ai/net-tool-plugins --ref main
codex plugin add tplink-easy-smart-switch-mcp@net-tool-plugins安装后启动一个新的 Codex 任务,以便加载 MCP 工具和交换机管理技能。
Related MCP server: packet-coders-mcp
已测试型号
当前实现已针对以下 Web UI 快照和只读状态调用进行了测试:
位于
192.168.3.10的 TP-Link TL-SE2106,固件1.8.1 Build 20251128 Rel.57341位于
192.168.3.11的 Mercury SE106 Pro,固件1.0.0 Build 20240812 Rel.65021
其他 TP-Link 或 Mercury Easy Smart 交换机如果使用相同的 Web UI 页面和 CGI 端点,也可能可以工作,但尚未验证。
已确认的设备特性
管理界面可通过 HTTP
80访问登录表单提交到
POST /logon.cgi登录字段为
username和加密的password登录页面加载
/cryp_new.js已知 Web UI 变量包括
g_product、g_year和encryptType某些固件将请求令牌暴露为裸数字赋值(例如
g_tid=1320064778;),而不是带引号的字符串。其他页面可能只引用top.g_tid,因此解析器必须区分赋值与引用。
工具
只读工具:
get_switch_status:返回交换机状态摘要get_port_status:返回端口状态get_vlan_status:返回端口 VLAN、802.1Q VLAN、PVID 和 MTU VLAN 状态get_trunk_status:返回端口聚合/LAG 状态search_mac_address:查询mac_address_search.cgi查找单个 MAC 地址,并在交换机有条目时返回学习到的端口/VLANanalyze_topology:分析两台或多台级联交换机,并报告交换机间链路端口、上行/下行关系以及链路两端的 VLAN 关系
拓扑分析的工作原理是登录每台交换机,并查询 MAC 搜索 CGI 以获取对端交换机的管理 MAC。如果一台交换机在某个端口上报告了对端 MAC,则该端口被用作交换机间链路证据。当 MAC 搜索无法确认链路时,检测会回退到活动的 SFP/10G 端口对作为低置信度猜测,优先考虑 VLAN 重叠,并以实时流量作为决胜条件。这些 Easy Smart 交换机没有 LLDP,因此这种带内关联是可用的信号。
配置 CGI 工具:
configure_mtu_vlan:从VlanMtuRpm.htm生成或提交mtuVlanSet.cgiconfigure_port_vlan:从VlanPortBasicRpm.htm生成或提交pvlanSet.cgiconfigure_8021q_vlan:从Vlan8021QRpm.htm生成或提交qvlanSet.cgiconfigure_vlan_pvid:从Vlan8021QPvidRpm.htm生成或提交vlanPvidSet.cgiconfigure_trunk_group:从PortTrunkRpm.htm生成或提交port_trunk_set.cgi/port_trunk_display.cgisave_configuration:从SavingConfigRpm.htm生成或提交POST savingconfig.cgi
配置工具默认 apply: false,这会返回 dry-run 请求预览且不提交任何内容。实际写入需要满足以下所有条件:
apply: trueconfirm: "APPLY"成功登录
通过 Web UI 规则校验
可读的
token/top.g_tid
安装
bun install开发期间运行
bun run src/index.ts构建二进制文件
Windows:
bun run build:win当前平台:
bun run build构建输出写入 dist/。
如果 MCP 客户端在 initialize 期间仍报告较旧的服务器版本,则其 command 可能指向旧的可执行文件。将其更新为 dist/tplink-easy-smart-switch-mcp.exe 并重启客户端。
调试 MCP
列出 MCP 工具:
bun run debug调用交换机状态工具:
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调用端口状态工具:
bun run debug -- --tool get_port_status --host 192.168.3.10 --username admin --password your-password预览配置请求而不提交它们:
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 '{}'页面示例
只读开发快照存储在:
examples/tplink-192.168.3.10:位于192.168.3.10的 TP-Link Easy Smart 交换机examples/mercury-192.168.3.11:位于192.168.3.11的 Mercury SE106 Pro
它们包括 VLAN、聚合、配置备份/恢复、保存配置页面,以及 pvlan.js、qvlan.js 和 menuList.js。这些示例不包含 SessionID 值或密码。
你还可以发送原始 JSON-RPC:
bun run debug -- --raw '{ "jsonrpc": "2.0", "id": 99, "method": "tools/list", "params": {} }'MCP 客户端示例
{
"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"
}
}
}
}备注
页面内容由 DOM 解析器解析,并规范化为标题、表单、框架、链接、表格和文本摘要。状态数据主要从诸如 MainRpm.htm、VlanPortBasicRpm.htm、Vlan8021QRpm.htm、Vlan8021QPvidRpm.htm、VlanMtuRpm.htm 和 PortTrunkRpm.htm 等页面中的 JavaScript 变量提取。
在已测试的 TP-Link TL-SE2106 和 Mercury SE106 Pro 固件上,MacSearchRpm.htm 是一个搜索表单,而不是完整的转发表转储。因此,受支持的 MAC 功能是 search_mac_address,它遵循页面逻辑并使用 txt_macAddress_search、txt_vid_search 和 token 调用 mac_address_search.cgi。
令牌提取支持带引号的 g_tid、裸数字 g_tid 以及隐藏的 token 输入。捕获脚本在保存开发示例之前,会对带引号和裸数字的 g_tid 赋值进行脱敏处理。
配置 CGI 调用使用显式确认流程。开发和调试默认采用 dry-run。save_configuration 也是一种写入操作;它遵循 SavingConfigRpm.htm 的页面逻辑并使用 POST savingconfig.cgi,但除非明确确认,否则不会提交。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityFmaintenanceSecurity-focused MCP server for TP-Link Omada Open API workflows, enabling network management via natural language.8720MIT
- FlicenseAqualityBmaintenanceA local MCP server for interacting with a network lab, supporting read-only and configuration tools for devices like Arista EOS switches.6
- AlicenseAqualityCmaintenanceMCP server for monitoring and controlling WiFi routers (OpenWrt) via SSH, enabling device listing, status checks, WiFi configuration, rebooting, and more.712MIT
- AlicenseNot gradedqualityBmaintenanceRead-only MCP server for TP-Link Omada SDN controllers, enabling querying controller, site, device, and WiFi state.Apache 2.0
Related MCP Connectors
MCP server for managing Prisma Postgres.
MCP server for URL shortening and management
MCP server wrapping the Tesla Fleet API and TeslaMate API
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/qwe7002-ai/tplink-easy-smart-switch-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server