apple-mail-mcp 2.18.0 → 2.18.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.
Files changed (2) hide show
  1. package/build/index.js +21 -2
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -84613,12 +84613,31 @@ ${indent}end try${this.sanitizeFragment("_uacct", indent)}${this.sanitizeFragmen
84613
84613
  set _out to _out & ((item _k of _gpos) as string) & "${FIELD_SEP}error:source mailbox \\"${mbInProse}\\" not found in account \\"${acctInProse}\\"${RECORD_SEP}"
84614
84614
  end repeat
84615
84615
  else${instrument ? `${this.countFragment("_cb")}${this.snapshotFragment("before", acctLit, mbLit, "_cb")}` : ""}
84616
+ -- WARNING: "whose id is N" is NOT an exact match -- Mail ROUNDS.
84617
+ -- Measured on Mail 2026-09-10 against a real store: "whose id is
84618
+ -- 78364.6" resolves to id 78365, a DIFFERENT, ADJACENT message that
84619
+ -- was never asked for (78364.0-.5 -> 78364, 78364.6-.0 -> 78365). So
84620
+ -- an id reaching AppleScript with the slightest imprecision does not
84621
+ -- fail; it silently selects a neighbour, and this loop then DELETES
84622
+ -- or MOVES it. That is exactly the #155 residual: "two adjacent
84623
+ -- messages that were NOT in the id list got deleted instead."
84624
+ --
84625
+ -- Reachable whenever an id survives JS's 2^53 safe-integer range or
84626
+ -- renders in exponential form -- both change the value before Mail
84627
+ -- sees it. Rather than enumerate those paths, refuse to act on any
84628
+ -- message whose OWN id is not the one requested: a mis-resolution
84629
+ -- becomes a safe notfound instead of a wrong-message mutation.
84630
+ -- Compared numerically, never as strings -- see canonicalNumericId
84631
+ -- for why the string forms cannot be trusted.
84632
+ --
84633
+ -- NB: no backticks anywhere in this comment. A backtick inside an
84634
+ -- AppleScript comment terminates the enclosing TS template literal.
84616
84635
  repeat with _k from 1 to (count of _gids)
84617
84636
  set _idx to item _k of _gpos
84618
84637
  set _pre to ""
84619
84638
  try
84620
84639
  set _m to (messages of _tmb whose id is (item _k of _gids))
84621
- if (count of _m) > 0 then
84640
+ if (count of _m) > 0 and ((id of (item 1 of _m)) is (item _k of _gids)) then
84622
84641
  set _msg to item 1 of _m${pre}
84623
84642
  ${operation}
84624
84643
  set _out to _out & (_idx as string) & "${FIELD_SEP}ok" & _pre & "${RECORD_SEP}"
@@ -84648,7 +84667,7 @@ ${this.errorEmit(" ")}
84648
84667
  repeat with _k from 1 to _ucount
84649
84668
  try
84650
84669
  set _m to (messages of mb whose id is (item _k of _uids))
84651
- if (count of _m) > 0 then
84670
+ if (count of _m) > 0 and ((id of (item 1 of _m)) is (item _k of _uids)) then
84652
84671
  set item _k of _uhit to ((item _k of _uhit) + 1)
84653
84672
  if (item _k of _uhit) is 1 then set item _k of _umsg to (item 1 of _m)
84654
84673
  set item _k of _unames to ((item _k of _unames) & (name of acct) & "/" & (name of mb) & ", ")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apple-mail-mcp",
3
- "version": "2.18.0",
3
+ "version": "2.18.1",
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",