netmiko-mcp
This MCP server provides SSH/telnet access to network devices (Comware) and Linux hosts, with two tools: list_devices to enumerate configured devices (excluding secrets) and run_command to execute read or config commands on a specified device, using sudo for Linux and automatic privilege escalation for network devices. Each invocation opens a fresh connection, logs actions to a local audit file, and returns full command output without truncation.
Provides SSH/telnet command execution on Linux servers via sudo, enabling remote administration and configuration tasks.
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., "@netmiko-mcpRun 'display version' on core-switch"
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.
netmiko-mcp
一个极简的 MCP 服务器,为编码智能体(Claude / DSH / Codex)提供对华三 Comware 网络设备与Linux 服务器的 SSH/telnet 命令执行能力。
两个工具:
list_devices(枚举设备)与run_command(执行命令)。完全读写委托,无确认门禁、无命令白名单。
每次调用独立连接,无跨调用会话状态。
唯一的护栏是本地审计日志(事后复盘,非事前拦截)。
依赖管理
本项目使用 uv 管理依赖,.python-version 固定 Python 3.12。
uv sync # 安装依赖到 .venv
uv run pytest # 运行测试
uv run python main.py # 以 stdio 启动 MCP 服务器Related MCP server: H3C CLI MCP Server
清单文件
默认读取当前目录下的 hosts.yaml(可用环境变量 NETMKO_MCP_INVENTORY 覆盖)。参见 hosts.example.yaml 的完整示例:
- id: core-switch # 唯一标识,run_command 用它对目标寻址
description: 核心交换机,负责办公网络汇聚 # 可选的设备描述
platform: network # network | linux
host: 192.168.1.1
protocol: ssh # ssh | telnet
port: 22 # 可选
device_type: hp_comware # netmiko 类型;telnet 会自动补 _telnet 后缀
username: admin
password: "CHANGE_ME"
secret: "CHANGE_ME" # 特权(super)密码,可选
- id: jump-host
platform: linux
host: 192.168.1.10
username: ops
password: "CHANGE_ME"
sudo_password: "CHANGE_ME" # linux 必填,经 sudo -S 使用工具
list_devices
返回清单中所有设备的公开元数据(id、description、platform、host、port、protocol、device_type、username),不返回 password、secret、sudo_password。
description 是可选的字符串,用于说明设备用途、位置等信息;未配置或设为 null 时返回 null,空字符串原样返回。现有清单无需修改。
run_command(target, mode, command)
target:清单中的id。mode:read(只读命令)或config(配置下发)。command:命令字符串;config模式按换行拆分为多条配置命令。
行为:
网络设备:
read走send_command,config走send_config_set(自动进/出系统视图);连接后自动关闭分页,连接时自动进入特权视图(secret)。Linux:命令以
sudo -S执行,使用清单中的sudo_password。每次调用独立连接,执行后断开。
输出完整返回,不截断。
配置下发不自动保存:持久化需由智能体显式执行
save(华三)等命令。
环境变量
变量 | 默认值 | 说明 |
|
| 清单文件路径 |
|
| 审计日志路径 |
审计日志
每次 run_command 都会向审计日志追加一行 JSON,字段含时间戳、目标、模式、命令、成功与否与输出:
{"timestamp":"...","target":"core-switch","mode":"read","command":"display version","success":true,"output":"..."}客户端接入示例
以 stdio 方式接入 MCP 客户端时,启动命令为:
{ "command": "uv", "args": ["run", "python", "main.py"], "cwd": "/path/to/netmiko-mcp" }安全警告(必读)
本工具默认完全委托、不做拦截,叠加以下设计后风险很高,请务必知悉:
凭证明文内联:
hosts.yaml直接存放所有设备的密码、特权密码与 sudo 密码,且已加入.gitignore。一旦该文件泄露,攻击者即获得所有设备的完全控制权。切勿提交到版本库,并严格控制文件权限。支持 telnet:telnet 为明文传输,登录凭证会在链路上明文暴露。仅应在隔离网络中使用。
完全读写、无确认:智能体可直接下发真实配置,无二次确认、无命令白名单、无干跑。
无提示注入防护:若智能体被不可信内容(网页、邮件、设备回显)诱导,命令会以完全权限执行。
不自动保存:配置下发后不会自动持久化,重启可能丢失,需智能体显式保存。
审计日志只能事后复盘,不能事前拦截。
请在完全理解并接受上述风险后再部署到生产环境。
Available Tools
2 toolslist_devicesA
枚举清单中的目标设备及 description 描述(不含密码/secret/sudo 密码)。
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must carry behavioral disclosure. It discloses the key exclusion of passwords/secrets and implies a read-only operation via 'enumerate', but it does not explicitly state whether the operation is safe or has side effects. This is adequate but not comprehensive.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence that front-loads the action and includes a valuable exclusion note. There is no fluff, and every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a zero-parameter list tool without an output schema, the description is fairly complete. It states what is returned (devices and descriptions) and what is excluded. It does not mention pagination or sorting, but these are not essential for basic invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters, so the description does not need to explain parameter semantics. The baseline for zero parameters is 4, and the description adds no parameter-related information, which is acceptable.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool enumerates target devices and their descriptions, with a specific exclusion of sensitive data. This distinguishes it from the sibling run_command, which executes commands, so an agent can easily tell them apart.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance is given on when to use this tool versus run_command. The context is implied by the verb 'enumerate' but there is no direct statement of alternatives or conditions, so an agent receives no explicit routing advice.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
run_commandA
对目标设备执行命令。mode 为 read(只读)或 config(配置下发)。
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | ||
| target | Yes | ||
| command | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of behavioral disclosure. It does add meaningful context by explaining that mode can be read-only or config-push, which hints at safety differences. However, it does not disclose output format, side effects of config mode, permissions needed, or error behavior, leaving significant behavioral ambiguity.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two short sentences with no filler. The primary action is front-loaded and the mode clarification is useful and directly relevant. Every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with three required parameters, no schema descriptions, no annotations, and no output schema, this description is too sparse. It fails to explain what target refers to, what format command should take, or what the tool returns. It is minimally viable but leaves important gaps for an agent to call it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema provides no descriptions for any of the three required parameters, and the description only explains the meaning of mode (read/config). The target and command parameters are left entirely to inference. At 0% schema coverage, the description should compensate more heavily but does not.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool executes a command on a target device, which is a specific verb and resource. It also distinguishes itself from the sibling tool list_devices by focusing on command execution rather than device enumeration. The mode distinction adds further clarity to the purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use the tool—whenever a command needs to be executed on a device—and notes the read/config mode split. However, it provides no explicit guidance on when not to use it or when to prefer the sibling list_devices instead. The usage context is implied rather than explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v0.0.1- First observed
list_devices - First observed
run_command
TDQS
Scored across 2 tools
list_devices and run_command have clearly distinct purposes: one enumerates available devices, the other executes commands on a target device. There is no overlap or ambiguity between them.
Both tool names follow the same verb_noun pattern: list_devices and run_command. The naming is consistent, predictable, and easy for an agent to reason about.
With only two tools, the server feels minimal and is at the thin end of the scale. The tools are essential and earn their place, but the surface is quite sparse for a network automation MCP.
The combination of listing devices and running arbitrary read/config commands covers the core Netmiko workflow well. Minor gaps exist, such as no dedicated multi-device execution or explicit save/commit operation, but agents can work around these via run_command.
Maintenance
Related MCP Connectors
Run and manage H Company's Computer-Use Agents from any MCP client.
Run commands and read/write files on your servers over Termalin's keyless tunnels (hosted MCP).
MCP server for network documentation, generated by doc2mcp.
Unified gateway exposing 150+ tools across all NexGenData MCP servers via one endpoint.
Related MCP Servers
- AlicenseAqualityDmaintenanceA comprehensive MCP server for network device management via SSH/Telnet. Supports multiple vendors such as Cisco IOS and BDCOM, enabling AI assistants to execute commands and manage routers, switches, and firewalls.4MIT
- FlicenseNot gradedqualityDmaintenanceTelnet-based MCP server for H3C network device CLI, enabling connection, command execution, and device mode detection via natural language.14-
- FlicenseNot gradedqualityCmaintenanceEnables executing Cisco CLI commands on network devices over SSH through two MCP tools for exec and config commands, with security and automation features.-
- FlicenseAqualityBmaintenanceEnables management of multiple MikroTik RouterOS devices over SSH via two tools: device listing and command execution.2-