Integrating Claude with Cisco Packet Tracer via MCP

A complete step-by-step guide: what to download, how to set up Claude Code and Packet Tracer, the versions used, security validation, and a real STP lab built from plain-language requests.

CISCOAIAUTOMATIONTROUBLESHOOTING

12/7/202610 min read

Integrating Claude with Cisco Packet Tracer via MCP

Figure 1 – Architecture overview: Claude Code ↔ MCP server ↔ extension inside Packet Tracer, all on the same computer. December 2026 · Tested on macOS 27.2.1 with Cisco Packet Tracer 9.0.1 and Claude Code 2.1.332

1. Introduction

Imagine typing: “build three switches in a triangle, configure STP with SW1 as root, and test ping between the PCs”, and watching the network get drawn, configured and tested on its own inside Cisco Packet Tracer. That is exactly what this tutorial teaches you to do, using Claude Code and MCP (Model Context Protocol).

MCP is an open protocol that lets an AI assistant use external tools in a standard way. An “MCP server” exposes tools (for example “add device” or “run a CLI command”), and the client, Claude Code in this case, decides when to call them to fulfil your request.

By the end of this guide you will have:

• Claude Code with access to 111 tools that control Packet Tracer.

• The extension installed and active inside Packet Tracer 9.0.1.

• The integration's access controls tested and documented.

• An STP troubleshooting lab built, broken, fixed and saved by Claude itself.

ℹ️ Note: Everything described here was actually executed, and the outputs shown in the terminal figures are the real outputs captured during installation. Sensitive values, such as the token, are masked.

2. Versions used

Using compatible versions avoids most problems. This is the combination that was tested:

⚠️ Warning: Use the same version for the server (packet-tracer-mcp@0.12.0) and the extension (the .pts from release v0.12.0). From version 0.6.0 on, the server requires extension V5 or newer.

3. How the integration works

