N8N System Manual: MDL Ops Intelligence (v2)

This manual provides technical documentation for the n8n v2 infrastructure and workflows hosted within the MDL Ops Engine.

1. System Architecture

The system is built on a modular Docker-based architecture for high reliability and AI-driven processing.

1.1 Docker Services

1.2 Connectivity & Public Access


2. The "FINAL MASTER" Workflow

The system uses a unified master workflow that handles all quote intake and analysis.

2.1 Intake & Routing

2.2 Google Drive Synchronization

2.3 AI Intelligence (Gemini 2.0 Flash)

2.4 Financial Audit & State Tracking


3. Maintenance and AI Training

The AI accuracy is maintained through a rigorous benchmarking process.

3.1 AI Training Pipeline

To add or improve vendor extraction: 1. Samples: Place new PDFs in n8n-docker/samples/{VENDOR}/. 2. Ground Truth: Run python n8n-docker/scripts/setup_ground_truth.py to create labeling templates. 3. Benchmarking: Run python n8n-docker/scripts/benchmark_ai.py to measure accuracy. 4. Prompt Tuning: Update the Gemini node in N8N with new "EXAMPLES" derived from the raw text of samples.

3.2 Excel API Maintenance

The excel-api service provides tools for: - Converting Sales Quotes to images for visual verification in Slack/Email. - Extracting specific cells for audit comparison.


4. Security & Access Control

Access to the n8n automation engine is strictly controlled via a dual-layer security model.

4.1 Layer 1: Network-Level SSO (Cloudflare)

Before reaching the application, users must authenticate via Microsoft Azure AD. - Scope: Access is restricted to @mdlcommunications.com email addresses. - Policy: Managed in the Cloudflare Zero Trust dashboard under "Access Applications". - Bot Protection: All search engine indexing is blocked via a global X-Robots-Tag: noindex policy and Cloudflare-level bot management.

4.2 Layer 2: Application-Level Auth (n8n)

Once past the Cloudflare wall, users must log in with their individual n8n service accounts.


5. Troubleshooting Reference

Issue Potential Cause Resolution
Workflow Paused Docker memory limit Check docker stats n8n-v2, increase in docker-compose.yaml.
Auth Error Token expired Re-authenticate Google/Outlook credentials in the N8N UI.
$0.00 Extraction Layout change Update "Few-Shot" examples in the Gemini node system prompt.
Excel Fail Invalid format Verify file is not corrupt; restart excel-api container.