Skip to main content
Glama

Tracerlab

MCP server for Cisco Packet Tracer 9. Lets Claude Code (or any MCP client) build networks in a running Packet Tracer: add devices, cable them, push IOS configs, address everything, set up routing, ping, and find what's broken. It can also read and write .pkt files without Packet Tracer open.

Building a 3 router OSPF ring, cabling it, addressing it and pinging across it

Twelve devices, twelve cables, OSPF across the ring and 6/6 pings, from one prompt.

There are also some ready-made labs (router on a stick, OSPF/EIGRP/RIP topologies, NAT, HSRP, EtherChannel, IPv6) that build in one call.

Install

Needs uv and Packet Tracer 9.

Register the server with your MCP client:

claude mcp add packet-tracer -- uvx --from tracerlab packet-tracer-mcp

Cursor (~/.cursor/mcp.json), VS Code (.vscode/mcp.json) and Codex take the same command:

{
  "mcpServers": {
    "packet-tracer": { "command": "uvx", "args": ["--from", "tracerlab", "packet-tracer-mcp"] }
  }
}

Then install the Packet Tracer side once:

uvx tracerlab install-extension

Restart Packet Tracer and answer Yes when it asks about the new script module. A small "PT-MCP Bridge" window shows up and goes green once the MCP server is running.

If something isn't connecting, run uvx tracerlab doctor.

Related MCP server: ptlab

Use

Open Packet Tracer, start Claude Code and ask for things like:

  • build a 3 router OSPF ring with a PC on each LAN and ping everything

  • set up router on a stick with VLANs 10, 20, 30 and DHCP

  • what's wrong with this network

  • show me the running config on R1

examples/enterprise-two-site.pkt is a bigger network built entirely through the tools.

Tests

uv run pytest

mcp-name: io.github.atharv-santosh/tracerlab

Available Tools

42 tools
ios_featuresA
Read-only

List IOS config generators and their parameters (used by ios_generate / pt_apply_feature).

Inputs: no named parameters.

ios_generateA
Read-only

Generate IOS config lines for a feature without applying them. See ios_features for names/params. e.g. ('dhcp_pool', {'name':'LAN','network':'192.168.1.0/24','dns':'8.8.8.8','exclude_first':10}).

Inputs: params (required), feature (required).

net_splitA
Read-only

Split a block into count equal subnets or into /new_prefix subnets (first 64 shown).

Inputs: cidr (required), count, new_prefix.

net_subnetB
Read-only

Subnet facts for an address/prefix: network, mask, wildcard, broadcast, host range, count, class.

Inputs: cidr (required).

net_summarizeB
Read-only

Route summarization: exact collapsed set and the single covering supernet (+ how much extra it covers).

Inputs: networks (required).

net_vlsmB
Read-only

VLSM plan: needs = {'Sales': 50, 'Eng': 25, 'R1-R2': 2}. Largest first; returns subnet, mask, wildcard, gateway (first host), host range and broadcast per segment.

Inputs: pool (required), needs (required).

pkt_convertB

Convert .pkt <-> .xml without Packet Tracer (decrypt to editable XML, or re-encrypt XML into a .pkt).

Inputs: dst (required), src (required).

pkt_export_configsB

Write every device's running-config from a .pkt file to <out_dir>/.txt.

Inputs: path (required), out_dir (required).

pkt_inspectA
Read-only

Read a .pkt/.pka file WITHOUT Packet Tracer: devices, models, IPs, links, and (configs=true) every device's running-config. Good for grading or understanding a lab file.

Inputs: path (required), configs.

pt_add_devicesA

Add devices. devices: [{name, model, x?, y?}], model like '2911', 'ISR4331', '2960-24TT', '3560-24PS', 'PC-PT', 'Laptop-PT', 'Server-PT' (see pt_catalog). Missing x/y are laid out automatically. Routers/switches have their boot skipped so they are ready immediately.

Inputs: devices (required).

pt_add_moduleA

Insert a module (device is power-cycled automatically). Common: HWIC-2T (2 serial, 1941/2901/2911), WIC-2T (1841/2811), NIM-2T (ISR4321/4331), HWIC-4ESW, NM-1FE-TX, PT-ROUTER-NM-1S (Router-PT), AC-POWER-SUPPLY (3650). slot omitted = first slot that accepts it. Returns the device's ports afterwards.

Inputs: device (required), module (required), slot.

pt_api_lookupA
Read-only

