Skip to main content

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

Project description

cisco-pt-mcp

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

┌───────────────────┐                       ┌──────────────────────┐
│                   │                       │     cisco-pt-mcp     │
│     MCP client    │ ◄──── stdio MCP ────► │   server (Python)    │
│                   │                       │                      │
└───────────────────┘                       └───────────┬──────────┘
                                                        │
                                                        │  Socket.IO 127.0.0.1:7531
                                                        ▼
                                           ┌─────────────────────────┐
                                           │      Packet Tracer +    │
                                           │     cisco-pt-mcp.pts    │
                                           │     bridge extension    │
                                           └─────────────────────────┘

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

Install extension/cisco-pt-mcp.pts through Packet Tracer's own extension manager:

  1. Open Packet Tracer.
  2. Extensions → Extensions Manager → Install Extension…
  3. Pick extension/cisco-pt-mcp.pts from this repo.
  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.2.tar.gz (12.5 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.2-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cisco_pt_mcp-0.1.2.tar.gz
  • Upload date:
  • Size: 12.5 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.2.tar.gz
Algorithm Hash digest
SHA256 279c1525b4d3143ac8acd412b72b17386e99d498c62f7d48d16d7bea402491fa
MD5 2376d7fb0fc3057df71ef2884e423e52
BLAKE2b-256 d223adbc226f7a250efbb3ed2996bc8f205f4d927df9b60f572d48f25474cf59

See more details on using hashes here.

Provenance

The following attestation bundles were made for cisco_pt_mcp-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: cisco_pt_mcp-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b436e84f257ad26bc5f5b5ad24f08442fe1346c8c419b0daec81dd848644ec80
MD5 23f648fcf30d8041531cfabd646e2ec4
BLAKE2b-256 9a10d18786540e8294be471ebbc92320f3ab8ecf255ee1cdcabeadffd762883b

See more details on using hashes here.

Provenance

The following attestation bundles were made for cisco_pt_mcp-0.1.2-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