packet-tracer-mcp

packet-tracer-mcp

Enables AI agents to control Cisco Packet Tracer in real time, allowing natural language-driven creation and configuration of network topologies.

Category
访问服务器

README

Packet Tracer MCP Server

Beta — Active development. Some features may be incomplete or change in future versions.

Control Cisco Packet Tracer in real time using natural language through any MCP-compatible AI agent — Claude Code, OpenCode, Cursor, Continue, Cline, and more.

Write prompts like "create a WAN network with OSPF between two sites" and watch the topology build itself live inside Packet Tracer.

How it works

Your AI agent (Claude Code, OpenCode, Cursor, Cline...)
        |
        v  natural language prompt
  MCP Server (Python)  <- stdio transport
        |
        v  generates JavaScript (PTBuilder API)
  Local HTTP server :54321
        |
        v  PTBuilder-MCP auto-polls /next every 500ms
  PTBuilder-MCP (extension running inside PT)
        |
        v  executes live
  Cisco Packet Tracer

Requirements

  • Python 3.11+
  • Cisco Packet Tracer 8.x
  • Builder-MCP.pts installed in PT (see Packet Tracer setup)
  • Any MCP-compatible AI agent (Claude Code, OpenCode, Cursor, Cline, Continue, etc.)

Installation

git clone https://github.com/caixax/packet-tracer-mcp
cd packet-tracer-mcp
pip install -e .

Packet Tracer setup

This server requires Builder-MCP.pts, a modified version of PTBuilder that automatically connects to the MCP server when Packet Tracer starts. No manual scripts or copy-pasting needed.

1. Download Builder-MCP.pts from the latest release

2. Open Packet Tracer and go to Extensions > Scripting > Configure PT Script Modules

3. Click Add and select the downloaded Builder-MCP.pts file

4. Make sure it is set to On Startup and click OK

5. Restart Packet Tracer. The bridge starts automatically — no further action needed.

Builder-MCP.pts is a fork of kimmknight/PTBuilder with an added MCP bridge module that auto-polls the MCP server on startup. The original Builder Code Editor functionality is preserved. Source code: github.com/caixax/PTBuilder

Configuration

Most AI coding tools run MCP servers as a subprocess via stdio — no extra setup, just point them at the command. Replace C:/path/to/packet-tracer-mcp with your actual path.


Claude Code

cd C:/path/to/packet-tracer-mcp
claude mcp add packet-tracer -- python -m src.server

Claude Desktop

# No CLI — edit the config file manually
# Windows: %APPDATA%\Claude\claude_desktop_config.json
# macOS:   ~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "packet-tracer": {
      "command": "python",
      "args": ["-m", "src.server"],
      "cwd": "C:/path/to/packet-tracer-mcp"
    }
  }
}

OpenCode

# No CLI — edit the config file manually
# Windows: %APPDATA%\opencode\config.json
# macOS/Linux: ~/.config/opencode/config.json
{
  "mcp": {
    "packet-tracer": {
      "type": "local",
      "command": ["python", "-m", "src.server"],
      "cwd": "C:/path/to/packet-tracer-mcp"
    }
  }
}

Cursor

# No CLI — edit the config file manually
# Project-level: .cursor/mcp.json
# Global: ~/.cursor/mcp.json
{
  "mcpServers": {
    "packet-tracer": {
      "command": "python",
      "args": ["-m", "src.server"],
      "cwd": "C:/path/to/packet-tracer-mcp"
    }
  }
}

Cline (VS Code)

# No CLI — use the UI
# Cline sidebar > Settings > MCP Servers > Edit MCP Settings
{
  "mcpServers": {
    "packet-tracer": {
      "command": "python",
      "args": ["-m", "src.server"],
      "cwd": "C:/path/to/packet-tracer-mcp"
    }
  }
}

Continue

