@mgcrea/mcp-apple-mail 1.6.0 → 1.7.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-C1JZDY5c.js";
2
+ import { a as loadConfig, b as MAIL_SURFACE, j as BUILD_INFO, r as createServer } from "./server-BlDyuhLT.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
@@ -286,16 +286,8 @@ declare class MailboxMap {
286
286
  }
287
287
  //#endregion
288
288
  //#region src/client/mail.d.ts
289
- /**
290
- * The facade every tool talks to. It owns three things the tools should not
291
- * each re-decide: which lane answers a question, what to say when a lane is
292
- * unavailable, and the read-after-write rule.
293
- */
294
289
  type MessageSummary = {
295
290
  ref: string;
296
- id: number;
297
- accountUuid: string;
298
- mailbox: string;
299
291
  subject: string | null;
300
292
  sender: string | null;
301
293
  dateReceived: string | null;
@@ -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/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;;;;;;;;;;;;;;;cC3CzD,cAAY,EAAA;;;;;;;;;;;;;;;;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I,YACJ,aACA;IAAQ;IAAc;MACrB,QAAQ;EAoBL,gBAAgB,mBAAmB;EAKnC,YAAY;IAChB;IACA;IACA;IACA;IACA;IACA;IACA;MACE;EAaE,eACJ,aACA;IACE;IACA;IACA;IACA;IACA;MAED;;;;;;;;;;;;;;;;;;;;;cChnCQ;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;;;KCtB7C;;;;;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/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;;;;;;;;;;;;;;;cC3CzD,cAAY,EAAA;;;;;;;;;;;;;;;;;;;;;;GA8CP,EAAA,KAAA;KAEC,SAAS,EAAE,aAAa;;;;;cAMvB,aAAU,MAAS,OAAO,eAA2B;;;KCvDtD;EACV;EACA;EACA;;;;;;;;;EASA;;EAEA;;;;;;;;;;;;;;;;;;;;;KCEU;EACV,SAAS;EACT;EACA;;EAEA,cAAc;IAAe;;EAC7B;EACA;EACA;EACA;;;;KC1BU;EACV;EACA,QAAQ;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AAU,iBAAe,YAAY;;;cChDvD;cACA;KAED;EACV,QAAQ;EACR,SAAS;;EAET,YAAY;;KAGF;EACV,QAAQ;EACR,QAAQ;;;;;;;cAQG,eAAY,MAAU,wBAAsB;;;KCtB7C;;;;;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-C1JZDY5c.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-BlDyuhLT.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,4 +1,4 @@
1
- import { AppBusyError as MailBusyError, AppNotRunningError as MailNotRunningError, AppleAutomationError, AppleAutomationError as AppleMailError, BaseConfigSchema, IndexUnavailableError, OsascriptTimeoutError, PlatformError, PreconditionError, ProtocolError, SchemaDriftError, TccDeniedError, WritesDisabledError, assertStaticScript, confirmArg, createOsascriptRunner, detectEpoch, escapeLike, fingerprintSchema, inspectFile, limitArg, mapOsaError, openReadOnly, parseBool, parseConfig, parseIntOpt, parseList, promptArg, readPackageIdentity, registerSurfaceResources, registerWorkflowPrompt, requiredPromptArg, tableMap, trimmed, withBusyRetry, wrap } from "@mgcrea/mcp-apple-core";
1
+ import { AppBusyError as MailBusyError, AppNotRunningError as MailNotRunningError, AppleAutomationError, AppleAutomationError as AppleMailError, BaseConfigSchema, IndexUnavailableError, OsascriptTimeoutError, PlatformError, PreconditionError, ProtocolError, SchemaDriftError, TccDeniedError, WritesDisabledError, assertStaticScript, confirmArg, createOsascriptRunner, detectEpoch, escapeLike, fingerprintSchema, inspectFile, limitArg, mapOsaError, openReadOnly, parseBool, parseConfig, parseIntOpt, parseList, promptArg, readPackageIdentity, registerSurfaceResources, registerWorkflowPrompt, requiredPromptArg, resolveLimit, tableMap, trimmed, withBusyRetry, wrap } from "@mgcrea/mcp-apple-core";
2
2
  import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, statSync, writeFileSync } from "node:fs";
