apple-mail-mcp 2.17.2 → 2.17.3

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 +31 -6
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -82817,11 +82817,36 @@ ${this.errorEmit(" ")}
82817
82817
  }
82818
82818
  const entry = this.buildSmartMailboxEntry(name, fromContains, subjectContains, bodyContains);
82819
82819
  const temp = this.prepareSmartPlistWrite(plistPath);
82820
- const ins = spawnSync2(
82821
- "plutil",
82822
- ["-insert", String(entries.length), "-json", JSON.stringify(entry), temp],
82823
- { encoding: "utf8" }
82824
- );
82820
+ const entryJson = `${temp}.entry.json`;
82821
+ const entryPlist = `${temp}.entry.plist`;
82822
+ const cleanupEntryFiles = () => {
82823
+ for (const f of [entryJson, entryPlist]) {
82824
+ try {
82825
+ unlinkSync(f);
82826
+ } catch {
82827
+ }
82828
+ }
82829
+ };
82830
+ writeFileSync3(entryJson, JSON.stringify([entry]), "utf8");
82831
+ const conv = spawnSync2("plutil", ["-convert", "xml1", "-o", entryPlist, entryJson], {
82832
+ encoding: "utf8"
82833
+ });
82834
+ if (conv.status !== 0) {
82835
+ cleanupEntryFiles();
82836
+ try {
82837
+ unlinkSync(temp);
82838
+ } catch {
82839
+ }
82840
+ return {
82841
+ created: false,
82842
+ alreadyExisted: false,
82843
+ error: (conv.stderr || "plutil could not encode the smart mailbox entry").trim()
82844
+ };
82845
+ }
82846
+ const ins = spawnSync2("/usr/libexec/PlistBuddy", ["-c", `Merge ${entryPlist} :`, temp], {
82847
+ encoding: "utf8"
82848
+ });
82849
+ cleanupEntryFiles();
82825
82850
  if (ins.status !== 0) {
82826
82851
  try {
82827
82852
  unlinkSync(temp);
@@ -82830,7 +82855,7 @@ ${this.errorEmit(" ")}
82830
82855
  return {
82831
82856
  created: false,
82832
82857
  alreadyExisted: false,
82833
- error: (ins.stderr || "plutil insert failed").trim()
82858
+ error: (ins.stderr || "PlistBuddy merge failed").trim()
82834
82859
  };
82835
82860
  }
82836
82861
  if (!this.commitSmartPlist(temp, plistPath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apple-mail-mcp",
3
- "version": "2.17.2",
3
+ "version": "2.17.3",
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",