@sempervirens-labs/apple-mail-mcp 1.2.0 → 1.3.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/.claude/settings.local.json +3 -1
- package/README.md +3 -0
- package/package.json +1 -1
- package/src/applescript/mail.ts +51 -4
package/README.md
CHANGED
|
@@ -169,6 +169,9 @@ Get recent emails from a mailbox.
|
|
|
169
169
|
"id": 12345,
|
|
170
170
|
"subject": "Meeting tomorrow",
|
|
171
171
|
"sender": "John Doe <john@example.com>",
|
|
172
|
+
"to": ["you@example.com", "team@example.com"],
|
|
173
|
+
"cc": ["manager@example.com"],
|
|
174
|
+
"bcc": [],
|
|
172
175
|
"dateSent": "Monday, 10. January 2025 at 09:30:00",
|
|
173
176
|
"isRead": false
|
|
174
177
|
}
|
package/package.json
CHANGED
package/src/applescript/mail.ts
CHANGED
|
@@ -100,6 +100,9 @@ export interface Email {
|
|
|
100
100
|
id: number;
|
|
101
101
|
subject: string;
|
|
102
102
|
sender: string;
|
|
103
|
+
to: string[];
|
|
104
|
+
cc: string[];
|
|
105
|
+
bcc: string[];
|
|
103
106
|
dateSent: string;
|
|
104
107
|
isRead: boolean;
|
|
105
108
|
content?: string;
|
|
@@ -142,7 +145,26 @@ tell application "Mail"
|
|
|
142
145
|
set msgRead to read status of msg
|
|
143
146
|
${contentPart}
|
|
144
147
|
|
|
145
|
-
|
|
148
|
+
-- Get recipients
|
|
149
|
+
set toList to ""
|
|
150
|
+
repeat with r in to recipients of msg
|
|
151
|
+
set toList to toList & address of r & ","
|
|
152
|
+
end repeat
|
|
153
|
+
if toList is not "" then set toList to text 1 thru -2 of toList
|
|
154
|
+
|
|
155
|
+
set ccList to ""
|
|
156
|
+
repeat with r in cc recipients of msg
|
|
157
|
+
set ccList to ccList & address of r & ","
|
|
158
|
+
end repeat
|
|
159
|
+
if ccList is not "" then set ccList to text 1 thru -2 of ccList
|
|
160
|
+
|
|
161
|
+
set bccList to ""
|
|
162
|
+
repeat with r in bcc recipients of msg
|
|
163
|
+
set bccList to bccList & address of r & ","
|
|
164
|
+
end repeat
|
|
165
|
+
if bccList is not "" then set bccList to text 1 thru -2 of bccList
|
|
166
|
+
|
|
167
|
+
set results to results & msgId & "<<>>" & msgSubject & "<<>>" & msgSender & "<<>>" & toList & "<<>>" & ccList & "<<>>" & bccList & "<<>>" & (msgDate as string) & "<<>>" & msgRead & "<<>>" & msgContent & "|||"
|
|
146
168
|
end repeat
|
|
147
169
|
on error errMsg
|
|
148
170
|
return "ERROR:" & errMsg
|
|
@@ -161,11 +183,14 @@ end tell
|
|
|
161
183
|
const parts = result.split("|||").filter(Boolean);
|
|
162
184
|
|
|
163
185
|
for (const part of parts) {
|
|
164
|
-
const [id, subject, sender, dateSent, isRead, content] = part.split("<<>>");
|
|
186
|
+
const [id, subject, sender, to, cc, bcc, dateSent, isRead, content] = part.split("<<>>");
|
|
165
187
|
emails.push({
|
|
166
188
|
id: parseInt(id) || 0,
|
|
167
189
|
subject: subject || "(No Subject)",
|
|
168
190
|
sender: sender || "(Unknown)",
|
|
191
|
+
to: to ? to.split(",").map(s => s.trim()).filter(Boolean) : [],
|
|
192
|
+
cc: cc ? cc.split(",").map(s => s.trim()).filter(Boolean) : [],
|
|
193
|
+
bcc: bcc ? bcc.split(",").map(s => s.trim()).filter(Boolean) : [],
|
|
169
194
|
dateSent: dateSent || "",
|
|
170
195
|
isRead: isRead === "true",
|
|
171
196
|
content: content || undefined,
|
|
@@ -219,7 +244,26 @@ tell application "Mail"
|
|
|
219
244
|
set msgDate to date sent of msg
|
|
220
245
|
set msgRead to read status of msg
|
|
221
246
|
|
|
222
|
-
|
|
247
|
+
-- Get recipients
|
|
248
|
+
set toList to ""
|
|
249
|
+
repeat with r in to recipients of msg
|
|
250
|
+
set toList to toList & address of r & ","
|
|
251
|
+
end repeat
|
|
252
|
+
if toList is not "" then set toList to text 1 thru -2 of toList
|
|
253
|
+
|
|
254
|
+
set ccList to ""
|
|
255
|
+
repeat with r in cc recipients of msg
|
|
256
|
+
set ccList to ccList & address of r & ","
|
|
257
|
+
end repeat
|
|
258
|
+
if ccList is not "" then set ccList to text 1 thru -2 of ccList
|
|
259
|
+
|
|
260
|
+
set bccList to ""
|
|
261
|
+
repeat with r in bcc recipients of msg
|
|
262
|
+
set bccList to bccList & address of r & ","
|
|
263
|
+
end repeat
|
|
264
|
+
if bccList is not "" then set bccList to text 1 thru -2 of bccList
|
|
265
|
+
|
|
266
|
+
set results to results & msgId & "<<>>" & msgSubject & "<<>>" & msgSender & "<<>>" & toList & "<<>>" & ccList & "<<>>" & bccList & "<<>>" & (msgDate as string) & "<<>>" & msgRead & "|||"
|
|
223
267
|
set foundCount to foundCount + 1
|
|
224
268
|
end repeat
|
|
225
269
|
end repeat
|
|
@@ -240,11 +284,14 @@ end tell
|
|
|
240
284
|
const parts = result.split("|||").filter(Boolean);
|
|
241
285
|
|
|
242
286
|
for (const part of parts) {
|
|
243
|
-
const [id, subject, sender, dateSent, isRead] = part.split("<<>>");
|
|
287
|
+
const [id, subject, sender, to, cc, bcc, dateSent, isRead] = part.split("<<>>");
|
|
244
288
|
emails.push({
|
|
245
289
|
id: parseInt(id) || 0,
|
|
246
290
|
subject: subject || "(No Subject)",
|
|
247
291
|
sender: sender || "(Unknown)",
|
|
292
|
+
to: to ? to.split(",").map(s => s.trim()).filter(Boolean) : [],
|
|
293
|
+
cc: cc ? cc.split(",").map(s => s.trim()).filter(Boolean) : [],
|
|
294
|
+
bcc: bcc ? bcc.split(",").map(s => s.trim()).filter(Boolean) : [],
|
|
248
295
|
dateSent: dateSent || "",
|
|
249
296
|
isRead: isRead === "true",
|
|
250
297
|
});
|