loading…
Search for a command to run...
loading…
An advanced email security analysis MCP server for real-time phishing detection, comprehensive header analysis, and threat intelligence integration. It enables
An advanced email security analysis MCP server for real-time phishing detection, comprehensive header analysis, and threat intelligence integration. It enables users to extract indicators of compromise and validate email authentication protocols like DKIM, SPF, and DMARC.
An advanced email security analysis MCP (Model Context Protocol) server that provides real-time phishing detection, threat intelligence integration, and comprehensive email header analysis.
HeaderHawk is a specialized MCP server designed to help security analysts, cybersecurity professionals, and organizations detect and analyze phishing attempts, malicious emails, and security threats through deep email header analysis and threat intelligence integration.
Key Features:
pip install headerhawk
git clone https://github.com/nervpeng/headerhawk.git
cd headerhawk
pip install -e .
Install HeaderHawk:
pip install headerhawk
Configure Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"headerhawk": {
"command": "headerhawk-mcp",
"env": {
"VIRUSTOTAL_API_KEY": "your_virustotal_api_key_here"
}
}
}
}
Restart Claude Desktop and start analyzing emails!
# Analyze an email for phishing indicators
headerhawk analyze /path/to/email.eml
# Extract IoCs from an email
headerhawk extract-iocs /path/to/email.eml
# Scan extracted indicators with VirusTotal
headerhawk scan-virustotal /path/to/email.eml
analyze_email(file_path: str)Performs comprehensive phishing analysis on an email file.
Input:
file_path: Path to .eml fileReturns:
Example:
from headerhawk import analyze_email
result = analyze_email("suspicious_email.eml")
print(f"Risk Level: {result['risk_level']}")
print(f"Indicators Found: {result['phishing_indicators']}")
print(f"Malware Detected: {result.get('malware_indicators', [])}")
Real-World Example Output:
Risk Level: CRITICAL
Verdict: MALICIOUS - Business Email Compromise with Malware
Phishing Indicators Found:
1. Spoofed Domain Authority (morecft.shop) - CRITICAL
2. Generic Business Greeting ("Good day") - HIGH
3. Urgency Pattern (RFQ Request) - MEDIUM
4. Suspicious Attachment Format (.7z archive) - CRITICAL
5. Base64-Encoded Payload - CRITICAL
Authentication:
- DKIM: PASS (but domain is malicious)
- SPF: PASS (but sender is spoofed)
- DMARC: PASS (policy bypass)
Malware Indicators:
- .7z compressed archive containing VBS script
- File: Invoice.vbs
- Payload: Base64-encoded executable
- Likely Attack: Ransomware/Trojan deployment
Recommended Action: QUARANTINE & DELETE
extract_iocs(file_path: str)Extracts Indicators of Compromise from email content and headers.
Input:
file_path: Path to .eml fileReturns:
Example:
from headerhawk import extract_iocs
iocs = extract_iocs("email.eml")
print(f"URLs: {iocs['urls']}")
print(f"Domains: {iocs['domains']}")
print(f"IPs: {iocs['ips']}")
print(f"Attachments: {iocs.get('attachments', [])}")
Real-World Example Output:
{
"domains": ["[redacted].shop"],
"ips": ["[redacted]"],
"emails": ["postmaster@[redacted].shop", "Mr. Andy <postmaster@[redacted].shop>"],
"attachments": [
{
"filename": "Request for Quotation (RFQ) - 3949483.7z",
"type": ".7z",
"risk": "CRITICAL",
"encoding": "base64",
"size_kb": "~100"
}
],
"mail_server": "[redacted].[redacted].shop",
"sender_ip": "[redacted]"
}
scan_with_virustotal(file_path: str)Scans extracted IoCs against VirusTotal threat intelligence database.
Input:
file_path: Path to .eml fileVIRUSTOTAL_API_KEYReturns:
Example:
from headerhawk import scan_with_virustotal
results = scan_with_virustotal("email.eml")
for ioc, verdict in results.items():
print(f"{ioc}: {verdict['detection_ratio']}")
print(f" Verdict: {verdict['verdict']}")
print(f" Categories: {verdict.get('categories', [])}")
HeaderHawk analyzes emails for 25+ phishing and malware indicators including:
Authentication Failures
Header Anomalies
Content Analysis
Infrastructure Indicators
Technical Indicators
Malware Detection
✅ Risk Level: LOW
Verdict: LEGITIMATE
Indicators:
- Valid DKIM/SPF/DMARC: ✓
- Known sender domain: [redacted].com
- Legitimate business (Music Festival)
- Clear unsubscribe mechanism
- Standard Mailchimp template
- No suspicious attachments
🚨 Risk Level: CRITICAL
Verdict: MALICIOUS - BEC with Malware
Indicators:
- Spoofed domain: [redacted].shop (newly registered)
- Generic greeting: "Good day"
- Business request (RFQ) for credibility
- Urgent tone: "awaiting your esteemed offer"
- .7z attachment with VBS payload
- Base64-encoded malware
- Bulletproof hosting IP: [redacted]
- Deprecated DKIM algorithm (RSA-SHA1)
Recommended Action: QUARANTINE & DELETE
User: "Analyze this suspicious email for me"
Claude: Uses HeaderHawk to extract IoCs and phishing indicators
Claude: "I found X phishing indicators including: [list]"
Claude: "Risk Level: [CRITICAL/HIGH/MEDIUM/LOW]"
Claude: "Recommended Action: [QUARANTINE/DELETE/REVIEW/SAFE]"
When used with Claude or other MCP-compatible clients:
# VirusTotal API Key (required for threat scanning)
export VIRUSTOTAL_API_KEY="your_api_key_here"
# Optional: API rate limiting
export VIRUSTOTAL_RATE_LIMIT="4" # requests per minute
# Optional: Output format
export OUTPUT_FORMAT="json" # or "text" (default)
# Optional: Threat level thresholds
export CRITICAL_THRESHOLD="0.8"
export HIGH_THRESHOLD="0.6"
Create ~/.headerhawk/config.json:
{
"virustotal": {
"api_key": "your_api_key",
"rate_limit": 4,
"timeout": 30
},
"analysis": {
"check_authentication": true,
"extract_urls": true,
"check_phishing_keywords": true,
"detect_malware": true,
"check_attachment_types": true
},
"threat_levels": {
"critical_threshold": 0.8,
"high_threshold": 0.6,
"medium_threshold": 0.4
}
}
{
"email_metadata": {
"from": "[email protected]",
"to": ["[email protected]"],
"date": "2026-01-08T13:30:49Z",
"subject": "[Important] Invoice (Due: TODAY at 10pm ET)"
},
"authentication": {
"dkim": "PASS",
"spf": "PASS",
"dmarc": "PASS",
"dkim_algorithm": "rsa-sha256"
},
"phishing_indicators": [
{
"indicator": "valid_dkim",
"severity": "low",
"description": "DKIM signature verified successfully",
"confidence": 0.95
}
],
"malware_indicators": [
{
"type": "suspicious_attachment",
"description": ".7z archive with VBS payload",
"severity": "critical",
"filename": "Document_Invoice.7z",
"payload_type": "VBS script"
}
],
"risk_level": "CRITICAL",
"verdict": "MALICIOUS"
}
{
"urls": [
"https://www.[target1].com/...",
"https://www.[target2].net/..."
],
"domains": [
"[target1].com",
"[target2].com"
],
"ips": [
"[redacted]"
],
"emails": [
"info@[target1].com"
],
"attachments": [
{
"filename": "document.7z",
"type": "archive",
"risk_level": "high",
"encoding": "base64"
}
]
}
Quickly triage and analyze suspicious emails in bulk with confidence scoring and automated threat intelligence lookup. Identify malware campaigns and BEC attempts in seconds.
Integrate HeaderHawk into security information and event management (SIEM) systems for automated email threat detection and alerting.
Extract and analyze phishing campaigns with comprehensive IoC extraction, malware payload detection, and threat intelligence correlation.
Deploy HeaderHawk as part of email gateway solutions for real-time phishing detection, malware scanning, and automated quarantine.
Rapidly analyze emails during security incidents with detailed forensic information, malware analysis, and threat assessment for faster response.
Offer HeaderHawk as part of email security services for clients, with automated reports and threat summaries.
# Package and upload to PyPI
python -m pip install --upgrade build twine
python -m build
twine upload dist/*
HeaderHawk is available for submission to the official MCP Registry at mcp-registry.anthropic.com.
To register:
FROM python:3.11-slim
RUN pip install headerhawk
ENV VIRUSTOTAL_API_KEY=your_key
CMD ["headerhawk-mcp"]
apiVersion: apps/v1
kind: Deployment
metadata:
name: headerhawk-mcp
spec:
replicas: 3
template:
spec:
containers:
- name: headerhawk
image: headerhawk:latest
env:
- name: VIRUSTOTAL_API_KEY
valueFrom:
secretKeyRef:
name: headerhawk-secrets
key: api-key
def analyze_email(file_path: str) -> Dict[str, Any]:
"""
Analyze email for phishing indicators and malware.
Args:
file_path: Path to .eml file
Returns:
Dictionary with analysis results including:
- email_metadata
- authentication (DKIM/SPF/DMARC)
- phishing_indicators
- malware_indicators
- risk_level
- verdict
"""
def extract_iocs(file_path: str) -> Dict[str, List[str]]:
"""
Extract Indicators of Compromise from email.
Args:
file_path: Path to .eml file
Returns:
Dictionary containing:
- urls: List of URLs
- domains: List of domains
- ips: List of IP addresses
- emails: List of email addresses
- attachments: List of attachment metadata
- hashes: List of file hashes
"""
def scan_with_virustotal(file_path: str) -> Dict[str, Dict[str, Any]]:
"""
Scan IoCs against VirusTotal threat intelligence.
Args:
file_path: Path to .eml file
Returns:
Dictionary with VirusTotal results for each IoC:
- detection_ratio: e.g., "5/72"
- last_analysis_date
- verdict
- categories
- malware_type
"""
| Operation | Typical Time | Notes |
|---|---|---|
| Email Analysis | 50-200ms | Local processing only |
| IoCs Extraction | 30-100ms | Includes regex parsing + attachment analysis |
| VirusTotal Scan | 1-5s per IoC | Depends on API rate limits |
| Malware Detection | 100-300ms | Payload analysis and pattern matching |
| Full Pipeline | 2-10s | Complete analysis with threats + VT lookup |
Error: "API key invalid or rate limit exceeded"
Solution: Check VIRUSTOTAL_API_KEY environment variable and request limits
Error: "File not found at path"
Solution: Ensure .eml file exists and path is absolute or relative from current directory
Error: "Unable to parse email"
Solution: Verify file is valid .eml format (SMTP mail with CRLF line terminators)
Error: "Payload analysis incomplete"
Solution: Ensure email includes attachments and they are properly encoded (base64/quoted-printable)
Contributions are welcome! Areas for improvement:
git clone https://github.com/nervpeng/headerhawk.git
cd headerhawk
pip install -e ".[dev]"
pytest # Run tests
pytest tests/ -v
pytest tests/ --cov=headerhawk # With coverage
pytest tests/test_malware_detection.py -v # Malware detection tests
MIT License - See LICENSE file for details
Made with 🦅 for cybersecurity professionals
For questions or support, reach out through GitHub Issues or community channels.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"headerhawk": {
"command": "npx",
"args": []
}
}
}