ptlab
This server lets you build and manipulate Cisco Packet Tracer topologies programmatically, generate .pkt/.pka files, and validate them offline.
create_topology: Build an in-memory topology with devices (router, switch, pc, server, laptop), links, and optional instructions.set_device_config: Push IOS-style configuration onto a device in the topology.generate_pkt: Serialize the topology to a Twofish-encrypted .pkt file.generate_graded_activity: Create a .pka activity with scored IP addressing and routing objectives.inspect_pkt: Parse an existing .pkt/.pka into a readable summary.validate_current_topology: Run offline checks for duplicate IPs, OSPF area mismatches, and DHCP overlap.
Provides headless generation, parsing, and inspection of Cisco Packet Tracer .pkt/.pka lab files, including topology creation, device configuration, and graded activity scoring without running Packet Tracer.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ptlabGenerate a graded Packet Tracer activity for a two-router OSPF lab."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ptlab
Headless Cisco Packet Tracer labs from Python (or MCP). Write .pkt / graded .pka without Packet Tracer running. Target: PT 9.x, CCNA switching + routing.
This is not a live PT driver. Mats2208/MCP-Packet-Tracer talks to a running instance over a Lua .pts bridge. ptlab is the opposite: codec first, files on disk, live deploy later (docs/PHASE2.md).
What works today
Layer | Status |
Container (Twofish-EAX + XOR + zlib) | GUI-valid on PT 9.0.0 — docs/FORMAT.md |
Donor mutation ( | Opens in PT; structural refs are unit-tested |
From-scratch skinny XML | Silent drop — blank untitled workspace |
Title-bar load gate ( | Fast; false-positive on broken cables |
Structural gate ( | Catches stale / dangling / colliding |
Simulation ping ( | Needs a one-time IPC ExApp registration |
Activity Wizard | Not verified yet |
Phase 2 live bridge | Not built |
GUI-openable files are template-backed: harvest a real device tree from local saves/, mint new MAC/DEV_ADDR, rewrite cables. Do not trust a file that only round-trips through this library.
CCNA wedge (not full PT coverage): PC-PT, Server-PT, 1841, 2960-24TT, plus 2950-24. Hold 2911 until a second independent export is diffed.
Related MCP server: packet-tracer-mcp
Install
Python 3.11+:
pip install -e ".[dev]"
python -m pytestPacket Tracer is optional for codec tests. The load / ping gates need Windows + PT 9.
Two ways to write a file
Donor-backed (opens in PT). Clone from a harvested tree, then gate it:
ptlab harvest --limit 25
ptlab clone donor.xml lab.pkt \
--from-device PC0 --name LabPC2 \
--peer Switch0 --peer-port FastEthernet0/4 \
--keep PC0,Switch0 \
--ip 192.168.1.50 --subnet 255.255.255.0 --gateway 192.168.1.1
ptlab check lab.pkt
ptlab gui-gate lab.pktObject graph (library / MCP). Good for configs, inspect, and Activity Wizard XML. The .pkt it emits is a valid container, not a GUI-valid hardware dump:
from ptlab import create_topology, generate_graded_activity, write_pkt
topo = create_topology(
devices=[
{"id": "R1", "kind": "router"},
{"id": "R2", "kind": "router"},
],
links=[{"a": "R1", "a_port": "GigabitEthernet0/0", "b": "R2", "b_port": "GigabitEthernet0/0"}],
)
topo.set_config("R1", """
hostname R1
interface GigabitEthernet0/0
ip address 10.0.0.1 255.255.255.252
no shutdown
router ospf 1
network 10.0.0.0 0.0.0.3 area 0
""")
topo.set_config("R2", """
hostname R2
interface GigabitEthernet0/0
ip address 10.0.0.2 255.255.255.252
no shutdown
router ospf 1
network 10.0.0.0 0.0.0.3 area 0
""")
write_pkt(topo, "lab.pkt")
generate_graded_activity(topo, output_path="lab.pka")examples/two_router_ospf.py is this path end-to-end.
Correctness gates
PT 9 does not error on bad XML. It opens a blank untitled workspace. A file that loads can still have a cable attached to the wrong device — or to nothing.
Tier | Command | Proves | Cost |
1 load |
| Title bar is | ~11s |
1b structure |
| Unique | instant |
2 ping |
| ICMP through the clone (LabPC2 → PC0, not the switch) | PT + IPC |
Register extras/ptlab_exapp.xml once: Extensions → IPC → Configure Apps → Add. Until then ping-gate reports load_ok: true, ipc_ok: false.
Do not mint multi-device labs for students until tier 2 is green.
CLI
ptlab decode lab.pkt lab.xml
ptlab encode lab.xml lab.pkt
ptlab inspect lab.pka
ptlab harvest --limit 25
ptlab clone donor.xml lab.pkt --from-device PC0 --name LabPC2 --peer Switch0 --peer-port FastEthernet0/4
ptlab check lab.pkt
ptlab gui-gate lab.pkt
ptlab ping-gate lab.pkt --from-device LabPC2 --to-device PC0MCP
{
"mcpServers": {
"ptlab": {
"command": "python",
"args": ["-m", "ptlab_mcp"]
}
}
}Tool | Purpose |
| In-memory devices + links |
| IOS-style config on a device |
| Twofish-encrypted |
|
|
| Parse an existing file to a summary |
| Duplicate IPs, OSPF area clashes, DHCP overlap |
These tools write the object-graph serializer. GUI-openable topologies go through ptlab clone, not generate_pkt.
Docs
Note | Contents |
Container pipeline, GUI experiments, gates, | |
Python topology model | |
Live deploy — blocked until Phase 1 ping + templates |
License
MIT. Packet Tracer is a Cisco product; this repo is an independent interoperability tool, not affiliated with Cisco. Container format: Mirco De Zorzi (pka2xml) and jeamxn/cisco-pka-to-xml.
Available Tools
6 toolscreate_topologyB
Build an in-memory Packet Tracer topology from devices and links.
Each device needs id (or name), kind (router|switch|pc|server|laptop),
and optionally model, interfaces, coordinates, and config.
Each link needs a_device, a_port, b_device, b_port, optional cable.
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Untitled | |
| links | No | ||
| devices | Yes | ||
| instructions | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It discloses that the topology is built 'in-memory,' but does not mention side effects, whether existing topologies are replaced, validation behavior, or what the tool returns. This is a meaningful gap for a creation tool with no annotation safety hints.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and front-loaded: the main purpose appears in the first sentence, followed by concise structured field guidance for devices and links. Every sentence contributes necessary information with no fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description adequately covers the main input structure and even provides an enum for device kinds, which is helpful given the sparse schema. However, it omits usage guidance, behavior details, and semantics of 'name' and 'instructions'. The output schema reduces the need to explain return values, but the missing pieces still leave the description only partially complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It adds valuable structure for the two core parameters: devices require id/name and kind with an enum, and links require endpoint fields. However, the 'name' and 'instructions' parameters are left completely unexplained, leaving part of the input surface undocumented.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('Build') and resource ('in-memory Packet Tracer topology from devices and links'), making the core purpose obvious. It does not explicitly name or distinguish itself from sibling tools, though 'in-memory' hints at a contrast with generate_pkt. This falls just short of full sibling differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is given about when to use this tool instead of alternatives such as validate_current_topology, generate_pkt, or set_device_config. The description implies its use case but provides no exclusions, prerequisites, or comparative context. An agent gets no help choosing between this and related tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
generate_graded_activityC
Serialize a .pka activity with scored IP addressing and routing criteria.
| Name | Required | Description | Default |
|---|---|---|---|
| objectives | No | ||
| output_path | Yes | ||
| topology_id | No | ||
| instructions | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of behavioral disclosure. It implies file output via 'Serialize' but does not state whether output_path is overwritten, whether a topology must already exist, what happens with optional parameters, or what is returned. This is a meaningful gap for a generation tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence with no filler words. It is concise, though the brevity contributes to under-specification elsewhere.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with four parameters, one required, and no annotations, the description is too thin. It provides a high-level output statement but omits parameter roles, prerequisites, error behavior, and relationship to the sibling topology tools, leaving the agent under-equipped to call it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% and the description does not compensate by defining output_path, objectives, topology_id, or instructions. None of the four parameters receive any added meaning beyond their titles, so the agent cannot reliably construct arguments.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb (Serialize) and names the resource (.pka activity) plus the distinguishing content (scored IP addressing and routing criteria), so an agent can tell it apart from siblings like generate_pkt or set_device_config. It stops short of 5 because it does not clarify what 'scored' means or mention the output path, but the core purpose is unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no guidance on when to call this tool instead of validate_current_topology, create_topology, generate_pkt, or inspect_pkt. No alternatives, prerequisites, or exclusions are mentioned, so the agent must infer usage from the name alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
generate_pktB
Serialize the in-memory topology to a Twofish-encrypted .pkt file.
| Name | Required | Description | Default |
|---|---|---|---|
| output_path | Yes | ||
| topology_id | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of behavioral disclosure. It does reveal that output is Twofish-encrypted and that serialization targets a .pkt file, which is useful. However, it does not mention whether an existing file is overwritten, whether a topology must already be loaded, or any other side effects or requirements.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence with no filler. Every word contributes meaning, and it is appropriately sized for the limited content it conveys.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description is too thin for a tool with two parameters, no annotations, and no parameter descriptions. The optional topology_id is particularly unexplained: the description says 'the in-memory topology,' which may conflict with the existence of a topology_id parameter. The output schema covers return values, but the tool's invocation context and parameter semantics remain unclear.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, and the description makes no mention of output_path or topology_id. The schema only provides names and types, so the agent cannot determine what output_path should be or what topology_id controls. The description adds no parameter-level meaning.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific action ('Serialize'), a specific resource ('the in-memory topology'), and a specific output format ('.pkt file'). It clearly differentiates from siblings like inspect_pkt (which inspects .pkt files) and create_topology (which builds the topology rather than serializing it).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is given about when to use this tool versus alternatives such as validate_current_topology or inspect_pkt. There are no exclusions, prerequisites, or contextual conditions stated. The agent is left to infer that this is for saving the current topology.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
inspect_pktA
Parse an existing .pkt or .pka file into a readable summary (offline).
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description must carry the transparency burden. It usefully conveys that the operation is offline and expects an existing file, implying read-only inspection. However, it does not explicitly state that the file is not modified, what the summary contains, or how failures are handled.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, tightly written sentence with no filler. The core action, input, and result are all front-loaded and clearly stated.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a one-parameter inspection tool with an output schema available, the description is nearly complete: it identifies the input type, the operation, the offline nature, and the kind of output. It lacks explicit usage guidance and a non-mutation guarantee, but the simple scope keeps the gap small.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema's only parameter, 'path', has 0% description coverage, so the description must compensate. It does so by specifying that the path must point to an existing .pkt or .pka file, adding meaningful constraints beyond the bare parameter name.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Parse') and names the exact resource ('existing .pkt or .pka file') and the result ('readable summary'). The 'offline' qualifier helps distinguish it from generation-oriented siblings like generate_pkt.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is given about when to use inspect_pkt versus sibling tools such as generate_pkt or validate_current_topology. It states the tool's capability but not the conditions that should lead an agent to select it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
set_device_configB
Push an IOS-style config onto a device in the in-memory topology.
| Name | Required | Description | Default |
|---|---|---|---|
| config | Yes | ||
| device_id | Yes | ||
| topology_id | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must carry the full behavioral burden. It states the action but does not disclose whether the config replaces or merges existing config, whether the device must already exist, what happens on invalid config, or whether changes are ephemeral beyond the 'in-memory' hint.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence with no filler. Every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Even with an output schema present, an agent still lacks critical information about parameter semantics, side effects, and preconditions for this mutation tool. The description is too thin to support confident invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate, but it does not. 'Device' and 'IOS-style config' loosely map to device_id and config, but topology_id is completely unexplained, and the required vs optional nature of parameters is not addressed.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Push') and clearly identifies the resource (a device in the in-memory topology) and the payload (IOS-style config). This distinguishes it well from sibling tools such as validate_current_topology or create_topology.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives. There are no stated prerequisites, no when-not-to-use conditions, and no mention of alternatives. The only contextual hint is 'in-memory topology.'
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
validate_current_topologyA
Run offline validation: duplicate IPs, OSPF area mismatches, DHCP overlap.
| Name | Required | Description | Default |
|---|---|---|---|
| topology_id | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The word 'offline' adds a behavioral trait, and listing the checks tells the agent what validation is performed. With no annotations provided, the description carries the full burden, but it does not explicitly confirm that the tool is read-only or describe behavior when topology_id is null.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single efficient sentence that front-loads the action and gives concrete validation categories without filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is simple and has an output schema, so return-value documentation is not required from the description. However, the description omits the role of topology_id and any prerequisites, leaving minor but real gaps for an agent deciding how to invoke it.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0% and the description never mentions the only parameter, topology_id. The parameter name is somewhat self-explanatory and optional, but the description does not clarify whether it selects a topology or what the null default means.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Run offline validation') and names concrete validation categories (duplicate IPs, OSPF area mismatches, DHCP overlap). This clearly distinguishes it from sibling tools like create_topology, set_device_config, or inspect_pkt.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The intended use is implied by the description: call this tool to validate a topology offline. However, it does not explicitly state when to prefer it over alternatives such as inspect_pkt, nor does it mention prerequisites like having a topology already created.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
6 tool updates
v0.1.0- First observed
create_topology - First observed
generate_graded_activity - First observed
generate_pkt - First observed
inspect_pkt - First observed
set_device_config - First observed
validate_current_topology
TDQS
Scored across 6 tools
Each tool targets a distinct operation: validation, activity generation, topology creation, configuration, serialization, and parsing. No overlapping purposes; even the two generate tools differ in output format (.pka vs .pkt).
All tools follow a consistent snake_case verb_noun pattern (validate_current_topology, generate_graded_activity, create_topology, etc.). The naming is predictable and readable.
Six tools is well-scoped for a Packet Tracer topology server, covering creation, validation, configuration, export, and inspection without redundancy or bloat.
Core workflows are covered: create, validate, configure, export, and inspect. Minor gaps like explicitly listing devices or removing devices/links exist, but agents can work around them through create and set operations.
Maintenance
Related MCP Connectors
Generate, edit, merge, translate and PDF-convert PowerPoint (.pptx) over MCP. 8 tools.
Official MCP server for Certifier to issue, manage, and track certificates and badges.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
MCP server for Pentest-Tools.com: run scans, manage findings and reports via your preffered LLM.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceAn MCP server that allows LLMs to create, configure, validate, and explain Cisco Packet Tracer network topologies. It provides a comprehensive suite of tools for generating deployment scripts, CLI configurations, and automated network troubleshooting.256 PyPI178MIT
- AlicenseNot gradedqualityCmaintenanceEnables control of Cisco Packet Tracer 9.0 via natural language, allowing creation of network topologies, device configuration, and simulation launches through an MCP interface.51 npm12MIT
- AlicenseBqualityDmaintenanceEnables automation of Cisco Packet Tracer simulations by placing devices, connecting links, and generating IOS configurations via MCP, ideal for network coursework and demonstrations.231MIT
- FlicenseNot gradedqualityCmaintenanceEnables AI models to generate, validate, and deploy network topologies directly into Cisco Packet Tracer from natural-language prompts.-