# shubham-s-pandey/wiresharkmcp architecture

> Architecture diagram of the GitHub repository shubham-s-pandey/wiresharkmcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shubham-s-pandey/wiresharkmcp
- Repository: https://github.com/shubham-s-pandey/wiresharkmcp

## Overview

##### Main Components
- Python MCP Server (represented by bridge.py):
- Responsible for managing the communication between Wireshark and Claude Desktop.
- Implements CLI operations, smart buffering, file management, and network interface discovery.
- Lua Wireshark Extension (represented by capture_packet.lua):
- Provides real-time packet dissection, custom protocol field definitions, and automated interface listing.
- Captures and logs network packets.
- Configuration Files:
- claude_desktop_config.json, which likely provides settings for integrating with Claude Desktop.
- External/Supporting Components:
- Wireshark (as the primary network analysis tool).
- Claude Desktop (as the natural language interface for interacting with network analysis).
- Hardware/Network interfaces (implied via network interface discovery).

##### Relationships and Data Flows
- Wireshark, operating on the network interfaces, utilizes the Lua extension (capture_packet.lua) to dissect packets in real-time.
- The Lua extension feeds captured packet data to the Python MCP server (bridge.py), which acts as the communication bridge.
- The Python server then processes these packets, performs file management/buffering, and communicates with Claude Desktop as configured.
- Data flow from Wireshark (and its Lua extension) to the Python MCP Server.
- Commands or interactions flowing from Claude Desktop to the Python server (and vice versa, depending on the CLI operations).
- Any configuration flow from claude_desktop_config.json to the Python server setup.

##### Architectural Patterns and Design Principles
- Separation of Concerns:
- Distinct roles for packet capture/dissection (Lua extension) and communication/analysis (Python server).
- Modular Design:
- Each component (Python server and Lua extension) is self-contained yet communicates through clearly defined interfaces.
- Real-Time Data Processing:
- That the Lua extension is responsible for real-time operations, which then feeds into the Python component for further processing.

##### Technologies and Frameworks
- Python is used for the MCP server component.
- Lua is used for the Wireshark extension.
- Wireshark (external tool) and MCP as key integration points.
- CLI interface implies command-line interaction which can be depicted as an external interface or user terminal.

## Diagram (Mermaid)

```mermaid
graph TD
    %% External Systems
    subgraph "External Systems"
        WS["Wireshark"]:::external
        CD["Claude Desktop"]:::external
    end

    %% Integration Components
    subgraph "Integration Components"
        LuaExt["Lua Wireshark Extension (capture_packet.lua)"]:::internal
        PyServer["Python MCP Server (bridge.py)"]:::internal
        Config["Configuration (claude_desktop_config.json)"]:::internal
    end

    %% Data Flows
    WS -->|"real-time_packet_capture"| LuaExt
    LuaExt -->|"packet_data"| PyServer
    Config -->|"configuration_data"| PyServer
    PyServer -->|"command_responses"| CD

    %% Click Events
    click PyServer "https://github.com/shubham-s-pandey/wiresharkmcp/blob/main/bridge.py"
    click LuaExt "https://github.com/shubham-s-pandey/wiresharkmcp/blob/main/capture_packet.lua"
    click Config "https://github.com/shubham-s-pandey/wiresharkmcp/blob/main/claude_desktop_config.json"

    %% Styles
    classDef external fill:#f96,stroke:#333,stroke-width:2px,color:#fff;
    classDef internal fill:#6cf,stroke:#333,stroke-width:2px,color:#fff;
```
