# Email Analytics
Reads emails from Outlook and Gmail MCP servers, groups them by sender domain, and learns folder organization rules through interactive user feedback. Applies learned rules automatically on future runs — gets smarter every time.
## How It Works
The agent connects to the Outlook MCP and Gmail MCP servers simultaneously. It reads unread emails, groups them by sender domain, and presents each group to the user interactively. You tell it which folder each group belongs to; the agent persists this as a rule in rules.json. On the next run, it auto-applies all known rules and only prompts for new senders.
Email Analytics Agent
├── Outlook MCP Server ──▶ inbox emails
├── Gmail MCP Server ──▶ inbox emails
├── Group by sender domain
├── Load rules.json (learned rules)
├── Auto-apply known rules
└── Prompt for unknown senders ──▶ save to rules.json## Screenshots
❯ node dist/agent.js Connecting to Outlook MCP... ✓ Connecting to Gmail MCP... ✓ Loaded 12 learned rules Auto-applied to 47 emails Unknown senders (3 groups): ┌─────────────────────────────────┐ │ github.com (12 emails) │ │ newsletter.co (8 emails) │ │ no-reply@stripe.com (3 emails) │ └─────────────────────────────────┘
Where to move emails from github.com? > Dev / GitHub ✓ Rule saved: github.com → Dev / GitHub Where to move emails from newsletter.co? > Newsletters ✓ Rule saved: newsletter.co → Newsletters ✓ 3 rules learned · 23 emails moved Next run: 70 emails will be auto-processed
## Features
- +Multi-account: Outlook + Gmail
- +Groups emails by sender domain
- +Interactive rule learning
- +Auto-applies rules on future runs
- +Persistent rules.json storage
## vs. The Field
| Feature | Email Analytics | SaneBox | Manual sorting |
|---|---|---|---|
| Multi-account (Outlook + Gmail) | ✓ | ✓ | ✓ |
| Rule learning from feedback | ✓ | ✓ | ✗ |
| MCP integration | ✓ | ✗ | ✗ |
| Free / open source | ✓ | paid | free |
| Auto-applies learned rules | ✓ | ✓ | ✗ |
## Installation
Set up email MCP servers
Install and configure the Outlook MCP and/or Gmail MCP servers from this ecosystem.
⚠ See the Outlook MCP Server and Gmail MCP Server project pages for setup instructions.
Install the agent
npm install npm run build
Configure MCP connections
Edit config.json to point to your running email MCP servers.
{
"servers": {
"outlook": { "command": "npx", "args": ["-y", "@web4w3/install", "outlook"] },
"gmail": { "command": "npx", "args": ["-y", "@web4w3/install", "gmail"] }
}
}Run the agent
Interactive on first run; subsequent runs auto-apply all learned rules.
node dist/agent.js