apple-mail-mcp 2.8.14 → 2.8.16

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 +9 -29
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -78534,20 +78534,9 @@ var AppleMailManager = class {
78534
78534
  */
78535
78535
  getUnreadCount(mailbox, account) {
78536
78536
  const targetAccount = this.resolveAccount(account);
78537
- let command;
78538
- if (mailbox) {
78539
- const targetMailbox = this.resolveMailbox(mailbox, targetAccount);
78540
- const safeMailbox = escapeForAppleScript(targetMailbox);
78541
- command = `return unread count of mailbox "${safeMailbox}"`;
78542
- } else {
78543
- command = `
78544
- set total to 0
78545
- repeat with mb in mailboxes
78546
- set total to total + (unread count of mb)
78547
- end repeat
78548
- return total
78549
- `;
78550
- }
78537
+ const targetMailbox = this.resolveMailbox(mailbox || "INBOX", targetAccount);
78538
+ const safeMailbox = escapeForAppleScript(targetMailbox);
78539
+ const command = `return unread count of mailbox "${safeMailbox}"`;
78551
78540
  const script = buildAccountScopedScript(targetAccount, command);
78552
78541
  const result = executeAppleScript(script, { timeoutMs: 6e4 });
78553
78542
  if (!result.success) {
@@ -79815,19 +79804,8 @@ function imapUnreadCount(mailbox, deps = {}) {
79815
79804
  return useClient(
79816
79805
  deps,
79817
79806
  async (client) => {
79818
- if (mailbox) {
79819
- const s = await client.status(resolveMailboxPath(mailbox, "list"), { unseen: true });
79820
- return s.unseen ?? 0;
79821
- }
79822
- let total = 0;
79823
- for (const b of await client.list()) {
79824
- try {
79825
- const s = await client.status(b.path, { unseen: true });
79826
- total += s.unseen ?? 0;
79827
- } catch {
79828
- }
79829
- }
79830
- return total;
79807
+ const s = await client.status(resolveMailboxPath(mailbox, "list"), { unseen: true });
79808
+ return s.unseen ?? 0;
79831
79809
  },
79832
79810
  true
79833
79811
  );
@@ -79917,6 +79895,7 @@ async function dropPool(key) {
79917
79895
  if (e.idle) clearTimeout(e.idle);
79918
79896
  pools.delete(key);
79919
79897
  await e.client.logout().catch(() => void 0);
79898
+ e.client.close?.();
79920
79899
  }
79921
79900
  async function dropAllPools() {
79922
79901
  await Promise.all([...pools.keys()].map((k) => dropPool(k)));
@@ -79990,6 +79969,7 @@ async function useClient(deps, fn, retryOnDrop = false) {
79990
79969
  return await fn(client, cfg);
79991
79970
  } finally {
79992
79971
  await client.logout().catch(() => void 0);
79972
+ client.close?.();
79993
79973
  }
79994
79974
  }
79995
79975
  const key = poolKey(cfg);
@@ -82268,9 +82248,9 @@ ${mailboxList}`, structured);
82268
82248
  server.registerTool(
82269
82249
  "get-unread-count",
82270
82250
  {
82271
- description: "Use when: you only need the number of unread messages (optionally scoped to one mailbox and/or account), without listing the messages themselves.\nReturns: the unread count for the requested scope.\nDo not use when: you need the actual unread messages and their ids (use list-messages with unreadOnly, or search-messages with isRead=false) or broader totals (use get-mail-stats).",
82251
+ description: "Use when: you only need the number of unread messages \u2014 INBOX by default, or scoped to one mailbox and/or account \u2014 without listing the messages themselves.\nReturns: the unread count for the requested scope (INBOX when no mailbox is given).\nDo not use when: you need the actual unread messages and their ids (use list-messages with unreadOnly, or search-messages with isRead=false) or broader totals across every mailbox (use get-mail-stats).",
82272
82252
  inputSchema: {
82273
- mailbox: external_exports.string().optional().describe("Mailbox to check (default: all)"),
82253
+ mailbox: external_exports.string().optional().describe("Mailbox to check (default: INBOX)"),
82274
82254
  account: external_exports.string().optional().describe("Account to check")
82275
82255
  },
82276
82256
  outputSchema: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apple-mail-mcp",
3
- "version": "2.8.14",
3
+ "version": "2.8.16",
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",