# bx33661/wireshark-mcp architecture

> Architecture diagram of the GitHub repository bx33661/wireshark-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bx33661/wireshark-mcp
- Repository: https://github.com/bx33661/wireshark-mcp

## Overview

Wireshark MCP is an MCP server that lets AI clients investigate packet captures through structured tools backed by tshark. The main workflow is client request → registered analysis or extraction tool → tshark dissection → structured findings and response. For large captures, an optional DuckDB index supports repeatable aggregate, timeline, comparison, SQL, and export operations. Persistent case files preserve investigation results. The README documents these capabilities; some implementation modules were not sampled, so their internal call links are omitted rather than inferred.

Main entry points: [`src/wireshark_mcp/tshark/client.py`](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tshark/client.py) (TShark client), [`src/wireshark_mcp/server.py`](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/server.py) (MCP server), [`src/wireshark_mcp/tools/stats.py`](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/stats.py) (Statistics tools), [`src/wireshark_mcp/tools/index.py`](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/index.py) (Index operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_server["MCP service"]
  node_mcp_server["MCP server<br/>[server.py]"]
  node_mcp_surface["Tool surface<br/>[mcp_app.py]"]
  node_prompts["Prompts and resources<br/>[prompts.py]"]
end

subgraph group_analysis["Packet analysis"]
  node_tshark_client["TShark client<br/>[client.py]"]
  node_packet_tools["Packet tools<br/>[analyze.py]"]
  node_extract_tools["Extraction tools<br/>[extract.py]"]
  node_stats_tools["Statistics tools<br/>[stats.py]"]
  node_protocol_tools["Protocol analysis<br/>[protocol.py]"]
  node_security_tools["Security detectors<br/>[threat.py]"]
  node_bluetooth_tools["Bluetooth analysis<br/>[bluetooth.py]"]
  node_case_tools["Case workflow<br/>[case.py]"]
  node_case_store[("Case files<br/>[cases.py]")]
  node_findings["Finding format<br/>[findings.py]"]
end

subgraph group_indexing["Capture index"]
  node_index_tools["Index operations<br/>[index.py]"]
  node_index_store[("DuckDB index<br/>[store.py]")]
  node_filter_sql["Filter translation<br/>[filter_sql.py]"]
  node_index_compare["Capture comparison<br/>[compare.py]"]
end

subgraph group_install["Client setup"]
  node_installer_cli["Installer workflow<br/>[_orchestrator.py]"]
  node_client_registry["Client registry<br/>[_clients.py]"]
  node_config_writer["Config writer<br/>[_writer.py]"]
end

node_analyst(("AI analyst"))
node_capture_input["Capture file"]
node_client_configs["MCP client configs"]
node_tshark["Wireshark tshark"]

node_analyst -->|"requests analysis"| node_mcp_server
node_mcp_server -->|"configures tools"| node_mcp_surface
node_mcp_server -->|"creates client"| node_tshark_client
node_mcp_server -->|"registers prompts"| node_prompts
node_analyst -->|"supplies capture"| node_capture_input
node_packet_tools -.->|"queries packets"| node_tshark_client
node_extract_tools -.->|"extracts fields"| node_tshark_client
node_stats_tools -->|"computes statistics"| node_tshark_client
node_protocol_tools -.->|"dissects protocols"| node_tshark_client
node_security_tools -->|"checks traffic"| node_tshark_client
node_bluetooth_tools -->|"queries BLE"| node_tshark_client
node_tshark_client -->|"runs commands"| node_tshark
node_security_tools -->|"formats findings"| node_findings
node_case_tools -.->|"records results"| node_case_store
node_index_tools -->|"builds and queries"| node_index_store
node_index_store -->|"dissects capture"| node_tshark_client
node_stats_tools -->|"uses indexed data"| node_index_store
node_stats_tools -->|"translates filters"| node_filter_sql
node_index_tools -->|"translates filters"| node_filter_sql
node_index_tools -->|"compares captures"| node_index_compare
node_installer_cli -->|"selects clients"| node_client_registry
node_installer_cli -->|"configures clients"| node_config_writer
node_client_registry -->|"resolves locations"| node_client_configs
node_config_writer -.->|"writes registration"| node_client_configs
node_mcp_server -->|"dispatches install"| node_installer_cli

click node_mcp_server "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/server.py"
click node_mcp_surface "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/mcp_app.py"
click node_prompts "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/prompts.py"
click node_tshark_client "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tshark/client.py"
click node_packet_tools "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/analyze.py"
click node_extract_tools "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/extract.py"
click node_stats_tools "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/stats.py"
click node_protocol_tools "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/protocol.py"
click node_security_tools "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/threat.py"
click node_bluetooth_tools "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/bluetooth.py"
click node_case_tools "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/case.py"
click node_case_store "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/cases.py"
click node_findings "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/findings.py"
click node_index_tools "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/index.py"
click node_index_store "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/index/store.py"
click node_filter_sql "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/index/filter_sql.py"
click node_index_compare "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/index/compare.py"
click node_installer_cli "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/installer/_orchestrator.py"
click node_client_registry "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/installer/_clients.py"
click node_config_writer "https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/installer/_writer.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mcp_server,node_mcp_surface,node_prompts,node_client_configs toneBlue
class node_tshark_client,node_packet_tools,node_extract_tools,node_stats_tools,node_protocol_tools,node_security_tools,node_bluetooth_tools,node_case_tools,node_case_store,node_findings toneAmber
class node_index_tools,node_index_store,node_filter_sql,node_index_compare toneMint
class node_installer_cli,node_client_registry,node_config_writer toneRose
class node_analyst,node_capture_input,node_tshark toneIndigo
```

## Components

### MCP service

- [MCP server](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/server.py): `src/wireshark_mcp/server.py`
- [Tool surface](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/mcp_app.py): `src/wireshark_mcp/mcp_app.py`
- [Prompts and resources](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/prompts.py): `src/wireshark_mcp/prompts.py`

### Packet analysis

- [TShark client](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tshark/client.py): `src/wireshark_mcp/tshark/client.py`
- [Packet tools](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/analyze.py): `src/wireshark_mcp/tools/analyze.py`
- [Extraction tools](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/extract.py): `src/wireshark_mcp/tools/extract.py`
- [Statistics tools](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/stats.py): `src/wireshark_mcp/tools/stats.py`
- [Protocol analysis](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/protocol.py): `src/wireshark_mcp/tools/protocol.py`
- [Security detectors](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/threat.py): `src/wireshark_mcp/tools/threat.py`
- [Bluetooth analysis](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/bluetooth.py): `src/wireshark_mcp/tools/bluetooth.py`
- [Case workflow](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/case.py): `src/wireshark_mcp/tools/case.py`
- [Case files](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/cases.py): `src/wireshark_mcp/cases.py`
- [Finding format](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/findings.py): `src/wireshark_mcp/tools/findings.py`

### Capture index

- [Index operations](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/tools/index.py): `src/wireshark_mcp/tools/index.py`
- [DuckDB index](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/index/store.py): `src/wireshark_mcp/index/store.py`
- [Filter translation](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/index/filter_sql.py): `src/wireshark_mcp/index/filter_sql.py`
- [Capture comparison](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/index/compare.py): `src/wireshark_mcp/index/compare.py`

### Client setup

- [Installer workflow](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/installer/_orchestrator.py): `src/wireshark_mcp/installer/_orchestrator.py`
- [Client registry](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/installer/_clients.py): `src/wireshark_mcp/installer/_clients.py`
- [Config writer](https://github.com/bx33661/wireshark-mcp/blob/main/src/wireshark_mcp/installer/_writer.py): `src/wireshark_mcp/installer/_writer.py`

### Other components

- **AI analyst**
- **Capture file**
- **MCP client configs**
- **Wireshark tshark**

## Connections

- AI analyst → MCP server: requests analysis (evidence: `README.md`)
- MCP server → Tool surface: configures tools (evidence: `src/wireshark_mcp/server.py`)
- MCP server → TShark client: creates client (evidence: `src/wireshark_mcp/server.py`)
- MCP server → Prompts and resources: registers prompts (evidence: `src/wireshark_mcp/server.py`)
- AI analyst → Capture file: supplies capture (evidence: `README.md`)
- Packet tools → TShark client: queries packets
- Extraction tools → TShark client: extracts fields
- Statistics tools → TShark client: computes statistics (evidence: `src/wireshark_mcp/tools/stats.py`)
- Protocol analysis → TShark client: dissects protocols
- Security detectors → TShark client: checks traffic (evidence: `src/wireshark_mcp/tools/threat.py`)
- Bluetooth analysis → TShark client: queries BLE (evidence: `src/wireshark_mcp/tools/bluetooth.py`)
- TShark client → Wireshark tshark: runs commands (evidence: `src/wireshark_mcp/tshark/client.py`)
- Security detectors → Finding format: formats findings (evidence: `src/wireshark_mcp/tools/threat.py`)
- Case workflow → Case files: records results
- Index operations → DuckDB index: builds and queries (evidence: `src/wireshark_mcp/tools/index.py`)
- DuckDB index → TShark client: dissects capture (evidence: `src/wireshark_mcp/index/store.py`)
- Statistics tools → DuckDB index: uses indexed data (evidence: `src/wireshark_mcp/tools/stats.py`)
- Statistics tools → Filter translation: translates filters (evidence: `src/wireshark_mcp/tools/stats.py`)
- Index operations → Filter translation: translates filters (evidence: `src/wireshark_mcp/tools/index.py`)
- Index operations → Capture comparison: compares captures (evidence: `src/wireshark_mcp/tools/index.py`)
- Installer workflow → Client registry: selects clients (evidence: `src/wireshark_mcp/installer/_orchestrator.py`)
- Installer workflow → Config writer: configures clients (evidence: `src/wireshark_mcp/installer/_orchestrator.py`)
- Client registry → MCP client configs: resolves locations (evidence: `src/wireshark_mcp/installer/_clients.py`)
- Config writer → MCP client configs: writes registration
- MCP server → Installer workflow: dispatches install (evidence: `src/wireshark_mcp/server.py`)
