@sempervirens-labs/apple-mail-mcp 1.1.0 → 1.2.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.
@@ -9,7 +9,8 @@
9
9
  "Bash(osascript:*)",
10
10
  "Bash(npm publish:*)",
11
11
  "Bash(bun run build)",
12
- "Bash(npx tsc:*)"
12
+ "Bash(npx tsc:*)",
13
+ "Bash(git push:*)"
13
14
  ]
14
15
  }
15
16
  }
package/README.md CHANGED
@@ -234,6 +234,7 @@ Archive an email by moving it to the Archive mailbox.
234
234
  | `messageId` | number | **Yes** | - | Email ID (from mail_get_emails or mail_search) |
235
235
  | `account` | string | No | - | Account name |
236
236
  | `mailbox` | string | No | "INBOX" | Current mailbox of the email |
237
+ | `archiveMailbox` | string | No | auto-detect | Name of the archive folder (auto-detects "Archive", "Archives", or "All Mail") |
237
238
 
238
239
  **Example response:**
239
240
  ```json
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sempervirens-labs/apple-mail-mcp",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "MCP server for Apple Mail - list accounts, mailboxes, search emails, and send messages",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -362,32 +362,49 @@ export function archiveEmail(options: {
362
362
  messageId: number;
363
363
  account?: string;
364
364
  mailbox?: string;
365
+ archiveMailbox?: string;
365
366
  }): { success: boolean; message: string } {
366
- const { messageId, account, mailbox = "INBOX" } = options;
367
+ const { messageId, account, mailbox = "INBOX", archiveMailbox: customArchiveMailbox } = options;
367
368
 
368
369
  const accountPart = account
369
370
  ? `mailbox "${mailbox}" of account "${account}"`
370
371
  : `mailbox "${mailbox}"`;
371
372
 
372
- const script = `
373
- tell application "Mail"
374
- try
375
- set theMailbox to ${accountPart}
376
- set theMessage to (first message of theMailbox whose id is ${messageId})
377
- set theAccount to account of theMailbox
373
+ // If a custom archive mailbox is specified, use it directly
374
+ const archiveLogic = customArchiveMailbox
375
+ ? `
376
+ set archiveMailbox to missing value
377
+ repeat with mb in mailboxes of theAccount
378
+ if name of mb is "${customArchiveMailbox}" then
379
+ set archiveMailbox to mb
380
+ exit repeat
381
+ end if
382
+ end repeat
378
383
 
379
- -- Find the Archive mailbox for this account
384
+ if archiveMailbox is missing value then
385
+ return "ERROR:Archive mailbox '${customArchiveMailbox}' not found for this account"
386
+ end if`
387
+ : `
388
+ -- Find the Archive mailbox for this account (try common names)
380
389
  set archiveMailbox to missing value
381
390
  repeat with mb in mailboxes of theAccount
382
- if name of mb is "Archive" or name of mb is "All Mail" then
391
+ if name of mb is "Archive" or name of mb is "Archives" or name of mb is "All Mail" then
383
392
  set archiveMailbox to mb
384
393
  exit repeat
385
394
  end if
386
395
  end repeat
387
396
 
388
397
  if archiveMailbox is missing value then
389
- return "ERROR:No Archive mailbox found for this account"
390
- end if
398
+ return "ERROR:No Archive mailbox found for this account. Try specifying archiveMailbox parameter with the exact folder name."
399
+ end if`;
400
+
401
+ const script = `
402
+ tell application "Mail"
403
+ try
404
+ set theMailbox to ${accountPart}
405
+ set theMessage to (first message of theMailbox whose id is ${messageId})
406
+ set theAccount to account of theMailbox
407
+ ${archiveLogic}
391
408
 
392
409
  move theMessage to archiveMailbox
393
410
  return "Message archived successfully"
package/src/index.ts CHANGED
@@ -163,6 +163,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
163
163
  messageId,
164
164
  account: args?.account as string | undefined,
165
165
  mailbox: (args?.mailbox as string) || "INBOX",
166
+ archiveMailbox: args?.archiveMailbox as string | undefined,
166
167
  });
167
168
 
168
169
  return {
package/src/tools.ts CHANGED
@@ -165,6 +165,10 @@ export const MAIL_ARCHIVE: Tool = {
165
165
  description: "The name of the mailbox/folder where the email currently is (default: INBOX)",
166
166
  default: "INBOX",
167
167
  },
168
+ archiveMailbox: {
169
+ type: "string",
170
+ description: "The name of the archive mailbox to move the email to (default: auto-detects 'Archive', 'Archives', or 'All Mail')",
171
+ },
168
172
  },
169
173
  required: ["messageId"],
170
174
  },