Skip to main content

MCP server that drives Cisco Packet Tracer through a bridge extension.

Project description

cisco-pt-mcp

PyPI version Python versions PyPI downloads Publish to PyPI License: MIT

An MCP server that lets any MCP-aware client (Claude Desktop, Cursor, Backboard, VS Code, ...) drive a running Cisco Packet Tracer instance.

flowchart LR
    client["MCP client"]
    server["cisco-pt-mcp<br/>server (Python)"]
    pt["Packet Tracer<br/>+ cisco-pt-mcp.pts<br/>bridge extension"]

    client <-- "stdio MCP" --> server
    server <-- "Socket.IO<br/>127.0.0.1:7531" --> pt

The PT extension shows a small bridge window (Extensions → Packet Tracer MCP) with a connection-status pill and a tool-call activity log — purely diagnostic.

Layout

cisco-pt-mcp/
├─ pyproject.toml                  # console_script: cisco-pt-mcp = mcp_server.server:main
├─ mcp_server/
│  ├─ __main__.py                  # python -m mcp_server entrypoint
│  ├─ server.py                    # MCP stdio server, registers tools, forwards to bridge
│  ├─ bridge.py                    # PTBridge: Socket.IO server on 127.0.0.1:7531
│  └─ tools.py                     # 9 tool schemas (single source of truth)
├─ extension/source/                # packaged into cisco-pt-mcp.pts
│  ├─ main.js                      # PT lifecycle, Extensions menu item
│  ├─ window.js                    # webview controller (this-sm:index.html)
│  ├─ runcode.js                   # $se('runCode') eval host
│  ├─ userfunctions.js             # the 9 tool implementations (PT scripting host)
│  ├─ devices.js / links.js / modules.js   # PT type-id lookup tables
│  └─ interface/                   # webview, browser context
│     ├─ index.html                # status pill + activity log
│     ├─ interface.js              # Socket.IO client, $se dispatcher
│     └─ socket.io.min.js          # vendored client
└─ tests/test_smoke.py             # 6 offline smoke tests

