An AI-powered phishing detection system that uses Claude AI as an autonomous agent to identify and classify sophisticated phishing attacks in real-time.
This system leverages Claude AI's agentic capabilities through the Model Context Protocol (MCP) to autonomously analyze emails, decide when to use external threat intelligence tools, and provide comprehensive security assessments.
Unlike traditional rule-based systems, the AI agent makes intelligent decisions about when and how to investigate suspicious emails, adapting its approach based on the content it encounters.
Modern phishing attacks are increasingly sophisticated:
- 1,003,924 phishing attacks recorded in Q1 2025 (Anti-Phishing Working Group)
- 3.4 billion phishing emails sent daily worldwide
- 90%+ of successful cyberattacks start with phishing emails
Traditional defenses fail because:
- Rule-based systems can't adapt to new patterns
- Basic ML models lack contextual understanding
- Manual analysis doesn't scale and is too slow
- Minutes matter in preventing damage
Organizations need a system that thinks like a security analyst, operates 24/7, and leverages real-time threat intelligence.
This implementation uses Claude AI as an autonomous agent that:
- Analyzes emails using natural language understanding
- Decides independently when to check external threat databases
- Synthesizes findings from multiple sources
- Provides explainable recommendations with full reasoning
- Operates continuously without human intervention
┌─────────────────┐
│ Schedule Trigger│ Every 5 minutes
└────────┬────────┘
↓
┌─────────────────┐
│ Get Gmail │ Fetch unread emails
│ Messages │
└────────┬────────┘
↓
┌─────────────────┐
│ AI Agent │ Claude autonomously:
│ (Claude 4) │ • Analyzes email content
│ │ • Extracts URLs/domains
│ │ • Decides if external check needed
│ │ • Calls VirusTotal tool (if needed)
│ │ • Re-evaluates with threat data
│ │ • Calculates final threat score
└────────┬────────┘
↓
┌────┴────┐
↓ ↓
┌─────────┐ ┌──────────────┐
│Anthropic│ │VirusTotal │ (Called by AI Agent)
│ Chat │ │check_virustotal│ Domain reputation check
│ Model │ │ │ 95+ antivirus engines
└────┬────┘ └──────────────┘
↓
┌─────────────────┐
│ JavaScript │ Format threat report
│ Code Node │
└────────┬────────┘
↓
┌─────────────────┐
│ Send Gmail │ Alert SOC team
│ Message │ with findings
└─────────────────┘
Trigger: Every 5 minutes
Action: Gmail node fetches unread messages
Output: Structured email data (from, subject, body, headers)
This is where the magic happens. The AI Agent node gives Claude access to tools and lets it decide how to investigate.
Tool Name: check_virustotal
Description: Check if a domain is malicious using VirusTotal API
Parameters:
domain(string): Domain to check (e.g., "suspicious-site.com")
Returns: VirusTotal analysis including:
- Malicious detections (X/95 engines)
- Reputation score
- Categories (phishing, malware, etc.)
The AI Agent receives the email and autonomously decides:
-
Initial Analysis
- Reads email content, sender, subject
- Identifies phishing indicators (urgency, suspicious links, typosquatting)
- Extracts any URLs or domains present
- Calculates preliminary threat score
-
Tool Use Decision
- If URLs found AND suspicious: Calls
check_virustotaltool - If no URLs OR clearly legitimate: Skips external check
- Agent makes this decision based on context, not hardcoded rules
- If URLs found AND suspicious: Calls
-
Tool Execution
- n8n executes the VirusTotal API call
- Results returned to the agent
- Agent can call the tool multiple times if multiple domains present
-
Final Synthesis
- Combines initial analysis with VirusTotal data
- Updates threat score based on external intelligence
- Provides final recommendation: ALLOW / QUARANTINE / BLOCK
- Includes detailed reasoning for the decision
Email Received:
From: security@paypa1-verify.com
Subject: URGENT: Verify Your Account
Body: Click here immediately: https://paypa1-verify.com/confirm
Agent Reasoning:
1. Initial Analysis:
- Typosquatting detected: "paypa1" vs "paypal"
- Urgency tactics: "URGENT", "immediately"
- Suspicious domain: paypa1-verify.com
- Preliminary Score: 85/100 (HIGH RISK)
2. Decision: I need external validation on this domain
→ Calling check_virustotal("paypa1-verify.com")
3. VirusTotal Results:
- 12/95 engines flag as malicious
- Categories: phishing, social engineering
- Recently registered domain
4. Final Assessment:
- Updated Score: 98/100 (CRITICAL)
- Recommendation: BLOCK IMMEDIATELY
- Reasoning: Multiple phishing indicators + confirmed
malicious by external engines
Purpose: Additional contextual analysis
Function: Provides secondary evaluation of email characteristics
Output: Supplementary insights fed to final report
This runs in parallel with the AI Agent's VirusTotal check to maximize efficiency.
Purpose: Format findings into human-readable threat report
Function:
- Consolidates AI Agent findings
- Structures data (threat score, verdict, reasoning)
- Formats as HTML/text for email alert
Example Output:
🚨 PHISHING ALERT - CRITICAL THREAT DETECTED
Email: "URGENT: Verify Your Account"
From: security@paypa1-verify.com
Threat Score: 98/100
RECOMMENDATION: BLOCK IMMEDIATELY
Indicators:
✗ Typosquatting domain (paypa1)
✗ VirusTotal: 12/95 engines flag as malicious
✗ Urgency-based social engineering
✗ Recently registered domain
Full Analysis:
[Detailed reasoning from AI Agent]
Purpose: Notify security team
Action: Send consolidated report to SOC email
Contains:
- Threat score and verdict
- Original email details
- AI reasoning
- Recommended action
The AI decides when to use tools, not hardcoded workflow logic. This means:
- Adapts to different email types dynamically
- Doesn't waste API calls on obvious legitimate emails
- Can handle new phishing tactics without workflow changes
Claude understands nuance:
- Distinguishes between "reset your password" from your bank vs. a scammer
- Considers sender reputation, email history, domain age
- Weighs multiple indicators together, not in isolation
Every verdict includes:
- Step-by-step reasoning
- Which indicators triggered concern
- Why external tools were (or weren't) used
- Confidence level in the assessment
Adding new capabilities is simple:
- Add tool definitions (WHOIS, URLScan, etc.)
- AI automatically learns to use them
- No workflow restructuring needed
- Only calls VirusTotal when necessary (AI's decision)
- Processes in ~8-15 seconds per email
- Minimal API usage compared to "check everything" approach
| Metric | Value |
|---|---|
| Detection Accuracy | High (adapts to sophisticated attacks) |
| False Positive Rate | <5% in testing |
| Processing Time | 8-15 seconds per email |
| Emails/Day | Up to 2,880 (scales with rate limits) |
| Cost per Email | ~$0.01-0.03 (Claude API) |
| VirusTotal Calls | 10-20/day (only when needed) |
| Component | Technology | Purpose |
|---|---|---|
| Orchestration | n8n | Workflow automation platform |
| AI Agent | Claude Sonnet 4 | Autonomous decision-making & analysis |
| Agent Framework | MCP (Model Context Protocol) | Tool use and reasoning framework |
| Threat Intel | VirusTotal API | Domain reputation (95+ engines) |
| Gmail API | Email monitoring and alerting | |
| Formatting | JavaScript | Report generation |
- WHOIS Lookup - Domain registration age verification
- URLScan.io - Live screenshot and behavior analysis
- Passive DNS - Historical domain infrastructure
- Certificate Transparency - SSL certificate validation
- Image OCR - Extract text from phishing images
- Attachment Analysis - Sandbox execution for files
- Header Forensics - SPF/DKIM/DMARC validation
- Campaign Detection - Cluster related attacks
- Feedback Loop - Learn from analyst corrections
- SIEM Integration - Feed events to Splunk/QRadar
- Email Gateway - Automatic message quarantine
- Ticketing - Auto-create SOC tickets
- Threat Sharing - Contribute IOCs to community feeds
- 24/7 monitoring of executive inboxes
- Automated triage reduces analyst workload by 80%
- Consistent analysis eliminates human fatigue
- Client protection from business email compromise
- Rapid detection of wire transfer fraud attempts
- Compliance with audit trails and explainable AI
- Affordable AI-powered protection
- No security team needed for basic protection
- Easy setup with minimal technical expertise
Email: "Your Microsoft account will be deleted - verify now"
Domain: micros0ft-verify.xyz
AI Decision: Called VirusTotal → 8/95 malicious
Verdict: BLOCK (Score: 96/100)
Email: "Team meeting tomorrow at 2pm"
Domain: None (internal sender)
AI Decision: No external check needed
Verdict: ALLOW (Score: 5/100)
Email: Marketing newsletter with shortened links
Domain: bit.ly redirects to legitimate site
AI Decision: Called VirusTotal → 0/95 malicious
Verdict: ALLOW (Score: 35/100) with note
This is an open-source security project. Contributions welcome in:
- Additional tool integrations
- Improved detection logic
- Performance optimizations
- Documentation and examples
MIT License - See LICENSE file for details
- Creator: Max Matkovski
- Email: maxmatkovski@gatech.edu
- LinkedIn: linkedin.com/in/maxmatkovski
- Issues: Submit via GitHub Issues



