Skip to main content
Glama

remote-mcp

无需远程桌面(如向日葵/ToDesk)和公网 IP,直接将绿色免安装工具包发给客户在 Windows 上双击运行,即可让你本机 Mac 上的 AI 客户端通过 EasyTier 加密组网 + HTTP 串口 MCP 远程调试远端 Console 口交换机。

工作原理

flowchart LR
  AI["本地 AI 客户端 (Mac)"] -->|"HTTP + Bearer Token"| MacET["本地 EasyTier (10.126.126.1)"]
  MacET <-->|"P2P 直连 / 国内中继加密隧道"| WinET["远端 EasyTier (10.126.126.2)"]
  WinET -->|"TCP :8765/mcp"| MCP["远端 serial_mcp.exe"]
  MCP -->|"pyserial (9600bps 限速)"| Switch["交换机 Console 口"]

Related MCP server: rs232-mcp

内置安全与工程特性

特性

说明

Bearer Token 鉴权

远端 HTTP MCP 接口强制校验 Authorization: Bearer <token>,防止公共中继或内网误访

9600bps 逐行限速

多行配置自动按行发送并间隔 0.15s,避免 Console 口缓冲区溢出丢字符

高危命令默认拦截

默认拦截 reboot、reload、erase、reset saved-configuration、format、write erase

全量会话审计日志

所有打开、发送、回显、控制键和关闭操作自动记录到远端 switch_session.log

零环境残留

打包成单文件 serial_mcp.exe 后无需远端装 Python 或 AI 客户端,调完一键清理防火墙并删除文件夹

目录结构

remote-mcp/
├── requirements.txt                # Python 依赖(mcp 2.x, pyserial, uvicorn)
├── remote_win/                     # 打包后发给远端 Windows 电脑的目录
│   ├── serial_mcp.py               # HTTP/stdio 双模式串口 MCP 服务端
│   ├── 一键启动_远端.bat            # 放行防火墙 + 启动 MCP + 启动 EasyTier
│   ├── 停止并清理防火墙.bat         # 结束进程并删除临时防火墙规则
│   └── 打包成exe.bat               # 在有 Python 的 Windows 上生成免环境 serial_mcp.exe
└── local_mac/                      # 本机 Mac (arm64) 使用
    ├── start_easytier_mac.sh       # 启动本机 EasyTier 加入同一加密网络
    ├── check_connection.sh         # 一键检测 ping、P2P/中继状态和 MCP 接口鉴权
    └── mcp_config.json             # 本地 AI 客户端 MCP 配置模板

快速上手(发给客户前准备)

1. 修改默认占位密钥

发给客户使用前,请先在以下 4 个文件中把 3 个占位符替换为同一组随机密码/Token:

  • CHANGE_ME_NET_NAME:临时组网名称(例如 sw-debug-20261128)

  • CHANGE_ME_NET_SECRET:临时组网密钥

  • CHANGE_ME_MCP_TOKEN:MCP 接口访问 Token

涉及文件:

  • remote_win/一键启动_远端.bat

  • local_mac/start_easytier_mac.sh

  • local_mac/check_connection.sh

  • local_mac/mcp_config.json

2. 下载 EasyTier 二进制

从 EasyTier Releases 下载同一大版本压缩包:

  1. 本机 Mac(Apple Silicon):下载 easytier-macos-aarch64-*.zip,解压 easytier-core 和 easytier-cli 到 local_mac/ 并赋权:

    chmod +x local_mac/easytier-core local_mac/easytier-cli
  2. 远端 Windows(x86_64):下载 easytier-windows-x86_64-*.zip,解压 easytier-core.exe 和 wintun.dll 到 remote_win/。

3. (推荐)打包免 Python 单文件 serial_mcp.exe

在任意一台装有 Python 3.10+ 的 Windows 电脑上双击运行 remote_win/打包成exe.bat,将生成的 serial_mcp.exe 留在 remote_win/ 中。之后只需把包含以下 5 个文件的 remote_win 压缩发给客户即可:

  • serial_mcp.exe

  • easytier-core.exe + wintun.dll

  • 一键启动_远端.bat

  • 停止并清理防火墙.bat

远程调试流程

  1. 客户侧:关闭占用 COM 口的软件(如 SecureCRT / PuTTY / MobaXterm),右键以管理员身份运行 一键启动_远端.bat。

  2. 本机侧启动组网:

    cd local_mac
    ./start_easytier_mac.sh
  3. 本机侧连通性检查(新开终端):

    cd local_mac
    ./check_connection.sh

    输出 [成功] MCP 服务响应正常 (HTTP 200)! 即打通。

  4. 接入本地 AI:将 local_mac/mcp_config.json 中的 switch-console 配置复制到本地 AI 客户端,即可调用 list_serial_ports、serial_open、serial_send 等工具调试交换机。

  5. 调试结束:让客户双击 停止并清理防火墙.bat 后删除文件夹即可。

提示与排障

  • 建议首条 AI 指令:连接串口后先关闭分页(华为/H3C:screen-length 0 temporary;思科/锐捷:terminal length 0)并备份当前配置;未经人工确认前仅执行只读命令。

  • 远端无管理员权限:无法创建 wintun 虚拟网卡时,可将远端 EasyTier 改为 no_tun = true + [[port_forward]] 的 config.toml 模式启动。

  • 串口被占用:serial_open 报错提示拒绝访问时,检查远端是否仍有串口终端或驱动助手占用该 COM 口。

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables control of network switches via serial console ports, supporting Huawei, H3C, and Cisco devices for command execution and configuration.
      6
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables AI agents to open persistent interactive terminal sessions with network devices over SSH, Telnet, TCP console, or serial, write raw commands including nested ssh/telnet transitions, and read full output without requiring a particular prompt format. It supports multiple concurrent sessions and keeps credentials/secrets out of MCP arguments or audit logs.
      7
      MIT