@diskd-ai/email-mcp 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/LICENSE +155 -0
  2. package/README.md +820 -0
  3. package/dist/cli/account-commands.d.ts +10 -0
  4. package/dist/cli/account-commands.d.ts.map +1 -0
  5. package/dist/cli/account-commands.js +703 -0
  6. package/dist/cli/account-commands.js.map +1 -0
  7. package/dist/cli/config-commands.d.ts +9 -0
  8. package/dist/cli/config-commands.d.ts.map +1 -0
  9. package/dist/cli/config-commands.js +156 -0
  10. package/dist/cli/config-commands.js.map +1 -0
  11. package/dist/cli/guard.d.ts +11 -0
  12. package/dist/cli/guard.d.ts.map +1 -0
  13. package/dist/cli/guard.js +18 -0
  14. package/dist/cli/guard.js.map +1 -0
  15. package/dist/cli/install-commands.d.ts +12 -0
  16. package/dist/cli/install-commands.d.ts.map +1 -0
  17. package/dist/cli/install-commands.js +320 -0
  18. package/dist/cli/install-commands.js.map +1 -0
  19. package/dist/cli/notify.d.ts +8 -0
  20. package/dist/cli/notify.d.ts.map +1 -0
  21. package/dist/cli/notify.js +143 -0
  22. package/dist/cli/notify.js.map +1 -0
  23. package/dist/cli/providers.d.ts +13 -0
  24. package/dist/cli/providers.d.ts.map +1 -0
  25. package/dist/cli/providers.js +180 -0
  26. package/dist/cli/providers.js.map +1 -0
  27. package/dist/cli/scheduler.d.ts +8 -0
  28. package/dist/cli/scheduler.d.ts.map +1 -0
  29. package/dist/cli/scheduler.js +268 -0
  30. package/dist/cli/scheduler.js.map +1 -0
  31. package/dist/cli/setup.d.ts +12 -0
  32. package/dist/cli/setup.d.ts.map +1 -0
  33. package/dist/cli/setup.js +15 -0
  34. package/dist/cli/setup.js.map +1 -0
  35. package/dist/cli/test.d.ts +7 -0
  36. package/dist/cli/test.d.ts.map +1 -0
  37. package/dist/cli/test.js +67 -0
  38. package/dist/cli/test.js.map +1 -0
  39. package/dist/config/loader.d.ts +34 -0
  40. package/dist/config/loader.d.ts.map +1 -0
  41. package/dist/config/loader.js +339 -0
  42. package/dist/config/loader.js.map +1 -0
  43. package/dist/config/schema.d.ts +351 -0
  44. package/dist/config/schema.d.ts.map +1 -0
  45. package/dist/config/schema.js +165 -0
  46. package/dist/config/schema.js.map +1 -0
  47. package/dist/config/xdg.d.ts +27 -0
  48. package/dist/config/xdg.d.ts.map +1 -0
  49. package/dist/config/xdg.js +30 -0
  50. package/dist/config/xdg.js.map +1 -0
  51. package/dist/connections/manager.d.ts +42 -0
  52. package/dist/connections/manager.d.ts.map +1 -0
  53. package/dist/connections/manager.js +266 -0
  54. package/dist/connections/manager.js.map +1 -0
  55. package/dist/connections/types.d.ts +13 -0
  56. package/dist/connections/types.d.ts.map +1 -0
  57. package/dist/connections/types.js +2 -0
  58. package/dist/connections/types.js.map +1 -0
  59. package/dist/logging.d.ts +46 -0
  60. package/dist/logging.d.ts.map +1 -0
  61. package/dist/logging.js +63 -0
  62. package/dist/logging.js.map +1 -0
  63. package/dist/main.d.ts +13 -0
  64. package/dist/main.d.ts.map +1 -0
  65. package/dist/main.js +206 -0
  66. package/dist/main.js.map +1 -0
  67. package/dist/prompts/actions.prompt.d.ts +9 -0
  68. package/dist/prompts/actions.prompt.d.ts.map +1 -0
  69. package/dist/prompts/actions.prompt.js +64 -0
  70. package/dist/prompts/actions.prompt.js.map +1 -0
  71. package/dist/prompts/calendar.prompt.d.ts +9 -0
  72. package/dist/prompts/calendar.prompt.d.ts.map +1 -0
  73. package/dist/prompts/calendar.prompt.js +55 -0
  74. package/dist/prompts/calendar.prompt.js.map +1 -0
  75. package/dist/prompts/cleanup.prompt.d.ts +9 -0
  76. package/dist/prompts/cleanup.prompt.d.ts.map +1 -0
  77. package/dist/prompts/cleanup.prompt.js +78 -0
  78. package/dist/prompts/cleanup.prompt.js.map +1 -0
  79. package/dist/prompts/compose.prompt.d.ts +8 -0
  80. package/dist/prompts/compose.prompt.d.ts.map +1 -0
  81. package/dist/prompts/compose.prompt.js +116 -0
  82. package/dist/prompts/compose.prompt.js.map +1 -0
  83. package/dist/prompts/register.d.ts +8 -0
  84. package/dist/prompts/register.d.ts.map +1 -0
  85. package/dist/prompts/register.js +20 -0
  86. package/dist/prompts/register.js.map +1 -0
  87. package/dist/prompts/thread.prompt.d.ts +9 -0
  88. package/dist/prompts/thread.prompt.d.ts.map +1 -0
  89. package/dist/prompts/thread.prompt.js +58 -0
  90. package/dist/prompts/thread.prompt.js.map +1 -0
  91. package/dist/prompts/triage.prompt.d.ts +9 -0
  92. package/dist/prompts/triage.prompt.d.ts.map +1 -0
  93. package/dist/prompts/triage.prompt.js +64 -0
  94. package/dist/prompts/triage.prompt.js.map +1 -0
  95. package/dist/resources/accounts.resource.d.ts +9 -0
  96. package/dist/resources/accounts.resource.d.ts.map +1 -0
  97. package/dist/resources/accounts.resource.js +26 -0
  98. package/dist/resources/accounts.resource.js.map +1 -0
  99. package/dist/resources/mailboxes.resource.d.ts +10 -0
  100. package/dist/resources/mailboxes.resource.d.ts.map +1 -0
  101. package/dist/resources/mailboxes.resource.js +33 -0
  102. package/dist/resources/mailboxes.resource.js.map +1 -0
  103. package/dist/resources/register.d.ts +12 -0
  104. package/dist/resources/register.d.ts.map +1 -0
  105. package/dist/resources/register.js +20 -0
  106. package/dist/resources/register.js.map +1 -0
  107. package/dist/resources/scheduled.resource.d.ts +9 -0
  108. package/dist/resources/scheduled.resource.d.ts.map +1 -0
  109. package/dist/resources/scheduled.resource.js +31 -0
  110. package/dist/resources/scheduled.resource.js.map +1 -0
  111. package/dist/resources/stats.resource.d.ts +10 -0
  112. package/dist/resources/stats.resource.d.ts.map +1 -0
  113. package/dist/resources/stats.resource.js +45 -0
  114. package/dist/resources/stats.resource.js.map +1 -0
  115. package/dist/resources/templates.resource.d.ts +9 -0
  116. package/dist/resources/templates.resource.d.ts.map +1 -0
  117. package/dist/resources/templates.resource.js +34 -0
  118. package/dist/resources/templates.resource.js.map +1 -0
  119. package/dist/resources/unread.resource.d.ts +11 -0
  120. package/dist/resources/unread.resource.d.ts.map +1 -0
  121. package/dist/resources/unread.resource.js +46 -0
  122. package/dist/resources/unread.resource.js.map +1 -0
  123. package/dist/safety/audit.d.ts +17 -0
  124. package/dist/safety/audit.d.ts.map +1 -0
  125. package/dist/safety/audit.js +50 -0
  126. package/dist/safety/audit.js.map +1 -0
  127. package/dist/safety/rate-limiter.d.ts +22 -0
  128. package/dist/safety/rate-limiter.d.ts.map +1 -0
  129. package/dist/safety/rate-limiter.js +52 -0
  130. package/dist/safety/rate-limiter.js.map +1 -0
  131. package/dist/safety/validation.d.ts +44 -0
  132. package/dist/safety/validation.d.ts.map +1 -0
  133. package/dist/safety/validation.js +113 -0
  134. package/dist/safety/validation.js.map +1 -0
  135. package/dist/server.d.ts +10 -0
  136. package/dist/server.d.ts.map +1 -0
  137. package/dist/server.js +25 -0
  138. package/dist/server.js.map +1 -0
  139. package/dist/services/calendar.service.d.ts +22 -0
  140. package/dist/services/calendar.service.d.ts.map +1 -0
  141. package/dist/services/calendar.service.js +115 -0
  142. package/dist/services/calendar.service.js.map +1 -0
  143. package/dist/services/event-bus.d.ts +28 -0
  144. package/dist/services/event-bus.d.ts.map +1 -0
  145. package/dist/services/event-bus.js +16 -0
  146. package/dist/services/event-bus.js.map +1 -0
  147. package/dist/services/hooks.service.d.ts +77 -0
  148. package/dist/services/hooks.service.d.ts.map +1 -0
  149. package/dist/services/hooks.service.js +498 -0
  150. package/dist/services/hooks.service.js.map +1 -0
  151. package/dist/services/imap.service.d.ts +133 -0
  152. package/dist/services/imap.service.d.ts.map +1 -0
  153. package/dist/services/imap.service.js +1393 -0
  154. package/dist/services/imap.service.js.map +1 -0
  155. package/dist/services/label-strategy.d.ts +20 -0
  156. package/dist/services/label-strategy.d.ts.map +1 -0
  157. package/dist/services/label-strategy.js +237 -0
  158. package/dist/services/label-strategy.js.map +1 -0
  159. package/dist/services/local-calendar.service.d.ts +126 -0
  160. package/dist/services/local-calendar.service.d.ts.map +1 -0
  161. package/dist/services/local-calendar.service.js +428 -0
  162. package/dist/services/local-calendar.service.js.map +1 -0
  163. package/dist/services/notifier.service.d.ts +69 -0
  164. package/dist/services/notifier.service.d.ts.map +1 -0
  165. package/dist/services/notifier.service.js +319 -0
  166. package/dist/services/notifier.service.js.map +1 -0
  167. package/dist/services/oauth.service.d.ts +47 -0
  168. package/dist/services/oauth.service.d.ts.map +1 -0
  169. package/dist/services/oauth.service.js +140 -0
  170. package/dist/services/oauth.service.js.map +1 -0
  171. package/dist/services/presets.d.ts +36 -0
  172. package/dist/services/presets.d.ts.map +1 -0
  173. package/dist/services/presets.js +173 -0
  174. package/dist/services/presets.js.map +1 -0
  175. package/dist/services/reminders.service.d.ts +63 -0
  176. package/dist/services/reminders.service.d.ts.map +1 -0
  177. package/dist/services/reminders.service.js +281 -0
  178. package/dist/services/reminders.service.js.map +1 -0
  179. package/dist/services/scheduler.service.d.ts +42 -0
  180. package/dist/services/scheduler.service.d.ts.map +1 -0
  181. package/dist/services/scheduler.service.js +260 -0
  182. package/dist/services/scheduler.service.js.map +1 -0
  183. package/dist/services/smtp.service.d.ts +40 -0
  184. package/dist/services/smtp.service.d.ts.map +1 -0
  185. package/dist/services/smtp.service.js +151 -0
  186. package/dist/services/smtp.service.js.map +1 -0
  187. package/dist/services/template.service.d.ts +33 -0
  188. package/dist/services/template.service.d.ts.map +1 -0
  189. package/dist/services/template.service.js +123 -0
  190. package/dist/services/template.service.js.map +1 -0
  191. package/dist/services/watcher.service.d.ts +36 -0
  192. package/dist/services/watcher.service.d.ts.map +1 -0
  193. package/dist/services/watcher.service.js +241 -0
  194. package/dist/services/watcher.service.js.map +1 -0
  195. package/dist/tools/accounts.tool.d.ts +7 -0
  196. package/dist/tools/accounts.tool.d.ts.map +1 -0
  197. package/dist/tools/accounts.tool.js +29 -0
  198. package/dist/tools/accounts.tool.js.map +1 -0
  199. package/dist/tools/analytics.tool.d.ts +9 -0
  200. package/dist/tools/analytics.tool.d.ts.map +1 -0
  201. package/dist/tools/analytics.tool.js +27 -0
  202. package/dist/tools/analytics.tool.js.map +1 -0
  203. package/dist/tools/attachments.tool.d.ts +7 -0
  204. package/dist/tools/attachments.tool.d.ts.map +1 -0
  205. package/dist/tools/attachments.tool.js +45 -0
  206. package/dist/tools/attachments.tool.js.map +1 -0
  207. package/dist/tools/bulk.tool.d.ts +7 -0
  208. package/dist/tools/bulk.tool.d.ts.map +1 -0
  209. package/dist/tools/bulk.tool.js +75 -0
  210. package/dist/tools/bulk.tool.js.map +1 -0
  211. package/dist/tools/calendar.tool.d.ts +19 -0
  212. package/dist/tools/calendar.tool.d.ts.map +1 -0
  213. package/dist/tools/calendar.tool.js +538 -0
  214. package/dist/tools/calendar.tool.js.map +1 -0
  215. package/dist/tools/contacts.tool.d.ts +7 -0
  216. package/dist/tools/contacts.tool.d.ts.map +1 -0
  217. package/dist/tools/contacts.tool.js +44 -0
  218. package/dist/tools/contacts.tool.js.map +1 -0
  219. package/dist/tools/drafts.tool.d.ts +8 -0
  220. package/dist/tools/drafts.tool.d.ts.map +1 -0
  221. package/dist/tools/drafts.tool.js +92 -0
  222. package/dist/tools/drafts.tool.js.map +1 -0
  223. package/dist/tools/emails.tool.d.ts +7 -0
  224. package/dist/tools/emails.tool.d.ts.map +1 -0
  225. package/dist/tools/emails.tool.js +400 -0
  226. package/dist/tools/emails.tool.js.map +1 -0
  227. package/dist/tools/folders.tool.d.ts +7 -0
  228. package/dist/tools/folders.tool.d.ts.map +1 -0
  229. package/dist/tools/folders.tool.js +111 -0
  230. package/dist/tools/folders.tool.js.map +1 -0
  231. package/dist/tools/health.tool.d.ts +10 -0
  232. package/dist/tools/health.tool.d.ts.map +1 -0
  233. package/dist/tools/health.tool.js +78 -0
  234. package/dist/tools/health.tool.js.map +1 -0
  235. package/dist/tools/label.tool.d.ts +11 -0
  236. package/dist/tools/label.tool.d.ts.map +1 -0
  237. package/dist/tools/label.tool.js +165 -0
  238. package/dist/tools/label.tool.js.map +1 -0
  239. package/dist/tools/locate.tool.d.ts +11 -0
  240. package/dist/tools/locate.tool.d.ts.map +1 -0
  241. package/dist/tools/locate.tool.js +59 -0
  242. package/dist/tools/locate.tool.js.map +1 -0
  243. package/dist/tools/mailboxes.tool.d.ts +7 -0
  244. package/dist/tools/mailboxes.tool.d.ts.map +1 -0
  245. package/dist/tools/mailboxes.tool.js +38 -0
  246. package/dist/tools/mailboxes.tool.js.map +1 -0
  247. package/dist/tools/manage.tool.d.ts +7 -0
  248. package/dist/tools/manage.tool.d.ts.map +1 -0
  249. package/dist/tools/manage.tool.js +125 -0
  250. package/dist/tools/manage.tool.js.map +1 -0
  251. package/dist/tools/register.d.ts +20 -0
  252. package/dist/tools/register.d.ts.map +1 -0
  253. package/dist/tools/register.js +53 -0
  254. package/dist/tools/register.js.map +1 -0
  255. package/dist/tools/scheduler.tool.d.ts +9 -0
  256. package/dist/tools/scheduler.tool.d.ts.map +1 -0
  257. package/dist/tools/scheduler.tool.js +104 -0
  258. package/dist/tools/scheduler.tool.js.map +1 -0
  259. package/dist/tools/send.tool.d.ts +7 -0
  260. package/dist/tools/send.tool.d.ts.map +1 -0
  261. package/dist/tools/send.tool.js +123 -0
  262. package/dist/tools/send.tool.js.map +1 -0
  263. package/dist/tools/templates.tool.d.ts +12 -0
  264. package/dist/tools/templates.tool.d.ts.map +1 -0
  265. package/dist/tools/templates.tool.js +140 -0
  266. package/dist/tools/templates.tool.js.map +1 -0
  267. package/dist/tools/thread.tool.d.ts +10 -0
  268. package/dist/tools/thread.tool.d.ts.map +1 -0
  269. package/dist/tools/thread.tool.js +146 -0
  270. package/dist/tools/thread.tool.js.map +1 -0
  271. package/dist/tools/watcher.tool.d.ts +9 -0
  272. package/dist/tools/watcher.tool.d.ts.map +1 -0
  273. package/dist/tools/watcher.tool.js +282 -0
  274. package/dist/tools/watcher.tool.js.map +1 -0
  275. package/dist/types/index.d.ts +271 -0
  276. package/dist/types/index.d.ts.map +1 -0
  277. package/dist/types/index.js +5 -0
  278. package/dist/types/index.js.map +1 -0
  279. package/dist/utils/calendar-notes.d.ts +31 -0
  280. package/dist/utils/calendar-notes.d.ts.map +1 -0
  281. package/dist/utils/calendar-notes.js +99 -0
  282. package/dist/utils/calendar-notes.js.map +1 -0
  283. package/dist/utils/calendar-state.d.ts +27 -0
  284. package/dist/utils/calendar-state.d.ts.map +1 -0
  285. package/dist/utils/calendar-state.js +85 -0
  286. package/dist/utils/calendar-state.js.map +1 -0
  287. package/dist/utils/conference-details.d.ts +12 -0
  288. package/dist/utils/conference-details.d.ts.map +1 -0
  289. package/dist/utils/conference-details.js +71 -0
  290. package/dist/utils/conference-details.js.map +1 -0
  291. package/dist/utils/meeting-url.d.ts +10 -0
  292. package/dist/utils/meeting-url.d.ts.map +1 -0
  293. package/dist/utils/meeting-url.js +30 -0
  294. package/dist/utils/meeting-url.js.map +1 -0
  295. package/package.json +108 -0
