@sempervirens-labs/apple-mail-mcp 1.5.0 → 1.6.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.
@@ -12,7 +12,11 @@
12
12
  "Bash(npx tsc:*)",
13
13
  "Bash(git push:*)",
14
14
  "Bash(git add:*)",
15
- "Bash(git commit:*)"
15
+ "Bash(git commit:*)",
16
+ "Bash(sdef:*)",
17
+ "WebSearch",
18
+ "Bash(npm run build)",
19
+ "Bash(bun run tsc:*)"
16
20
  ]
17
21
  }
18
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sempervirens-labs/apple-mail-mcp",
3
- "version": "1.5.0",
3
+ "version": "1.6.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",
@@ -790,3 +790,36 @@ end tell
790
790
  return { success: false, message: error.message };
791
791
  }
792
792
  }
793
+
794
+ /**
795
+ * Send the front-most draft (outgoing message) in Apple Mail
796
+ */
797
+ export function sendDraft(): { success: boolean; message: string } {
798
+ const script = `
799
+ tell application "Mail"
800
+ try
801
+ set outgoingCount to count of outgoing messages
802
+ if outgoingCount is 0 then
803
+ return "ERROR:No draft message found. Create a draft first using mail_create_draft or mail_create_draft_reply."
804
+ end if
805
+
806
+ set theDraft to outgoing message 1
807
+ send theDraft
808
+
809
+ return "Draft sent successfully"
810
+ on error errMsg
811
+ return "ERROR:" & errMsg
812
+ end try
813
+ end tell
814
+ `;
815
+
816
+ try {
817
+ const result = runAppleScript(script, 30000);
818
+ if (result.startsWith("ERROR:")) {
819
+ return { success: false, message: result.substring(6) };
820
+ }
821
+ return { success: true, message: result || "Draft sent successfully" };
822
+ } catch (error: any) {
823
+ return { success: false, message: error.message };
824
+ }
825
+ }
package/src/index.ts CHANGED
@@ -22,6 +22,7 @@ import {
22
22
  markAsUnread,
23
23
  createDraft,
24
24
  createDraftReply,
25
+ sendDraft,
25
26
  } from "./applescript/mail.js";
26
27
 
27
28
  // Create MCP server
@@ -318,6 +319,19 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
318
319
  };
319
320
  }
320
321
 
322
+ case "mail_send_draft": {
323
+ const result = sendDraft();
324
+
325
+ return {
326
+ content: [
327
+ {
328
+ type: "text",
329
+ text: JSON.stringify(result, null, 2),
330
+ },
331
+ ],
332
+ };
333
+ }
334
+
321
335
  default:
322
336
  throw new Error(`Unknown tool: ${name}`);
323
337
  }
package/src/tools.ts CHANGED
@@ -360,6 +360,16 @@ export const MAIL_CREATE_DRAFT_REPLY: Tool = {
360
360
  },
361
361
  };
362
362
 
363
+ export const MAIL_SEND_DRAFT: Tool = {
364
+ name: "mail_send_draft",
365
+ description: "Send the front-most draft (compose window) in Apple Mail. Use this after creating a draft with mail_create_draft or mail_create_draft_reply.",
366
+ inputSchema: {
367
+ type: "object",
368
+ properties: {},
369
+ required: [],
370
+ },
371
+ };
372
+
363
373
  export const tools: Tool[] = [
364
374
  MAIL_LIST_ACCOUNTS,
365
375
  MAIL_LIST_MAILBOXES,
@@ -374,4 +384,5 @@ export const tools: Tool[] = [
374
384
  MAIL_MARK_UNREAD,
375
385
  MAIL_CREATE_DRAFT,
376
386
  MAIL_CREATE_DRAFT_REPLY,
387
+ MAIL_SEND_DRAFT,
377
388
  ];