一个MCP服务器,使LLMs能够通过SSH(netmiko)与您的网络设备进行交互。
| 工具 | 描述 |
|---|---|
| get_network_device_list | 返回在TOML文件中定义的网络设备名称和类型的列表。 |
| send_command_and_get_output | 向设备发送命令并返回其输出。 |
| set_config_commands_and_commit_or_save | 向设备发送配置命令,并自动提交或保存。 |
git clone https://github.com/upa/mcp-netmiko-server
cd mcp-netmiko-server
# 编写列出您的设备的TOML文件
vim my-devices.network.toml
# 通过标准输入输出运行
uv run --with "mcp[cli]" --with netmiko main.py my-devices.network.toml
# 作为SSE服务器运行:在这种情况下,URL是http://localhost:10000/sse
uv run --with "mcp[cli]" --with netmiko main.py my-devices.network.toml --sse
在TOML文件中列出您的网络设备,例如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]是一个特殊的部分,用于定义默认值,如username和password。如果设备部分未定义这些值,则继承默认值。
对于device_type值,请参阅netmiko支持平台。
{
"mcpServers": {
"netmiko server": {
"command": "uv",
"args": [
"run",
"--with",
"mcp[cli]",
"--with",
"netmiko",
"[PATH TO]/mcp-netmiko-server/main.py",
"[PATH TO]/YOUR-DEVICE.toml"
]
}
}
}