Simon-Ensp-Mcp-Pro
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Simon-Ensp-Mcp-Pro 帮我搭一个含 USG6000V 防火墙和两台 S3700 交换机的 eNSP 拓扑"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
grbj-ensp-mcp (enhanced)
第一次来?先看
开始这里.md——三分钟上手指南,只讲怎么用,不讲原理。
华为 eNSP 的 MCP 服务器 · 社区增强版——在官方 v0.2.2 基础上打了本地补丁,让 AI 能程序化生成含 USG6000V 防火墙的 eNSP 拓扑文件,并在设备启动后直接经 Telnet 完成配置下发、校验与诊断。
一句话:你写需求 → AI 生成
.topo→ 你在 eNSP 点启动 → AI 自动下发配置、跑校验。
🧭 我该用哪个功能?(小白从这里开始)
本仓库有三个功能,各管一件事,每个文件夹里都有手把手的使用说明:
你想干什么 | 用哪个功能 | 去哪里 |
不想手动拖设备拉线,让脚本帮我画拓扑 | 功能一:生成拓扑 | |
设备启动后不想逐台敲命令,让 AI 帮我配置 | 功能二:配置下发 | |
不知道装对没有 / 报错了不会看 | 功能三:自检与排错 |
5 分钟上手路线
🤖 AI 用户(最省事的路):在你的 AI 助手(WorkBuddy / Claude Code / Cursor 等)里直接说:
「帮我搭一个 eNSP 拓扑:两台 AR2220 + 一台 S5700 + 两台 PC,R1、R2 下联交换机,PC 接交换机。」
前提二选一(都是一次性的,装完以后永远不用再管):
装技能(推荐,生成拓扑用):把
skill/ensp-topo-generate/文件夹拷到 AI 技能目录(WorkBuddy:~/.workbuddy/skills/;Claude Code:~/.claude/skills/)。技能自带模板和补丁,之后连本仓库都不需要工作区指到仓库:把 AI 工作区设为本仓库文件夹,AI 自动读根目录
AGENTS.md执行手册
⌨️ 首次试用 / 不装任何东西:把整个仓库下载到电脑,对 AI 说「我用了一个项目在 C:\...\Simon-Ensp-Mcp-Pro,帮我用它搭一个拓扑:…」——报路径只是这个一次性场景需要。
⌨️ 手动路线(不借助 AI 时):
第 1 步(1 分钟) python "功能1-生成拓扑/一键体验.py"
→ 得到 体验拓扑.topo,零安装,拖进 eNSP 就能看
第 2 步(1 分钟) 双击 install.bat 装 MCP(WorkBuddy 用户)
其他工具看 功能2 使用说明的手动安装
第 3 步(1 分钟) python scripts/check_health.py → 8 项全 PASS
第 4 步(2 分钟) eNSP 打开拓扑、启动设备,对 AI 说:
"拓扑已启动,文件在 xxx.topo,开始配置"两个功能什么关系:功能一画"图纸"(不需要 MCP),功能二负责"施工"(需要 MCP)。可以只用一个,也可以连着用。
Related MCP server: ENSP-MCP AI
与上游的差异(为什么有这个 fork)
增强项 | 说明 |
USG6000V 拓扑生成支持 | 上游 |
S3700 接口表修正 | 上游默认 24 FE 与实机不符,修正为实测形态 22 Ethernet + 2 GE(GE0/0/23~24) |
install.bat 路径修正 | 上游把 MCP 注册写到 |
一键健康自检 |
|
补丁验证脚本 |
|
按功能重组目录 | 三个功能文件夹各带使用说明(见上表),小白可按需取用 |
补丁本体在 src/grbj_ensp_mcp/topo_builder.py(约 65 行差异)。
⚠️ 来源与许可(请先读)
上游项目 grbj-ensp-mcp v0.2.2 由「广然笔记」发布,作者声明的官方分发渠道为 广然笔记下载站 grbj.cn(原版说明见
docs/README-upstream.md)。本仓库是社区增强 fork,不是官方分发。原版以 MIT License 发布(见
LICENSE),本仓库在同等许可下再分发并保留原版权声明;对本仓库改动的部分,同样以 MIT 提供。请优先支持原作者的官方渠道获取更新;本 fork 的补丁如被上游吸收,建议回归上游。
安装
前置:Windows 10/11、华为 eNSP、Python 3.10+(3.13 实测通过)。
详细的分步说明(含截图级别的手把手)在
功能2-配置下发/使用说明.md,这里是速查版。
方式一:脚本安装(WorkBuddy 用户)
install.bat自动:建 venv → 装本地 wheel(含补丁)→ 注册到 ~/.workbuddy/mcp.json(自动备份)→ 在连接器页点「信任」即启用。
方式二:手动安装(任意环境)
python -m venv .venv
.venv\Scripts\pip install grbj_ensp_mcp-0.2.2-py3-none-any.whl
# 关键一步:用补丁版覆盖
copy /y src\grbj_ensp_mcp\topo_builder.py .venv\Lib\site-packages\grbj_ensp_mcp\topo_builder.py然后在你的 AI 工具 MCP 配置中注册(command 指向 venv 的 python.exe,args 为 ["-m", "grbj_ensp_mcp.server"])。
验证
python scripts/check_health.py # 8 项自检
python tests/verify_usg6000v.py # 补丁专项验证(免安装)拓扑生成(不走 MCP,本地库直调)
MCP 的 31 个工具不含生成能力(只有解析/建连/下发/校验)。生成拓扑直接调库:
from grbj_ensp_mcp.topo_builder import NativeTopoBuilder
b = NativeTopoBuilder()
b.add_device("FW-1", model="USG6000V", com_port=2004)
b.add_device("SW-1", model="S5700", com_port=2006)
b.add_line("FW-1", "SW-1", src_index=1, tar_index=1)
xml = b.render()
# 落盘必须:encoding="UNICODE" 声明 + CRLF + GBK 编码(UTF-8 中文必乱码)零安装快速体验:python "功能1-生成拓扑/一键体验.py"(自动加载仓库 src,无需 pip install)。
生成模板见 功能1-生成拓扑/模板脚本.py;零安装体验见 功能1-生成拓扑/一键体验.py。
型号支持(builder 内置接口表):AR1220/2220/2240、S2700/3700/5700/6700、AC6005、AP6050、USG5500、USG6000V(本 fork 补丁)、PC/STA/Laptop/Server。
两个配套 Skill
Skill | 用途 |
| 配置方法论:先探查再配置、报错走诊断流程、实验报告规范 |
| 拓扑生成 SOP:型号 index 映射表、GBK 落盘三要素、自检要点、常见坑 |
安装到你的 AI 工具技能目录即可(WorkBuddy:~/.workbuddy/skills/;Claude Code:~/.claude/skills/)。
目录结构
├── 功能1-生成拓扑/ ★ 小白入口:一键体验 + 模板 + 示例 + 手把手说明
├── 功能2-配置下发/ ★ 小白入口:MCP 安装与日常用法说明
├── 功能3-自检与排错/ ★ 小白入口:体检脚本用法 + 报错速查表
├── src/ 含补丁的源码(补丁权威源)
├── skill/ 两个配套 Skill(拷给 AI 助手用)
├── scripts/check_health.py 一键自检
├── tests/ 上游测试套件 + verify_usg6000v.py 补丁验证
├── docs/ 上游文档 + 日常使用手册 + 原版 README
├── install.bat / install.sh
├── grbj_ensp_mcp-0.2.2-py3-none-any.whl 原厂 wheel(不含补丁,装完必须覆盖 topo_builder.py)
└── LICENSE MIT(上游)已知限制
eNSP 是 Windows GUI 程序:打开文件与点启动必须人工完成,MCP 只接管启动后的操作
Console 5 分钟空闲超时、接口名必须写全称(
GigabitEthernet0/0/1、LoopBack0).topo含中文设备名必须 GBK 编码落盘(详见功能一使用说明)USG6000V 补丁按 GUI 默认形态(1 管理 + 7 业务口)生成;不支持通过改 XML 给设备加口
许可
MIT License · 上游 © 2026 grbj-ensp-mcp contributors · enhanced fork 的改动同样以 MIT 提供
Available Tools
31 toolsensp_apply_experimentA
一站式下发实验配置:按设备规划的命令序列逐台下发 + 校验 + 报告。
参数:
plan:{ "设备名": ["system-view", "interface GE0/0/0", "ip address ...", ...], ... }verify_targets:可选校验项,元素为{"device": str, "kind": "ospf"|"vlan"|"routes"|"interfaces"|"ping", "args": {...}}auto_save:下发完成后自动 save
工作流:
对 plan 中每台设备调用
ensp_send_commands(自动进 system-view 后再下发)跑 verify_targets
auto_save=True 时全部 save
返回结构化报告 + Markdown
Inputs: plan (required), auto_save, verify_targets. Returns: object
ensp_cleanup_idle_sessionsC
清理闲置超过 idle_seconds 秒的会话。
Inputs: idle_seconds. Returns: object
ensp_clear_output_bufferC
清空指定会话的输出缓冲。
Inputs: session_id_or_name (required). Returns: object
ensp_close_all_sessionsB
关闭所有会话。
Inputs: no named parameters. Returns: object
ensp_connect_deviceA
建立到指定 eNSP 设备的 Telnet 会话。
port 为 eNSP 分配的 Telnet 端口(通常 2000+)。
若 reuse=True 且已存在同 (host, port) 的活跃会话则直接复用。
Inputs: port (required), host, name, reuse. Returns: object
ensp_cross_validate_topologyA
把 .topo 文件解析结果与设备 LLDP 邻居做交叉验证。
这是「拓扑纠错」的核心入口——ensp_parse_topology 只看拓扑文件,
而 ensp_verify_lldp_neighbors 反映物理事实。两者不一致时就是
拓扑图错位 / 线缆未接 / 对端设备未启 / 老拓扑需要更新等问题的信号。
工作流程:
解析
topo_path(XML 或 ZIP 自动识别)接收
lldp_results(每台设备调ensp_verify_lldp_neighbors返回的scan字段或整个返回对象)对每条边做双向比对:
matched:
.topo和 LLDP 都看到的连线(接口端点完全一致)topo_only:
.topo记录了但 LLDP 没看到(线没接 / 对端未启 / LLDP 未使能)lldp_only:物理上接了但
.topo没记(拓扑图过时)mismatched:两端点都对得上,但至少一个接口号错位(拓扑图错位)
输出结构化 JSON + Markdown 报告,便于 LLM 直接理解和用户存档
参数:
topo_path:.topo文件绝对路径lldp_results:列表,元素为ensp_verify_lldp_neighbors的返回 (建议传scan字段;为了容错,传整个返回对象也可)device_aliases:可选,把 LLDP 的system-name映射到.topo里的设备名(如{"AR1": "R1"}),处理 sysname 与拓扑名不一致的情况
典型使用场景:
生成配置前验证接口号:调用本工具确认
.topo的GE0/0/0是否真的接在物理 GE0/0/0 上,避免下发配置时把 IP 配到错误接口拓扑图纠错:发现接口错位后,用
ensp_gather_diagnostic_context收集上下文,让 LLM 给出修改建议(更新 .topo 或重新接线)实验前环境检查:学生实验前用本工具确认 eNSP GUI 接的线与设计一致
Inputs: topo_path (required), lldp_results (required), device_aliases. Returns: object
ensp_diagnose_batchB
对批量命令结果(ensp_send_commands 的 results 列表)进行批量诊断。
返回每个失败命令的诊断结果,并汇总修复建议。
Inputs: command_results (required), session_id_or_name (required). Returns: object
ensp_diagnose_errorA
对一条命令错误进行智能诊断,返回根因分析与修复建议。
参数:
session_id_or_name:会话 ID 或设备名error_text:设备回显中的错误文本(如ensp_send_command返回的errors)command:触发该错误的命令(可选,用于更精准的诊断)
返回:
category:错误分类标签severity:严重级别(critical/error/warning/info)root_causes:可能的根因列表probe_commands:建议先执行的探查命令fix_suggestions:修复建议列表confidence:诊断置信度(high/medium/low)
使用场景:
当 ensp_send_command 返回 errored=True 时,将 errors 字段
传入本工具获取诊断,而不是直接放弃或盲目重试。
Inputs: error_text (required), session_id_or_name (required), command. Returns: object
ensp_disconnect_deviceC
关闭一个会话并释放其 Telnet 连接。
Inputs: session_id_or_name (required). Returns: object
ensp_enable_lldpA
在指定设备上开启 LLDP(用于让设备广播 / 接收邻居信息)。
LLDP(Link Layer Discovery Protocol)是华为 eNSP 设备默认支持的链路层发现协议,
设备互相通告自己的接口和系统名。开启后即可用 ensp_verify_lldp_neighbors
看到哪些接口连到了对端设备的哪个接口。
工作流程:
system-view进入系统视图lldp enable全局使能(华为默认全局开启后所有接口都广播)若指定了
interfaces,进每个接口视图执行lldp enable(仅在接口视图下需要单独使能时才需要;默认情况下全局开即可)
参数:
session_id_or_name:会话 ID 或设备名interfaces:可选,要单独使能 LLDP 的接口列表(如["GigabitEthernet0/0/2"]); 留空表示仅全局使能
返回每步的执行结果(命令 / elapsed / output / errored),失败时停止并标记。
Inputs: session_id_or_name (required), interfaces. Returns: object
ensp_enter_system_viewC
把指定会话切换到 system-view。
Inputs: session_id_or_name (required). Returns: object
ensp_gather_diagnostic_contextA
当命令执行失败时,自动收集设备全貌供 LLM 深度推理。
与 ensp_diagnose_error 的区别:
ensp_diagnose_error返回规则引擎的快速匹配结果本工具收集设备真实状态(配置、接口、最近输出),生成结构化推理 prompt, 供 LLM 像网络工程师一样分析根因
本工具会自动执行以下探查命令(无需手动调用):
display version— 设备信息display current-configuration— 运行配置display ip interface brief— 接口状态
返回的 reasoning_prompt 字段可直接用于 LLM 推理,
引导 LLM 按四步分析:错误类型判断 → 根因分析 → 修复方案 → 验证步骤。
典型使用场景:
ensp_smart_config返回has_error=true且规则诊断置信度为 low 时规则引擎未覆盖的未知错误
需要 LLM 结合配置上下文做深度推理的复杂场景
Inputs: error_text (required), failed_command (required), session_id_or_name (required), experiment_description. Returns: object
ensp_get_device_infoA
获取设备元信息(hostname、型号、版本、uptime)。
refresh=True 时重新执行 display version;否则只返回已缓存的值。
Inputs: session_id_or_name (required), refresh. Returns: object
ensp_get_recent_outputC
获取指定会话输出缓冲中最近 lines 行。
Inputs: session_id_or_name (required), lines. Returns: object
ensp_get_running_configA
获取设备当前运行配置(display current-configuration)。
这是配置前必须做的探查步骤。eNSP 不同镜像 / VRP 版本支持的命令集并不一致,
直接套用记忆中的命令很可能报错(Error: Unrecognized command)。正确做法是:
先用 :func:
ensp_get_device_info拿到型号与 VRP 版本;再用本工具拿到设备 已有的 配置(已存在的接口 IP、VLAN、路由、特性开关等);
基于这两份真实信息生成配置命令,而非凭空猜测;
下发后用 :func:
ensp_send_command的errored回显 / :func:ensp_verify_interfaces等校验,失败则据设备反馈修正。
Inputs: session_id_or_name (required). Returns: object
ensp_health_checkB
对设备进行全面健康检查,自动诊断异常。
检查项:
会话状态(连接是否正常)
设备元信息(VRP 版本、型号)
接口状态(物理/协议状态,自动诊断 down 的接口)
OSPF 邻居状态(可选,需
check_ospf=True)路由表完整性(可选,需
check_routes=True)
返回结构化诊断报告,包含每个检查项的 issues 列表和修复建议。
Inputs: session_id_or_name (required), check_ospf, check_routes, expected_routes, +2 more. Returns: object
ensp_list_sessionsB
列出当前所有活跃会话的快照。
Inputs: no named parameters. Returns: result
ensp_load_topologyA
加载 .topo 拓扑:解析 → 探测每个设备的 com_port → 自动建连 → 输出启动指引。
典型工作流:
调用本工具解析
.topo,获得设备清单与连线;工具对每个
com_port做 TCP 探测(无需 telnet 登录);对可达端口自动调用
ensp_connect_device建连;对不可达端口,把设备列入
pending_devices并附带 eNSP GUI 启动步骤;用户在 eNSP GUI 中启动设备后,再次调用本工具(或
ensp_scan_devices+ensp_connect_device组合)补齐剩余会话。
返回 JSON + Markdown 报告(markdown_report 字段)。
Inputs: path (required), auto_connect, scan_timeout. Returns: object
ensp_parse_topologyC
解析本地 .topo 文件(XML 或 ZIP 格式)。
Inputs: path (required). Returns: object
ensp_parse_topology_b64A
解析 base64 编码的 .topo 字节(用于 MCP 客户端直接上传)。
输入是标准 base64 字符串。返回与 ensp_parse_topology 一致的结构。
Inputs: content_b64 (required), name. Returns: object
ensp_pingB
在指定会话上执行 ping -c {count} {target},解析丢包率。
Inputs: target (required), session_id_or_name (required), count, timeout. Returns: object
ensp_save_configC
触发 save 流程:先 quit 退到用户视图,再 save 并确认 y。
Inputs: session_id_or_name (required). Returns: object
ensp_scan_devicesC
扫描 eNSP 设备的 Telnet 端口(默认 2000-2100)。
返回 {"host": str, "ports": [int, ...]}。
Inputs: host, timeout, port_end, port_start, +1 more. Returns: object
ensp_send_commandB
下发单条命令,返回命令输出、耗时与命令层报错标记。
errored=True 表示设备回显中包含 Error:(如命令不存在 / 参数错误),
此时应据 errors 回显修正命令后重试,而不是继续下发后续配置。
Inputs: command (required), session_id_or_name (required), timeout. Returns: object
ensp_send_commandsA
批量下发命令,每条命令返回独立的 :class:TelnetResult。
stop_on_error=True 时,遇到连接错误 或 设备命令报错(errored)会立刻中断。
auto_diagnose=True 时,对每条失败命令自动调用诊断引擎,返回 diagnosis 字段。
返回中 has_error 汇总是否存在任意一条命令报错。
Inputs: commands (required), session_id_or_name (required), auto_diagnose, stop_on_error. Returns: object
ensp_smart_configA
智能配置下发:逐条下发命令,遇到错误时自动诊断并提供修复建议。
与 ensp_send_commands 的区别:
每条命令执行后,若
errored=True自动调用诊断引擎返回中包含每条失败命令的
diagnosis字段stop_on_error=True时首条失败即停止,避免级联错误auto_gather_llm_context=True时,失败后自动收集设备全貌供 LLM 深度推理
参数:
session_id_or_name:会话 ID 或设备名commands:命令列表stop_on_error:遇错即停(推荐 True)auto_diagnose:自动对失败命令执行规则诊断(默认 True)auto_gather_llm_context:失败后自动收集设备全貌生成 LLM 推理上下文(默认 False)experiment_description:用户实验需求描述(用于 LLM 推理上下文)
Inputs: commands (required), session_id_or_name (required), auto_diagnose, stop_on_error, +2 more. Returns: object
ensp_verify_interfacesC
在指定会话上执行 display ip interface brief,解析后返回。
Inputs: session_id_or_name (required). Returns: object
ensp_verify_lldp_neighborsA
采集指定设备的 LLDP 邻居信息(真实物理连接)。
与 ensp_verify_interfaces 的区别:
ensp_verify_interfaces只看本设备接口状态,不知道对端是谁本工具通过 LLDP 看到的是「对端设备 + 对端接口」,是物理事实
自动使能 LLDP(默认开启):
先发
display lldp neighbor brief(默认)或display lldp neighbor若回显表明 LLDP 未使能(命令报错,或含
LLDP is not enabled/LLDP功能未使能等关键字),且auto_enable=True,自动走:system-view → lldp enable → quit,等enable_retry_delay秒 让邻居收敛,再发一次采集命令若第二次仍然失败,返回
status="error"并附带 hint
把 auto_enable 设为 False 时,行为退回到「仅采集,未使能则报错」,
便于在已经手工开启 LLDP 的脚本里复用。
输出格式:
neighbors列表:每条含local_interface/remote_device/remote_interface/remote_chassis_id等字段返回的接口名已归一化(
GE0/0/0→GigabitEthernet0/0/0)lldp_was_enabled/auto_enable_attempts字段告诉调用方 本次是否自动使能过 LLDP(避免 LLM 重复操作)
典型用法:
在每台路由器 / 交换机上各调一次,收集到全网 LLDP 邻居后 传给
ensp_cross_validate_topology做交叉验证
核心实现见 :func:grbj_ensp_mcp.lldp_verifier.collect_lldp_neighbors_with_auto_enable。
Inputs: session_id_or_name (required), detail, auto_enable, enable_retry_delay. Returns: object
ensp_verify_ospfB
执行 display ospf peer brief + display ospf routing,合并返回。
Inputs: session_id_or_name (required). Returns: object
ensp_verify_routesC
执行 display ip routing-table,可按 protocol 过滤(如 ospf static)。
Inputs: session_id_or_name (required), protocol. Returns: object
ensp_verify_vlanC
执行 display vlan,可按 vlan_id 过滤。
Inputs: session_id_or_name (required), vlan_id. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 31 tools
The send-command family (ensp_send_command vs ensp_send_commands vs ensp_smart_config vs ensp_apply_experiment) overlaps substantially, and the four diagnosis tools (diagnose_error, diagnose_batch, gather_diagnostic_context, health_check) require careful reading to distinguish. Descriptions do provide enough guidance (single vs batch vs auto-diagnose vs experiment-plan), but boundaries remain fuzzy.
Every tool uses a consistent ensp_ prefix followed by a clear snake_case verb_noun pattern (ensp_scan_devices, ensp_get_running_config, ensp_verify_routes). Variations like verify_* and diagnose_* are used predictably across the set.
At 31 tools the surface is heavy and exceeds the comfortable range, and several command-sending tools could plausibly be consolidated. The domain (session mgmt, command exec, verification, diagnosis, topology) is genuinely broad, so not all of it is bloat.
Coverage spans discovery, connection lifecycle, command execution, config save, multiple verification dimensions (interfaces/routes/OSPF/VLAN/LLDP/ping), diagnosis, and topology cross-validation. The main gap is that lifecycle management is send-command-driven with no explicit rollback/undo or interface-config-removal tool.
Related MCP Connectors
AI network lab: build and validate real multi-vendor router and switch labs from a prompt.
AI helper for choosing and speccing network & security products from Cisco, Arista, Juniper and more
Network hardware BOMs, built inside your AI assistant
IP intelligence, network diagnostics, and AI service availability tools for AI agents.
Related MCP Servers
- AlicenseBqualityDmaintenanceGenerates eNSP network topologies, deploys Huawei VRP configurations, and provides verification plans for lab scenarios.124MIT
- FlicenseBqualityCmaintenanceEnables AI clients to manage Huawei eNSP simulated network devices, execute CLI commands, apply configurations, and perform network diagnostics through natural language, with topology upload and visualization via a web UI.2010-
- FlicenseNot gradedqualityDmaintenanceBridges AI assistants with EVE-NG network simulation labs, enabling autonomous management of labs, device configuration, and diagnostics through natural language.1-
- FlicenseNot gradedqualityDmaintenanceEnables AI models to generate, validate, and deploy network topologies directly into Cisco Packet Tracer from natural-language prompts.-