apple-mail-mcp 2.19.15 → 2.19.16

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/README.md CHANGED
@@ -1086,6 +1086,12 @@ matches both is refused with an error saying so — rename one of them. For the
1086
1086
  same reason `create-mailbox` treats a normalization-equivalent existing name as
1087
1087
  already existing, and `rename-mailbox` refuses to create such a twin.
1088
1088
 
1089
+ **Messages awaiting expunge are not listed.** On IMAP accounts, search,
1090
+ list, thread and mail-stats queries only match messages *not* flagged
1091
+ `\Deleted` (IMAP `UNDELETED`). iCloud keeps flagged-but-never-expunged
1092
+ messages out of its message counts yet still returns them from `UID SEARCH`,
1093
+ which made a filter-less `list-messages` fail on such a mailbox before 2.19.16.
1094
+
1089
1095
  **Mail's local "On My Mac" mailboxes** are not children of any account — they
1090
1096
  hang off the application — so they are reported under the synthetic account label
1091
1097
  **`On My Mac`**. An unscoped call includes them (listed last); `account="On My
package/build/cli.js CHANGED
@@ -58323,7 +58323,7 @@ async function resolveMailboxPath(client, mailbox, _mode) {
58323
58323
  return staticMailboxAlias(mailbox);
58324
58324
  }
58325
58325
  function buildCriteria(a, listMode) {
58326
- const c = {};
58326
+ const c = { ...NOT_DELETED };
58327
58327
  if (a.query) c.or = [{ subject: a.query }, { from: a.query }];
58328
58328
  if (a.body) c.body = a.body;
58329
58329
  if (a.from) c.from = a.from;
@@ -58335,7 +58335,6 @@ function buildCriteria(a, listMode) {
58335
58335
  if (a.isFlagged === false) c.unflagged = true;
58336
58336
  if (a.dateFrom) c.since = new Date(a.dateFrom);
58337
58337
  if (a.dateTo) c.before = new Date(a.dateTo);
58338
- if (Object.keys(c).length === 0) c.all = true;
58339
58338
  return c;
58340
58339
  }
58341
58340
  function validDate(d) {
@@ -58629,7 +58628,10 @@ function imapMailStats(deps = {}) {
58629
58628
  try {
58630
58629
  const lock = await client.getMailboxLock("INBOX");
58631
58630
  try {
58632
- const found = await client.search({ since: since(days) }, { uid: true });
58631
+ const found = await client.search(
58632
+ { since: since(days), ...NOT_DELETED },
58633
+ { uid: true }
58634
+ );
58633
58635
  return Array.isArray(found) ? found.length : 0;
58634
58636
  } finally {
58635
58637
  lock.release();
@@ -59498,11 +59500,23 @@ async function imapThread(id, deps = {}, limit = 50) {
59498
59500
  if (Array.isArray(found)) found.forEach((u) => uidSet.add(u));
59499
59501
  };
59500
59502
  if (seedMsgId) {
59501
- addFound(await client.search({ header: { references: seedMsgId } }, { uid: true }));
59502
- addFound(await client.search({ header: { "in-reply-to": seedMsgId } }, { uid: true }));
59503
+ addFound(
59504
+ await client.search(
59505
+ { header: { references: seedMsgId }, ...NOT_DELETED },
59506
+ { uid: true }
59507
+ )
59508
+ );
59509
+ addFound(
59510
+ await client.search(
59511
+ { header: { "in-reply-to": seedMsgId }, ...NOT_DELETED },
59512
+ { uid: true }
59513
+ )
59514
+ );
59503
59515
  }
59504
59516
  for (const mid of [...refIds].slice(0, 20)) {
59505
- addFound(await client.search({ header: { "message-id": mid } }, { uid: true }));
59517
+ addFound(
59518
+ await client.search({ header: { "message-id": mid }, ...NOT_DELETED }, { uid: true })
59519
+ );
59506
59520
  }
59507
59521
  if (uidSet.size <= 1) return null;
59508
59522
  const uids = [...uidSet].slice(0, limit);
@@ -59554,7 +59568,7 @@ async function imapThread(id, deps = {}, limit = 50) {
59554
59568
  true
59555
59569
  );
59556
59570
  }
59557
- var import_imapflow, IMAP_ENV, defaultConnect, SPECIAL_USE_ALIASES, poolConnect, pools, connecting, MAX_COMPOSE_SOURCE_BYTES, MAX_RFC822_INLINE_BYTES, MAX_RFC822_FILE_BYTES, HEADER_WINDOW_BYTES, MAIL_FLAG_BITS, imapMarkRead, imapMarkUnread, FALLBACK_TRASH_PATH, imapBatchMarkRead, imapBatchMarkUnread, imapBatchFlag, imapBatchUnflag, imapBatchDelete;
59571
+ var import_imapflow, IMAP_ENV, defaultConnect, SPECIAL_USE_ALIASES, NOT_DELETED, poolConnect, pools, connecting, MAX_COMPOSE_SOURCE_BYTES, MAX_RFC822_INLINE_BYTES, MAX_RFC822_FILE_BYTES, HEADER_WINDOW_BYTES, MAIL_FLAG_BITS, imapMarkRead, imapMarkUnread, FALLBACK_TRASH_PATH, imapBatchMarkRead, imapBatchMarkUnread, imapBatchFlag, imapBatchUnflag, imapBatchDelete;
59558
59572
  var init_imapClient = __esm({
59559
59573
  "src/services/imapClient.ts"() {
59560
59574
  "use strict";
@@ -59607,6 +59621,7 @@ var init_imapClient = __esm({
59607
59621
  junk: "\\junk",
59608
59622
  starred: "\\flagged"
59609
59623
  };
59624
+ NOT_DELETED = { deleted: false };
59610
59625
  poolConnect = defaultConnect;
59611
59626
  pools = /* @__PURE__ */ new Map();
59612
59627
  connecting = /* @__PURE__ */ new Map();
package/build/index.js CHANGED
@@ -65652,7 +65652,7 @@ async function resolveMailboxPath(client, mailbox, _mode) {
65652
65652
  return staticMailboxAlias(mailbox);
65653
65653
  }
65654
65654
  function buildCriteria(a, listMode) {
65655
- const c = {};
65655
+ const c = { ...NOT_DELETED };
65656
65656
  if (a.query) c.or = [{ subject: a.query }, { from: a.query }];
65657
65657
  if (a.body) c.body = a.body;
65658
65658
  if (a.from) c.from = a.from;
@@ -65664,7 +65664,6 @@ function buildCriteria(a, listMode) {
65664
65664
  if (a.isFlagged === false) c.unflagged = true;
65665
65665
  if (a.dateFrom) c.since = new Date(a.dateFrom);
65666
65666
  if (a.dateTo) c.before = new Date(a.dateTo);
65667
- if (Object.keys(c).length === 0) c.all = true;
65668
65667
  return c;
65669
65668
  }
65670
65669
  function validDate(d) {
@@ -65958,7 +65957,10 @@ function imapMailStats(deps = {}) {
65958
65957
  try {
65959
65958
  const lock = await client.getMailboxLock("INBOX");
65960
65959
  try {
65961
- const found = await client.search({ since: since(days) }, { uid: true });
65960
+ const found = await client.search(
65961
+ { since: since(days), ...NOT_DELETED },
65962
+ { uid: true }
65963
+ );
65962
65964
  return Array.isArray(found) ? found.length : 0;
65963
65965
  } finally {
65964
65966
  lock.release();
@@ -66827,11 +66829,23 @@ async function imapThread(id, deps = {}, limit = 50) {
66827
66829
  if (Array.isArray(found)) found.forEach((u) => uidSet.add(u));
66828
66830
  };
66829
66831
  if (seedMsgId) {
66830
- addFound(await client.search({ header: { references: seedMsgId } }, { uid: true }));
66831
- addFound(await client.search({ header: { "in-reply-to": seedMsgId } }, { uid: true }));
66832
+ addFound(
66833
+ await client.search(
66834
+ { header: { references: seedMsgId }, ...NOT_DELETED },
66835
+ { uid: true }
66836
+ )
66837
+ );
66838
+ addFound(
66839
+ await client.search(
66840
+ { header: { "in-reply-to": seedMsgId }, ...NOT_DELETED },
66841
+ { uid: true }
66842
+ )
66843
+ );
66832
66844
  }
66833
66845
  for (const mid of [...refIds].slice(0, 20)) {
66834
- addFound(await client.search({ header: { "message-id": mid } }, { uid: true }));
66846
+ addFound(
66847
+ await client.search({ header: { "message-id": mid }, ...NOT_DELETED }, { uid: true })
66848
+ );
66835
66849
  }
66836
66850
  if (uidSet.size <= 1) return null;
66837
66851
  const uids = [...uidSet].slice(0, limit);
@@ -66883,7 +66897,7 @@ async function imapThread(id, deps = {}, limit = 50) {
66883
66897
  true
66884
66898
  );
66885
66899
  }
66886
- var import_imapflow, IMAP_ENV, defaultConnect, SPECIAL_USE_ALIASES, poolConnect, pools, connecting, MAX_COMPOSE_SOURCE_BYTES, MAX_RFC822_INLINE_BYTES, MAX_RFC822_FILE_BYTES, HEADER_WINDOW_BYTES, MAIL_FLAG_BITS, imapMarkRead, imapMarkUnread, FALLBACK_TRASH_PATH, imapBatchMarkRead, imapBatchMarkUnread, imapBatchFlag, imapBatchUnflag, imapBatchDelete;
66900
+ var import_imapflow, IMAP_ENV, defaultConnect, SPECIAL_USE_ALIASES, NOT_DELETED, poolConnect, pools, connecting, MAX_COMPOSE_SOURCE_BYTES, MAX_RFC822_INLINE_BYTES, MAX_RFC822_FILE_BYTES, HEADER_WINDOW_BYTES, MAIL_FLAG_BITS, imapMarkRead, imapMarkUnread, FALLBACK_TRASH_PATH, imapBatchMarkRead, imapBatchMarkUnread, imapBatchFlag, imapBatchUnflag, imapBatchDelete;
66887
66901
  var init_imapClient = __esm({
66888
66902
  "src/services/imapClient.ts"() {
66889
66903
  "use strict";
@@ -66936,6 +66950,7 @@ var init_imapClient = __esm({
66936
66950
  junk: "\\junk",
66937
66951
  starred: "\\flagged"
66938
66952
  };
66953
+ NOT_DELETED = { deleted: false };
66939
66954
  poolConnect = defaultConnect;
66940
66955
  pools = /* @__PURE__ */ new Map();
66941
66956
  connecting = /* @__PURE__ */ new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apple-mail-mcp",
3
- "version": "2.19.15",
3
+ "version": "2.19.16",
4
4
  "description": "MCP server for Apple Mail - read, search, send, and manage emails via Claude and other AI assistants",
5
5
  "type": "module",
6
6
  "main": "build/index.js",