@lengelhard/imap-email-mcp 1.5.0 → 1.7.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.
package/.env.example CHANGED
@@ -11,6 +11,14 @@ IMAP_HOST=imap.example.com
11
11
  # IMAP_TLS=true
12
12
  # IMAP_AUTH_TIMEOUT=10000
13
13
  # IMAP_TLS_REJECT_UNAUTHORIZED=true
14
+ # IMAP_IDLE_CLOSE_SECONDS=300
15
+
16
+ # Optional - Local read-only search index (requires Node 22.13+)
17
+ # INDEX_ENABLED=false
18
+ # INDEX_DB_PATH= (default: ~/Library/Application Support/imap-email-mcp/index-<account>.sqlite on macOS)
19
+ # INDEX_FOLDERS= (comma list; default: all folders except Trash and Junk)
20
+ # INDEX_EXCLUDE_FOLDERS= (comma list, added to the default exclusions)
21
+ # INDEX_SYNC_INTERVAL_MINUTES=5
14
22
 
15
23
  # Optional - SMTP Settings (defaults to IMAP values if not set)
16
24
  # SMTP_HOST=smtp.example.com
package/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ # Changelog
2
+
3
+ ## 1.7.0
4
+
5
+ ### Added
6
+ - Optional local read-only full-text index (`INDEX_ENABLED=true`) with tools `search_index`, `index_status` and `sync_index`. Uses Node's built-in SQLite (FTS5, accent-insensitive). Indexes subject, sender, recipients, attachment names and body text. Never modifies the mailbox.
7
+ - `search_emails`: `folders` (multi-folder search), `cc`, `text`, `since_date`, `before_date`, `unseen_only`, `flagged_only`.
8
+ - `list_emails`: `flagged_only`, `before_date`, `offset`.
9
+ - `get_email`: `include_html` (HTML with inline images removed).
10
+ - Responses from `list_emails` and `search_emails` include `total_matches`, and each result carries its `folder`.
11
+
12
+ ### Changed
13
+ - One persistent IMAP connection is shared by all tools (serialised, auto-reconnect, closed after `IMAP_IDLE_CLOSE_SECONDS` of inactivity) instead of a new login per call.
14
+ - `list_emails` and `search_emails` sort on the server (SORT by arrival time, UID order as fallback) and fetch headers only for the messages returned. Previously every match was fetched, including its MIME structure.
15
+ - Read tools open folders read-only (EXAMINE).
16
+ - `get_email` returns the text body by default and no longer returns HTML unless asked. HTML-only emails get a text version converted from the HTML.
17
+ - `get_email` reports a missing UID as an error with a hint that UIDs change on move.
18
+ - The server reports its real version.
19
+
20
+ ### Fixed
21
+ - `list_emails`: combining `unseen_only` and `since_date` dropped the unread filter.
22
+ - Date filters use the local calendar date (previously parsed as UTC).
23
+ - A message expunged between SEARCH and FETCH could hang a search.
24
+
25
+ ### Compatibility
26
+ - Result shape of `list_emails` and `search_emails` changed from a bare array to `{ total_matches, returned, results }`.
27
+ - The local index requires Node 22.13+. Everything else still runs on Node 18+.
package/README.md CHANGED
@@ -70,7 +70,8 @@ Add to your config file:
70
70
  ## Features
71
71
 
72
72
  - **Read emails** - List and read emails from any folder
73
- - **Search** - Search by subject, sender, or body content
73
+ - **Search** - Live IMAP search across one or several folders, with date and flag filters, newest first
74
+ - **Local full-text index** - Optional read-only SQLite index for reliable content search, independent of the server's body search
74
75
  - **Compose** - Create and save email drafts
75
76
  - **Send** - Send emails directly via SMTP
76
77
  - **Manage drafts** - List, read, update, and delete drafts
@@ -96,6 +97,22 @@ Add to your config file:
96
97
  | `SMTP_HOST` | Same as IMAP_HOST | SMTP server hostname |
97
98
  | `SMTP_PORT` | `465` | SMTP port |
98
99
  | `SMTP_SECURE` | `true` | Use secure SMTP |
100
+ | `IMAP_IDLE_CLOSE_SECONDS` | `300` | Close the shared IMAP connection after this much inactivity |
101
+ | `INDEX_ENABLED` | `false` | Enable the local read-only search index |
102
+ | `INDEX_DB_PATH` | see below | Location of the index database |
103
+ | `INDEX_FOLDERS` | all but Trash/Junk | Comma-separated folders to index |
104
+ | `INDEX_EXCLUDE_FOLDERS` | none | Comma-separated folders to skip, on top of Trash/Junk |
105
+ | `INDEX_SYNC_INTERVAL_MINUTES` | `5` | Background sync interval |
106
+
107
+ ### Local search index
108
+
109
+ Some IMAP servers return incomplete results for body searches without reporting an error. The local index avoids that by keeping a searchable copy of message text on your machine.
110
+
111
+ - **Read-only.** The indexer opens folders with EXAMINE and fetches with BODY.PEEK. It never changes flags, never moves, deletes or appends mail.
112
+ - **What is indexed.** Subject, sender, recipients, attachment file names, and the text body (plain text, or HTML converted to text). Attachment contents are not indexed.
113
+ - **Sync.** Newest mail first, in the background, every few minutes. Moves and deletes are picked up on the next sync; moves made through this server trigger a sync of the affected folders within seconds.
114
+ - **Storage.** A single SQLite file, created with owner-only permissions. Default location on macOS: `~/Library/Application Support/imap-email-mcp/index-<account>.sqlite`; elsewhere `~/.local/share/imap-email-mcp/`. It contains the text of your mail, so keep the disk encrypted. Deleting the file is safe; it is rebuilt on the next start.
115
+ - **Requirements.** Node 22.13 or later (uses the built-in `node:sqlite`, no native modules).
99
116
 
100
117
  ### Provider Settings
101
118
 
@@ -112,15 +129,20 @@ Add to your config file:
112
129
  | Tool | Description |
113
130
  |------|-------------|
114
131
  | `list_folders` | List all email folders/mailboxes |
115
- | `list_emails` | List emails with optional filtering |
116
- | `get_email` | Get full email content by UID |
117
- | `search_emails` | Search by subject, sender, or body |
132
+ | `list_emails` | List emails newest first, with unread, flagged and date filters and paging |
133
+ | `get_email` | Get an email by UID. Text by default; HTML (without inline images) on request |
134
+ | `search_emails` | Live IMAP search across one or more folders: subject, from, to, cc, body, text, dates, flags |
135
+ | `search_index` | Full-text search of the local index (when `INDEX_ENABLED=true`) |
136
+ | `index_status` | Per-folder index coverage, last sync and errors |
137
+ | `sync_index` | Run an index sync now |
118
138
  | `list_drafts` | List all draft emails |
119
139
  | `get_draft` | Get a specific draft by UID |
120
140
  | `create_draft` | Create a new email draft |
121
141
  | `update_draft` | Update an existing draft |
122
142
  | `send_email` | Send an email directly |
123
143
  | `delete_email` | Delete an email by UID |
144
+ | `download_attachment` | Download an attachment: ≤700KB returns inline base64, larger saves to disk (ATTACHMENT_DIR) |
145
+ | `extract_text` | Extract plain text from a PDF, xlsx/xlsm/xls, docx, or text attachment in one call, parsed server-side |
124
146
 
125
147
  ## Usage Examples
126
148