apple-mail-mcp 1.0.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/LICENSE +21 -0
- package/README.md +522 -0
- package/build/index.d.ts +23 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +401 -0
- package/build/services/appleMailManager.d.ts +232 -0
- package/build/services/appleMailManager.d.ts.map +1 -0
- package/build/services/appleMailManager.js +1208 -0
- package/build/types.d.ts +306 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +13 -0
- package/build/utils/applescript.d.ts +45 -0
- package/build/utils/applescript.d.ts.map +1 -0
- package/build/utils/applescript.js +372 -0
- package/package.json +86 -0
package/build/types.d.ts
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type Definitions for Apple Mail MCP Server
|
|
3
|
+
*
|
|
4
|
+
* This module contains all TypeScript interfaces and types used throughout
|
|
5
|
+
* the Apple Mail MCP server. These types model:
|
|
6
|
+
*
|
|
7
|
+
* - Apple Mail data structures (messages, mailboxes, accounts)
|
|
8
|
+
* - AppleScript execution results
|
|
9
|
+
* - MCP tool parameters
|
|
10
|
+
*
|
|
11
|
+
* @module types
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Represents an email message in Apple Mail.
|
|
15
|
+
*/
|
|
16
|
+
export interface Message {
|
|
17
|
+
/** Unique identifier for the message */
|
|
18
|
+
id: string;
|
|
19
|
+
/** Subject line of the email */
|
|
20
|
+
subject: string;
|
|
21
|
+
/** Sender email address */
|
|
22
|
+
sender: string;
|
|
23
|
+
/** Sender display name (if available) */
|
|
24
|
+
senderName?: string;
|
|
25
|
+
/** Recipients (To field) */
|
|
26
|
+
recipients: string[];
|
|
27
|
+
/** CC recipients */
|
|
28
|
+
ccRecipients?: string[];
|
|
29
|
+
/** BCC recipients (only available for sent mail) */
|
|
30
|
+
bccRecipients?: string[];
|
|
31
|
+
/** Date the message was received */
|
|
32
|
+
dateReceived: Date;
|
|
33
|
+
/** Date the message was sent */
|
|
34
|
+
dateSent?: Date;
|
|
35
|
+
/** Whether the message has been read */
|
|
36
|
+
isRead: boolean;
|
|
37
|
+
/** Whether the message is flagged */
|
|
38
|
+
isFlagged: boolean;
|
|
39
|
+
/** Whether the message is marked as junk */
|
|
40
|
+
isJunk: boolean;
|
|
41
|
+
/** Whether the message has been deleted */
|
|
42
|
+
isDeleted: boolean;
|
|
43
|
+
/** Name of the mailbox containing the message */
|
|
44
|
+
mailbox: string;
|
|
45
|
+
/** Name of the account containing the message */
|
|
46
|
+
account: string;
|
|
47
|
+
/** Whether the message has attachments */
|
|
48
|
+
hasAttachments: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Represents the content of an email message.
|
|
52
|
+
*/
|
|
53
|
+
export interface MessageContent {
|
|
54
|
+
/** Message identifier */
|
|
55
|
+
id: string;
|
|
56
|
+
/** Subject line */
|
|
57
|
+
subject: string;
|
|
58
|
+
/** Plain text content */
|
|
59
|
+
plainText: string;
|
|
60
|
+
/** HTML content (if available) */
|
|
61
|
+
htmlContent?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Represents a mailbox (folder) in Apple Mail.
|
|
65
|
+
*/
|
|
66
|
+
export interface Mailbox {
|
|
67
|
+
/** Display name of the mailbox */
|
|
68
|
+
name: string;
|
|
69
|
+
/** Account containing the mailbox */
|
|
70
|
+
account: string;
|
|
71
|
+
/** Number of unread messages */
|
|
72
|
+
unreadCount: number;
|
|
73
|
+
/** Total number of messages */
|
|
74
|
+
messageCount: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Represents an email account in Apple Mail.
|
|
78
|
+
*/
|
|
79
|
+
export interface Account {
|
|
80
|
+
/** Display name of the account */
|
|
81
|
+
name: string;
|
|
82
|
+
/** Primary email address for the account */
|
|
83
|
+
email: string;
|
|
84
|
+
/** Account type (e.g., "iCloud", "Gmail", "Exchange") */
|
|
85
|
+
accountType?: string;
|
|
86
|
+
/** Whether the account is enabled */
|
|
87
|
+
enabled: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Represents an email attachment.
|
|
91
|
+
*/
|
|
92
|
+
export interface Attachment {
|
|
93
|
+
/** Attachment identifier */
|
|
94
|
+
id: string;
|
|
95
|
+
/** Filename of the attachment */
|
|
96
|
+
name: string;
|
|
97
|
+
/** MIME type of the attachment */
|
|
98
|
+
mimeType: string;
|
|
99
|
+
/** Size in bytes */
|
|
100
|
+
size: number;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Options for AppleScript execution.
|
|
104
|
+
*/
|
|
105
|
+
export interface AppleScriptOptions {
|
|
106
|
+
/** Maximum execution time in milliseconds */
|
|
107
|
+
timeoutMs?: number;
|
|
108
|
+
/** Maximum number of retry attempts */
|
|
109
|
+
maxRetries?: number;
|
|
110
|
+
/** Initial delay between retries in milliseconds */
|
|
111
|
+
retryDelayMs?: number;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Result from executing an AppleScript command.
|
|
115
|
+
*/
|
|
116
|
+
export interface AppleScriptResult {
|
|
117
|
+
/** Whether the script executed successfully */
|
|
118
|
+
success: boolean;
|
|
119
|
+
/** Output from the script (stdout) */
|
|
120
|
+
output: string;
|
|
121
|
+
/** Error message if execution failed */
|
|
122
|
+
error?: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Parameters for searching messages.
|
|
126
|
+
*/
|
|
127
|
+
export interface SearchMessagesParams {
|
|
128
|
+
/** Text to search for (searches subject, sender, content) */
|
|
129
|
+
query?: string;
|
|
130
|
+
/** Filter by sender email address */
|
|
131
|
+
from?: string;
|
|
132
|
+
/** Filter by recipient email address */
|
|
133
|
+
to?: string;
|
|
134
|
+
/** Filter by subject line */
|
|
135
|
+
subject?: string;
|
|
136
|
+
/** Mailbox to search in */
|
|
137
|
+
mailbox?: string;
|
|
138
|
+
/** Account to search in */
|
|
139
|
+
account?: string;
|
|
140
|
+
/** Filter by read status */
|
|
141
|
+
isRead?: boolean;
|
|
142
|
+
/** Filter by flagged status */
|
|
143
|
+
isFlagged?: boolean;
|
|
144
|
+
/** Start date for search range */
|
|
145
|
+
dateFrom?: Date;
|
|
146
|
+
/** End date for search range */
|
|
147
|
+
dateTo?: Date;
|
|
148
|
+
/** Maximum number of results to return */
|
|
149
|
+
limit?: number;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Parameters for sending an email.
|
|
153
|
+
*/
|
|
154
|
+
export interface SendEmailParams {
|
|
155
|
+
/** Recipient email addresses (To field) */
|
|
156
|
+
to: string[];
|
|
157
|
+
/** CC recipients */
|
|
158
|
+
cc?: string[];
|
|
159
|
+
/** BCC recipients */
|
|
160
|
+
bcc?: string[];
|
|
161
|
+
/** Email subject line */
|
|
162
|
+
subject: string;
|
|
163
|
+
/** Email body content */
|
|
164
|
+
body: string;
|
|
165
|
+
/** Whether the body is HTML formatted */
|
|
166
|
+
isHtml?: boolean;
|
|
167
|
+
/** Account to send from */
|
|
168
|
+
account?: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Parameters for getting a message by ID.
|
|
172
|
+
*/
|
|
173
|
+
export interface GetMessageParams {
|
|
174
|
+
/** Message identifier */
|
|
175
|
+
id: string;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Parameters for listing messages.
|
|
179
|
+
*/
|
|
180
|
+
export interface ListMessagesParams {
|
|
181
|
+
/** Mailbox to list messages from */
|
|
182
|
+
mailbox?: string;
|
|
183
|
+
/** Account to list messages from */
|
|
184
|
+
account?: string;
|
|
185
|
+
/** Maximum number of messages to return */
|
|
186
|
+
limit?: number;
|
|
187
|
+
/** Filter to unread messages only */
|
|
188
|
+
unreadOnly?: boolean;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Parameters for mailbox operations.
|
|
192
|
+
*/
|
|
193
|
+
export interface MailboxParams {
|
|
194
|
+
/** Mailbox name */
|
|
195
|
+
name: string;
|
|
196
|
+
/** Account containing the mailbox */
|
|
197
|
+
account?: string;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Parameters for moving a message.
|
|
201
|
+
*/
|
|
202
|
+
export interface MoveMessageParams {
|
|
203
|
+
/** Message identifier */
|
|
204
|
+
id: string;
|
|
205
|
+
/** Destination mailbox name */
|
|
206
|
+
mailbox: string;
|
|
207
|
+
/** Account containing the destination mailbox */
|
|
208
|
+
account?: string;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Individual check result in a health check.
|
|
212
|
+
*/
|
|
213
|
+
export interface HealthCheckItem {
|
|
214
|
+
/** Name of the check */
|
|
215
|
+
name: string;
|
|
216
|
+
/** Whether the check passed */
|
|
217
|
+
passed: boolean;
|
|
218
|
+
/** Details about the check result */
|
|
219
|
+
message: string;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Result of a health check operation.
|
|
223
|
+
*/
|
|
224
|
+
export interface HealthCheckResult {
|
|
225
|
+
/** Whether all checks passed */
|
|
226
|
+
healthy: boolean;
|
|
227
|
+
/** Individual check results */
|
|
228
|
+
checks: HealthCheckItem[];
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Statistics for a mailbox.
|
|
232
|
+
*/
|
|
233
|
+
export interface MailboxStats {
|
|
234
|
+
/** Mailbox name */
|
|
235
|
+
name: string;
|
|
236
|
+
/** Total message count */
|
|
237
|
+
messageCount: number;
|
|
238
|
+
/** Unread message count */
|
|
239
|
+
unreadCount: number;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Statistics for an account.
|
|
243
|
+
*/
|
|
244
|
+
export interface AccountStats {
|
|
245
|
+
/** Account name */
|
|
246
|
+
name: string;
|
|
247
|
+
/** Total messages in account */
|
|
248
|
+
totalMessages: number;
|
|
249
|
+
/** Total unread messages */
|
|
250
|
+
unreadMessages: number;
|
|
251
|
+
/** Number of mailboxes */
|
|
252
|
+
mailboxCount: number;
|
|
253
|
+
/** Per-mailbox statistics */
|
|
254
|
+
mailboxes: MailboxStats[];
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Recently received message counts.
|
|
258
|
+
*/
|
|
259
|
+
export interface RecentlyReceivedStats {
|
|
260
|
+
/** Messages received in last 24 hours */
|
|
261
|
+
last24h: number;
|
|
262
|
+
/** Messages received in last 7 days */
|
|
263
|
+
last7d: number;
|
|
264
|
+
/** Messages received in last 30 days */
|
|
265
|
+
last30d: number;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Overall mail statistics.
|
|
269
|
+
*/
|
|
270
|
+
export interface MailStats {
|
|
271
|
+
/** Total messages across all accounts */
|
|
272
|
+
totalMessages: number;
|
|
273
|
+
/** Total unread messages */
|
|
274
|
+
totalUnread: number;
|
|
275
|
+
/** Per-account statistics */
|
|
276
|
+
accounts: AccountStats[];
|
|
277
|
+
/** Recently received message counts */
|
|
278
|
+
recentlyReceived?: RecentlyReceivedStats;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Result of a batch operation on a single item.
|
|
282
|
+
*/
|
|
283
|
+
export interface BatchOperationResult {
|
|
284
|
+
/** Item identifier */
|
|
285
|
+
id: string;
|
|
286
|
+
/** Whether the operation succeeded */
|
|
287
|
+
success: boolean;
|
|
288
|
+
/** Error message if operation failed */
|
|
289
|
+
error?: string;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Status of Mail.app sync activity.
|
|
293
|
+
*/
|
|
294
|
+
export interface SyncStatus {
|
|
295
|
+
/** Whether sync activity was detected */
|
|
296
|
+
syncDetected: boolean;
|
|
297
|
+
/** Number of items pending upload */
|
|
298
|
+
pendingUpload: number;
|
|
299
|
+
/** Whether there was recent database activity */
|
|
300
|
+
recentActivity: boolean;
|
|
301
|
+
/** Seconds since last database change */
|
|
302
|
+
secondsSinceLastChange: number;
|
|
303
|
+
/** Error message if status check failed */
|
|
304
|
+
error?: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AAM,WAAW,SAAS;IACxB,yCAAyC;IACzC,aAAa,EAAE,MAAM,CAAC;IAEtB,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAC;IAEpB,6BAA6B;IAC7B,QAAQ,EAAE,YAAY,EAAE,CAAC;IAEzB,uCAAuC;IACvC,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;CAC1C;AAMD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAC;IAEX,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAC;IAEjB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAMD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,yCAAyC;IACzC,YAAY,EAAE,OAAO,CAAC;IAEtB,qCAAqC;IACrC,aAAa,EAAE,MAAM,CAAC;IAEtB,iDAAiD;IACjD,cAAc,EAAE,OAAO,CAAC;IAExB,yCAAyC;IACzC,sBAAsB,EAAE,MAAM,CAAC;IAE/B,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
package/build/types.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type Definitions for Apple Mail MCP Server
|
|
3
|
+
*
|
|
4
|
+
* This module contains all TypeScript interfaces and types used throughout
|
|
5
|
+
* the Apple Mail MCP server. These types model:
|
|
6
|
+
*
|
|
7
|
+
* - Apple Mail data structures (messages, mailboxes, accounts)
|
|
8
|
+
* - AppleScript execution results
|
|
9
|
+
* - MCP tool parameters
|
|
10
|
+
*
|
|
11
|
+
* @module types
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AppleScript Execution Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides a safe interface for executing AppleScript commands
|
|
5
|
+
* on macOS. It handles script execution, error capture, and result parsing.
|
|
6
|
+
*
|
|
7
|
+
* @module utils/applescript
|
|
8
|
+
*/
|
|
9
|
+
import type { AppleScriptResult, AppleScriptOptions } from "../types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Executes an AppleScript command and returns a structured result.
|
|
12
|
+
*
|
|
13
|
+
* This function serves as the bridge between TypeScript and macOS AppleScript.
|
|
14
|
+
* It handles the complexity of shell escaping, execution, and error handling
|
|
15
|
+
* so that calling code can work with clean TypeScript interfaces.
|
|
16
|
+
*
|
|
17
|
+
* The script is executed synchronously via the `osascript` command-line tool.
|
|
18
|
+
* Multi-line scripts are supported and preserved (important for AppleScript
|
|
19
|
+
* tell blocks and repeat loops).
|
|
20
|
+
*
|
|
21
|
+
* @param script - The AppleScript code to execute
|
|
22
|
+
* @param options - Optional execution settings (timeout, etc.)
|
|
23
|
+
* @returns A result object with success status and output or error message
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* // Basic usage with default timeout (30 seconds)
|
|
28
|
+
* const result = executeAppleScript(`
|
|
29
|
+
* tell application "Notes"
|
|
30
|
+
* get name of every note
|
|
31
|
+
* end tell
|
|
32
|
+
* `);
|
|
33
|
+
*
|
|
34
|
+
* // With custom timeout for complex operations
|
|
35
|
+
* const result = executeAppleScript(complexScript, { timeoutMs: 60000 });
|
|
36
|
+
*
|
|
37
|
+
* if (result.success) {
|
|
38
|
+
* console.log("Notes:", result.output);
|
|
39
|
+
* } else {
|
|
40
|
+
* console.error("Failed:", result.error);
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function executeAppleScript(script: string, options?: AppleScriptOptions): AppleScriptResult;
|
|
45
|
+
//# sourceMappingURL=applescript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applescript.d.ts","sourceRoot":"","sources":["../../src/utils/applescript.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAuOxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,CA6HnB"}
|