# rstierli/fortianalyzer-mcp architecture

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

- Interactive diagram: https://gitdiagram.com/rstierli/fortianalyzer-mcp
- Repository: https://github.com/rstierli/fortianalyzer-mcp

## Overview

FortiAnalyzer MCP Server exposes FortiAnalyzer security and operations capabilities to AI assistants through MCP tools. The main workflow is an MCP client request entering the server, reaching a domain tool, and using the API client to query FortiAnalyzer; query helpers shape and constrain log results. Separate branches provide reports, device and security operations, higher-level SOC skills, and optional reversible masking. Edges reflect README statements and the supplied source index or excerpts; some tool registrations and unsampled implementations are documented but not shown in source excerpts.

Main entry points: [`src/fortianalyzer_mcp/server.py`](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/server.py) (MCP server), [`src/fortianalyzer_mcp/api/client.py`](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/api/client.py) (API client), [`src/fortianalyzer_mcp/skills/handlers.py`](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/skills/handlers.py) (SOC skills), [`src/fortianalyzer_mcp/tools/log_tools.py`](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/log_tools.py) (Log analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["MCP interface"]
  node_server["MCP server<br/>[server.py]"]
end

subgraph group_operations["FortiAnalyzer operations"]
  node_api_client["API client<br/>[client.py]"]
  node_logs["Log analysis<br/>[log_tools.py]"]
  node_traffic["Traffic analysis<br/>[traffic_tools.py]"]
  node_fortiview["FortiView analytics<br/>[fortiview_tools.py]"]
  node_events["Alerts and events<br/>[event_tools.py]"]
  node_incidents["Incident management<br/>[incident_tools.py]"]
  node_ioc["IOC analysis<br/>[ioc_tools.py]"]
  node_pcap["PCAP downloads<br/>[pcap_tools.py]"]
  node_reports["Report operations<br/>[report_tools.py]"]
  node_device_system["Device and system"]
end

subgraph group_query["Query processing"]
  node_query_helpers["Query helpers"]
end

subgraph group_capabilities["SOC capabilities"]
  node_skills["SOC skills<br/>[handlers.py]"]
  node_skill_dispatch["Skill dispatcher<br/>[dispatcher.py]"]
  node_masking["Output masking<br/>[wrapper.py]"]
end

subgraph group_shared["Shared runtime"]
  node_config_validation["Configuration and validation<br/>[config.py]"]
  node_response_helpers["Response helpers<br/>[responses.py]"]
end

node_client_actor(("AI assistant"))
node_faz["FortiAnalyzer"]

node_client_actor -->|"calls tools"| node_server
node_server -->|"registers tools"| node_logs
node_server -->|"registers tools"| node_events
node_server -->|"registers tools"| node_fortiview
node_server -->|"registers tools"| node_incidents
node_server -->|"registers tools"| node_ioc
node_server -.->|"registers tools"| node_pcap
node_server -.->|"registers tools"| node_reports
node_server -.->|"registers tools"| node_device_system
node_logs -->|"queries API"| node_api_client
node_traffic -.->|"queries API"| node_api_client
node_fortiview -->|"queries API"| node_api_client
node_events -->|"queries API"| node_api_client
node_incidents -->|"queries API"| node_api_client
node_ioc -->|"queries API"| node_api_client
node_pcap -->|"queries API"| node_api_client
node_reports -->|"queries API"| node_api_client
node_device_system -.->|"queries API"| node_api_client
node_api_client -->|"sends JSON-RPC"| node_faz
node_logs -->|"uses filters and shaping"| node_query_helpers
node_fortiview -->|"uses grouping and shaping"| node_query_helpers
node_server -->|"exposes skill tool"| node_skill_dispatch
node_skill_dispatch -->|"dispatches skills"| node_skills
node_skills -->|"orchestrates tools"| node_logs
node_skills -->|"orchestrates tools"| node_events
node_skills -->|"orchestrates tools"| node_incidents
node_skills -->|"orchestrates tools"| node_fortiview
node_server -->|"wraps tool outputs"| node_masking
node_server -->|"loads settings"| node_config_validation
node_logs -->|"builds responses"| node_response_helpers

click node_server "https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/server.py"
click node_api_client "https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/api/client.py"
click node_logs "https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/log_tools.py"
click node_traffic "https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/traffic_tools.py"
click node_fortiview "https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/fortiview_tools.py"
click node_events "https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/event_tools.py"
click node_incidents "https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/incident_tools.py"
click node_ioc "https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/ioc_tools.py"
click node_pcap "https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/pcap_tools.py"
click node_reports "https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/report_tools.py"
click node_device_system "https://github.com/rstierli/fortianalyzer-mcp/tree/main/src/fortianalyzer_mcp/tools"
click node_query_helpers "https://github.com/rstierli/fortianalyzer-mcp/tree/main/src/fortianalyzer_mcp/query"
click node_skills "https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/skills/handlers.py"
click node_skill_dispatch "https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/skills/dispatcher.py"
click node_masking "https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/masking/wrapper.py"
click node_config_validation "https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/utils/config.py"
click node_response_helpers "https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/utils/responses.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_server toneBlue
class node_api_client,node_logs,node_traffic,node_fortiview,node_events,node_incidents,node_ioc,node_pcap,node_reports,node_device_system toneAmber
class node_query_helpers toneMint
class node_skills,node_skill_dispatch,node_masking toneRose
class node_config_validation,node_response_helpers,node_client_actor,node_faz toneIndigo
```

## Components

### MCP interface

- [MCP server](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/server.py): `src/fortianalyzer_mcp/server.py`

### FortiAnalyzer operations

- [API client](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/api/client.py): `src/fortianalyzer_mcp/api/client.py`
- [Log analysis](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/log_tools.py): `src/fortianalyzer_mcp/tools/log_tools.py`
- [Traffic analysis](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/traffic_tools.py): `src/fortianalyzer_mcp/tools/traffic_tools.py`
- [FortiView analytics](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/fortiview_tools.py): `src/fortianalyzer_mcp/tools/fortiview_tools.py`
- [Alerts and events](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/event_tools.py): `src/fortianalyzer_mcp/tools/event_tools.py`
- [Incident management](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/incident_tools.py): `src/fortianalyzer_mcp/tools/incident_tools.py`
- [IOC analysis](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/ioc_tools.py): `src/fortianalyzer_mcp/tools/ioc_tools.py`
- [PCAP downloads](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/pcap_tools.py): `src/fortianalyzer_mcp/tools/pcap_tools.py`
- [Report operations](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/tools/report_tools.py): `src/fortianalyzer_mcp/tools/report_tools.py`
- [Device and system](https://github.com/rstierli/fortianalyzer-mcp/tree/main/src/fortianalyzer_mcp/tools): `src/fortianalyzer_mcp/tools`

### Query processing

- [Query helpers](https://github.com/rstierli/fortianalyzer-mcp/tree/main/src/fortianalyzer_mcp/query): `src/fortianalyzer_mcp/query`

### SOC capabilities

- [SOC skills](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/skills/handlers.py): `src/fortianalyzer_mcp/skills/handlers.py`
- [Skill dispatcher](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/skills/dispatcher.py): `src/fortianalyzer_mcp/skills/dispatcher.py`
- [Output masking](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/masking/wrapper.py): `src/fortianalyzer_mcp/masking/wrapper.py`

### Shared runtime

- [Configuration and validation](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/utils/config.py): `src/fortianalyzer_mcp/utils/config.py`
- [Response helpers](https://github.com/rstierli/fortianalyzer-mcp/blob/main/src/fortianalyzer_mcp/utils/responses.py): `src/fortianalyzer_mcp/utils/responses.py`

### Other components

- **AI assistant**
- **FortiAnalyzer**

## Connections

- AI assistant → MCP server: calls tools (evidence: `README.md`)
- MCP server → Log analysis: registers tools (evidence: `src/fortianalyzer_mcp/server.py`)
- MCP server → Alerts and events: registers tools (evidence: `src/fortianalyzer_mcp/server.py`)
- MCP server → FortiView analytics: registers tools (evidence: `src/fortianalyzer_mcp/server.py`)
- MCP server → Incident management: registers tools (evidence: `src/fortianalyzer_mcp/server.py`)
- MCP server → IOC analysis: registers tools (evidence: `src/fortianalyzer_mcp/server.py`)
- MCP server → PCAP downloads: registers tools (evidence: `src/fortianalyzer_mcp/server.py`)
- MCP server → Report operations: registers tools (evidence: `src/fortianalyzer_mcp/server.py`)
- MCP server → Device and system: registers tools (evidence: `src/fortianalyzer_mcp/server.py`)
- Log analysis → API client: queries API (evidence: `src/fortianalyzer_mcp/tools/log_tools.py`)
- Traffic analysis → API client: queries API
- FortiView analytics → API client: queries API (evidence: `src/fortianalyzer_mcp/tools/fortiview_tools.py`)
- Alerts and events → API client: queries API (evidence: `src/fortianalyzer_mcp/tools/event_tools.py`)
- Incident management → API client: queries API (evidence: `src/fortianalyzer_mcp/tools/incident_tools.py`)
- IOC analysis → API client: queries API (evidence: `src/fortianalyzer_mcp/tools/ioc_tools.py`)
- PCAP downloads → API client: queries API (evidence: `src/fortianalyzer_mcp/tools/pcap_tools.py`)
- Report operations → API client: queries API (evidence: `src/fortianalyzer_mcp/tools/report_tools.py`)
- Device and system → API client: queries API (evidence: `src/fortianalyzer_mcp/tools/log_tools.py`)
- API client → FortiAnalyzer: sends JSON-RPC (evidence: `README.md`)
- Log analysis → Query helpers: uses filters and shaping (evidence: `src/fortianalyzer_mcp/tools/log_tools.py`)
- FortiView analytics → Query helpers: uses grouping and shaping (evidence: `src/fortianalyzer_mcp/tools/fortiview_tools.py`)
- MCP server → Skill dispatcher: exposes skill tool (evidence: `src/fortianalyzer_mcp/skills/dispatcher.py`)
- Skill dispatcher → SOC skills: dispatches skills (evidence: `src/fortianalyzer_mcp/skills/dispatcher.py`)
- SOC skills → Log analysis: orchestrates tools (evidence: `src/fortianalyzer_mcp/skills/handlers.py`)
- SOC skills → Alerts and events: orchestrates tools (evidence: `src/fortianalyzer_mcp/skills/handlers.py`)
- SOC skills → Incident management: orchestrates tools (evidence: `src/fortianalyzer_mcp/skills/handlers.py`)
- SOC skills → FortiView analytics: orchestrates tools (evidence: `src/fortianalyzer_mcp/skills/handlers.py`)
- MCP server → Output masking: wraps tool outputs (evidence: `src/fortianalyzer_mcp/server.py`)
- MCP server → Configuration and validation: loads settings (evidence: `src/fortianalyzer_mcp/server.py`)
- Log analysis → Response helpers: builds responses (evidence: `src/fortianalyzer_mcp/tools/log_tools.py`)