package/README.md ADDED
@@ -0,0 +1,820 @@
1
+ # Email MCP Server
2
+
3
+ [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
4
+ [![license](https://img.shields.io/github/license/codefuturist/email-mcp.svg?style=flat-square)](LICENSE)
5
+ [![npm version](https://img.shields.io/npm/v/@codefuturist/email-mcp.svg?style=flat-square)](https://www.npmjs.com/package/@codefuturist/email-mcp)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@codefuturist/email-mcp.svg?style=flat-square)](https://www.npmjs.com/package/@codefuturist/email-mcp)
7
+ [![CI](https://img.shields.io/github/actions/workflow/status/codefuturist/email-mcp/ci.yml?branch=main&style=flat-square&label=CI)](https://github.com/codefuturist/email-mcp/actions/workflows/ci.yml)
8
+
9
+ An MCP (Model Context Protocol) server providing comprehensive email capabilities via IMAP and SMTP.
10
+
11
+ Enables AI assistants to read, search, send, manage, schedule, and analyze emails across multiple accounts. Exposes 47 tools, 7 prompts, and 6 resources over the MCP protocol with OAuth2 support _(experimental)_, email scheduling, calendar extraction, analytics, provider-aware label management, real-time IMAP IDLE watcher with AI-powered triage, customizable presets and static rules, and a guided setup wizard.
12
+
13
+ ## Highlights
14
+
15
+ | Feature | email-mcp | Typical MCP email |
16
+ |---------|:---------:|:-----------------:|
17
+ | Multi-account | ✅ | ❌ |
18
+ | Send / reply / forward | ✅ | ✅ |
19
+ | Drafts & templates | ✅ | ❌ |
20
+ | Labels & bulk ops | ✅ provider-aware | ❌ |
21
+ | Schedule future emails | ✅ | ❌ |
22
+ | Real-time IMAP IDLE watcher | ✅ | ❌ |
23
+ | AI triage with presets | ✅ | ❌ |
24
+ | Desktop & webhook alerts | ✅ | ❌ |
25
+ | Calendar (ICS) extraction | ✅ | ❌ |
26
+ | Email analytics | ✅ | ❌ |
27
+ | OAuth2 (Gmail / M365) | ✅ _experimental_ | ❌ |
28
+ | Guided setup wizard | ✅ auto-detect | ❌ |
29
+
30
+ ## Table of Contents
31
+
32
+ - [Highlights](#highlights)
33
+ - [Security](#security)
34
+ - [Background](#background)
35
+ - [Install](#install)
36
+ - [Usage](#usage)
37
+ - [API](#api)
38
+ - [Maintainers](#maintainers)
39
+ - [Contributing](#contributing)
40
+ - [License](#license)
41
+
42
+ ## Security
43
+
44
+ - All connections use TLS/STARTTLS encryption
45
+ - Passwords are never logged; audit trail records operations without credentials
46
+ - Token-bucket rate limiter prevents abuse (configurable per account)
47
+ - OAuth2 XOAUTH2 authentication for Gmail and Microsoft 365 _(experimental)_
48
+ - Attachment downloads capped at 5 MB with base64 encoding
49
+
50
+ ## Background
51
+
52
+ Most MCP email implementations provide only basic read/send. This server aims to be a full-featured email client for AI assistants, covering the entire lifecycle: reading, composing, managing, scheduling, and analyzing email — all from a single MCP server.
53
+
54
+ Key design decisions:
55
+
56
+ - **XDG-compliant config** — TOML at `~/.config/email-mcp/config.toml`
57
+ - **Multi-account** — Operate across multiple IMAP/SMTP accounts simultaneously
58
+ - **Layered services** — Business logic is decoupled from MCP wiring for testability
59
+ - **Provider auto-detection** — Gmail, Outlook, Yahoo, iCloud, Fastmail, ProtonMail, Zoho, GMX
60
+
61
+ ## Install
62
+
63
+ Requires Node.js ≥ 22.
64
+
65
+ ```bash
66
+ # Run directly (no install needed)
67
+ npx @codefuturist/email-mcp setup
68
+ # or
69
+ pnpm dlx @codefuturist/email-mcp setup
70
+
71
+ # Or install globally
72
+ npm install -g @codefuturist/email-mcp
73
+ # or
74
+ pnpm add -g @codefuturist/email-mcp
75
+ ```
76
+
77
+ ### Docker
78
+
79
+ No Node.js required — just Docker.
80
+
81
+ ```bash
82
+ # Latest stable release
83
+ docker pull ghcr.io/codefuturist/email-mcp:latest
84
+
85
+ # Pin to an exact version (immutable)
86
+ docker pull ghcr.io/codefuturist/email-mcp:0.2.3
87
+
88
+ # Auto-update patches within a minor version
89
+ docker pull ghcr.io/codefuturist/email-mcp:0.2
90
+
91
+ # Track a major version (won't cross breaking-change boundary)
92
+ docker pull ghcr.io/codefuturist/email-mcp:0
93
+
94
+ # Pin to an exact git commit (immutable, CI traceability)
95
+ docker pull ghcr.io/codefuturist/email-mcp:sha-abc1234
96
+
97
+ # Or build from source
98
+ docker build -t ghcr.io/codefuturist/email-mcp .
99
+ ```
100
+
101
+ > **Tag convention:** Tags follow bare semver (no `v` prefix), matching Docker ecosystem standards (e.g. `node:24`, `nginx:1.25`). The `latest` tag is only updated on stable releases, never pre-releases.
102
+
103
+ > **Note:** The server uses stdio transport. Config must be created on the host first
104
+ > (via `npx @codefuturist/email-mcp setup` or manually) and mounted into the container.
105
+
106
+ ## Usage
107
+
108
+ ### Setup
109
+
110
+ ```bash
111
+ # Add an email account interactively (recommended)
112
+ email-mcp account add
113
+
114
+ # Or use the legacy alias
115
+ email-mcp setup
116
+
117
+ # Or create a template config manually
118
+ email-mcp config init
119
+ ```
120
+
121
+ The setup wizard auto-detects server settings, tests connections, saves config, and outputs the MCP client config snippet.
122
+
123
+ ### Test Connections
124
+
125
+ ```bash
126
+ email-mcp test # all accounts
127
+ email-mcp test personal # specific account
128
+ ```
129
+
130
+ ### Configure Your MCP Client
131
+
132
+ **Recommended — use the guided installer** (auto-detects Claude Desktop, VS Code, Cursor, Windsurf):
133
+
134
+ ```bash
135
+ email-mcp install
136
+ ```
137
+
138
+ Or add manually using the snippets below.
139
+
140
+ <details>
141
+ <summary><strong>Claude Desktop</strong></summary>
142
+
143
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
144
+
145
+ ```json
146
+ {
147
+ "mcpServers": {
148
+ "email": {
149
+ "command": "npx",
150
+ "args": ["-y", "@codefuturist/email-mcp", "stdio"]
151
+ }
152
+ }
153
+ }
154
+ ```
155
+ </details>
156
+
157
+ <details>
158
+ <summary><strong>VS Code (GitHub Copilot)</strong></summary>
159
+
160
+ **Option 1 — Extensions gallery (easiest):**
161
+ 1. Open the Extensions view (<kbd>⇧⌘X</kbd> / <kbd>Ctrl+Shift+X</kbd>)
162
+ 2. Search `@mcp email-mcp`
163
+ 3. Click **Install** (user-wide) or right-click → **Install in Workspace**
164
+
165
+ **Option 2 — Workspace config** (`.vscode/mcp.json`, committed to source control):
166
+
167
+ ```json
168
+ {
169
+ "servers": {
170
+ "email": {
171
+ "type": "stdio",
172
+ "command": "npx",
173
+ "args": ["-y", "@codefuturist/email-mcp", "stdio"]
174
+ }
175
+ }
176
+ }
177
+ ```
178
+
179
+ **Option 3 — User config** (`settings.json`, applies to all workspaces):
180
+
181
+ Open the Command Palette → **Preferences: Open User Settings (JSON)** and add:
182
+
183
+ ```json
184
+ {
185
+ "mcp": {
186
+ "servers": {
187
+ "email": {
188
+ "type": "stdio",
189
+ "command": "npx",
190
+ "args": ["-y", "@codefuturist/email-mcp", "stdio"]
191
+ }
192
+ }
193
+ }
194
+ }
195
+ ```
196
+ </details>
197
+
198
+ <details>
199
+ <summary><strong>Cursor</strong></summary>
200
+
201
+ Edit `~/.cursor/mcp.json`:
202
+
203
+ ```json
204
+ {
205
+ "mcpServers": {
206
+ "email": {
207
+ "command": "npx",
208
+ "args": ["-y", "@codefuturist/email-mcp", "stdio"]
209
+ }
210
+ }
211
+ }
212
+ ```
213
+ </details>
214
+
215
+ <details>
216
+ <summary><strong>Windsurf</strong></summary>
217
+
218
+ Edit `~/.codeium/windsurf/mcp_config.json`:
219
+
220
+ ```json
221
+ {
222
+ "mcpServers": {
223
+ "email": {
224
+ "command": "npx",
225
+ "args": ["-y", "@codefuturist/email-mcp", "stdio"]
226
+ }
227
+ }
228
+ }
229
+ ```
230
+ </details>
231
+
232
+ <details>
233
+ <summary><strong>Zed</strong></summary>
234
+
235
+ Edit `~/.config/zed/settings.json`:
236
+
237
+ ```json
238
+ {
239
+ "context_servers": {
240
+ "email": {
241
+ "command": {
242
+ "path": "npx",
243
+ "args": ["-y", "@codefuturist/email-mcp", "stdio"]
244
+ }
245
+ }
246
+ }
247
+ }
248
+ ```
249
+ </details>
250
+
251
+ <details>
252
+ <summary><strong>Mistral Vibe</strong></summary>
253
+
254
+ Add to `~/.vibe/config.toml`:
255
+
256
+ ```toml
257
+ [[mcp_servers]]
258
+ name = "email-mcp"
259
+ transport = "stdio"
260
+ command = "npx"
261
+ args = ["-y", "@codefuturist/email-mcp", "stdio"]
262
+ ```
263
+
264
+ To pass credentials directly instead of using a config file, use the `env` field:
265
+
266
+ ```toml
267
+ [[mcp_servers]]
268
+ name = "email-mcp"
269
+ transport = "stdio"
270
+ command = "npx"
271
+ args = ["-y", "@codefuturist/email-mcp", "stdio"]
272
+ env = { "EMAIL_ACCOUNTS" = "<your-accounts-json>" }
273
+ ```
274
+
275
+ MCP tools are exposed as `email-mcp_<tool_name>` (e.g. `email-mcp_list_emails`). Restart Vibe after editing the config.
276
+
277
+ </details>
278
+
279
+ <details>
280
+ <summary><strong>Docker (any MCP client)</strong></summary>
281
+
282
+ Run the server in a container — mount your config directory read-only:
283
+
284
+ ```bash
285
+ docker run --rm -i \
286
+ -v ~/.config/email-mcp:/home/node/.config/email-mcp:ro \
287
+ ghcr.io/codefuturist/email-mcp
288
+ ```
289
+
290
+ For MCP client configuration (e.g. Claude Desktop):
291
+
292
+ ```json
293
+ {
294
+ "mcpServers": {
295
+ "email": {
296
+ "command": "docker",
297
+ "args": [
298
+ "run", "--rm", "-i",
299
+ "-v", "~/.config/email-mcp:/home/node/.config/email-mcp:ro",
300
+ "ghcr.io/codefuturist/email-mcp"
301
+ ]
302
+ }
303
+ }
304
+ }
305
+ ```
306
+ </details>
307
+
308
+ <details>
309
+ <summary><strong>Single-account via environment variables (no config file needed)</strong></summary>
310
+
311
+ ```json
312
+ {
313
+ "mcpServers": {
314
+ "email": {
315
+ "command": "npx",
316
+ "args": ["-y", "@codefuturist/email-mcp", "stdio"],
317
+ "env": {
318
+ "MCP_EMAIL_ADDRESS": "you@gmail.com",
319
+ "MCP_EMAIL_PASSWORD": "your-app-password",
320
+ "MCP_EMAIL_IMAP_HOST": "imap.gmail.com",
321
+ "MCP_EMAIL_SMTP_HOST": "smtp.gmail.com"
322
+ }
323
+ }
324
+ }
325
+ }
326
+ ```
327
+ </details>
328
+
329
+ ### CLI Commands
330
+
331
+ ```
332
+ email-mcp [command]
333
+
334
+ Commands:
335
+ stdio Run as MCP server over stdio (default)
336
+ account list List all configured accounts
337
+ account add Add a new email account interactively
338
+ account edit [name] Edit an existing account
339
+ account delete [name] Remove an account
340
+ setup Alias for 'account add'
341
+ test Test connections for all or a specific account
342
+ install Register email-mcp with MCP clients interactively
343
+ install status Show registration status for detected clients
344
+ install remove Unregister email-mcp from MCP clients
345
+ config show Show config (passwords masked)
346
+ config edit Edit global settings (rate limit, read-only)
347
+ config path Print config file path
348
+ config init Create template config
349
+ scheduler check Process pending scheduled emails
350
+ scheduler list Show all scheduled emails
351
+ scheduler install Install OS-level scheduler (launchd/crontab)
352
+ scheduler uninstall Remove OS-level scheduler
353
+ scheduler status Show scheduler installation status
354
+ help Show help
355
+ ```
356
+
357
+ ### Configuration
358
+
359
+ Located at `$XDG_CONFIG_HOME/email-mcp/config.toml` (default: `~/.config/email-mcp/config.toml`).
360
+
361
+ ```toml
362
+ [settings]
363
+ rate_limit = 10 # max emails per minute per account
364
+
365
+ [[accounts]]
366
+ name = "personal"
367
+ email = "you@gmail.com"
368
+ full_name = "Your Name"
369
+ password = "your-app-password"
370
+
371
+ [accounts.imap]
372
+ host = "imap.gmail.com"
373
+ port = 993
374
+ tls = true
375
+
376
+ [accounts.smtp]
377
+ host = "smtp.gmail.com"
378
+ port = 465
379
+ tls = true
380
+ starttls = false
381
+ verify_ssl = true
382
+
383
+ [accounts.smtp.pool]
384
+ enabled = true
385
+ max_connections = 1
386
+ max_messages = 100
387
+ ```
388
+
389
+ #### OAuth2 _(experimental)_
390
+
391
+ > **Note:** OAuth2 support is experimental. Token refresh and provider-specific flows may require additional testing in your environment.
392
+
393
+ ```toml
394
+ [[accounts]]
395
+ name = "work"
396
+ email = "you@company.com"
397
+ full_name = "Your Name"
398
+
399
+ [accounts.oauth2]
400
+ provider = "google" # or "microsoft"
401
+ client_id = "your-client-id"
402
+ client_secret = "your-client-secret"
403
+ refresh_token = "your-refresh-token"
404
+
405
+ [accounts.imap]
406
+ host = "imap.gmail.com"
407
+ port = 993
408
+ tls = true
409
+
410
+ [accounts.smtp]
411
+ host = "smtp.gmail.com"
412
+ port = 465
413
+ tls = true
414
+
415
+ [accounts.smtp.pool]
416
+ enabled = true
417
+ max_connections = 1
418
+ max_messages = 100
419
+ ```
420
+
421
+ #### Environment Variables
422
+
423
+ For single-account setups (overrides config file):
424
+
425
+ | Variable | Default | Description |
426
+ |----------|---------|-------------|
427
+ | `MCP_EMAIL_ADDRESS` | *required* | Email address |
428
+ | `MCP_EMAIL_PASSWORD` | *required* | Password or app password |
429
+ | `MCP_EMAIL_IMAP_HOST` | *required* | IMAP server hostname |
430
+ | `MCP_EMAIL_SMTP_HOST` | *required* | SMTP server hostname |
431
+ | `MCP_EMAIL_ACCOUNT_NAME` | `default` | Account name |
432
+ | `MCP_EMAIL_FULL_NAME` | — | Display name |
433
+ | `MCP_EMAIL_USERNAME` | *email* | Login username |
434
+ | `MCP_EMAIL_IMAP_PORT` | `993` | IMAP port |
435
+ | `MCP_EMAIL_IMAP_TLS` | `true` | IMAP TLS |
436
+ | `MCP_EMAIL_SMTP_PORT` | `465` | SMTP port |
437
+ | `MCP_EMAIL_SMTP_TLS` | `true` | SMTP TLS |
438
+ | `MCP_EMAIL_SMTP_STARTTLS` | `false` | SMTP STARTTLS |
439
+ | `MCP_EMAIL_SMTP_VERIFY_SSL` | `true` | Verify SSL certificates |
440
+ | `MCP_EMAIL_SMTP_POOL_ENABLED` | `true` | Enable SMTP transport pooling |
441
+ | `MCP_EMAIL_SMTP_POOL_MAX_CONNECTIONS` | `1` | Max pooled SMTP connections |
442
+ | `MCP_EMAIL_SMTP_POOL_MAX_MESSAGES` | `100` | Max messages per pooled connection |
443
+ | `MCP_EMAIL_RATE_LIMIT` | `10` | Max sends per minute |
444
+
445
+ ### Email Scheduling
446
+
447
+ The scheduler enables future email delivery with a layered architecture:
448
+
449
+ 1. **MCP auto-check** — Processes the queue on server startup and every 60 seconds while the MCP server is running
450
+ 2. **CLI** — `email-mcp scheduler check` for manual or cron-based processing
451
+ 3. **OS-level daemon** — `email-mcp scheduler install` sets up launchd (macOS) or crontab (Linux) to run every minute, independently of the MCP server
452
+
453
+ > **Important — the daemon must be installed for reliable delivery.**
454
+ > Without it, scheduled emails only fire while an AI client is actively connected.
455
+ > Your machine also needs to be running at the scheduled time; if it's asleep or
456
+ > off, the daemon will process overdue emails on next wake/startup. Failed sends
457
+ > are retried up to **3 times** before being marked `failed`.
458
+
459
+ #### Setting up the daemon
460
+
461
+ ```bash
462
+ # Install (macOS launchd / Linux crontab — runs every minute)
463
+ email-mcp scheduler install
464
+
465
+ # Verify it's running
466
+ email-mcp scheduler status
467
+
468
+ # View pending / sent / failed scheduled emails
469
+ email-mcp scheduler list
470
+
471
+ # Trigger a manual check immediately
472
+ email-mcp scheduler check
473
+
474
+ # Remove the daemon
475
+ email-mcp scheduler uninstall
476
+ ```
477
+
478
+ Scheduled emails are stored as JSON files in `~/.local/state/email-mcp/scheduled/` with status-based locking. Each entry tracks attempts (max 3) and the last error, so you can inspect failures with `scheduler list`.
479
+
480
+ ### Real-time Watcher & AI Hooks
481
+
482
+ The IMAP IDLE watcher monitors configured mailboxes in real-time using persistent IDLE connections (separate from tool connections). When new emails arrive:
483
+
484
+ 1. **Static rules** — Pattern-match on from/to/subject → apply labels, flag, or mark read instantly (no AI)
485
+ 2. **AI triage** — Remaining emails are analyzed via MCP sampling with a customizable preset prompt
486
+ 3. **Notify mode** — Falls back to logging if AI triage is disabled
487
+
488
+ Configure in `config.toml`:
489
+
490
+ ```toml
491
+ [settings.watcher]
492
+ enabled = true
493
+ folders = ["INBOX"]
494
+ idle_timeout = 1740 # 29 minutes (IMAP spec max is 30)
495
+
496
+ [settings.hooks]
497
+ on_new_email = "triage" # "triage" | "notify" | "none"
498
+ preset = "inbox-zero" # "inbox-zero" | "gtd" | "priority-focus" | "notification-only" | "custom"
499
+ auto_label = true # apply AI-suggested labels
500
+ auto_flag = true # flag urgent emails
501
+ batch_delay = 5 # seconds to batch before triage
502
+
503
+ # User context — appended to preset's AI prompt
504
+ custom_instructions = """
505
+ I'm a software engineer. Emails from @mycompany.com are always high priority.
506
+ Newsletters I read: TL;DR, Hacker Newsletter.
507
+ """
508
+
509
+ # Static rules — run BEFORE AI, skip AI if matched
510
+ [[settings.hooks.rules]]
511
+ name = "GitHub Notifications"
512
+ match = { from = "*@github.com" }
513
+ actions = { labels = ["Dev"], mark_read = true }
514
+
515
+ [[settings.hooks.rules]]
516
+ name = "Newsletter Archive"
517
+ match = { from = "*@substack.com|*@buttondown.email" }
518
+ actions = { labels = ["Newsletter"] }
519
+
520
+ [[settings.hooks.rules]]
521
+ name = "VIP Contacts"
522
+ match = { from = "ceo@company.com|cto@company.com" }
523
+ actions = { flag = true, labels = ["VIP"] }
524
+ ```
525
+
526
+ #### Presets
527
+
528
+ | Preset | Focus | Suggested Labels |
529
+ |--------|-------|------------------|
530
+ | `inbox-zero` | Aggressive categorization + archiving | Newsletter, Notification, Updates, Finance, Social, Promo |
531
+ | `gtd` | Getting Things Done contexts | @Action, @Waiting, @Reference, @Someday, @Delegated |
532
+ | `priority-focus` | Simple priority classification (default) | _(none — just priority + flag)_ |
533
+ | `notification-only` | No AI triage, just log | _(none)_ |
534
+ | `custom` | User defines full system prompt | User-defined |
535
+
536
+ #### Static Rules
537
+
538
+ Static rules use glob-style patterns (`*@github.com`) with `|` as OR separator (`*@github.com|*@gitlab.com`). All conditions within a match are AND'd. First matching rule wins.
539
+
540
+ Available actions: `labels` (string array), `flag` (boolean), `mark_read` (boolean), `alert` (boolean — forces desktop notification).
541
+
542
+ #### Alerts
543
+
544
+ Urgency-based multi-channel notification routing — grab attention for important emails even when you're not looking at the chat. All channels are **opt-in** and disabled by default.
545
+
546
+ | Priority | Desktop | Sound | MCP Log Level | Webhook |
547
+ |----------|---------|-------|---------------|---------|
548
+ | `urgent` | ✅ Banner | 🔊 Alert | `alert` | ✅ |
549
+ | `high` | ✅ Banner | 🔇 Silent | `warning` | ✅ |
550
+ | `normal` | ❌ | ❌ | `info` | ❌ |
551
+ | `low` | ❌ | ❌ | `debug` | ❌ |
552
+
553
+ ```toml
554
+ [settings.hooks.alerts]
555
+ desktop = true # OS-level notifications (macOS/Linux/Windows)
556
+ sound = true # play sound for urgent emails
557
+ urgency_threshold = "high" # minimum priority to trigger desktop alert
558
+ webhook_url = "https://ntfy.sh/my-email-alerts" # optional: Slack, Discord, ntfy.sh, etc.
559
+ webhook_events = ["urgent", "high"]
560
+ ```
561
+
562
+ **Supported platforms:** macOS (Notification Center via `osascript`), Linux (`notify-send`), Windows (PowerShell toast). Zero npm dependencies — uses native OS commands.
563
+
564
+ **Notification setup by platform:**
565
+
566
+ <details>
567
+ <summary>macOS</summary>
568
+
569
+ Desktop notifications use `osascript` (built-in). The terminal app running the MCP server needs notification permission:
570
+
571
+ 1. Open **System Settings → Notifications & Focus**
572
+ 2. Find your terminal app (Terminal, iTerm2, VS Code, Cursor, etc.)
573
+ 3. Enable **Allow Notifications** and choose **Banners** or **Alerts**
574
+ 4. Ensure **Focus** / Do Not Disturb is not blocking notifications
575
+
576
+ Use `check_notification_setup` to diagnose and `test_notification` to verify.
577
+ </details>
578
+
579
+ <details>
580
+ <summary>Linux</summary>
581
+
582
+ Requires `notify-send` from `libnotify`. For sound alerts, `paplay` is also needed:
583
+
584
+ ```bash
585
+ # Ubuntu / Debian
586
+ sudo apt install libnotify-bin pulseaudio-utils
587
+
588
+ # Fedora
589
+ sudo dnf install libnotify pulseaudio-utils
590
+
591
+ # Arch
592
+ sudo pacman -S libnotify
593
+ ```
594
+
595
+ Desktop notifications require a running display server (X11/Wayland) — they will not work in headless/SSH sessions.
596
+ </details>
597
+
598
+ <details>
599
+ <summary>Windows</summary>
600
+
601
+ Uses PowerShell toast notifications (built-in):
602
+
603
+ 1. Open **Settings → System → Notifications**
604
+ 2. Ensure **Notifications** is turned on
605
+ 3. Set **Focus Assist** to allow notifications
606
+ 4. If using Windows Terminal, ensure its notifications are enabled
607
+ </details>
608
+
609
+ **AI-configurable:** The AI can check, test, and configure notifications at runtime:
610
+ - `check_notification_setup` — diagnose platform support and show setup instructions
611
+ - `test_notification` — send a test notification to verify everything works
612
+ - `configure_alerts` — enable/disable desktop, sound, threshold, webhook (with optional persist to config file)
613
+
614
+ **Webhook payload:**
615
+ ```json
616
+ {
617
+ "event": "email.urgent",
618
+ "account": "work",
619
+ "sender": { "name": "John CEO", "address": "ceo@company.com" },
620
+ "subject": "Q4 Review Due Today",
621
+ "priority": "urgent",
622
+ "labels": ["VIP"],
623
+ "rule": "VIP Contacts",
624
+ "timestamp": "2026-02-18T11:30:00Z"
625
+ }
626
+ ```
627
+
628
+ Static rules can force desktop notifications with `alert = true`, regardless of urgency threshold:
629
+ ```toml
630
+ [[settings.hooks.rules]]
631
+ name = "VIP Contacts"
632
+ match = { from = "ceo@company.com" }
633
+ actions = { flag = true, alert = true, labels = ["VIP"] }
634
+ ```
635
+
636
+ Features:
637
+ - **Auto-reconnect** — Exponential backoff (1s → 60s) on connection failures
638
+ - **Batching** — Groups arrivals within a configurable delay to reduce AI calls
639
+ - **Rate limiting** — Max 10 sampling calls per minute
640
+ - **Graceful degradation** — Falls back to notify mode if client doesn't support sampling
641
+ - **Resource subscriptions** — Pushes `notifications/resources/updated` for unread counts
642
+
643
+ ## API
644
+
645
+ ### Tools (47)
646
+
647
+ #### Read (14)
648
+
649
+ | Tool | Description |
650
+ |------|-------------|
651
+ | `list_accounts` | List all configured email accounts |
652
+ | `list_mailboxes` | List folders with unread counts and special-use flags |
653
+ | `list_emails` | Paginated email listing with date, sender, subject, and flag filters |
654
+ | `get_email` | Read full email content with attachment metadata |
655
+ | `get_emails` | Fetch full content of multiple emails in a single call (max 20) |
656
+ | `get_email_status` | Get read/flag/label state of an email without fetching the body |
657
+ | `search_emails` | Search by keyword across subject, sender, and body |
658
+ | `download_attachment` | Download an email attachment by filename |
659
+ | `find_email_folder` | Discover the real folder(s) an email resides in (resolves virtual folders) |
660
+ | `extract_contacts` | Extract unique contacts from recent email headers |
661
+ | `get_thread` | Reconstruct a conversation thread via References/In-Reply-To |
662
+ | `list_templates` | List available email templates |
663
+ | `get_email_stats` | Email analytics — volume, top senders, daily trends |
664
+ | `check_health` | Connection health, latency, quota, and IMAP capabilities |
665
+
666
+ #### Write (9)
667
+
668
+ | Tool | Description |
669
+ |------|-------------|
670
+ | `send_email` | Send a new email (plain text or HTML, CC/BCC) |
671
+ | `reply_email` | Reply with proper threading (In-Reply-To, References) |
672
+ | `forward_email` | Forward with original content quoted |
673
+ | `save_draft` | Save an email draft to the Drafts folder |
674
+ | `send_draft` | Send an existing draft and remove from Drafts |
675
+ | `apply_template` | Apply a template with variable substitution |
676
+ | `schedule_email` | Schedule an email for future delivery |
677
+ | `list_scheduled` | List scheduled emails by status |
678
+ | `cancel_scheduled` | Cancel a pending scheduled email |
679
+
680
+ #### Manage (7)
681
+
682
+ | Tool | Description |
683
+ |------|-------------|
684
+ | `move_email` | Move email between folders |
685
+ | `delete_email` | Move to Trash or permanently delete |
686
+ | `mark_email` | Mark as read/unread, flag/unflag |
687
+ | `bulk_action` | Batch operation on up to 100 emails |
688
+ | `create_mailbox` | Create a new mailbox folder |
689
+ | `rename_mailbox` | Rename an existing mailbox folder |
690
+ | `delete_mailbox` | Permanently delete a mailbox and contents |
691
+
692
+ #### Labels (5)
693
+
694
+ | Tool | Description |
695
+ |------|-------------|
696
+ | `list_labels` | Discover available labels (auto-detects provider strategy) |
697
+ | `add_label` | Add a label to an email (ProtonMail folders, Gmail X-GM-LABELS, or IMAP keywords) |
698
+ | `remove_label` | Remove a label from an email |
699
+ | `create_label` | Create a new label |
700
+ | `delete_label` | Delete a label |
701
+
702
+ #### Watcher & Alerts (6)
703
+
704
+ | Tool | Description |
705
+ |------|-------------|
706
+ | `get_watcher_status` | Show IMAP IDLE connections, folders being monitored, and last-seen UIDs |
707
+ | `list_presets` | List available AI triage presets with descriptions and suggested labels |
708
+ | `get_hooks_config` | Show current hooks configuration — preset, rules, and custom instructions |
709
+ | `configure_alerts` | Update alert/notification settings at runtime |
710
+ | `check_notification_setup` | Diagnose desktop notification support and provide setup instructions |
711
+ | `test_notification` | Send a test notification to verify OS permissions are configured |
712
+
713
+ #### Calendar & Reminders (6)
714
+
715
+ | Tool | Description |
716
+ |------|-------------|
717
+ | `extract_calendar` | Extract ICS/iCalendar events from an email |
718
+ | `analyze_email_for_scheduling` | Analyze an email to detect events and reminder-worthy content |
719
+ | `add_to_calendar` | Add an email event to the local calendar (macOS/Linux) |
720
+ | `create_reminder` | Create a reminder in macOS Reminders.app from an email |
721
+ | `list_calendars` | List all available local calendars |
722
+ | `check_calendar_permissions` | Check whether the local calendar is accessible |
723
+
724
+ ### Prompts (7)
725
+
726
+ | Prompt | Description |
727
+ |--------|-------------|
728
+ | `triage_inbox` | Categorize and prioritize unread emails with suggested actions |
729
+ | `summarize_thread` | Summarize an email conversation thread |
730
+ | `compose_reply` | Draft a context-aware reply to an email |
731
+ | `draft_from_context` | Compose a new email from provided context and instructions |
732
+ | `extract_action_items` | Extract actionable tasks from email threads |
733
+ | `summarize_meetings` | Summarize upcoming calendar events from emails |
734
+ | `cleanup_inbox` | Suggest emails to archive, delete, or unsubscribe from |
735
+
736
+ ### Resources (6)
737
+
738
+ | Resource | URI | Description |
739
+ |----------|-----|-------------|
740
+ | Accounts | `email://accounts` | List of configured accounts |
741
+ | Mailboxes | `email://{account}/mailboxes` | Folder tree for an account |
742
+ | Unread | `email://{account}/unread` | Unread email summary |
743
+ | Templates | `email://templates` | Available email templates |
744
+ | Stats | `email://{account}/stats` | Email statistics snapshot |
745
+ | Scheduled | `email://scheduled` | Pending scheduled emails |
746
+
747
+ ### Provider Auto-Detection
748
+
749
+ | Provider | Domains |
750
+ |----------|---------|
751
+ | Gmail | gmail.com |
752
+ | Outlook / Hotmail | outlook.com, hotmail.com, live.com |
753
+ | Yahoo Mail | yahoo.com, ymail.com |
754
+ | iCloud | icloud.com, me.com, mac.com |
755
+ | Fastmail | fastmail.com |
756
+ | ProtonMail Bridge | proton.me, protonmail.com |
757
+ | Zoho Mail | zoho.com |
758
+ | GMX | gmx.com, gmx.de, gmx.net |
759
+
760
+ ### Architecture
761
+
762
+ ```
763
+ src/
764
+ ├── main.ts — Entry point and subcommand routing
765
+ ├── server.ts — MCP server factory
766
+ ├── logging.ts — MCP protocol logging bridge
767
+ ├── cli/ — Interactive CLI commands
768
+ │ ├── account-commands.ts — Account CRUD (list, add, edit, delete)
769
+ │ ├── setup.ts — Legacy setup alias → account add
770
+ │ ├── test.ts — Connection tester
771
+ │ ├── config-commands.ts — Config management (show, edit, path, init)
772
+ │ ├── install-commands.ts — MCP client registration (install, status, remove)
773
+ │ ├── providers.ts — Provider auto-detection + OAuth2 endpoints (experimental)
774
+ │ └── scheduler.ts — Scheduler CLI
775
+ ├── config/ — Configuration layer
776
+ │ ├── xdg.ts — XDG Base Directory paths
777
+ │ ├── schema.ts — Zod validation schemas
778
+ │ └── loader.ts — Config loader (TOML + env vars)
779
+ ├── connections/
780
+ │ └── manager.ts — Lazy persistent IMAP/SMTP with OAuth2 (experimental)
781
+ ├── services/ — Business logic
782
+ │ ├── imap.service.ts — IMAP operations
783
+ │ ├── label-strategy.ts — Provider-aware label strategy (ProtonMail/Gmail/IMAP keywords)
784
+ │ ├── smtp.service.ts — SMTP operations
785
+ │ ├── template.service.ts — Email template engine
786
+ │ ├── oauth.service.ts — OAuth2 token management (experimental)
787
+ │ ├── calendar.service.ts — ICS/iCalendar parsing
788
+ │ ├── scheduler.service.ts — Email scheduling queue
789
+ │ ├── watcher.service.ts — IMAP IDLE real-time watcher with auto-reconnect
790
+ │ ├── hooks.service.ts — AI triage via MCP sampling + static rules + auto-labeling/flagging
791
+ │ ├── notifier.service.ts — Multi-channel notification dispatcher (desktop/sound/webhook)
792
+ │ ├── presets.ts — Built-in hook presets (inbox-zero, gtd, priority-focus, etc.)
793
+ │ └── event-bus.ts — Typed EventEmitter for internal email events
794
+ ├── tools/ — MCP tool definitions (42)
795
+ ├── prompts/ — MCP prompt definitions (7)
796
+ ├── resources/ — MCP resource definitions (6)
797
+ ├── safety/ — Audit trail and rate limiter
798
+ └── types/ — Shared TypeScript types
799
+ ```
800
+
801
+ ## Maintainers
802
+
803
+ [@codefuturist](https://github.com/codefuturist)
804
+
805
+ ## Contributing
806
+
807
+ PRs accepted. Please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification when editing this README.
808
+
809
+ ```bash
810
+ # Development workflow
811
+ pnpm install
812
+ pnpm typecheck # type check
813
+ pnpm check # lint and format
814
+ pnpm build # build
815
+ pnpm start # run
816
+ ```
817
+
818
+ ## License
819
+
820
+ [LGPL-3.0-or-later](LICENSE)