apple-mail-mcp 2.20.19 → 2.20.20

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/build/cli.js CHANGED
@@ -58581,10 +58581,13 @@ async function searchUids(client, path3, criteria, size) {
58581
58581
  async function filterUidsByColor(client, uids, colorIndex) {
58582
58582
  if (uids.length === 0) return uids;
58583
58583
  const keep = /* @__PURE__ */ new Set();
58584
- for await (const msg of client.fetch(uids.join(","), { uid: true, flags: true }, { uid: true })) {
58585
- if (typeof msg?.uid !== "number") continue;
58586
- const idx = mailFlagColorIndex(msg.flags);
58587
- if (colorIndex === 0 ? idx === void 0 : idx === colorIndex) keep.add(msg.uid);
58584
+ for (let i = 0; i < uids.length; i += COLOR_FETCH_CHUNK) {
58585
+ const slice = uids.slice(i, i + COLOR_FETCH_CHUNK).join(",");
58586
+ for await (const msg of client.fetch(slice, { uid: true, flags: true }, { uid: true })) {
58587
+ if (typeof msg?.uid !== "number") continue;
58588
+ const idx = mailFlagColorIndex(msg.flags);
58589
+ if (colorIndex === 0 ? idx === void 0 : idx === colorIndex) keep.add(msg.uid);
58590
+ }
58588
58591
  }
58589
58592
  return uids.filter((uid) => keep.has(uid));
58590
58593
  }
@@ -60075,7 +60078,7 @@ async function imapThread(id, deps = {}, limit = 50) {
60075
60078
  true
60076
60079
  );
60077
60080
  }
60078
- var import_imapflow, IMAP_ENV, defaultConnect, SPECIAL_USE_ALIASES, NOT_DELETED, LARGE_MAILBOX_MESSAGES, FIRST_SEARCH_WINDOW, MAX_WINDOW, MAX_UNSCOPED_SEARCH_DEPTH, ROW_QUERY, ROW_QUERY_NO_STRUCTURE, ROW_QUERY_HEADERS_ONLY, DELETED_MARGIN, poolConnect, pools, connecting, MAX_COMPOSE_SOURCE_BYTES, MAX_RFC822_INLINE_BYTES, MAX_RFC822_FILE_BYTES, HEADER_WINDOW_BYTES, MAIL_FLAG_BITS, FLAG_COLOR_NAMES, imapMarkRead, imapMarkUnread, FALLBACK_TRASH_PATH, BASE64_TAIL_WINDOW, QP_EXACT_MAX_BYTES, imapBatchMarkRead, imapBatchMarkUnread, imapBatchFlag, imapBatchUnflag, imapBatchDelete;
60081
+ var import_imapflow, IMAP_ENV, defaultConnect, SPECIAL_USE_ALIASES, NOT_DELETED, LARGE_MAILBOX_MESSAGES, FIRST_SEARCH_WINDOW, MAX_WINDOW, MAX_UNSCOPED_SEARCH_DEPTH, COLOR_FETCH_CHUNK, ROW_QUERY, ROW_QUERY_NO_STRUCTURE, ROW_QUERY_HEADERS_ONLY, DELETED_MARGIN, poolConnect, pools, connecting, MAX_COMPOSE_SOURCE_BYTES, MAX_RFC822_INLINE_BYTES, MAX_RFC822_FILE_BYTES, HEADER_WINDOW_BYTES, MAIL_FLAG_BITS, FLAG_COLOR_NAMES, imapMarkRead, imapMarkUnread, FALLBACK_TRASH_PATH, BASE64_TAIL_WINDOW, QP_EXACT_MAX_BYTES, imapBatchMarkRead, imapBatchMarkUnread, imapBatchFlag, imapBatchUnflag, imapBatchDelete;
60079
60082
  var init_imapClient = __esm({
60080
60083
  "src/services/imapClient.ts"() {
60081
60084
  "use strict";
@@ -60151,6 +60154,7 @@ var init_imapClient = __esm({
60151
60154
  FIRST_SEARCH_WINDOW = 5e3;
60152
60155
  MAX_WINDOW = 5e4;
60153
60156
  MAX_UNSCOPED_SEARCH_DEPTH = 5e3;
60157
+ COLOR_FETCH_CHUNK = 500;
60154
60158
  ROW_QUERY = {
60155
60159
  envelope: true,
60156
60160
  flags: true,
package/build/index.js CHANGED
@@ -66334,10 +66334,13 @@ async function searchUids(client, path3, criteria, size) {
66334
66334
  async function filterUidsByColor(client, uids, colorIndex) {
66335
66335
  if (uids.length === 0) return uids;
66336
66336
  const keep = /* @__PURE__ */ new Set();
66337
- for await (const msg of client.fetch(uids.join(","), { uid: true, flags: true }, { uid: true })) {
66338
- if (typeof msg?.uid !== "number") continue;
66339
- const idx = mailFlagColorIndex(msg.flags);
66340
- if (colorIndex === 0 ? idx === void 0 : idx === colorIndex) keep.add(msg.uid);
66337
+ for (let i = 0; i < uids.length; i += COLOR_FETCH_CHUNK) {
66338
+ const slice = uids.slice(i, i + COLOR_FETCH_CHUNK).join(",");
66339
+ for await (const msg of client.fetch(slice, { uid: true, flags: true }, { uid: true })) {
66340
+ if (typeof msg?.uid !== "number") continue;
66341
+ const idx = mailFlagColorIndex(msg.flags);
66342
+ if (colorIndex === 0 ? idx === void 0 : idx === colorIndex) keep.add(msg.uid);
66343
+ }
66341
66344
  }
66342
66345
  return uids.filter((uid) => keep.has(uid));
66343
66346
  }
@@ -67828,7 +67831,7 @@ async function imapThread(id, deps = {}, limit = 50) {
67828
67831
  true
67829
67832
  );
67830
67833
  }
67831
- var import_imapflow, IMAP_ENV, defaultConnect, SPECIAL_USE_ALIASES, NOT_DELETED, LARGE_MAILBOX_MESSAGES, FIRST_SEARCH_WINDOW, MAX_WINDOW, MAX_UNSCOPED_SEARCH_DEPTH, ROW_QUERY, ROW_QUERY_NO_STRUCTURE, ROW_QUERY_HEADERS_ONLY, DELETED_MARGIN, poolConnect, pools, connecting, MAX_COMPOSE_SOURCE_BYTES, MAX_RFC822_INLINE_BYTES, MAX_RFC822_FILE_BYTES, HEADER_WINDOW_BYTES, MAIL_FLAG_BITS, FLAG_COLOR_NAMES, imapMarkRead, imapMarkUnread, FALLBACK_TRASH_PATH, BASE64_TAIL_WINDOW, QP_EXACT_MAX_BYTES, imapBatchMarkRead, imapBatchMarkUnread, imapBatchFlag, imapBatchUnflag, imapBatchDelete;
67834
+ var import_imapflow, IMAP_ENV, defaultConnect, SPECIAL_USE_ALIASES, NOT_DELETED, LARGE_MAILBOX_MESSAGES, FIRST_SEARCH_WINDOW, MAX_WINDOW, MAX_UNSCOPED_SEARCH_DEPTH, COLOR_FETCH_CHUNK, ROW_QUERY, ROW_QUERY_NO_STRUCTURE, ROW_QUERY_HEADERS_ONLY, DELETED_MARGIN, poolConnect, pools, connecting, MAX_COMPOSE_SOURCE_BYTES, MAX_RFC822_INLINE_BYTES, MAX_RFC822_FILE_BYTES, HEADER_WINDOW_BYTES, MAIL_FLAG_BITS, FLAG_COLOR_NAMES, imapMarkRead, imapMarkUnread, FALLBACK_TRASH_PATH, BASE64_TAIL_WINDOW, QP_EXACT_MAX_BYTES, imapBatchMarkRead, imapBatchMarkUnread, imapBatchFlag, imapBatchUnflag, imapBatchDelete;
67832
67835
  var init_imapClient = __esm({
67833
67836
  "src/services/imapClient.ts"() {
67834
67837
  "use strict";
@@ -67904,6 +67907,7 @@ var init_imapClient = __esm({
67904
67907
  FIRST_SEARCH_WINDOW = 5e3;
67905
67908
  MAX_WINDOW = 5e4;
67906
67909
  MAX_UNSCOPED_SEARCH_DEPTH = 5e3;
67910
+ COLOR_FETCH_CHUNK = 500;
67907
67911
  ROW_QUERY = {
67908
67912
  envelope: true,
67909
67913
  flags: true,
@@ -83560,10 +83564,17 @@ function buildMessageRowLoop(opts) {
83560
83564
  set _dates to date received of _msgs
83561
83565
  set _reads to read status of _msgs
83562
83566
  set _flags to flagged status of _msgs
83563
- set _flagColors to flag index of _msgs
83564
83567
  on error
83565
83568
  set _bulkOK to false
83566
83569
  end try
83570
+ -- Its own try, like the sent dates: a getter that fails on one account type must
83571
+ -- not send every other property down the slow per-message path.
83572
+ set _flagBulkOK to true
83573
+ try
83574
+ set _flagColors to flag index of _msgs
83575
+ on error
83576
+ set _flagBulkOK to false
83577
+ end try
83567
83578
  set _sentBulkOK to true
83568
83579
  try
83569
83580
  set _sentDates to date sent of _msgs
@@ -83591,15 +83602,21 @@ function buildMessageRowLoop(opts) {
83591
83602
  set msgSender to item _i of _sndrs
83592
83603
  set msgRead to (item _i of _reads) as string
83593
83604
  set msgFlagged to (item _i of _flags) as string
83594
- set msgFlagColorRaw to (item _i of _flagColors) as string
83595
83605
  else
83596
83606
  set _m to item _i of _msgs
83597
83607
  set msgSubject to subject of _m
83598
83608
  set msgSender to sender of _m
83599
83609
  set msgRead to read status of _m as string
83600
83610
  set msgFlagged to flagged status of _m as string
83601
- set msgFlagColorRaw to flag index of _m as string
83602
- end if${attRow}
83611
+ end if
83612
+ set msgFlagColorRaw to "-1"
83613
+ try
83614
+ if _bulkOK and _flagBulkOK then
83615
+ set msgFlagColorRaw to (item _i of _flagColors) as string
83616
+ else
83617
+ set msgFlagColorRaw to (flag index of (item _i of _msgs)) as string
83618
+ end if
83619
+ end try${attRow}
83603
83620
  set msgDateStr to ${AS_DATE_TO_STRING}
83604
83621
  set msgDateSentStr to ""
83605
83622
  try
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apple-mail-mcp",
3
- "version": "2.20.19",
3
+ "version": "2.20.20",
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",