@mgcrea/mcp-apple-mail 1.24.1 → 1.25.0

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/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as loadConfig, b as MAIL_SURFACE, j as BUILD_INFO, r as createServer } from "./server-DYBtv289.js";
2
+ import { a as loadConfig, b as MAIL_SURFACE, j as BUILD_INFO, r as createServer } from "./server-Chflrnvi.js";
3
3
  import { runStdioServer } from "@mgcrea/mcp-apple-core";
4
4
  //#region src/cli.ts
5
5
  const LOG_PREFIX = "apple-mail-mcp";
package/dist/index.d.ts CHANGED
@@ -67,7 +67,7 @@ declare const locateEnvelopeIndex: (opts?: LocateOptions) => LocateResult;
67
67
  * machinery without a job.
68
68
  */
69
69
  /**
70
- * `allowWrites`, `debug`, `osascriptPath`, `osascriptTimeoutMs` and `maxResults`
70
+ * `allowWrites`, `osascriptPath`, `osascriptTimeoutMs` and `maxResults`
71
71
  * come from `BaseConfigSchema` — every Apple-app server has them, with the same
72
72
  * bounds and the same defaults.
73
73
  */
@@ -75,7 +75,6 @@ declare const ConfigSchema: z.ZodObject<{
75
75
  allowWrites: z.ZodDefault<z.ZodBoolean>;
76
76
  exposePrompts: z.ZodDefault<z.ZodBoolean>;
77
77
  lazyTools: z.ZodDefault<z.ZodBoolean>;
78
- debug: z.ZodDefault<z.ZodBoolean>;
79
78
  osascriptPath: z.ZodDefault<z.ZodString>;
80
79
  osascriptTimeoutMs: z.ZodDefault<z.ZodNumber>;
81
80
  maxResults: z.ZodDefault<z.ZodNumber>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/build-info.ts","../src/client/errors.ts","../src/client/locate.ts","../src/config.ts","../src/client/ax.ts","../src/client/compose.ts","../src/client/mime.ts","../src/client/emlx.ts","../src/client/schema.ts","../src/client/envelope.ts","../src/client/mailbox-map.ts","../src/client/mail.ts","../src/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AAgB;IAAmB;IAAoB;MAC/D;IAAU;IAAiB;IAAgB;;EA6BxC,aACJ,gBACA;IAAQ;IAA4B;MACnC;IAAU;IAAe;IAAgB;IAAqB;;EAqD3D,eAAe,iBAAiB;IACpC;IACA;IACA;IACA;;;;;;;;;;;;;;EAuCI,cACJ,cACA,mBACC;IACD;IACA;IACA;IACA;IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoEI,YACJ,aACA;IAAQ;IAAc;MACrB,QAAQ;EAsCL,gBAAgB,mBAAmB;EAKnC,YAAY;IAChB;IACA;IACA;IACA;IACA;IACA;IACA;MACE;EAaE,eACJ,aACA;IACE;IACA;IACA;IACA;IACA;MAED;;;;;;;;;;;;;;;;;;;;;cC1zCQ;KAED;EACV;EACA;EACA;;cAKW,YAAS,KAAS;cAGlB,YAAS,gBAAkB;;cA2B3B,qBAAkB,MAAU,iBAAe,YAAY;;;cChDvD;cACA;KAED;EACV,QAAQ;EACR,SAAS;;EAET,YAAY;;KAGF;EACV,QAAQ;EACR,QAAQ;;;;;;;cAQG,eAAY,MAAU,wBAAsB;;;KCrB7C;;;;;EAKV;;;;;;;;;;;;cAaW,gBAAa,QAChB,WAAS,QACT,iBAAe,KAClB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/build-info.ts","../src/client/errors.ts","../src/client/locate.ts","../src/config.ts","../src/client/ax.ts","../src/client/compose.ts","../src/client/mime.ts","../src/client/emlx.ts","../src/client/schema.ts","../src/client/envelope.ts","../src/client/mailbox-map.ts","../src/client/mail.ts","../src/client/ref.ts","../src/server.ts","../src/tools/index.ts"],"mappings":";;;;;cAkBa,YAAY;;;;cCWZ,6BAA6B;WACtB;EAElB,YAAY;;;;;;;;;;;;;;;;;;;;KCTF;;EAEV;;EAEA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;;KAKU;;EAEV;;EAEA;;EAEA;;EAEA;;cAiBW,sBAAmB,OAAU,kBAAqB;;;;;;;;;;;;;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YACJ,aACA;IAAQ;IAAc;MACrB,QAAQ;EAsCL,gBAAgB,mBAAmB;EAKnC,YAAY;IAChB;IACA;IACA;IACA;IACA;IACA;IACA;MACE;EAaE,eACJ,aACA;IACE;IACA;IACA;IACA;IACA;MAED;;;;;;;;;;;;;;;;;;;;;cCtzCQ;KAED;EACV;EACA;EACA;;cAKW,YAAS,KAAS;cAGlB,YAAS,gBAAkB;;cA2B3B,qBAAkB,MAAU,iBAAe,YAAY;;;cChDvD;cACA;KAED;EACV,QAAQ;EACR,SAAS;;EAET,YAAY;;KAGF;EACV,QAAQ;EACR,QAAQ;;;;;;;cAQG,eAAY,MAAU,wBAAsB;;;KCrB7C;;;;;EAKV;;;;;;;;;;;;cAaW,gBAAa,QAChB,WAAS,QACT,iBAAe,KAClB"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as WritesDisabledError, C as MessageNotFoundError, D as ProtocolError, E as PreconditionError, O as SchemaDriftError, S as MailNotRunningError, T as PlatformError, _ as locateEnvelopeIndex, a as loadConfig, c as decodeRef, d as assertStaticScript, f as createOsascriptRunner, g as inspectFile, h as MailboxMap, i as registerTools, j as BUILD_INFO, k as TccDeniedError, l as encodeRef, m as withBusyRetry, n as SERVER_VERSION, o as AppleMailClient, p as mapOsaError, r as createServer, s as REF_VERSION, t as SERVER_NAME, u as groupRefsByMailbox, v as AppleMailError, w as OsascriptTimeoutError, x as MailBusyError, y as IndexUnavailableError } from "./server-DYBtv289.js";
1
+ import { A as WritesDisabledError, C as MessageNotFoundError, D as ProtocolError, E as PreconditionError, O as SchemaDriftError, S as MailNotRunningError, T as PlatformError, _ as locateEnvelopeIndex, a as loadConfig, c as decodeRef, d as assertStaticScript, f as createOsascriptRunner, g as inspectFile, h as MailboxMap, i as registerTools, j as BUILD_INFO, k as TccDeniedError, l as encodeRef, m as withBusyRetry, n as SERVER_VERSION, o as AppleMailClient, p as mapOsaError, r as createServer, s as REF_VERSION, t as SERVER_NAME, u as groupRefsByMailbox, v as AppleMailError, w as OsascriptTimeoutError, x as MailBusyError, y as IndexUnavailableError } from "./server-Chflrnvi.js";
2
2
  export { AppleMailClient, AppleMailError, BUILD_INFO, IndexUnavailableError, MailBusyError, MailNotRunningError, MailboxMap, MessageNotFoundError, OsascriptTimeoutError, PlatformError, PreconditionError, ProtocolError, REF_VERSION, SERVER_NAME, SERVER_VERSION, SchemaDriftError, TccDeniedError, WritesDisabledError, assertStaticScript, createOsascriptRunner, createServer, decodeRef, encodeRef, groupRefsByMailbox, inspectFile, loadConfig, locateEnvelopeIndex, mapOsaError, registerTools, withBusyRetry };
@@ -1,7 +1,7 @@
1
- import { AppBusyError as MailBusyError, AppNotRunningError as MailNotRunningError, AppleAutomationError, AppleAutomationError as AppleMailError, BaseConfigSchema, IndexUnavailableError, OsascriptTimeoutError, PlatformError, PreconditionError, ProtocolError, SchemaDriftError, TccDeniedError, WritesDisabledError, assertStaticScript, confirmArg, createOsascriptRunner, describeAggregation, detectEpoch, escapeLike, fingerprintSchema, groupByArg, inspectFile, interferenceNote, limitArg, mapOsaError, openAxChannel, openReadOnly, parseBool, parseBound, parseConfig, parseIntOpt, parseList, project, promptArg, readPackageIdentity, registerSurfaceResources, registerWorkflowPrompt, requiredPromptArg, resolveLimit, selectArg, tableMap, trimmed, watchInterference, withBusyRetry, withLazyTools, wrap } from "@mgcrea/mcp-apple-core";
2
- import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, statSync, writeFileSync } from "node:fs";
1
+ import { AppBusyError as MailBusyError, AppNotRunningError as MailNotRunningError, AppleAutomationError, AppleAutomationError as AppleMailError, BaseConfigSchema, IndexUnavailableError, OsascriptTimeoutError, PlatformError, PreconditionError, ProtocolError, SchemaDriftError, TccDeniedError, WritesDisabledError, assertStaticScript, buildBaseDiagnostics, confirmArg, createOsascriptRunner, describeAggregation, detectEpoch, escapeLike, fingerprintSchema, groupByArg, inspectFile, interferenceNote, limitArg, mapOsaError, openAxChannel, openReadOnly, parseBool, parseBound, parseConfig, parseIntOpt, parseList, project, promptArg, readPackageIdentity, registerSurfaceResources, registerWorkflowPrompt, requiredPromptArg, resolveLimit, selectArg, tableMap, trimmed, watchInterference, withBusyRetry, withLazyTools, wrap, writeConfinedFile } from "@mgcrea/mcp-apple-core";
2
+ import { closeSync, existsSync, openSync, readFileSync, readSync, readdirSync, statSync } from "node:fs";
3
3
  import { homedir } from "node:os";