The split between extension/source/*.js (PT scripting host: ipc.network(), webViewManager, $se) and extension/source/interface/* (webview browser context: DOM, socket.io, talks to PT only via $se('runCode', ...)) is load-bearing — see Cisco's own Cisco-Agent extension for the same pattern.

Install

1. Server

The server is published on PyPI. No cloning or venv setup required — uvx handles everything in an isolated environment. Install uv if you don't have it yet (single command on any platform), then register the server with your MCP client:

Client One-line registration
Claude Code claude mcp add cisco-pt-mcp --scope user -- uvx cisco-pt-mcp
Claude Desktop %APPDATA%\Claude\claude_desktop_config.json — JSON below
Cursor %USERPROFILE%\.cursor\mcp.json (or .cursor/mcp.json per project) — same JSON
VS Code .vscode/mcp.json — JSON below (note different key name)
Codex CLI %USERPROFILE%\.codex\config.toml — TOML below
Backboard CLI backboard config add-mcp '{"name": "cisco-pt-mcp", "command": "uvx", "args": ["cisco-pt-mcp"]}'

Claude Desktop / Cursor (mcpServers):

{
  "mcpServers": {
    "cisco-pt-mcp": { "command": "uvx", "args": ["cisco-pt-mcp"] }
  }
}

VS Code (servers):

{
  "servers": {
    "cisco-pt-mcp": { "command": "uvx", "args": ["cisco-pt-mcp"] }
  }
}

Codex CLI (TOML):

[mcp_servers.cisco-pt-mcp]
command = "uvx"
args = ["cisco-pt-mcp"]

Backboard CLI (one-shot command, persists to ~/.backboard/config.json):

backboard config add-mcp "{\"name\": \"cisco-pt-mcp\", \"command\": \"uvx\", \"args\": [\"cisco-pt-mcp\"]}"

Verify with backboard config list-mcp. Toggle off/on later with backboard config disable-mcp cisco-pt-mcp / enable-mcp cisco-pt-mcp.

Fallback: If uvx isn't available, install the package manually and point directly at the binary:

{ "mcpServers": { "cisco-pt-mcp": { "command": "C:\\path\\to\\.venv\\Scripts\\cisco-pt-mcp.exe" } } }

For remote use, expose this server through mcp-remote; HTTP transport is intentionally not built in.

2. Extension

  1. Download cisco-pt-mcp.pts from the repo: github.com/muhammadbalawal/cisco-pt-mcp/raw/main/extension/cisco-pt-mcp.pts (or grab the latest .pts from the Releases page).
  2. In Packet Tracer: Extensions → Extensions Manager → Install Extension…
  3. Select the downloaded cisco-pt-mcp.pts.
  4. Restart Packet Tracer when prompted.

Extensions → Packet Tracer MCP now shows in the menu — click it to open the bridge window.

Prefer to drop it in by hand? The per-user extensions directory is %USERPROFILE%\Cisco Packet Tracer <version>\extensions\cisco-pt-mcp\.

To rebuild after editing extension/source/*.js, use PT's Extensions → Scripting workflow to re-package the source folder into a new .pts, then reinstall via the Extensions Manager.

Run

  1. Launch Packet Tracer; click Extensions → Packet Tracer MCP. The bridge window opens with status connecting then offline.
  2. Launch your MCP client. It spawns cisco-pt-mcp.exe as a subprocess; within a second the bridge window flips to connected.
  3. Ask the model to do something. Tool calls show up in the bridge window's Activity log.

Tools exposed

Tool Purpose
addDevice Drop a router/switch/PC on the canvas
addModule Install an interface module in a device slot
addLink Connect two devices with a cable
removeDevice Delete one or more devices
removeLink Delete one or more cables
configurePcIp Set IP / DHCP / gateway / DNS on a PC
configureIosDevice Run IOS CLI commands on a router/switch
getNetwork Snapshot of all devices, interfaces, cables
getDeviceInfo Detail view of a single device

All tool calls return JSON {success, ...}; errors come back as {success: false, error: "..."} so the model can recover.

Configuration

Variable Default Meaning
CISCO_PT_MCP_TOOL_TIMEOUT 60 Seconds to wait for a tool result
CISCO_PT_MCP_LOG_LEVEL INFO Server log level

The bridge endpoint is hard-coded to 127.0.0.1:7531 (both ends are local). To retarget, edit MCP_URL in extension/source/interface/interface.js and the constants in mcp_server/bridge.py, then rebuild the .pts.

Tests

pip install -e .[dev]
pytest tests\ -v

Offline tests — no Packet Tracer required.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cisco_pt_mcp-0.1.1.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cisco_pt_mcp-0.1.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file cisco_pt_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: cisco_pt_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cisco_pt_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a0f8816b35355ab323e6bf8610e4fd25b178835f6be11d170b74e3b7fdd7426f
MD5 1cc3b45f29b9ae6bff306c7ac130c769
BLAKE2b-256 9496ecad611340462860e0a96ea67f5344e2c786ae9d081e9dd3c5d440debbd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for cisco_pt_mcp-0.1.1.tar.gz:

Publisher: publish.yml on muhammadbalawal/cisco-pt-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cisco_pt_mcp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cisco_pt_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cisco_pt_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 40d232048c84a623338f5a815c71eda2597e1a33a3c23dac1c43e5e95fb56474
MD5 cb512a151536f34bea926d9bb558db19
BLAKE2b-256 36ee7f2c9e617d3f0e61fba87bef6710f741d3a2cff6c47765bf00bdd8ee33be

See more details on using hashes here.

Provenance

The following attestation bundles were made for cisco_pt_mcp-0.1.1-py3-none-any.whl:

Publisher: publish.yml on muhammadbalawal/cisco-pt-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page