Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
ENSP_MCP_LOG_DIRNoDirectory used for command trace logs. By default, logs are written under %USERPROFILE%\.ensp-mcp.

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
list_modelsA

列出 eNSP 支持的设备型号,以及每种型号的接口清单。

搭拓扑前先调这个,就知道有哪些型号可选、每个型号有几个口、口叫什么名字。 连线时 fromPort / toPort 填的就是这里的接口名。

Args: category: 只看某一类,可选 AR(路由器)、LSW(交换机)、WLAN(无线)、 FW(防火墙)、CLIENT(终端)、OTHER(其它)。留空看全部。 model: 只看某一个型号,例如 "S5700"。填了会连完整接口列表一起返回。 topo_path: 可选。给一份现成 .topo,会顺带核对内置型号表和这份文件 里实际写出的接口布局是否一致,用于确认 eNSP 版本差异。

topo_createB

新建一个空的 .topo 文件。

Args: path: 要写到哪,例如 "D:/work/campus.topo"。 overwrite: 目标已存在时是否覆盖,默认不覆盖。

topo_inspectA

读一份 .topo,返回设备清单、链路清单和每台设备的空闲接口。

每台设备会带上 consolePort,那就是 device_* 工具要用的端口号。

topo_add_devicesA

往拓扑里批量加设备。

Args: path: .topo 文件路径。 devices: 设备列表,每项支持这些字段:

    - model(必填):型号,见 list_models。
    - name:设备名,省略则按 eNSP 习惯自动编号(S5700 叫 LSW1、
      AR2220 叫 AR1,重名自动往后排)。
    - count:一次加几台,默认 1;配合省略 name 可以批量生成。
    - x / y:画布坐标,省略则先堆在原点,之后跑 topo_layout 自动摆开。
    - settings:终端类设备的初始参数,PC/Server 可填
      {"ip": "...", "mask": "...", "gateway": "..."},
      AP 可填 {"mac": "...", "sn": "..."}。具体字段见
      list_models 返回的 settingsFields。

举例:[{"model": "S5700", "name": "Core", "count": 2},
      {"model": "PC", "settings": {"ip": "192.168.1.10"}}]

console 端口会自动从 2000 起顺序分配,不会和已有设备冲突。

topo_connectA

批量连线。

Args: path: .topo 文件路径。 links: 链路列表,每项支持:

    - from / to(必填):两端设备名。
    - fromPort / toPort:接口名("GE0/0/1"、"GigabitEthernet0/0/1"
      都认)或接口序号。省略则自动挑该设备第一个空闲口。
    - lineType:线型,默认按接口类型自动判断(串口给 Serial,
      其余给 Copper)。也可显式写 Copper / Fiber / Serial。

举例:[{"from": "Core1", "to": "Core2", "fromPort": "GE0/0/1",
       "toPort": "GE0/0/1"},
      {"from": "Core1", "to": "PC1"}]

一个接口只能连一条线,重复占用会直接报错并指出是哪个口。

topo_removeA

删设备或删连线。

Args: path: .topo 文件路径。 devices: 要删的设备名列表,删设备会连带删掉它身上所有的线。 links: 要断开的链路,每项 {"from": "A", "to": "B"}。

topo_layoutA

自动排布设备坐标,不用手工填 x/y。

Args: path: .topo 文件路径。 mode: 布局方式。

    - layered(默认):按连线关系自动分层,出口在上、终端在下,
      最贴近常见的园区网拓扑图。
    - tree:从 root 出发按层级展开。
    - grid:网格铺开,适合还没连线的时候。
    - ring:环形,适合环网。
groups: 只在 layered 下有效。手工指定每一层放哪些设备,
    例如 [["Internet"], ["AR1"], ["Core1","Core2"]]。
    没列进去的设备会自动补到最后一层。
