Skip to main content
Glama

cisco-pt-mcp 🚀

基于 AI 的 Cisco Packet Tracer 自动化 - 让 AI 客户端通过自然语言控制 Packet Tracer。开源 MCP 服务器,集成 Gemini AI。

Demo

✨ 特性

  • 🤖 AI 网络生成 - 用自然语言描述网络,即可得到可运行的拓扑

  • 🎨 可视化构建器界面 - 基于网页的代码编辑器,支持语法高亮

  • 📦 现成模板 - 校园、分公司、VLAN、路由配置

  • 🔌 MCP 协议 - 兼容 Claude Desktop、Cursor 及其他 MCP 客户端

  • 实时控制 - 直接桥接正在运行的 Packet Tracer 实例

  • 🛠️ 完整工具集 - 20+ 个工具,用于设备管理、配置和测试


Related MCP server: packet-tracer-mcp

📥 快速安装

1. 安装 MCP 服务器

# Clone or download this repository
cd cisco-pt-mcp

# Install with AI support
pip install -e ".[ai]"

# Configure Gemini API (optional, for AI features)
python setup_config.py

2. 安装 Packet Tracer 扩展

  1. 打开 Cisco Packet Tracer

  2. Extensions → Scripting → Configure PT Script Modules

  3. 点击 Add → 选择 extension/cisco-pt-mcp.pts

  4. 重新启动 Packet Tracer

3. 启动并连接

# Start the MCP server
python -m mcp_server

在 Packet Tracer 中:

  • 点击 Extensions → Packet Tracer MCP

  • 状态应显示 “MCP Connected”

📖 详细说明请参阅 QUICKSTART.md


🎯 使用模式

模式 1:AI 生成器(自然语言)

打开 Packet Tracer 中的 PTBuilder 界面,并使用 AI Generator 标签页:

"Create a corporate network with 1 edge router, 1 core switch, 
2 department switches, and 3 PCs per department. Configure VLANs."

点击 Generate → 网络就会出现在工作区中!

模式 2:代码编辑器(JavaScript)

直接编写 PTBuilder 代码:

addDevice("R1", "2911", 150, 150);
addDevice("S1", "2960-24TT", 350, 150);
addLink("R1", "GigabitEthernet0/0", "S1", "GigabitEthernet0/1", "straight");
configureIosDevice("R1", "interface Gi0/0\nip address 192.168.1.1 255.255.255.0");

模式 3:MCP 客户端(Claude/Cursor)

配置你的 MCP 客户端:

Claude Desktop~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "cisco-pt-mcp": {
      "command": "python",
      "args": ["-m", "mcp_server"],
      "cwd": "/path/to/cisco-pt-mcp",
      "env": {
        "GEMINI_API_KEY": "your_key_here"
      }
    }
  }
}

然后与 Claude 对话:

“创建一个使用 3 台路由器测试 OSPF 路由的网络”


🛠️ 可用工具

AI 驱动工具

工具

描述

示例

generateNetworkFromDescription

根据文本生成完整网络

“创建一个小型办公网络...”

generateCodeSnippet

生成 PTBuilder JavaScript 代码

“为一个由 5 台交换机组成的环网编写代码”

executeBuilderCode

运行 PTBuilder 代码

执行自定义/生成的代码

buildNetworkFromDesign

根据 JSON 规范构建网络

导入复杂设计

openBuilderInterface

打开网页界面

访问代码编辑器和模板

核心网络工具

工具

描述

addDevice

添加路由器、交换机、PC 或服务器

addModule

安装接口模块(WIC、NIM 等)

addLink

使用线缆连接设备

removeDevice

删除设备

removeLink

移除连接

renameDevice

重命名设备

moveDevice

在画布上移动设备

setPower

开启/关闭设备电源

配置工具

工具

描述

configurePcIp

在 PC 上设置 IP、子网掩码、网关和 DNS

configureIosDevice

在路由器/交换机上执行 IOS CLI 命令

监控与仿真工具

工具

描述

getNetwork

获取所有设备和连接的快照

getDeviceInfo

获取设备详细信息

setSimulationMode

切换仿真/实时模式

getSimulationStatus

查询仿真状态

stepSimulation

逐步演示数据包传输过程

sendPdu

发送 PDU(例如 ICMP ping)

getPduResults

读取 PDU 结果

getCommandLog

查看 IOS 命令历史


📚 文档


🎓 示例

示例 1:使用 AI 创建简单网络

Prompt: "Create a basic network with one 2911 router, one 2960 switch, 
and two PCs. Configure the router with IP 192.168.1.1 and the PCs 
with static IPs in the same subnet."

Result: Complete working network in 30 seconds

示例 2:园区网络模板

Templates 标签页加载 “Campus Network” 模板:

  • 三层架构(核心、汇聚、接入)

  • 1 台核心交换机

  • 2 台汇聚交换机

  • 4 台接入交换机

  • 正确的交换机间互连

示例 3:VLAN 配置

// From templates - VLAN setup
addDevice("S1", "2960-24TT", 300, 200);
addDevice("PC1", "PC-PT", 150, 300);
addDevice("PC2", "PC-PT", 450, 300);

configureIosDevice("S1", `
vlan 10
name Sales
vlan 20
name Engineering

interface FastEthernet0/1
switchport mode access
switchport access vlan 10

interface FastEthernet0/2
switchport mode access
switchport access vlan 20
`);

🔧 配置

Gemini API 设置

方式一:交互式

python setup_config.py

方式二:环境变量

export GEMINI_API_KEY="your_key_here"

方式三:配置文件 创建 ~/.cisco-pt-mcp/config.json

{
  "gemini_api_key": "YOUR_KEY_HERE",
  "bridge_host": "127.0.0.1",
  "bridge_port": 7531,
  "tool_timeout": 60
}

🏗️ 架构

┌─────────────────┐
│   MCP Client    │  (Claude Desktop, Cursor, etc.)
│  (Natural Lang) │
└────────┬────────┘
         │ MCP Protocol
┌────────▼────────┐
│   MCP Server    │  (Python)
│   + Gemini AI   │  - Network generation
│                 │  - Code generation
└────────┬────────┘
         │ Socket.IO (port 7531)
┌────────▼────────┐
│ PT Extension    │  (JavaScript)
│  cisco-pt-mcp   │  - PTBuilder integration
│                 │  - Web interface
└────────┬────────┘
         │ IPC API
┌────────▼────────┐
│ Packet Tracer   │  (Cisco Application)
│   Workspace     │
└─────────────────┘

🤝 参与贡献

欢迎贡献!该项目集成了:


📄 许可证

MIT License - 请参阅 LICENSE 文件


🙏 致谢

  • PTBuilder by kimmknight - JavaScript 自动化框架

  • MCP 协议 - AI 应用通信的标准

  • Google Gemini - AI 生成能力

  • 原始 cisco-pt-mcp 由 muhammadbalawal 开发


🆘 支持与问题

  • 故障排查:请参阅 SETUP_GUIDE.md

  • 问题反馈:在 GitHub 上提交 Issue

  • 文档:查看 docs 文件夹

如果你觉得这个项目有用,请给它点个 Star ⭐!

Install Server
A
license - permissive license
A
quality
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer

  • MCP server for Pentest-Tools.com: run scans, manage findings and reports via your preffered LLM.

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

View all MCP Connectors

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/2001sithum/cisco-pt-mcp'

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