# No CLI — edit the config file manually
# ~/.continue/config.json
{
  "experimental": {
    "modelContextProtocolServers": [
      {
        "transport": {
          "type": "stdio",
          "command": "python",
          "args": ["-m", "src.server"],
          "cwd": "C:/path/to/packet-tracer-mcp"
        }
      }
    ]
  }
}

HTTP mode (advanced)

If you want the server running independently so multiple clients can share it, or if your client only supports HTTP/SSE:

python -m src.server --transport http --port 3000
# Server available at http://127.0.0.1:3000/sse

Not on the list?

This server follows the MCP specification — it should work with any MCP-compatible client.

Check your client's documentation for how to add a stdio MCP server with a custom command. If you get it working with a client not listed here, feel free to open a PR or issue to add it to this list.

Usage

With Packet Tracer open and the MCP server running, write in Claude:

Create a network with router R1, switch SW1 and two PCs.
Connect them and configure the 192.168.1.0/24 network.
Add a DNS server with IP 192.168.1.10 connected to the switch.
Configure all PCs to use that DNS server.
Create a WAN topology: two routers with a serial link, each with
its own LAN, and configure OSPF area 0 between them.

Available tools

Devices

Tool Description
pt_add_device Add a device to the canvas
pt_remove_device Remove a device from the canvas
pt_list_devices List devices in the topology
pt_get_device_info Get detailed info about a device

Connections

Tool Description
pt_connect Connect two devices with a cable
pt_disconnect Remove a cable from a port
pt_list_connections List all connections

Configuration

Tool Description
pt_send_commands Send CLI commands to a router/switch
pt_configure_ip Configure IP on an interface (shortcut)
pt_configure_pc Configure IP/DNS on a PC, Laptop or Server
pt_save_config Save running-config to startup-config

Topology

Tool Description
pt_apply_template Apply a predefined topology template
pt_export_topology Export topology as JSON
pt_validate Validate network configuration

Device aliases

Alias Model
router Cisco 2911
switch Cisco 2960-24TT
switch-l3 Cisco 3560-24PS
pc PC-PT
server Server-PT
laptop Laptop-PT
tablet TabletPC-PT
smartphone SMARTPHONE-PT
phone Cisco 7960
ap AccessPoint-PT
wifi Linksys-WRT300N
firewall ASA 5506-X
cloud Cloud-PT
wlc WLC-3504

Project structure

packet-tracer-mcp/
├── src/
│   ├── server.py              # MCP entry point + resources
│   ├── app.py                 # FastMCP instance + lifespan
│   ├── tools/
│   │   ├── devices.py         # Device tools
│   │   ├── connections.py     # Connection tools
│   │   ├── configuration.py   # CLI configuration tools
│   │   └── topology.py        # Topology and diagnostics
│   ├── bridge/
│   │   ├── pt_connection.py   # HTTP bridge server :54321
│   │   ├── script_builder.py  # PTBuilder JS code generator
│   │   └── command_queue.py   # Serialized async queue
│   └── catalog/
│       ├── devices.json        # Device catalog
│       ├── cables.json         # Cable types
│       └── templates.json      # Topology templates
├── pyproject.toml
└── LICENSE

Troubleshooting

"PTBuilder is not polling"

  • Make sure Packet Tracer is open with Builder-MCP.pts installed
  • Verify the module is enabled: Extensions > Scripting > Configure PT Script Modules
  • Check that it is set to "On Startup"
  • Restart Packet Tracer after installing the module

"Port 54321 already in use"

  • A previous MCP server process may still be running
  • The server automatically cleans up stale processes on startup, but if it fails, restart Packet Tracer and Claude Code

Error "Invalid arguments for IPC call"

  • Check the device type is valid (use the aliases from the table above)
  • Port names are auto-expanded (Gi0/0 -> GigabitEthernet0/0) but verify they exist on the device model

Error "getPort of null"

  • The device was not added successfully before trying to configure it
  • Verify pt_add_device succeeded before calling pt_configure_pc

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选