UM

upa/mcp-netmiko-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

35 stars 8 forks 质量 41 趋势 12

一个MCP服务器,使LLM能够与你的网络设备交互

概览

一个MCP服务器,使LLM通过SSH(netmiko)与你的网络设备交互。 在像 sample.network.toml 这样的 toml 文件中列出你的网络设备: [default] 是一个特殊部分,定义了默认值,如用户名和密码。如果设备在其部分未定义,则继承默认值。 有关device_type值,请参见netmiko支持平台。

概述(AI 翻译)

一个MCP服务器,使LLM能够与你的网络设备交互 通过SSH(netmiko)。

工具 描述
get_network_device_list 返回TOML文件中定义的网络设备名称和类型列表。
send_command_and_get_output 向设备发送命令并返回其输出。
set_config_commands_and_commit_or_save 向设备发送配置命令并自动提交或保存。

如何使用

  • 安装

  • 配置

在像 sample.network.toml 这样的 toml 文件中列出你的网络设备:

[default] 是定义默认值的特殊节,如下 作为username和password。如果设备继承默认值,则 这些条款未被定义。

关于device_type值,请参见netmiko Supported 平台。

  • Claude Desktop config json:

本页由 AI 翻译,技术细节请以原文为准。

README

mcp-netmiko-server

An MCP server that enables LLMs interacting with your network devices via SSH (netmiko).

Tool Description
get_network_device_list Return list of network device names and types defined in a TOML file.
send_command_and_get_output Send a command to a device and returns its output.
set_config_commands_and_commit_or_save Send configuration commands to a device and commit or save automatically.

How to use

  • Install
git clone https://github.com/upa/mcp-netmiko-server
cd mcp-netmiko-server

# Write your toml file that lists your devices
vim my-devices.network.toml

# Run via stdio
uv run --with "mcp[cli]" --with netmiko main.py my-devices.network.toml

# Run as an SSE server: URL is http://localhost:10000/sse in this case
uv run --with "mcp[cli]" --with netmiko main.py my-devices.network.toml --sse
  • Configuration

List your network devices in a toml file like sample.network.toml:

[default]

username = "rouser"
password = "rouserpassword"

[qfx1]

hostname = "172.16.0.40"
device_type = "juniper_junos"

[nexus1]

hostname = "nexus1.lab"
device_type = "cisco_nxos"

[default] is a special section that defines the default values such as username and password. Devices inherit the default values if not defined on their sections.

For device_type values, see netmiko Supported Platforms.

  • claude desktop config json:
{
  "mcpServers": {
    "netmiko server": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "--with",
        "netmiko",
        "[PATH TO]/mcp-netmiko-server/main.py",
        "[PATH TO]/YOUR-DEVICE.toml"
      ]
    }
  }
}
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "netmiko server": { "command": "uv", "args": [ "run", "--with", "mcp[cli]", "--with", "netmiko", "[PATH TO]/mcp-netmiko-server/main.py", "[PATH TO]/YOUR-DEVICE.toml" ] } } }