Skip to main content
Glama
bowling233

Network Operator MCP

by bowling233

网络运维 MCP

network-operator-mcp 让智能体能够操作网络设备管理接口,同时将设备凭据保存在 MCP 服务器内部。

服务器支持以下设备后端:

  • ssh-terminal:用于交互式网络 CLI 的持久 SSH PTY。

  • ssh-exec:每次工具调用执行一次标准 SSH exec 请求。

  • http-tplink-switch:TP-Link 交换机 WebUI API。

  • http-zte-be7200:中兴 BE7200 Pro+ WebUI API。

  • http-mellanox-onyx:Mellanox Onyx WebUI API。

服务器不解释命令、提示符或 API 响应。它只在智能体与所选设备之间传输请求和响应。

已测试设备

厂商和型号

软件

后端

华为 S1730S-S48T4X-A1

VRP 5.170 (V200R022C00SPC500)

ssh-terminal

华为 S5720-28P-LI-AC

VRP 5.170 (V200R011C10SPC600)

ssh-terminal

华为 S5720S-52P-LI-AC

VRP 5.170 (V200R011C10SPC600)

ssh-terminal

华为 FutureMatrix S6720S-S24S28X-A

VRP 5.170 (V200R022C00SPC500)

ssh-terminal

MikroTik CCR2004-1G-12S+2XS (r3)

RouterOS 7.23.1 stable

ssh-exec

OpenWrt 和 ImmortalWrt 设备

多种

ssh-exec

TP-Link TL-SG2226

2023 WebUI

http-tplink-switch

TP-Link TL-SG2024D

2023 WebUI

http-tplink-switch

TP-Link TL-SE2206

2024 WebUI

http-tplink-switch

中兴 BE7200 Pro+

V1.0.0.4B8.8000

http-zte-be7200

Mellanox SN2700

Onyx 3.7.1134

http-mellanox-onyx

Related MCP server: SSH MCP Server

配置

backends:
  ssh-terminal:
    connect_timeout_seconds: 15
    default_quiet_timeout_ms: 1000
    default_deadline_ms: 15000
    default_response_limit_bytes: 200000
    max_sessions: 10
    session_idle_ttl_seconds: 600
    max_session_lifetime_seconds: 3600
  ssh-exec:
    connect_timeout_seconds: 15
    default_command_timeout_seconds: 60
  http:
    connect_timeout_seconds: 10
    default_request_timeout_seconds: 30
    max_response_bytes: 2000000

accounts:
  ssh-operator:
    username: netadmin
    password: plaintext-password

  web-operator:
    username: webadmin
    password: plaintext-password

  zte-password:
    password: plaintext-password

devices:
  example-huawei:
    type: ssh-terminal
    host: 192.0.2.10
    account: ssh-operator

  example-tplink:
    type: http-tplink-switch
    host: 192.0.2.20
    account: web-operator

  example-zte:
    type: http-zte-be7200
    host: 192.0.2.30
    account: zte-password

  example-onyx:
    type: http-mellanox-onyx
    host: 192.0.2.40
    account: web-operator
    verify_tls: false

多个设备可以共享账户。SSH 账户可以使用 password、内联 private_key 以及可选的 private_key_passphrase。ZTE 后端只接受仅含密码的账户,因为该产品的 WebUI 用户名是固定的。

HTTP 默认使用 80 端口,但 http-mellanox-onyx 除外,它默认使用 HTTPS 443 端口。当设备的设置与这些默认值不同时,请在设备上设置 schemeportverify_tls。完整的占位配置位于 config/devices.example.yaml

MCP 工具

工具

设备后端

用途

list_devices

全部

列出已配置的设备名称和后端类型。

ssh_execute

ssh-exec

执行一次 SSH exec 请求。

open_session

ssh-terminal

打开或复用设备的终端。

list_sessions

ssh-terminal

列出已打开的终端。

exchange

ssh-terminal

写入终端输入并读取输出。

read_session

ssh-terminal

从字节游标处读取输出。

close_session

ssh-terminal

关闭设备的终端。

http_request

HTTP 后端

发送经过身份验证的 WebUI API 请求。

HTTP 请求

http_request 接受已配置的 device、HTTP method 以及相对于设备的 path。可选参数包括 queryheadersbodybody_base64formtimeout_secondsbodybody_base64form 最多只能提供其中一个。

MCP 服务器管理凭据、Cookie 和设备令牌。调用方不能提供包含凭据的请求头,敏感的身份验证请求头也不会被返回。来自智能体请求的重定向会返回给智能体,而不会自动跟随。文本响应直接返回;二进制响应使用 base64 编码,并将 body_encoding 设置为 base64

示例:

{
  "device": "example-zte",
  "method": "POST",
  "path": "/?_type=vueData&_tag=vuecfg_data",
  "form": {
    "IF_ACTION": "Get"
  }
}

SSH 终端

每个终端都有一个后台读取器,将设备输出追加到临时记录中。将 initial_output.next_cursor 带入第一次 exchange,然后将每次返回的 next_cursor 继续向前传递。静默超时仅表示在该时间段内没有新的字节到达;它并不能证明命令已完成。

MCP 服务器重启必然会关闭活动的 SSH 连接并丢弃其记录。请再次为设备调用 open_session,并使用新的初始游标继续操作。

状态

SSH 终端以设备名称为键,不属于任何 MCP 客户端会话。这些工具不暴露也不接受终端会话标识符。Streamable HTTP 传输也是无状态的,因此重启 MCP 服务器不会让客户端持有过期的 MCP 会话标识符。

运行服务器

验证配置:

network-operator-mcp --config config/devices.local.yaml validate-config

通过 stdio 运行:

network-operator-mcp --config config/devices.local.yaml serve

使用 Streamable HTTP 运行:

network-operator-mcp --config config/devices.local.yaml serve \
  --transport streamable-http --host 127.0.0.1 --port 8000

服务器还支持 sse 传输。

安全说明

  • 保护配置文件,因为它们包含明文凭据。

  • 不验证 SSH 服务器主机密钥。

  • 当设备具有受信任的证书时,请保持启用 TLS 验证。仅对 WebUI 证书无法验证的设备使用 verify_tls: false

  • 仅向受信任的智能体和用户暴露 MCP 传输。HTTP API 调用可以更改设备配置。

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    B
    quality
    D
    maintenance
    Enables seamless SSH operations including secure connections, file transfers, interactive shell sessions, and Docker container management on remote servers. Supports both password and SSH key authentication with credential management and connection pooling.
    18
  • A
    license
    A
    quality
    C
    maintenance
    Enables remote server management through SSH and SFTP, supporting command execution, file transfers, and interactive shell sessions. It allows for multiple concurrent connections using either password or SSH key authentication.
    11
    19
    4
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    Enables secure SSH connections to remote servers for executing shell commands and managing active sessions. It supports authentication via passwords or private keys and provides optional host-based access control.
    4
    210
    MIT

Latest Blog Posts

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/bowling233/network-operator-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server