4
- import { basename, dirname, join, resolve, sep } from "node:path";
4
+ import { basename, dirname, join } from "node:path";
5
5
  import { execFile } from "node:child_process";
6
6
  import { promisify } from "node:util";
7
7
  import { z } from "zod";
@@ -14,8 +14,8 @@ const pkg = readPackageIdentity(new URL("../package.json", import.meta.url), {
14
14
  const BUILD_INFO = {
15
15
  name: pkg.name,
16
16
  version: pkg.version,
17
- gitCommit: "26f4045",
18
- gitCommitDate: "2026-09-29T16:31:42+02:00"
17
+ gitCommit: "782cb1c",
18
+ gitCommitDate: "2026-10-03T15:37:05+02:00"
19
19
  };
20
20
  //#endregion
21
21
  //#region src/client/errors.ts
@@ -1388,7 +1388,7 @@ const extractAttachment = (emlxPath, filename, rowid) => {
1388
1388
  });
1389
1389
  if (!match) throw new PreconditionError(`No attachment named "${filename}" in this message. Use apple_mail_list_attachments to see what is there.`);
1390
1390
  const inline = partBytes(match);
1391
- if (inline.length > 0) return {
1391
+ if (hasContent(inline)) return {
1392
1392
  bytes: inline,
1393
1393
  from: "inline"
1394
1394
  };
@@ -4880,7 +4880,7 @@ var AppleMailClient = class {
4880
4880
  results.push({
4881
4881
  ...base,
4882
4882
  status: "not-probed",
4883
- reason: noIndex ?? void 0
4883
+ ...noIndex ? { reason: noIndex } : {}
4884
4884
  });
4885
4885
  continue;
4886
4886
  }
@@ -4974,23 +4974,19 @@ var AppleMailClient = class {
4974
4974
  const decoded = decodeRef(ref);
4975
4975
  const located = await this.#lookupMessageFile(decoded);
4976
4976
  if (!located.found) throw new PreconditionError(`The message file was not found, so its attachments are not reachable. ${located.explain}`, { probed: located.lookup?.probed.slice(0, 3) ?? [] });
4977
- const root = resolve(this.config.attachmentDir);
4978
- const target = resolve(join(root, basename(filename)));
4979
- if (target !== join(root, basename(filename)) || !target.startsWith(root + sep)) throw new PreconditionError(`Refusing to write outside ${root}. Set APPLE_MAIL_ATTACHMENT_DIR to change the destination.`);
4980
- const { bytes, from } = extractAttachment(located.path, filename, decoded.id);
4981
- mkdirSync(root, { recursive: true });
4982
- try {
4983
- writeFileSync(target, bytes, {
4984
- mode: 384,
4985
- flag: opts.overwrite ? "w" : "wx"
4986
- });
4987
- } catch (err) {
4988
- if (err.code === "EEXIST") throw new PreconditionError(`${target} already exists; refusing to overwrite it.`);
4989
- throw err;
4990
- }
4977
+ let from = "inline";
4991
4978
  return {
4992
- path: target,
4993
- bytes: bytes.length,
4979
+ ...writeConfinedFile({
4980
+ root: this.config.attachmentDir,
4981
+ name: filename,
4982
+ bytes: () => {
4983
+ const extracted = extractAttachment(located.path, filename, decoded.id);
4984
+ from = extracted.from;
4985
+ return extracted.bytes;
4986
+ },
4987
+ overwrite: opts.overwrite ?? false,
4988
+ settingName: "APPLE_MAIL_ATTACHMENT_DIR"
4989
+ }),
4994
4990
  from
4995
4991
  };
4996
4992
  }
@@ -5231,7 +5227,7 @@ var AppleMailClient = class {
5231
5227
  * machinery without a job.
5232
5228
  */
5233
5229
  /**
5234
- * `allowWrites`, `debug`, `osascriptPath`, `osascriptTimeoutMs` and `maxResults`
5230
+ * `allowWrites`, `osascriptPath`, `osascriptTimeoutMs` and `maxResults`
5235
5231
  * come from `BaseConfigSchema` — every Apple-app server has them, with the same
5236
5232
  * bounds and the same defaults.
5237
5233
  */
@@ -5296,7 +5292,6 @@ const loadConfig = (env = process.env) => {
5296
5292
  allowWrites: parseBool(env.APPLE_MAIL_ALLOW_WRITES),
5297
5293
  exposePrompts: parseBool(env.APPLE_MAIL_EXPOSE_PROMPTS),
5298
5294
  lazyTools: parseBool(env.APPLE_MAIL_LAZY_TOOLS),
5299
- debug: parseBool(env.APPLE_MAIL_DEBUG),
5300
5295
  accounts: parseList(env.APPLE_MAIL_ACCOUNTS),
5301
5296
  mailRoot: trimmed(env.APPLE_MAIL_ROOT),
5302
5297
  envelopeIndexPath: trimmed(env.APPLE_MAIL_ENVELOPE_INDEX),
@@ -5522,14 +5517,13 @@ const buildDiagnostics = async (client, ctx) => {
5522
5517
  accountsError = err instanceof Error ? err.message : String(err);
5523
5518
  }
5524
5519
  const indexAgeSeconds = located.mtime ? Math.max(0, Math.round((Date.now() - Date.parse(located.mtime)) / 1e3)) : null;
5520
+ const base = buildBaseDiagnostics({
5521
+ build: BUILD_INFO,
5522
+ config: client.config,
5523
+ allowWrites: ctx.allowWrites
5524
+ });
5525
5525
  return {
5526
- server: {
5527
- name: BUILD_INFO.name,
5528
- version: BUILD_INFO.version,
5529
- gitCommit: BUILD_INFO.gitCommit,
5530
- node: process.version,
5531
- platform: process.platform
5532
- },
5526
+ ...base,
5533
5527
  lanes,
5534
5528
  messageFile,
5535
5529
  bodySearch: {
@@ -5574,8 +5568,7 @@ const buildDiagnostics = async (client, ctx) => {
5574
5568
  reason: located.reason
5575
5569
  },
5576
5570
  settings: {
5577
- allowWrites: ctx.allowWrites,
5578
- exposePrompts: client.config.exposePrompts,
5571
+ ...base.settings,
5579
5572
  accountAllowlist: client.config.accounts.length ? client.config.accounts : "(all accounts)",
5580
5573
  indexMode: client.config.indexMode,
5581
5574
  degradedMaxMessages: client.config.degradedMaxMessages,
@@ -5878,6 +5871,7 @@ const registerMessageTools = (server, client, allowWrites) => {
5878
5871
  body: message.content ?? "",
5879
5872
  note: "Body came from Mail rather than the message file, so attachment details are not " + `available. ${fallbackReason ?? ""}`.trimEnd()
5880
5873
  };
5874
+ const missing = parsed.attachments.filter((a) => !a.retrievable && a.filename).map((a) => a.filename);
5881
5875
  return {
5882
5876
  ref: message.ref,
5883
5877
  source,
@@ -5891,7 +5885,7 @@ const registerMessageTools = (server, client, allowWrites) => {
5891
5885
  truncated: parsed.truncated,
5892
5886
  body: parsed.body,
5893
5887
  attachments: parsed.attachments,
5894
- ...parsed.attachments.some((a) => !a.inline) ? { note: "Some attachments are stored outside this message file, so their sizes are unknown and apple_mail_save_attachment cannot retrieve them. Open the message in Mail to download them first." } : {}
5888
+ ...missing.length > 0 ? { note: `Not downloaded by Mail yet: ${missing.join(", ")}. Its bytes are not on disk, so apple_mail_save_attachment cannot retrieve it. Open the message in Mail to download it first.` } : {}
5895
5889
  };
5896
5890
  }));
5897
5891
  server.registerTool("apple_mail_get_message_source", {
@@ -6235,4 +6229,4 @@ const createServer = (opts) => {
6235
6229
  //#endregion
6236
6230
  export { WritesDisabledError as A, MessageNotFoundError as C, ProtocolError as D, PreconditionError as E, SchemaDriftError as O, MailNotRunningError as S, PlatformError as T, locateEnvelopeIndex as _, loadConfig as a, MAIL_SURFACE as b, decodeRef as c, assertStaticScript as d, createOsascriptRunner as f, inspectFile as g, MailboxMap as h, registerTools as i, BUILD_INFO as j, TccDeniedError as k, encodeRef as l, withBusyRetry as m, SERVER_VERSION as n, AppleMailClient as o, mapOsaError as p, createServer as r, REF_VERSION as s, SERVER_NAME as t, groupRefsByMailbox as u, AppleMailError as v, OsascriptTimeoutError as w, MailBusyError as x, IndexUnavailableError as y };
6237
6231
 
6238
- //# sourceMappingURL=server-DYBtv289.js.map
6232
+ //# sourceMappingURL=server-Chflrnvi.js.map