apple-mail-mcp 1.6.1 → 1.6.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"applescript.d.ts","sourceRoot":"","sources":["../../src/utils/applescript.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAmQxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,CAoInB"}
1
+ {"version":3,"file":"applescript.d.ts","sourceRoot":"","sources":["../../src/utils/applescript.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA8RxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,CAwInB"}
@@ -13,6 +13,32 @@ import { execSync, spawnSync } from "child_process";
13
13
  * searches on large mailboxes. Can be overridden per-call.
14
14
  */
15
15
  const DEFAULT_TIMEOUT_MS = 30000;
16
+ /**
17
+ * Maximum stdout/stderr buffer (bytes) for an osascript invocation.
18
+ *
19
+ * Node's `execSync` defaults to a 1 MB `maxBuffer`; exceeding it throws
20
+ * `ENOBUFS`, which we surface as a failure and callers convert to `null`. Mail
21
+ * operations routinely exceed 1 MB — `getRawSource` reads the entire raw MIME
22
+ * (a 20 MB attachment is explicitly anticipated), `getMessageContent` returns
23
+ * the full source, and large `search`/`list` result sets accumulate — so the
24
+ * default silently breaks exactly the large / attachment-bearing messages where
25
+ * it matters most (issue #27). Default to 64 MB; override with
26
+ * `APPLE_MAIL_MCP_MAX_BUFFER` (bytes).
27
+ */
28
+ const DEFAULT_MAX_BUFFER_BYTES = 64 * 1024 * 1024;
29
+ /**
30
+ * Resolve the osascript output buffer size, honoring the
31
+ * `APPLE_MAIL_MCP_MAX_BUFFER` environment override (bytes).
32
+ */
33
+ function getMaxBuffer() {
34
+ const raw = process.env.APPLE_MAIL_MCP_MAX_BUFFER;
35
+ if (raw !== undefined) {
36
+ const n = Number(raw);
37
+ if (Number.isFinite(n) && n > 0)
38
+ return n;
39
+ }
40
+ return DEFAULT_MAX_BUFFER_BYTES;
41
+ }
16
42
  /**
17
43
  * Default retry configuration.
18
44
  * - 1 attempt means no retries (default behavior)
@@ -325,6 +351,10 @@ export function executeAppleScript(script, options = {}) {
325
351
  // up and worsen the contention. SIGKILL guarantees the process is reaped
326
352
  // when the timeout fires. (#11)
327
353
  killSignal: "SIGKILL",
354
+ // Raise the output cap well above Node's 1 MB default so large message
355
+ // sources / attachment payloads aren't truncated into an ENOBUFS
356
+ // failure. (#27)
357
+ maxBuffer: getMaxBuffer(),
328
358
  // Capture stderr separately to get error details
329
359
  stdio: ["pipe", "pipe", "pipe"],
330
360
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apple-mail-mcp",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "MCP server for Apple Mail - read, search, send, and manage emails via Claude",
5
5
  "type": "module",
6
6
  "main": "build/index.js",