root: 只在 tree 下有效,指定树根设备名。省略则挑连线最多的那台。
columns: 只在 grid 下有效,每行几台。省略则自动取平方根。
zones: 可选的分区列表。每项包含 title(或 name)、devices,可选
    color(#RRGGBB)和 columns。给了 zones 后会使用分区布局,
    mode/groups/root/columns 不再参与排布。
replace_annotations: 拓扑已有背景图形或文字时,是否明确清空并按 zones
    重建。默认拒绝覆盖,因为 eNSP 标注没有稳定 ID,无法可靠区分手工项。
include_unassigned: zones 未包含的设备是否自动放入“未分区”背景框,默认是。
zone_columns: 整体画布每行放几个分区;0 表示自动。
allow_annotation_desync: 普通布局遇到已有标注时是否仍移动设备。默认否,
    避免背景框和文字留在旧位置;仅在确认标注无需同步时才设为 true。
topo_validateA

检查拓扑有没有问题,建议在交给 eNSP 打开之前跑一次。

errors 会让 eNSP 打开异常或链路失效,必须改;warnings 只是提醒。 查的内容包括:设备重名、接口序号越界、一个口接了多条线、 console 端口冲突、孤立设备、图标/文字/背景框重叠,以及条件型号风险。

topo_renderA

可选:把拓扑画成辅助 PNG,不用开 eNSP 就能粗看布局。

PNG 不是 eNSP 原生界面,也不能证明 VirtualBox、镜像或设备能启动; 正常建图和验收流程不依赖它。

Args: path: .topo 文件路径。 out_path: 图片输出路径,省略则和 .topo 同名同目录,扩展名换成 .png。 scale: 缩放比例,设备多、连线挤的时候调大到 1.5 左右。 show_ports: 是否在连线两端标出接口名,默认标。

environment_checkA

只读检查 eNSP、VirtualBox、模板机和设备镜像,不启动或修改任何虚拟机。

检查结果的 readyForTopology=true 才表示这份拓扑的已知前置条件 已满足。检查会识别 VirtualBox 版本、Hyper-V/VBS 冲突、Host-Only 网卡、 AR/WLAN 基机、SVRP 镜像和 USG6000V 镜像/注册状态。

Args: path: 可选的 .topo。给出后按其中实际型号判断 readyForTopology。 models: 可选的计划型号列表;还没创建拓扑时可先检查,例如 ["AR2220", "USG5500"]。与 path 同时给出时合并检查。 ensp_home: 可选的 eNSP 安装目录;省略时从环境、注册表和常见目录查找。

topo_exportA

把拓扑导成写文档用得上的格式。

Args: path: .topo 文件路径。 format: mermaid(流程图源码)、drawio(可导入 draw.io)、 csv(设备表 + 接口连接表)。 out_path: 输出文件路径,省略则只把内容返回、不落盘。 csv 会写成两个文件,分别加 _devices / _links 后缀。

device_execA

在已启动的 eNSP 设备 console 上逐条执行命令。

target 为设备名(配 topo_path)或端口号。view 为 keep/user/system。 username/password 用于需要登录的 console,只有密码的 console 可只给 password。 new_password 仅在设备要求初次设置或修改密码时使用;不主动修改已有密码。 stop_on_error 默认遇错停止;失败时不 save。confirm 为 Y/N/YES/NO。 返回 ok、逐条 results、errorCount、stoppedEarly 和 saveStatus;超时断线不会重试命令。

device_push_configA

从文本或 UTF-8 .cfg 下发配置,config/config_file 必须且只能选一个。

自动进入系统视图,支持带 # 分段的 display current-configuration 配置文本, 分段时退出子视图再进入系统视图。默认遇错停止且不保存;不会自动回滚已生效配置。 username/password/new_password 与 device_exec 相同。save 默认 true。 CE 提示符标记存在未提交改动时,保存前先 commit;任何保存异常都返回失败状态。

device_fetch_configA

读回运行配置;save_to 可保存 UTF-8 文件,compare_with 可与基线文件比较。

diff 同时提供 identical、onlyOnDevice、onlyInFile 和带上下文的 unifiedDiff, 保留行顺序及重复行。命令失败或超时不写出配置文件。登录参数与 device_exec 相同。

device_probeA

设备连通性和状态查询。action: ping/tracert/interfaces/arp/mac/route/vlan/ospf。

ping/tracert 需要 destination;ping count 为 1–100。ping 返回统计和 reachable, 无法解析时 reachable 为 null;其他查询返回 output 原文。ok 表示命令执行状态, ping 是否连通看 parsed.reachable。登录参数与 device_exec 相同。

device_sessionsA

查看或关闭 console 会话。action 为 list/close/close_all。

close 时 target 为端口号。后台每 30 秒回收空闲超过 5 分钟的连接; 服务退出时关闭所有连接。关闭操作等待该连接正在执行的命令结束。

device_batchA

对多台设备并发执行命令或下发配置,单台失败不影响其他设备。

两种模式,commands 和 configs 必须且只能给一个:

  • commands:同一组命令打到所有选中设备,适合批量查询(display ...) 或统一配置片段。

  • configs:每台设备一份配置,写成 {"Core1": "sysname Core1\n...", "Core2": ...}, 键必须是拓扑里的设备名。

devices 省略表示拓扑里所有带 console 的设备;也可以给设备名、设备类别 (AR / LSW / FW / WLAN / CLIENT)或 "all" 混合使用,例如 ["FW1", "FW2", "LSW"]。

concurrency 是同时连几台,默认 4,范围 1–16。eNSP 的 console 端口本身能 承受并发,但一次开太多会拖慢设备启动较慢的那些,建议 4–8。

save 省略时按模式决定:commands 模式不保存(查询命令不需要), configs 模式保存。返回每台设备的 ok、执行条数、错误数和失败命令, 默认不回传全部回显;要看完整 results 就设 include_results=true。

所有命令同样会自动留痕,这次调用的命令在报告里归为同一个 batch。

lab_verifyA

按规则验证实验是否真的做对了,给出 PASS / FAIL 判定。

检查项 = 某台设备上跑一条命令 + 对回显的判定规则。两种给法:

  • suite:内置套件名,见下。

  • checks:自定义检查项列表,每项: {"name": "VRRP 主备", "target": "FW1", "command": "display vrrp", "expect": {"minCount": {"pattern": "State\s*:\s*(Master|Backup)", "atLeast": 1}}}

    target 可以是设备名、设备类别(AR / LSW / FW / WLAN / CLIENT)或 all, 用类别时会自动展开到这类所有设备。

expect 可组合的规则:contains / notContains(字符串或列表)、regex、 notRegex、minCount{"pattern","atLeast"}、reachable(布尔,ping 是否通)、 maxLoss(丢包率上限)。留空表示“命令跑通就算过”。

内置套件:

  • reachable:逐台登录,只验证 console 可连(最简单的连通性体检)

  • fw_ha:防火墙双机热备(HRP 角色 + 心跳口 + VRRP 主备)

  • bfd:BFD 会话 Up

  • ospf:OSPF 邻居 Full

  • vrrp:VRRP 主备

  • vlan:交换机上存在业务 VLAN

devices 可限定范围。检查项并发执行,concurrency 默认 4、最大 16。 返回 verdict(PASS / FAIL)、passed / failed / skipped 计数和每条检查的 状态、未满足的条件、回显片段。save_report 可把结果另存为 JSON。

验收跑过的命令同样自动留痕,tool 记为 lab_verify。

command_traceA

把“哪条命令打到了哪台设备”整理成可交互的 HTML 可视化报告。

报告分两块:左边是按 .topo 真实坐标画的拓扑,每台设备角标写着它收到多少条命令、 有几条失败,点设备会跳到右边对应的命令明细;右边按设备列出每条命令的时间、 来自哪个工具(下发 / 执行 / 探测 / 读回)、执行状态和可展开的回显。

所有设备操作都会自动留痕,不需要额外开关。日志在 %USERPROFILE%.ensp-mcp\commands.jsonl,可用 ENSP_MCP_LOG_DIR 改目录。

Args: path: .topo 路径。给了就只看这份拓扑上的记录,并按它的坐标画图; 省略则用最近一次 topo_* 用过的拓扑,再没有就把日志里的设备平铺成网格。 device: 只看某一台设备,例如 "Core1"。省略看全部。 out_path: 报告输出路径,省略则写到拓扑同目录的 <拓扑名>-commands.html。 limit: 最多取最近多少条命令记录,默认 2000,范围 1–20000。 show_output: 明细里是否附带命令回显,默认带。 open_browser: 生成后是否自动用默认浏览器打开,默认不打开。

返回 report(HTML 绝对路径)、commandCount、failedCommands、byDevice 等统计。

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A3.9/5.0

Scored across 19 tools

Disambiguation4/5

Most tools target clearly distinct operations: topology editing (topo_*), device interaction (device_*), verification (lab_verify), and reporting (command_trace). The only mild overlap is among device_exec, device_push_config, and device_batch, but their descriptions make the boundaries clear (arbitrary commands vs. config push vs. multi-device fan-out).

Naming Consistency4/5

The set largely follows a predictable prefix_action convention (topo_validate, device_exec, list_models, lab_verify). A couple of names such as environment_check and command_trace use noun_verb ordering rather than the dominant verb/prefix style, but the overall pattern remains easy to read and predict.

Tool Count4/5

19 tools is slightly above the typical ideal range but is justified by the breadth of the domain: topology CRUD, layout/export, environment checks, device operations, batch execution, lab verification, and tracing. Each tool earns its place, with no obvious redundant entries.

Completeness5/5

The surface covers the full lifecycle: model discovery, topology creation/edit/validate/layout/export/render, environment readiness, device command execution, config push/fetch/probe, session management, batch operations, lab verification, and command tracing. There are no obvious dead ends for the stated purpose.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues