# 2584210631-star/mc-scanner-v3 architecture

> Architecture diagram of the GitHub repository 2584210631-star/mc-scanner-v3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/2584210631-star/mc-scanner-v3
- Repository: https://github.com/2584210631-star/mc-scanner-v3

## Overview

MC Scanner is a Minecraft server discovery, probing, monitoring, and security-alert tool with CLI and Web interfaces. Its main workflow finds open ports, probes servers with Minecraft SLP, identifies authentication and software traits, then stores and presents results. Separate branches support bot-based observation and messaging, AI-managed chat, Microsoft account login, recurring health checks, and warnings. The README documents these capabilities; sampled source confirms key scan, persistence, and Web-route relationships, while some unsampled subsystem links are omitted rather than inferred.

Main entry points: [`scanner/engine.py`](https://github.com/2584210631-star/mc-scanner-v3/blob/main/scanner/engine.py) (Scan Engine), [`web/routes_scan.py`](https://github.com/2584210631-star/mc-scanner-v3/blob/main/web/routes_scan.py) (Scan Routes), [`core/bot.py`](https://github.com/2584210631-star/mc-scanner-v3/blob/main/core/bot.py) (Bot Client), [`web/routes_data.py`](https://github.com/2584210631-star/mc-scanner-v3/blob/main/web/routes_data.py) (Data Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User Interfaces"]
  node_cli["CLI<br/>[cli.py]"]
  node_webapp["Web Panel<br/>[app.py]"]
end

subgraph group_scan["Discovery and Probing"]
  node_scanengine["Scan Engine<br/>[engine.py]"]
  node_asyncengine["Async Scanner<br/>[async_engine.py]"]
  node_ports["Port Scanning<br/>[portscan.py]"]
  node_masscan["Masscan Integration<br/>[masscan.py]"]
  node_probe["SLP and Auth Probe<br/>[probe.py]"]
  node_protocols["Protocol Adapters"]
end

subgraph group_operate["Server Operations"]
  node_bot["Bot Client<br/>[bot.py]"]
  node_observer["Observer Sessions"]
  node_ai["AI Chat<br/>[ai_bot.py]"]
  node_ai_memory["AI Memory<br/>[ai_memory.py]"]
  node_oauth["Microsoft Login<br/>[microsoft_auth.py]"]
  node_warn["Security Warnings<br/>[warn_service.py]"]
end

subgraph group_web["Web Services"]
  node_routes_scan["Scan Routes<br/>[routes_scan.py]"]
  node_routes_obs["Observer Routes<br/>[routes_observer.py]"]
  node_routes_data["Data Routes<br/>[routes_data.py]"]
  node_routes_warn["Warning Routes<br/>[routes_warn.py]"]
end

subgraph group_state["State and Notifications"]
  node_state["Shared Runtime State<br/>[state.py]"]
  node_database[("SQLite Database<br/>[db.py]")]
  node_favorites[("Favorites<br/>[favorites.py]")]
  node_history[("Player History<br/>[player_history.py]")]
  node_discord["Discord Webhook<br/>[discord.py]"]
  node_config["Configuration<br/>[config.py]"]
end

node_user(("Operator"))
node_minecraft(("Minecraft Servers"))

node_user -->|"runs scans"| node_cli
node_user -->|"uses panel"| node_webapp
node_cli -.->|"starts scan"| node_scanengine
node_webapp -.->|"serves routes"| node_routes_scan
node_routes_scan -->|"starts scan"| node_scanengine
node_routes_scan -->|"selects discovery"| node_masscan
node_scanengine -->|"scans ports"| node_ports
node_scanengine -->|"probes servers"| node_probe
node_asyncengine -->|"probes servers"| node_probe
node_probe -->|"uses adapters"| node_protocols
node_scanengine -->|"stores results"| node_database
node_asyncengine -->|"writes batches"| node_database
node_scanengine -->|"notifies findings"| node_discord
node_scanengine -->|"probes"| node_minecraft
node_bot -->|"logs in"| node_minecraft
node_routes_obs -->|"manages sessions"| node_observer
node_observer -.->|"uses client"| node_bot
node_ai -.->|"uses client"| node_bot
node_ai -.->|"uses memory"| node_ai_memory
node_oauth -->|"authenticates account"| node_minecraft
node_routes_warn -->|"runs warnings"| node_warn
node_warn -->|"sends messages"| node_bot
node_routes_data -->|"reads results"| node_database
node_routes_data -->|"manages favorites"| node_favorites
node_routes_data -->|"reads history"| node_history
node_routes_scan -->|"updates state"| node_state
node_routes_obs -->|"uses state"| node_state
node_routes_warn -->|"uses state"| node_state
node_config -.->|"configures scans"| node_scanengine
node_user -->|"sets up account"| node_oauth

click node_cli "https://github.com/2584210631-star/mc-scanner-v3/blob/main/cli.py"
click node_webapp "https://github.com/2584210631-star/mc-scanner-v3/blob/main/web/app.py"
click node_scanengine "https://github.com/2584210631-star/mc-scanner-v3/blob/main/scanner/engine.py"
click node_asyncengine "https://github.com/2584210631-star/mc-scanner-v3/blob/main/scanner/async_engine.py"
click node_ports "https://github.com/2584210631-star/mc-scanner-v3/blob/main/scanner/portscan.py"
click node_masscan "https://github.com/2584210631-star/mc-scanner-v3/blob/main/scanner/masscan.py"
click node_probe "https://github.com/2584210631-star/mc-scanner-v3/blob/main/core/probe.py"
click node_protocols "https://github.com/2584210631-star/mc-scanner-v3/tree/main/core/protocols"
click node_bot "https://github.com/2584210631-star/mc-scanner-v3/blob/main/core/bot.py"
click node_observer "https://github.com/2584210631-star/mc-scanner-v3/blob/main/web/observer_session.py"
click node_ai "https://github.com/2584210631-star/mc-scanner-v3/blob/main/core/ai_bot.py"
click node_ai_memory "https://github.com/2584210631-star/mc-scanner-v3/blob/main/core/ai_memory.py"
click node_oauth "https://github.com/2584210631-star/mc-scanner-v3/blob/main/core/microsoft_auth.py"
click node_warn "https://github.com/2584210631-star/mc-scanner-v3/blob/main/service/warn_service.py"
click node_routes_scan "https://github.com/2584210631-star/mc-scanner-v3/blob/main/web/routes_scan.py"
click node_routes_obs "https://github.com/2584210631-star/mc-scanner-v3/blob/main/web/routes_observer.py"
click node_routes_data "https://github.com/2584210631-star/mc-scanner-v3/blob/main/web/routes_data.py"
click node_routes_warn "https://github.com/2584210631-star/mc-scanner-v3/blob/main/web/routes_warn.py"
click node_state "https://github.com/2584210631-star/mc-scanner-v3/blob/main/web/state.py"
click node_database "https://github.com/2584210631-star/mc-scanner-v3/blob/main/storage/db.py"
click node_favorites "https://github.com/2584210631-star/mc-scanner-v3/blob/main/storage/favorites.py"
click node_history "https://github.com/2584210631-star/mc-scanner-v3/blob/main/storage/player_history.py"
click node_discord "https://github.com/2584210631-star/mc-scanner-v3/blob/main/notify/discord.py"
click node_config "https://github.com/2584210631-star/mc-scanner-v3/blob/main/config.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_cli,node_webapp toneBlue
class node_scanengine,node_asyncengine,node_ports,node_masscan,node_probe,node_protocols toneAmber
class node_bot,node_observer,node_ai,node_ai_memory,node_oauth,node_warn,node_minecraft toneMint
class node_routes_scan,node_routes_obs,node_routes_data,node_routes_warn toneRose
class node_state,node_database,node_favorites,node_history,node_discord,node_config,node_user toneIndigo
```

## Components

### User Interfaces

- [CLI](https://github.com/2584210631-star/mc-scanner-v3/blob/main/cli.py): `cli.py`
- [Web Panel](https://github.com/2584210631-star/mc-scanner-v3/blob/main/web/app.py): `web/app.py`

### Discovery and Probing

- [Scan Engine](https://github.com/2584210631-star/mc-scanner-v3/blob/main/scanner/engine.py): `scanner/engine.py`
- [Async Scanner](https://github.com/2584210631-star/mc-scanner-v3/blob/main/scanner/async_engine.py): `scanner/async_engine.py`
- [Port Scanning](https://github.com/2584210631-star/mc-scanner-v3/blob/main/scanner/portscan.py): `scanner/portscan.py`
- [Masscan Integration](https://github.com/2584210631-star/mc-scanner-v3/blob/main/scanner/masscan.py): `scanner/masscan.py`
- [SLP and Auth Probe](https://github.com/2584210631-star/mc-scanner-v3/blob/main/core/probe.py): `core/probe.py`
- [Protocol Adapters](https://github.com/2584210631-star/mc-scanner-v3/tree/main/core/protocols): `core/protocols`

### Server Operations

- [Bot Client](https://github.com/2584210631-star/mc-scanner-v3/blob/main/core/bot.py): `core/bot.py`
- [Observer Sessions](https://github.com/2584210631-star/mc-scanner-v3/blob/main/web/observer_session.py): `web/observer_session.py`
- [AI Chat](https://github.com/2584210631-star/mc-scanner-v3/blob/main/core/ai_bot.py): `core/ai_bot.py`
- [AI Memory](https://github.com/2584210631-star/mc-scanner-v3/blob/main/core/ai_memory.py): `core/ai_memory.py`
- [Microsoft Login](https://github.com/2584210631-star/mc-scanner-v3/blob/main/core/microsoft_auth.py): `core/microsoft_auth.py`
- [Security Warnings](https://github.com/2584210631-star/mc-scanner-v3/blob/main/service/warn_service.py): `service/warn_service.py`

### Web Services

- [Scan Routes](https://github.com/2584210631-star/mc-scanner-v3/blob/main/web/routes_scan.py): `web/routes_scan.py`
- [Observer Routes](https://github.com/2584210631-star/mc-scanner-v3/blob/main/web/routes_observer.py): `web/routes_observer.py`
- [Data Routes](https://github.com/2584210631-star/mc-scanner-v3/blob/main/web/routes_data.py): `web/routes_data.py`
- [Warning Routes](https://github.com/2584210631-star/mc-scanner-v3/blob/main/web/routes_warn.py): `web/routes_warn.py`

### State and Notifications

- [Shared Runtime State](https://github.com/2584210631-star/mc-scanner-v3/blob/main/web/state.py): `web/state.py`
- [SQLite Database](https://github.com/2584210631-star/mc-scanner-v3/blob/main/storage/db.py): `storage/db.py`
- [Favorites](https://github.com/2584210631-star/mc-scanner-v3/blob/main/storage/favorites.py): `storage/favorites.py`
- [Player History](https://github.com/2584210631-star/mc-scanner-v3/blob/main/storage/player_history.py): `storage/player_history.py`
- [Discord Webhook](https://github.com/2584210631-star/mc-scanner-v3/blob/main/notify/discord.py): `notify/discord.py`
- [Configuration](https://github.com/2584210631-star/mc-scanner-v3/blob/main/config.py): `config.py`

### Other components

- **Operator**
- **Minecraft Servers**

## Connections

- Operator → CLI: runs scans
- Operator → Web Panel: uses panel
- CLI → Scan Engine: starts scan
- Web Panel → Scan Routes: serves routes
- Scan Routes → Scan Engine: starts scan (evidence: `web/routes_scan.py`)
- Scan Routes → Masscan Integration: selects discovery (evidence: `web/routes_scan.py`)
- Scan Engine → Port Scanning: scans ports (evidence: `scanner/engine.py`)
- Scan Engine → SLP and Auth Probe: probes servers (evidence: `scanner/engine.py`)
- Async Scanner → SLP and Auth Probe: probes servers (evidence: `scanner/async_engine.py`)
- SLP and Auth Probe → Protocol Adapters: uses adapters (evidence: `core/probe.py`)
- Scan Engine → SQLite Database: stores results (evidence: `scanner/engine.py`)
- Async Scanner → SQLite Database: writes batches (evidence: `scanner/async_engine.py`)
- Scan Engine → Discord Webhook: notifies findings (evidence: `scanner/engine.py`)
- Scan Engine → Minecraft Servers: probes
- Bot Client → Minecraft Servers: logs in
- Observer Routes → Observer Sessions: manages sessions (evidence: `web/routes_observer.py`)
- Observer Sessions → Bot Client: uses client
- AI Chat → Bot Client: uses client
- AI Chat → AI Memory: uses memory
- Microsoft Login → Minecraft Servers: authenticates account
- Warning Routes → Security Warnings: runs warnings (evidence: `web/routes_warn.py`)
- Security Warnings → Bot Client: sends messages (evidence: `service/warn_service.py`)
- Data Routes → SQLite Database: reads results (evidence: `web/routes_data.py`)
- Data Routes → Favorites: manages favorites (evidence: `web/routes_data.py`)
- Data Routes → Player History: reads history (evidence: `web/routes_data.py`)
- Scan Routes → Shared Runtime State: updates state (evidence: `web/routes_scan.py`)
- Observer Routes → Shared Runtime State: uses state (evidence: `web/routes_observer.py`)
- Warning Routes → Shared Runtime State: uses state (evidence: `web/routes_warn.py`)
- Configuration → Scan Engine: configures scans
- Operator → Microsoft Login: sets up account
