@lengelhard/imap-email-mcp 1.6.0 → 1.7.1

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,40 @@
1
+ # Changelog
2
+
3
+ ## 1.7.1
4
+
5
+ ### Fixed
6
+ - Several server processes sharing one index (Claude Desktop can start more than one) no longer sync at the same time. A lock file next to the database lets one process sync while the others keep answering searches. Stale locks (process gone, or no heartbeat for 3 minutes) are taken over automatically.
7
+ - SQLite waits up to 10 seconds for a busy database instead of failing with "database is locked".
8
+ - A scheduled sync is skipped when another process completed a full sync in the last half interval.
9
+ - Index refreshes requested after a move or delete are retried when another process holds the sync lock.
10
+ - The server exits when the client disconnects or on SIGTERM/SIGINT/SIGHUP, instead of lingering while IMAP sockets are open. The sync lock is released on exit.
11
+
12
+ ### Changed
13
+ - `index_status` reports `this_pid`, `sync_running_in_pid` (when another process syncs), `last_full_sync`, and a `last_run` shared by all processes.
14
+ - `sync_index` and `search_index` say so when another process is already syncing.
15
+
16
+ ## 1.7.0
17
+
18
+ ### Added
19
+ - 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.
20
+ - `search_emails`: `folders` (multi-folder search), `cc`, `text`, `since_date`, `before_date`, `unseen_only`, `flagged_only`.
21
+ - `list_emails`: `flagged_only`, `before_date`, `offset`.
22
+ - `get_email`: `include_html` (HTML with inline images removed).
23
+ - Responses from `list_emails` and `search_emails` include `total_matches`, and each result carries its `folder`.
24
+
25
+ ### Changed
26
+ - 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.
27
+ - `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.
28
+ - Read tools open folders read-only (EXAMINE).
29
+ - `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.
30
+ - `get_email` reports a missing UID as an error with a hint that UIDs change on move.
31
+ - The server reports its real version.
32
+
33
+ ### Fixed
34
+ - `list_emails`: combining `unseen_only` and `since_date` dropped the unread filter.
35
+ - Date filters use the local calendar date (previously parsed as UTC).
36
+ - A message expunged between SEARCH and FETCH could hang a search.
37
+
38
+ ### Compatibility
39
+ - Result shape of `list_emails` and `search_emails` changed from a bare array to `{ total_matches, returned, results }`.
40
+ - 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,23 @@ 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
+ - **Several processes.** Some clients start more than one copy of the server. They share the index file: one process syncs at a time (a lock file next to the database), and all of them answer searches. A lock left by a process that died is taken over after at most 3 minutes.
116
+ - **Requirements.** Node 22.13 or later (uses the built-in `node:sqlite`, no native modules).
99
117
 
100
118
  ### Provider Settings
101
119
 
@@ -112,9 +130,12 @@ Add to your config file:
112
130
  | Tool | Description |
113
131
  |------|-------------|
114
132
  | `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 |
133
+ | `list_emails` | List emails newest first, with unread, flagged and date filters and paging |
134
+ | `get_email` | Get an email by UID. Text by default; HTML (without inline images) on request |
135
+ | `search_emails` | Live IMAP search across one or more folders: subject, from, to, cc, body, text, dates, flags |
136
+ | `search_index` | Full-text search of the local index (when `INDEX_ENABLED=true`) |
137
+ | `index_status` | Per-folder index coverage, last sync and errors |
138
+ | `sync_index` | Run an index sync now |
118
139
  | `list_drafts` | List all draft emails |
119
140
  | `get_draft` | Get a specific draft by UID |
120
141
  | `create_draft` | Create a new email draft |