n8n-nodes-spamassassin-mcp
v1.1.11
Published
n8n community node for SpamAssassin MCP server integration
Maintainers
Readme
n8n-nodes-spamassassin-mcp
An n8n community node that integrates with the SpamAssassin MCP server to provide powerful email spam analysis capabilities within your n8n workflows.
Features
This node provides four main operations for email security analysis:
🔍 Scan Email
- Analyze email content for spam probability
- Configurable analysis levels (Basic, Detailed, Full)
- Include/exclude header analysis
- Returns spam score, confidence, and triggered rules
🛡️ Check Reputation
- Check sender email reputation
- Verify IP address reputation (optional)
- Domain reputation analysis (optional)
- Blacklist checking across multiple sources
🧪 Test Rules
- Test custom SpamAssassin rules
- Validate rule syntax and effectiveness
- Score individual rule contributions
- Detailed test result breakdown
📊 Explain Score
- Detailed spam score breakdown
- Rule-by-rule explanation
- Categorized analysis
- Actionable recommendations
Installation
Prerequisites
SpamAssassin MCP Server: Install the SpamAssassin MCP server first:
npm install -g @btafoya/spamassassin-mcpn8n: This is a community node for n8n. You need n8n installed:
npm install n8n -g
Install the Community Node
Via npm (recommended):
npm install n8n-nodes-spamassassin-mcpVia n8n Community Nodes UI:
- Go to Settings → Community Nodes
- Click "Install a community node"
- Enter:
n8n-nodes-spamassassin-mcp - Click Install
For Development:
git clone https://github.com/btafoya/spamassassin-mcp-n8n-community-node.git cd spamassassin-mcp-n8n-community-node npm install npm run build npm link cd ~/.n8n/nodes npm link n8n-nodes-spamassassin-mcp
Configuration
Credentials Setup
The node requires SpamAssassin MCP API credentials. You can connect in two ways:
1. Command Line Connection (Recommended)
- Connection Type: Command Line
- Command:
npx @btafoya/spamassassin-mcp(default) - Arguments: Additional command line arguments (optional)
- Timeout: Connection timeout in seconds (default: 30)
2. HTTP/SSE Connection
- Connection Type: HTTP/SSE
- Base URL:
http://localhost:3000(default) - API Key: Authentication key (if required)
- Timeout: Connection timeout in seconds (default: 30)
Enable Community Node Tool Usage
If you want to use this node as a tool in n8n AI Agents, enable the community node tool usage:
export N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
n8n startOr in your .env file:
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=trueUsage Examples
Basic Email Spam Scanning
- Add the SpamAssassin MCP node to your workflow
- Set operation to "Scan Email"
- Provide email content in the "Email Content" field
- Configure analysis level (Basic/Detailed/Full)
- Execute the workflow
Example Input:
Subject: Amazing Deal - Limited Time Offer!
From: [email protected]
Congratulations! You've won $1,000,000!
Click here to claim your prize now!Example Output:
{
"operation": "scan_email",
"scanResult": {
"is_spam": true,
"spam_score": 15.2,
"threshold": 5.0,
"confidence": 0.95,
"rules_triggered": [
"LOTS_OF_MONEY",
"SUSPICIOUS_DOMAIN",
"URGENT_ACTION"
],
"analysis_time_ms": 245,
"headers_analyzed": true
},
"timestamp": "2024-01-15T10:30:00.000Z"
}Reputation Checking
Perfect for validating sender trustworthiness:
- Set operation to "Check Reputation"
- Enter the email address to check
- Optionally add IP address and domain
- Execute to get reputation scores
Custom Rule Testing
Test your own SpamAssassin rules:
- Set operation to "Test Rules"
- Enter your custom rules in "Rules Content"
- Provide test email content
- Get detailed test results and rule effectiveness
Score Explanation
Understand why an email was marked as spam:
- Set operation to "Explain Score"
- Provide the email content
- Enable detailed explanation if needed
- Get rule-by-rule breakdown
Workflow Integration
Email Processing Pipeline
Email Trigger → SpamAssassin MCP (Scan) → Router → [Clean Email Path / Quarantine Path]Reputation-Based Filtering
New Contact → SpamAssassin MCP (Check Reputation) → Decision → [Allow / Block / Monitor]Rule Development Workflow
Rule Editor → SpamAssassin MCP (Test Rules) → Validation → [Deploy / Refine]Advanced Configuration
Performance Tuning
- Timeout: Adjust based on your email size and analysis complexity
- Analysis Level: Use "Basic" for high-volume processing, "Full" for detailed analysis
- Connection Type: Command line is generally faster for local setups
Security Considerations
- Defensive Operations Only: This node performs only defensive email analysis
- No Email Storage: Emails are not persistently stored by the MCP server
- Rate Limiting: The MCP server includes built-in rate limiting
- Input Validation: All inputs are validated before processing
Docker Integration
If using n8n in Docker, ensure the SpamAssassin MCP server is accessible:
version: '3'
services:
n8n:
image: n8nio/n8n
environment:
- N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
volumes:
- ~/.n8n:/home/node/.n8n
depends_on:
- spamassassin-mcp
spamassassin-mcp:
image: btafoya/spamassassin-mcp
ports:
- "3000:3000"Error Handling
The node includes comprehensive error handling:
- Connection Errors: Automatic retry with exponential backoff
- Timeout Handling: Configurable timeouts with graceful degradation
- Validation Errors: Clear error messages for invalid inputs
- Continue on Fail: Optional continue-on-fail for batch processing
Troubleshooting
Common Issues
"Connection Failed"
- Verify SpamAssassin MCP server is running
- Check connection credentials
- Ensure network connectivity
"Command Not Found"
- Install SpamAssassin MCP server:
npm install -g @btafoya/spamassassin-mcp - Verify PATH includes npm global binaries
- Install SpamAssassin MCP server:
"Permission Denied"
- Check file permissions
- Ensure n8n has access to execute commands
"Timeout Error"
- Increase timeout in credentials
- Check system resources
- Reduce analysis complexity
Debug Mode
Enable debug logging in credentials to get detailed connection information.
Contributing
Contributions are welcome! Please read our Contributing Guidelines for details.
Development Setup
git clone https://github.com/btafoya/spamassassin-mcp-n8n-community-node.git
cd spamassassin-mcp-n8n-community-node
npm install
npm run build
npm run lint
npm testLicense
MIT License - see LICENSE file for details.
Related Projects
- SpamAssassin MCP Server - The underlying MCP server
- n8n - Workflow automation platform
- Model Context Protocol - Protocol for AI-tool integration
Support
- 📚 Documentation
- 🐛 Bug Reports
- 💬 Discussions
- 📧 Email: [email protected]
