apple-mail-mcp 2.19.3 → 2.19.5

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
@@ -59094,7 +59094,12 @@ async function imapThread(id, deps = {}, limit = 50) {
59094
59094
  id: encodeImapId(ref.account, ref.path, m.uid),
59095
59095
  subject: m.envelope?.subject || "(no subject)",
59096
59096
  sender: senderName(m.envelope?.from),
59097
- date: m.envelope?.date ? new Date(m.envelope.date).toISOString() : "",
59097
+ // Was `new Date(m.envelope.date).toISOString()`, unguarded — a
59098
+ // truthy but unparseable `env.date` (e.g. a non-RFC-5322 header the
59099
+ // IMAP server's own ENVELOPE parser couldn't normalize) threw
59100
+ // `RangeError: Invalid time value` out of get-thread (#226 follow-up).
59101
+ // Same omitted-not-invented contract as `structuredRow` (2.19.2).
59102
+ date: isoOrEmpty(m.envelope?.date),
59098
59103
  isRead: m.flags?.has("\\Seen") ?? false
59099
59104
  }))
59100
59105
  };
package/build/index.js CHANGED
@@ -65131,6 +65131,23 @@ function splitIds(raw) {
65131
65131
  if (bracketed) return bracketed.map(bareId).filter(Boolean);
65132
65132
  return raw.split(/[\s,]+/).map(bareId).filter(Boolean);
65133
65133
  }
65134
+ function parseDateHeader(value) {
65135
+ const direct = new Date(value);
65136
+ if (!Number.isNaN(direct.getTime())) return direct;
65137
+ let replaced = value;
65138
+ for (const [abbr, en] of Object.entries(LOCALE_MONTHS)) {
65139
+ const re = new RegExp(`\\b${abbr}\\.?\\b`, "i");
65140
+ if (re.test(replaced)) {
65141
+ replaced = replaced.replace(re, en);
65142
+ break;
65143
+ }
65144
+ }
65145
+ if (replaced !== value) {
65146
+ const viaMonth = new Date(replaced);
65147
+ if (!Number.isNaN(viaMonth.getTime())) return viaMonth;
65148
+ }
65149
+ return void 0;
65150
+ }
65134
65151
  function parseHeaderBlock(input) {
65135
65152
  const text = (input ?? "").replace(/\r\n|\r/g, "\n");
65136
65153
  const blank = text.search(/\n\n/);
@@ -65154,8 +65171,8 @@ function parseHeaderBlock(input) {
65154
65171
  const dateHeader = first("Date");
65155
65172
  let date3;
65156
65173
  if (dateHeader) {
65157
- const parsed = new Date(dateHeader.replace(/\s*\([^)]*\)\s*$/, ""));
65158
- if (!Number.isNaN(parsed.getTime())) date3 = parsed.toISOString();
65174
+ const parsed = parseDateHeader(dateHeader.replace(/\s*\([^)]*\)\s*$/, ""));
65175
+ if (parsed) date3 = parsed.toISOString();
65159
65176
  }
65160
65177
  const messageIdRaw = first("Message-ID") ?? first("Message-Id");
65161
65178
  const inReplyToRaw = first("In-Reply-To");
@@ -65202,9 +65219,52 @@ function isoOrUndefined(d) {
65202
65219
  const date3 = d instanceof Date ? d : new Date(d);
65203
65220
  return Number.isNaN(date3.getTime()) ? void 0 : date3.toISOString();
65204
65221
  }
65222
+ var LOCALE_MONTHS;
65205
65223
  var init_headers = __esm({
65206
65224
  "src/utils/headers.ts"() {
65207
65225
  "use strict";
65226
+ LOCALE_MONTHS = {
65227
+ // Spanish
65228
+ ene: "Jan",
65229
+ feb: "Feb",
65230
+ mar: "Mar",
65231
+ abr: "Apr",
65232
+ may: "May",
65233
+ jun: "Jun",
65234
+ jul: "Jul",
65235
+ ago: "Aug",
65236
+ sep: "Sep",
65237
+ set: "Sep",
65238
+ oct: "Oct",
65239
+ nov: "Nov",
65240
+ dic: "Dec",
65241
+ // French
65242
+ janv: "Jan",
65243
+ f\u00E9vr: "Feb",
65244
+ fevr: "Feb",
65245
+ avr: "Apr",
65246
+ mai: "May",
65247
+ juin: "Jun",
65248
+ juil: "Jul",
65249
+ ao\u00FBt: "Aug",
65250
+ aout: "Aug",
65251
+ d\u00E9c: "Dec",
65252
+ dec: "Dec",
65253
+ // German
65254
+ jan: "Jan",
65255
+ m\u00E4r: "Mar",
65256
+ maer: "Mar",
65257
+ mrz: "Mar",
65258
+ okt: "Oct",
65259
+ dez: "Dec",
65260
+ // Italian / Portuguese
65261
+ gen: "Jan",
65262
+ giu: "Jun",
65263
+ lug: "Jul",
65264
+ ott: "Oct",
65265
+ out: "Oct",
65266
+ fev: "Feb"
65267
+ };
65208
65268
  }
65209
65269
  });
65210
65270
 
@@ -66504,7 +66564,12 @@ async function imapThread(id, deps = {}, limit = 50) {
66504
66564
  id: encodeImapId(ref.account, ref.path, m.uid),
66505
66565
  subject: m.envelope?.subject || "(no subject)",
66506
66566
  sender: senderName(m.envelope?.from),
66507
- date: m.envelope?.date ? new Date(m.envelope.date).toISOString() : "",
66567
+ // Was `new Date(m.envelope.date).toISOString()`, unguarded — a
66568
+ // truthy but unparseable `env.date` (e.g. a non-RFC-5322 header the
66569
+ // IMAP server's own ENVELOPE parser couldn't normalize) threw
66570
+ // `RangeError: Invalid time value` out of get-thread (#226 follow-up).
66571
+ // Same omitted-not-invented contract as `structuredRow` (2.19.2).
66572
+ date: isoOrEmpty(m.envelope?.date),
66508
66573
  isRead: m.flags?.has("\\Seen") ?? false
66509
66574
  }))
66510
66575
  };
@@ -86598,7 +86663,16 @@ function messageSummary(m) {
86598
86663
  id: m.id,
86599
86664
  subject: m.subject,
86600
86665
  sender: m.sender,
86601
- dateReceived: m.dateReceived instanceof Date ? m.dateReceived.toISOString() : m.dateReceived,
86666
+ // `m.dateReceived` can be a genuine `Date` instance that is nonetheless
86667
+ // INVALID: `parseAppleScriptDate` (appleMailManager.ts) returns `new
86668
+ // Date(NaN)` rather than `undefined` when Mail's own "date received" /
86669
+ // "date sent" property doesn't parse, and `instanceof Date` is true for an
86670
+ // invalid Date too. Calling `.toISOString()` unconditionally threw
86671
+ // `RangeError: Invalid time value` out of search-messages/list-messages for
86672
+ // any AppleScript-backed row with an unparseable arrival date (#226
86673
+ // follow-up) — omitted-as-empty, never invented, same contract as the IMAP
86674
+ // rows' `isoOrEmpty`.
86675
+ dateReceived: m.dateReceived instanceof Date ? Number.isNaN(m.dateReceived.getTime()) ? "" : m.dateReceived.toISOString() : m.dateReceived,
86602
86676
  isRead: m.isRead,
86603
86677
  isFlagged: m.isFlagged,
86604
86678
  mailbox: m.mailbox,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apple-mail-mcp",
3
- "version": "2.19.3",
3
+ "version": "2.19.5",
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",