console-switch-mcp
Enables control of network switches via serial console ports, supporting Huawei, H3C, and Cisco devices for command execution and configuration.
README
Console Switch MCP
通过串口 Console 口(RS-232/USB-to-Serial)控制网络交换机的 MCP Server。支持华为、H3C、思科等主流品牌交换机。
功能
| Tool | 说明 |
|---|---|
list_ports |
列出计算机所有可用串口(COM口) |
connect |
通过 Console 口连接交换机 |
send_command |
发送单条命令并获取返回结果 |
send_config |
批量发送配置命令 |
disconnect |
断开 Console 连接 |
get_status |
查看当前连接状态 |
支持的设备
- 华为 (Huawei) — 自动识别
<Huawei>/[Huawei]提示符 - H3C — 自动识别
<H3C>/[H3C]提示符 - 思科 (Cisco) — 自动识别
Router>/Router#提示符 - 其他支持标准串口 Console 的网络设备
前置条件
- 硬件:Console 线(USB 转 RJ45/RS-232),常见芯片:FTDI、CH340、PL2303
- 驱动:安装对应 USB 转串口芯片的驱动程序
- Node.js:>= 18.0.0
安装
1. 克隆项目
git clone https://github.com/yangyu2729/console-switch-mcp.git
cd console-switch-mcp
2. 安装依赖并构建
npm install
npm run build
3. 配置 MCP
WorkBuddy
编辑 ~/.workbuddy/mcp.json,添加:
{
"mcpServers": {
"console-switch-mcp": {
"command": "node",
"args": ["/你的路径/console-switch-mcp/build/index.js"],
"disabled": false
}
}
}
Windows 路径示例:
C:/Users/你的用户名/console-switch-mcp/build/index.jsmacOS/Linux 路径示例:/home/你的用户名/console-switch-mcp/build/index.js
Claude Desktop
编辑配置文件:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"console-switch-mcp": {
"command": "node",
"args": ["/绝对路径/console-switch-mcp/build/index.js"]
}
}
}
配置完成后重启 WorkBuddy / Claude Desktop 即可生效。
使用
在 AI 对话中直接使用自然语言操作:
- "列出电脑上可用的串口"
- "用 COM3 连接华为交换机,波特率 9600"
- "查看交换机版本信息"
- "查看 VLAN 配置"
- "进入系统视图,配置端口"
- "断开连接"
常用华为交换机命令
display version 查看设备版本
display current-configuration 查看当前配置
display vlan 查看 VLAN 信息
display interface brief 查看接口概要
display arp 查看 ARP 表
display mac-address 查看 MAC 地址表
display ip routing-table 查看路由表
display cpu-usage 查看 CPU 使用率
display logbuffer 查看日志缓冲
system-view 进入系统视图
ping 192.168.1.1 测试网络连通性
串口参数
| 参数 | 默认值 | 说明 |
|---|---|---|
| baudRate | 9600 | 华为/H3C 默认 9600,部分设备用 115200 |
| dataBits | 8 | 数据位 |
| stopBits | 1 | 停止位 |
| parity | none | 校验位 |
项目结构
console-switch-mcp/
├── src/
│ ├── index.ts # MCP Server 入口
│ └── serial-console.ts # 串口通信核心模块
├── build/ # 编译输出
├── package.json
└── tsconfig.json
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.