3
3
  import { homedir } from "node:os";
4
4
  import { basename, dirname, join, resolve, sep } from "node:path";
@@ -12,8 +12,8 @@ const pkg = readPackageIdentity(new URL("../package.json", import.meta.url), {
12
12
  const BUILD_INFO = {
13
13
  name: pkg.name,
14
14
  version: pkg.version,
15
- gitCommit: "90f269d",
16
- gitCommitDate: "2026-09-01T00:21:33+02:00"
15
+ gitCommit: "24d3fc4",
16
+ gitCommitDate: "2026-09-01T14:32:08+02:00"
17
17
  };
18
18
  //#endregion
19
19
  //#region src/client/errors.ts
@@ -1959,8 +1959,10 @@ const SEND_MESSAGE = script(`
1959
1959
  * * **Threading.** `In-Reply-To` and `References` are set by Mail's own
1960
1960
  * `reply` command, which needs the original message. A recreated reply
1961
1961
  * draft looks perfect and starts a new thread.
1962
- * * **Attachments.** They can be read but not re-attached; the dictionary has
1963
- * no verb for adding one to an outgoing message.
1962
+ * * **Attachments.** Adding one to an outgoing message IS possible:
1963
+ * `content.attachments.push(Mail.Attachment({fileName: Path(f)}))`, measured
1964
+ * on macOS 26.6. What is missing is a file to point at. The bytes live in the
1965
+ * original's sidecar tree, and extracting them first is not done here.
1964
1966
  *
1965
1967
  * Both are refused rather than silently dropped. A draft that is correct in
1966
1968
  * every visible respect except the part nobody checks is the exact failure the
@@ -2076,9 +2078,9 @@ const UPDATE_DRAFT = script(`
2076
2078
  return ok({
2077
2079
  replaced: false, degraded: true, capability: "attachments", draft: facts,
2078
2080
  reason:
2079
- "This draft carries " + attachments + " attachment(s). Mail's scripting interface can " +
2080
- "read an attachment but has no verb for adding one to an outgoing message, so " +
2081
- "recreating the draft would silently drop them.",
2081
+ "This draft carries " + attachments + " attachment(s). Recreating it would silently drop " +
2082
+ "them: their bytes live inside the original message, not as files this can point at, and " +
2083
+ "re-attaching means extracting them first, which is not done here.",
2082
2084
  hint: "Edit the body in Mail directly, which keeps the attachments."
2083
2085
  });
2084
2086
  }
@@ -2864,9 +2866,6 @@ var AppleMailClient = class {
2864
2866
  mailbox: entry.mailbox,
2865
2867
  id: row.rowid
2866
2868
  }),
2867
- id: row.rowid,
2868
- accountUuid: entry.accountUuid,
2869
- mailbox: entry.mailbox,
2870
2869
  subject: row.subject,
2871
2870
  sender,
2872
2871
  dateReceived: row.dateReceived,
@@ -3321,14 +3320,14 @@ var AppleMailClient = class {
3321
3320
  });
3322
3321
  }
3323
3322
  #withRef(m) {
3324
- const ref = {
3325
- accountUuid: m.accountUuid,
3326
- mailbox: m.mailbox,
3327
- id: m.id
3328
- };
3323
+ const { id, accountUuid, mailbox, ...rest } = m;
3329
3324
  return {
3330
- ...m,
3331
- ref: encodeRef(ref)
3325
+ ...rest,
3326
+ ref: encodeRef({
3327
+ accountUuid,
3328
+ mailbox,
3329
+ id
3330
+ })
3332
3331
  };
3333
3332
  }
3334
3333
  };
@@ -3933,7 +3932,7 @@ const registerComposeTools = (server, client) => {
3933
3932
  });
