Get up and running
in minutes.

Everything you need to install the server, connect your MCP client, and deploy your first topology.

Prerequisites

Python 3.11+

Required runtime. Check with python --version

pip

Python package manager for installation

Git

To clone the repository

Cisco Packet Tracer 8.x

Required only for live deploy — not for planning or generation

Installation

1

Clone the repository

git clone https://github.com/Mats2208/MCP-Packet-Tracer.git
cd MCP-Packet-Tracer
2

Install in editable mode

pip install -e .

This installs all dependencies defined in pyproject.toml.

3

Verify installation

python -m pytest tests/ -v

All 34 tests should pass.

Start the Server

$ python -m src.packet_tracer_mcp
INFO  Packet Tracer MCP v0.4.0
INFO  Transport: streamable-http
INFO  Listening on http://127.0.0.1:39000/mcp

The server starts on port 39000 using streamable HTTP transport. For legacy stdio mode, use --stdio flag.

# Alternative: stdio mode for debugging
python -m src.packet_tracer_mcp --stdio

Connect a Client

VS Code (Copilot)

Add to .vscode/mcp.json:

{
  "servers": {
    "packet-tracer": {
      "url": "http://127.0.0.1:39000/mcp"
    }
  }
}

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "packet-tracer": {
      "url": "http://127.0.0.1:39000/mcp"
    }
  }
}
Any MCP client works. Connect to http://127.0.0.1:39000/mcp using streamable HTTP transport. The server exposes 22 tools and 5 resources that any MCP-compatible client can discover automatically.

Your First Topology

Once connected, ask your AI agent to build a topology. You can also call tools directly:

Quick Build (one-shot)

pt_full_build(
  routers=2,
  pcs_per_lan=2,
  dhcp=True,
  routing="ospf",
  has_wan=True
)

# Returns: plan + script + configs + explanation

Step by Step

# 1. Generate plan
plan = pt_plan_topology(routers=2, pcs_per_lan=2, routing="static")

# 2. Validate
pt_validate_plan(plan)

# 3. Auto-fix if needed
pt_fix_plan(plan)

# 4. Generate artifacts
pt_generate_script(plan)    # PTBuilder JavaScript
pt_generate_configs(plan)   # IOS CLI configs

# 5. Get explanation
pt_explain_plan(plan)       # Natural language summary

Export to Files

# Save everything to a directory
pt_export(plan, path="./my_lab/")

Live Deploy Setup

Requirements: Cisco Packet Tracer 8.x must be open with the Builder Code Editor accessible. The live deploy feature uses a bidirectional HTTP bridge.
1

Open Packet Tracer

Create a new or open an existing workspace.

2

Paste the bootstrap script

Open the Builder Code Editor inside Packet Tracer, paste this script, and click Run:

window.webview.evaluateJavaScriptAsync("setInterval(function(){var x=new XMLHttpRequest();x.open('GET','http://127.0.0.1:54321/next',true);x.onload=function(){if(x.status===200&&x.responseText){$se('runCode',x.responseText)}};x.onerror=function(){};x.send()},500)");
3

Deploy from the MCP server

# Check bridge connection
pt_bridge_status()

# Deploy a plan in real-time
pt_live_deploy(plan)

Devices will appear in Packet Tracer within seconds. Links and configurations are applied automatically.

Project Management

Save and load topologies for later reuse.

# List saved projects
pt_list_projects()

# Load a previously saved project
pt_load_project("my_lab")

# Export creates a project automatically
pt_export(plan, path="./my_lab/")

Troubleshooting

Server won't start

Check Python version: python --version (needs 3.11+). Ensure all dependencies installed: pip install -e .

Client can't connect

Verify the server is running on http://127.0.0.1:39000/mcp. Check no firewall is blocking port 39000.

Bridge ping fails

Ensure the bootstrap script is running in Packet Tracer. Check that port 54321 is not in use by another process. The bootstrap only needs to be pasted once per PT session.

Validation errors

Run pt_fix_plan(plan) to auto-correct common issues (wrong cables, model limitations, port conflicts). If errors persist, check the error codes for specific guidance.

Known limitations

NAT, ACL, VLAN, and STP are not yet supported. RIP and EIGRP are available via enum but are not as mature as static and OSPF routing.

Need more details?

The full source code, tests, and WIKI are in the repository.

View Full Repository