Packet Tracer has no public API for external control. It does listen on TCP port 39000 (the native IPC used by Cisco's external apps), but that channel requires a Cisco-signed handshake and is undocumented. That is why the MCP projects for Packet Tracer take a different route, made of three pieces:

1. A Script Module (.pts) inside Packet Tracer. PT has a JavaScript Script Engine with access to the topology, the devices and the CLI. The MCP-Control-Center.pts file runs in that engine.

2. A local HTTP bridge. The module polls the bridge at http://127.0.0.1:54321 every 500 ms (“any commands for me?”), runs whatever it gets and returns the result. If the extension window is closed, a file-based fallback channel (file-bridge) takes over.

3. The MCP server. packet-tracer-mcp exposes the pt_* tools to Claude and translates each call into commands for the bridge.

With this, Claude can create devices and cables, configure IP addresses, run IOS commands, read STP, routes and VLANs, run real pings, save .pkt files and even grade .pka activities.

4. What to download

💡 Tip: In my case Python, Node, uv and Bun were already installed. Before downloading anything, check what you already have with uv --version and claude --version.

5. Step 1: check the installed Packet Tracer

Before installing anything new, take stock of what is already there. In Terminal, list the installations:

ls /Applications | grep -i "packet tracer"

With Packet Tracer open, check which ports it listens on:

lsof -nP -iTCP -sTCP:LISTEN | grep PacketTra

Figure 2 – Real lsof output: Packet Tracer listens on ports 39000 (native IPC) and 38000 (multiuser). The “*” means they accept connections on any network interface.

🔒 Security: Ports 39000 and 38000 belong to Packet Tracer itself, not to the MCP server, and they are open to the network. If you don't use multiuser mode or Cisco's external apps, consider blocking them in the system firewall (section 9.3).

6. Step 2: choose the MCP server

I found two community projects compatible with Packet Tracer 9. Neither is an official Cisco project.

The deciding factor was bridge security: the Mats2208 project requires a secret token on every request and validates the Host header, which blocks DNS rebinding attacks launched from the browser.

💡 Tip: Before installing, I downloaded the package from PyPI and checked in the source code that the bridge listens only on 127.0.0.1 (ThreadingHTTPServer(("127.0.0.1", port))) and compares the token with hmac.compare_digest, which resists timing attacks. Do this quick check for any MCP server that controls software on your machine.

7. Step 3: install uv

uv is a fast Python package manager. The uvx command downloads and runs Python tools in isolated environments, without touching the system Python. Install it one of these ways:

# macOS with Homebrew

brew install uv

# or the official installer (macOS/Linux)

curl -LsSf https://astral.sh/uv/install.sh | sh

Confirm the installation:

uv --version

# uv 0.13.9

8. Step 4: register the MCP server in Claude Code

A single command registers the MCP server for all your projects (user scope):

claude mcp add --scope user --transport stdio packet-tracer -- uvx packet-tracer-mcp@0.12.0 --stdio

What each part of the command means:

Then check the status:

claude mcp get packet-tracer

Figure 3 – Real output of the registration and check: the packet-tracer server shows “Status: ✔ Connected”.

⚠️ Warning: The pt_* tools only show up in Claude Code sessions opened after registration. If a session was already open, start a new one.

💡 Tip: Pinning the version (@0.12.0) keeps a package update from slipping in unnoticed. To upgrade, change the number and register again.

9. Step 5: install the extension in Packet Tracer

9.1 Download the file

Download MCP-Control-Center.pts from the project's releases page (version v0.12.0, 28,666 bytes). Keep it in a fixed folder. I used the project's extension/ folder, because Packet Tracer remembers the module's path.

9.2 Add it as a Script Module

Figure 4 – Extension install sequence in Packet Tracer 9.0.1. Step 6, closing the dialog, is mandatory.

1. Open Cisco Packet Tracer 9.0.1.

2. In the top menu, click Extensions → Scripting → Configure PT Script Modules.

3. In the window that opens, click Add and select the MCP-Control-Center.pts file.

4. Confirm the prompt “detected a new script module… enable?”. The module should appear in the list as active.

5. Close the Configure PT Script Modules window. While any modal dialog is open, the MCP sends no commands, so it won't hang Packet Tracer.

6. Open Extensions → MCP BUILDER (MCP Control Center). This window shows the log and keeps the HTTP connection.

ℹ️ Note: With the MCP BUILDER window open, communication goes over the HTTP bridge, which is faster and has a log. If you close the window, the extension keeps working over the file-bridge, a file “mailbox” in ~/.local/state/packet-tracer-mcp that is just a bit slower.

9.3 Confirm the connection

In a new Claude Code session, ask: “check the Packet Tracer bridge status”. Claude calls the pt_bridge_status tool:

Figure 5 – Real output of the pt_bridge_status tool: connected over both channels, HTTP (window open) and file-bridge.

Optional: close PT's native ports. In System Settings → Network → Firewall → Options, add Cisco Packet Tracer and select “Block incoming connections”. This doesn't affect the MCP server, which uses 127.0.0.1:54321, but it disables multiuser mode.

10. Step 6: test the access controls

A bridge that runs commands in Packet Tracer must not take orders from just anyone. The project implements four layers of protection, and I tested each one:

• Loopback-only listener (127.0.0.1): another machine on the network can't even open a connection.

• Per-machine token: generated with secrets.token_urlsafe(32) and stored with mode 600.

• Host header check: only 127.0.0.1, localhost or [::1] are accepted, which blocks DNS rebinding.

• Size limit: oversized requests get a 413.

10.1 Commands used

With the MCP server running, I ran in Terminal:

# 1) /ping is public on purpose: it only returns the token fingerprint

curl -s http://127.0.0.1:54321/ping

# 2) No token

curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:54321/next

# 3) Fake token

curl -s -o /dev/null -w "%{http_code}\n" "http://127.0.0.1:54321/next?t=abc"

# 4) Valid token + forged Host (simulates DNS rebinding)

curl -s -o /dev/null -w "%{http_code}\n" -H "X-PT-Token: $TOKEN" -H "Host: evil.com:54321" http://127.0.0.1:54321/next

# 5) Valid token + correct Host

curl -s -o /dev/null -w "%{http_code}\n" -H "X-PT-Token: $TOKEN" http://127.0.0.1:54321/next

# 6) From the LAN IP, as if from another machine

curl -s -m3 http://$(ipconfig getifaddr en0):54321/ping || echo "connection refused"

Figure 6 – Real run of the access tests: no token, fake token and forged Host are blocked (401); a valid token with the correct Host is accepted (200); from the local network the connection is refused. The token is masked.

10.2 Results

🔒 Security: The token lives in ~/.local/state/packet-tracer-mcp/bridge_token. Never publish that file or its contents, and mask the value in screenshots and videos.

11. Step 7: first test, 2 PCs and 1 switch

With everything connected, the first request to Claude was a simple one, in plain language:

ℹ️ Note: “In Packet Tracer, create a 2960 switch named SW1 and two PCs, PC1 with 192.168.10.1/24 and PC2 with 192.168.10.2/24. Connect both to the switch and test ping in both directions.”

Figure 7 – Topology Claude built in the first test: SW1 (2960-24TT) with PC1 and PC2 connected on ports Fa0/1 and Fa0/2.

Behind the scenes, Claude chained these MCP tools:

Figure 8 – Real sequence of MCP calls: device creation, cables (straight-through picked automatically), IP addresses, and ping with 4/4 packets in both directions.

In under a minute the network was built, addressed and validated, without a single click in Packet Tracer.

12. Step 8: a real lab, STP with flapping

To test something genuinely useful for study, I asked Claude:

ℹ️ Note: “Generate an STP lab where one switch is causing flapping. I need to identify which switch is causing it and fix it. Document the step-by-step resolution.”

12.1 What Claude did

1. Built 3 2960 switches in a triangle (SW1, SW2 and SW3), with one PC on each, all in VLAN 1 (192.168.10.0/24).

2. Configured Rapid PVST+, with SW1 as root (priority 4096) and SW2 as secondary (8192). Uplinks were set to trunk and the PC ports to PortFast.

3. Validated the baseline: all 3 switches agreed on the root, exactly one port was blocking and every ping worked.

4. Injected the fault on one of the switches: an uplink started dropping BPDUs, so STP stopped seeing the loop.

5. Confirmed the symptom: no blocked port, 100% ping loss and an unstable MAC table (the flapping).

6. Saved the faulty .pkt, applied the fix, re-validated (ping 4/4 and the blocked port back) and saved the solution .pkt.

7. Wrote a resolution guide with the commands, the expected outputs and best practices.

Figure 9 – STP-Flap lab topology: a switch triangle with one PC on each switch. SW1 is the root. Which switch causes the fault is left for you to find out.

Figure 10 – Real baseline: show spanning-tree on SW1 confirming it is the root bridge for VLAN 1 (priority 4097).

Figure 11 – Real symptom with the fault active: pings with 100% loss and an empty or unstable MAC table, typical of a layer-2 loop.

12.2 Files produced

💡 Tip: To practise, open STP-Flap-LAB.pkt and try to find the culprit switch with show spanning-tree, show mac address-table and show running-config. A hint: a segment can only have one Designated port.

13. Problems I hit and how I solved them

14. How to uninstall

1. Remove the server from Claude Code with claude mcp remove packet-tracer -s user.

2. In Packet Tracer: Extensions → Scripting → Configure PT Script Modules, select MCP-Control-Center and click Remove.

3. Optional: delete the local state (token and file-bridge) with rm -rf ~/.local/state/packet-tracer-mcp.

15. Conclusion

With three pieces (Claude Code, an MCP server and a Script Module), Packet Tracer becomes a lab you drive in plain language. You can build topologies, configure IOS, inject faults for study and validate everything with real pings, without leaving the chat.

Most importantly, everything runs locally, and the bridge between Claude and Packet Tracer has real access controls (loopback, token and Host check) that I tested and documented here.

Next experiments: OSPF labs with broken adjacencies, ACLs blocking the wrong traffic, and automatic grading of .pkaactivities.

16. References

• MCP project (Mats2208/MCP-Packet-Tracer): https://github.com/Mats2208/MCP-Packet-Tracer

• Installation docs: https://mats2208.github.io/MCP-Packet-Tracer/installation/

• PyPI package: https://pypi.org/project/packet-tracer-mcp/

• Releases (.pts extension): https://github.com/Mats2208/MCP-Packet-Tracer/releases

• Alternative project (jcorderop02): https://github.com/jcorderop02/packet-tracer-mcp

• Model Context Protocol: https://modelcontextprotocol.io

• Claude Code: https://docs.claude.com/en/docs/claude-code/overview

• uv: https://docs.astral.sh/uv/

techcyber.blog

All rights reserved.