Content
# PacketTracer-MCP-Enhanced
Based on [Mats2208/MCP-Packet-Tracer](https://github.com/Mats2208/MCP-Packet-Tracer) and [kimmknight/PTBuilder](https://github.com/kimmknight/PTBuilder) with secondary optimization.
AI-driven Cisco Packet Tracer automation tool. Using OpenCode + MCP protocol, build network topology, configure OSPF/NAT/ACL, and test connectivity with natural language.
## Table of Contents
```
MCP-Packet-Tracer/ ← MCP Server (modified)
PTBuilder/ ← Builder Code Editor (optimized version)
skills/packet-tracer/ ← AI Skills (auto-loaded, anti-guessing API)
AGENTS.md ← AI Memory File, place in ~/.agents/
```
## Quick Start
### 1. Install PTBuilder
```
① PTBuilder/PTBuilder.pts → Copy to PT installation directory's extensions\ folder
(e.g., D:\Program Files\Cisco Packet Tracer 8.2.2\extensions\)
② PT → Extensions → Scripting → Config PT Script Modules → Add → Select PTBuilder.pts
③ Restart PT
```
⚠️ Do not delete the .pts file, or Builder Code Editor will disappear.
### 2. Install MCP Server
```bash
cd MCP-Packet-Tracer
pip install -e .
```
### 3. Configure OpenCode
Edit `~/.config/opencode/opencode.json`:
```json
{
"mcp": {
"packet-tracer": {
"type": "local",
"command": ["python", "-m", "packet_tracer_mcp", "--stdio"],
"enabled": true,
"env": { "PYTHONPATH": "/path/to/MCP-Packet-Tracer/src" }
}
}
}
```
### 4. Install AI Skills
```bash
cp -r skills/packet-tracer ~/.agents/skills/
cp AGENTS.md ~/.agents/AGENTS.md
```
### 5. Establish Bridge
```
① PT → Extensions → Builder Code Editor
② Open MCP-Packet-Tracer/test_bootstrap.js → Select all, copy, paste, and Run
③ OpenCode → "Check bridge status"
```
## Optimized Content
### MCP Server
- Added 6 bridge functions: reportResult, deleteDevice, renameDevice, moveDevice, deleteLink, queryTopology
- Dynamic bootstrap generation, no longer hardcoded
- Enhanced AI system instructions: complete API reference + non-existent function blacklist + practical error recording
- Tool description correction: all example codes changed to correct calling methods
### AI Skills System
- SKILL.md: auto-loaded, includes GOLDEN RULE, bootstrap code block, complete API reference, and 16 practical errors
- AGENTS.md: persistent memory, records discovered and verified APIs
### PTBuilder
- CodeMirror 5: syntax highlighting, line numbers, bracket matching
- Three-state button: Running → Done / Error
- Real-time bridge status indication
- Fixed multi-line script bug
- Auto-save
## Example Conversation with AI
> "Build a 3-router OSPF topology from scratch, configure static IP, and ping through"
> "Configure NAT overload on R1, allowing LAN PCs to access the Internet"
> "Configure extended ACL on R3, allowing specific traffic to access the server"
## Related Projects
- [MCP-Packet-Tracer](https://github.com/Mats2208/MCP-Packet-Tracer) — Original MCP Server
- [PTBuilder](https://github.com/kimmknight/PTBuilder) — Original Builder Code Editor