3934
3933
  }));
3935
3934
  server.registerTool("apple_mail_update_draft", {
3936
- description: "Replace the body of an unsent draft. Mail has no way to edit a saved draft — its `content` is read-only and there is no open or edit command — so this RECREATES it: a new draft with the same recipients and a new body, and the old one deleted once the replacement is confirmed present. The ref you passed in is DEAD afterwards and the result carries the new one. It REFUSES rather than doing damage, and returns `replaced: false` with a reason when it does: on a reply or forward draft, because In-Reply-To is set by Mail's reply command and a recreated one would silently start a new thread; on a draft carrying attachments, because they cannot be re-attached; and on anything that is not in the Drafts mailbox, because deleting a sent or received message and writing a lookalike is not editing. In every refusal the original is untouched. If the replacement cannot be confirmed the original is KEPT and you are told there are now two — never assume a clean swap without reading `replaced`.",
3935
+ description: "Replace the body of an unsent draft. Mail has no way to edit a saved draft — its `content` is read-only and there is no open or edit command — so this RECREATES it: a new draft with the same recipients and a new body, and the old one deleted once the replacement is confirmed present. The ref you passed in is DEAD afterwards and the result carries the new one. It REFUSES rather than doing damage, and returns `replaced: false` with a reason when it does: on a reply or forward draft, because In-Reply-To is set by Mail's reply command and a recreated one would silently start a new thread; on a draft carrying attachments, because their bytes are not available as files to re-attach; and on anything not in the Drafts mailbox, because deleting a sent or received message and writing a lookalike is not editing. In every refusal the original is untouched. If the replacement cannot be confirmed the original is KEPT and you are told there are now two — never assume a clean swap without reading `replaced`.",
3937
3936
  inputSchema: {
3938
3937
  ref: messageRefArg,
3939
3938
  body: z.string().min(1).describe("The complete new body. This REPLACES the draft's text rather than appending to it, so include everything that should remain — read the draft first with apple_mail_get_message if you are editing rather than rewriting."),
@@ -4069,7 +4068,7 @@ const registerSearchTools = (server, client) => {
4069
4068
  }, async (args) => wrap(async () => {
4070
4069
  const result = await client.searchMessages({
4071
4070
  ...args,
4072
- limit: Math.min(args.limit ?? 25, client.config.maxResults),
4071
+ limit: resolveLimit(args.limit, client.config.maxResults),
4073
4072
  offset: args.offset ?? 0
4074
4073
  });
4075
4074
  if (!result) return {
@@ -4106,7 +4105,7 @@ const registerSearchTools = (server, client) => {
4106
4105
  },
4107
4106
  annotations: { readOnlyHint: true }
4108
4107
  }, async ({ ref, limit }) => wrap(async () => {
4109
- const messages = await client.threadOf(ref, Math.min(limit ?? 50, client.config.maxResults));
4108
+ const messages = await client.threadOf(ref, resolveLimit(limit, client.config.maxResults, 50));
4110
4109
  if (!messages) return {
4111
4110
  degraded: true,
4112
4111
  capability: "search-index",
@@ -4134,7 +4133,7 @@ const registerSearchTools = (server, client) => {
4134
4133
  note: "No accounts are visible to this server."
4135
4134
  };
4136
4135
  const box = mailbox ?? (resolved.mailboxes.includes("INBOX") ? "INBOX" : "Inbox");
4137
- const result = await client.listRecent(resolved, box, limit ?? 25);
4136
+ const result = await client.listRecent(resolved, box, resolveLimit(limit, client.config.maxResults));
4138
4137
  const lanes = await client.lanes();
4139
4138
  return {
4140
4139
  account: resolved.name,
@@ -4245,4 +4244,4 @@ const createServer = (opts) => {
4245
4244
  //#endregion
4246
4245
  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 };
4247
4246
 
4248
- //# sourceMappingURL=server-C1JZDY5c.js.map
4247
+ //# sourceMappingURL=server-BlDyuhLT.js.map