Search Packet Tracer's IPC/scripting API (6000+ methods, 374 classes) for use with pt_run_js. query: a class name ('TerminalLine'), a method fragment ('Vlan', 'ospf'), or 'Class.method'.

Inputs: query (required), limit.

pt_apply_featureA

Generate IOS config for a feature (see ios_features) and apply it to a device in one step. e.g. feature='ospf', params={'networks':['10.0.0.0/30','192.168.1.0/24'],'router_id':'1.1.1.1', 'passive':['GigabitEthernet0/0']}. dry_run=true returns the lines without applying.

Inputs: device (required), params (required), feature (required), dry_run.

pt_auto_addressA

Address the live topology and generate routing, computed from the actual cabling: each L3 segment (router/host ports joined through switches) gets a subnet: LANs from lan_pool (/lan_prefix, or right-sized when null), router-only links get /30s from p2p_pool. Routers take the first host addresses (gateway), hosts .10+ (or DHCP pools on the router with dhcp=true). Existing addresses are kept unless overwrite=true. apply=false only shows the plan and configs.

Inputs: dns, dhcp, apply, routing, +5 more.

pt_buildA

Build a whole network in one call. spec = { devices: [{name, model, x?, y?, modules?: [{module, slot?}]}], links: [{a, b, a_port?, b_port?, cable?}], # ports auto-picked when omitted configs: {device: ["ios line", ...]}, # global-config lines, applied + saved hosts: {pc: {ip, mask | cidr, gateway, dns} | {dhcp: true}}, auto: {routing: 'ospf'|'eigrp'|'rip'|'static'|'none', lan_pool, p2p_pool, dhcp, lan_prefix}, # optional checks: [[src, dst], ...] # ping pairs, run when verify=true } auto runs pt_auto_address after cabling, so addresses fit whatever ports were chosen.

Inputs: spec (required), verify.

pt_catalogA
Read-only

Device models PT 9 offers (exact names for pt_add_devices) with ports, slots and usage notes. category: router | switch | l3-switch | host | firewall | ap | wireless-router ... modules=true lists modules.

Inputs: modules, category.

pt_clear_canvasA
Destructive

Delete EVERY device on the canvas. Requires confirm=true.

Inputs: confirm.

pt_cliA

Run IOS commands on a router/switch/ASA. mode=config: lines are entered from global config (sub-modes like 'interface g0/0' work, 'end' is added); the reply lists only failing lines. mode=exec: privileged EXEC, returns output (prefer pt_show). save=true appends 'write memory'.

Inputs: device (required), commands (required), mode, save.

pt_command_logC
Read-only

Recent commands typed into any device CLI (PT's command log), oldest first.

Inputs: limit, device.

pt_configure_hostsB

IP settings for PCs/laptops/servers/printers. hosts: [{name, ip, mask? | ip:'10.0.0.5/24' | cidr, gateway?, dns?, dhcp?: true, port?, ipv6?: '2001:db8::5/64', gw6?}].

Inputs: hosts (required).

pt_connectA

Cable devices. links: [{a, b, a_port?, b_port?, cable?}]. Ports are optional: the first free port of the right media is chosen (fastest first; on switches use a_pref/b_pref='access' to keep gigabit uplinks free). cable: auto (default) | straight | cross | serial | fiber | console | coaxial | phone. For serial links the device needs a serial module (pt_add_module).

Inputs: links (required).

pt_delete_devicesB
Destructive

Delete devices (and their cables).

Inputs: names (required).

pt_deviceB
Read-only

One device in depth: all physical ports (IP, peer, state, switchport mode), free ports, module slots.

Inputs: name (required).

pt_device_modulesB
Read-only

Module slot tree of a device: slot path, slot type and installed module.

Inputs: device (required).

pt_diagnoseA
Read-only

Find misconfigurations from the live state: duplicate IPs, mixed subnets on a segment, hosts without IP / wrong or missing gateway, cabled-but-down interfaces, powered-off devices, uncabled hosts. deep=true also reads every router's routing table and lists subnets each router cannot reach.

Inputs: deep.

pt_disconnectB
Destructive

Remove cables by endpoint: ['R1:GigabitEthernet0/0', 'S1:FastEthernet0/3'].

Inputs: ports (required).

pt_fast_forwardB

Fast-forward PT's realtime clock (speeds up STP, OSPF/EIGRP convergence, DHCP).

Inputs: times.

pt_fileA

Packet Tracer file operations on the open workspace: new, open , save, save_as (.pkt).

Inputs: action (required), path.

pt_labB

Build a complete, pre-computed lab (devices, cabling, IPs, configs, hosts, test pairs) in one call. name='list' shows blueprints and their params: small-office, router-on-a-stick, intervlan-l3, routing (ospf|eigrp|rip|static x chain|ring|star|mesh, optional serial), nat-internet, hsrp, etherchannel-stp, ipv6-dual-stack. verify=true pings the test pairs after convergence.

Inputs: name, params, verify, clear_first.

pt_pingA
Read-only

Ping from devices and report OK/PARTIAL/FAIL per pair. pairs: [[src, dst], ...] where dst is a device name or IP. Sources can be PCs/servers (Command Prompt) or routers/switches (IOS ping). Pairs from different sources run in parallel. A first-ping loss is usually ARP warm-up: count>=2 hides it.

Inputs: pairs (required), count.

pt_ping_matrixB
Read-only

All-pairs reachability between end hosts (default: every PC/laptop/server, max 10) as a matrix.

Inputs: count, hosts.

pt_run_jsA

Escape hatch: run JavaScript inside PT's script engine and return the JSON result. The code is a function body: use return. Globals: ipc (IPC root: ipc.network(), ipc.appWindow(), ipc.simulation()), PTM (this server's helpers: PTM.dev(name), PTM.snapshot(), PTM.cli(name, lines, mode)...). Example: return ipc.network().getDevice('R1').getPort('GigabitEthernet0/0').getMacAddress();

Inputs: code (required), timeout.

pt_running_configA
Read-only

Running (or startup) config of an IOS device, read from the device model (fast, no paging). section: only blocks whose header contains this text, e.g. 'interface', 'router ospf', 'line vty'.

Inputs: device (required), section, startup.

pt_save_configsC

'write memory' on the given (default: all) routers/switches.

Inputs: devices.

pt_screenshotB
Read-only

Image of the logical workspace (the topology as drawn in PT).

Inputs: fmt.

pt_setup_instructionsA
Read-only

How to install the one-time PT-side bridge module (needed if pt_status says NOT CONNECTED).

Inputs: no named parameters.

pt_showB
Read-only

Run show/exec commands (privileged EXEC) on a router/switch and return their output. commands: one or more, e.g. ['show ip interface brief', 'show ip route']. grep: optional regex; keep only matching lines (like '| include').

Inputs: device (required), commands (required), grep.

pt_simulationC

Simulation mode control. action: simulation|realtime (switch mode), pdu (simple ICMP PDU src->dst), forward/back (steps events), reset, frames (last events with status), status.

Inputs: action (required), dst, src, steps.

pt_statusA
Read-only

Bridge + Packet Tracer status: connection, PT version, open file, device/link counts.

Inputs: no named parameters.

pt_topologyA
Read-only

Whole canvas, compact: every device (model, position, power) with its addressed/cabled interfaces, peers and link state. detail=true adds MACs, switchport modes, descriptions and unused ports.

Inputs: detail.

pt_tracerouteB
Read-only

Traceroute (tracert on hosts) from a device to a device name or IP; returns the hop list.

Inputs: dst (required), src (required).

pt_update_deviceC

Rename, move and/or power a device on/off.

Inputs: name (required), x, y, power, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 42 tools

    Disambiguation3/5

    Several tools overlap by design: pt_show vs pt_cli (mode=exec) both run EXEC commands, pt_build vs pt_lab both construct whole topologies, and pt_apply_feature vs ios_generate vs pt_cli all produce/apply IOS config. The descriptions do provide guidance (e.g. 'prefer pt_show', dry_run on pt_apply_feature), so boundaries are workable but require careful reading.

    Naming Consistency3/5

    Names are snake_case throughout, but the surface mixes several prefix families (pt_, pkt_, net_, ios_) and verb styles, including bare nouns like pt_topology, pt_device and pt_status. The grouping is semantically meaningful but not a uniform verb_noun convention, so an agent must learn each family.

    Tool Count2/5

    42 tools is heavy for a Packet Tracer bridge, and much of the count comes from layered abstractions of the same jobs (build/lab/add_devices/connect vs pt_cli, pt_show vs pt_cli, ios_generate vs pt_apply_feature). The extra granularity is useful for power users but expands the selection space considerably.

    Completeness5/5

    The surface covers the full lifecycle: topology inspection, device/cable CRUD, modules, IOS and host configuration, auto-addressing and routing, verification (ping/traceroute/ping_matrix), file operations, offline .pkt inspection/conversion, subnet math, and a JS escape hatch. Very few obvious gaps remain for the stated Packet Tracer domain.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers