@sempervirens-labs/apple-mail-mcp 1.3.0 → 1.4.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/README.md CHANGED
@@ -160,6 +160,7 @@ Get recent emails from a mailbox.
160
160
  | `mailbox` | string | No | "INBOX" | Mailbox name |
161
161
  | `limit` | number | No | 10 | Max emails to retrieve |
162
162
  | `includeContent` | boolean | No | false | Include email body |
163
+ | `unreadOnly` | boolean | No | false | Only return unread emails |
163
164
 
164
165
  **Example response:**
165
166
  ```json
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sempervirens-labs/apple-mail-mcp",
3
- "version": "1.3.0",
3
+ "version": "1.4.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",
@@ -116,8 +116,9 @@ export function getEmails(options: {
116
116
  mailbox?: string;
117
117
  limit?: number;
118
118
  includeContent?: boolean;
119
+ unreadOnly?: boolean;
119
120
  }): Email[] {
120
- const { account, mailbox = "INBOX", limit = 10, includeContent = false } = options;
121
+ const { account, mailbox = "INBOX", limit = 10, includeContent = false, unreadOnly = false } = options;
121
122
 
122
123
  const contentPart = includeContent
123
124
  ? `set msgContent to content of msg`
@@ -127,12 +128,17 @@ export function getEmails(options: {
127
128
  ? `mailbox "${mailbox}" of account "${account}"`
128
129
  : `mailbox "${mailbox}"`;
129
130
 
131
+ // If unreadOnly, filter messages by read status
132
+ const messageFilter = unreadOnly
133
+ ? `(messages of theMailbox whose read status is false)`
134
+ : `messages of theMailbox`;
135
+
130
136
  const script = `
131
137
  tell application "Mail"
132
138
  set results to ""
133
139
  try
134
140
  set theMailbox to ${accountPart}
135
- set msgList to messages of theMailbox
141
+ set msgList to ${messageFilter}
136
142
  set msgCount to count of msgList
137
143
  if msgCount > ${limit} then set msgCount to ${limit}
138
144
 
package/src/index.ts CHANGED
@@ -78,6 +78,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
78
78
  mailbox: (args?.mailbox as string) || "INBOX",
79
79
  limit: (args?.limit as number) || 10,
80
80
  includeContent: (args?.includeContent as boolean) || false,
81
+ unreadOnly: (args?.unreadOnly as boolean) || false,
81
82
  });
82
83
  return {
83
84
  content: [
package/src/tools.ts CHANGED
@@ -50,6 +50,11 @@ export const MAIL_GET_EMAILS: Tool = {
50
50
  description: "Whether to include the email body content (default: false)",
51
51
  default: false,
52
52
  },
53
+ unreadOnly: {
54
+ type: "boolean",
55
+ description: "Only return unread emails (default: false)",
56
+ default: false,
57
+ },
53
58
  },
54
59
  required: [],
55
60
  },