apple-mail-mcp 2.10.17 → 2.10.21
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 +1 -0
- package/build/index.js +28 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1597,6 +1597,7 @@ The entrypoint is written as:
|
|
|
1597
1597
|
| Date filter format | Date filters must be valid parseable dates (e.g., "January 1, 2026" or "2026-03-15"); bare numbers or non-date strings are rejected |
|
|
1598
1598
|
| Attachment save path restrictions | `save-attachment` only allows saving to home directory, `/tmp`, `/private/tmp`, and `/Volumes`; path traversal is blocked |
|
|
1599
1599
|
| Attachment count limit | `send-email` and `create-draft` accept a maximum of 20 file attachments |
|
|
1600
|
+
| IMAP attachment fetch size | `fetch-attachment` / `save-attachment` over IMAP refuse a part larger than 25 MiB — rejected before download when the server declares the size, and the stream is cut off at the limit when it does not |
|
|
1600
1601
|
|
|
1601
1602
|
### Mail.app `<blockquote>` wrapping on macOS 15+ (workaround in v1.6.0)
|
|
1602
1603
|
|
package/build/index.js
CHANGED
|
@@ -78057,6 +78057,7 @@ import { tmpdir } from "os";
|
|
|
78057
78057
|
|
|
78058
78058
|
// src/utils/attachmentLimits.ts
|
|
78059
78059
|
var MAX_INLINE_ATTACHMENT_BYTES = 25 * 1024 * 1024;
|
|
78060
|
+
var MAX_IMAP_ATTACHMENT_BYTES = MAX_INLINE_ATTACHMENT_BYTES;
|
|
78060
78061
|
var MAX_INLINE_ATTACHMENT_BASE64_CHARS = Math.ceil(MAX_INLINE_ATTACHMENT_BYTES / 3) * 4;
|
|
78061
78062
|
var MAX_INLINE_ATTACHMENT_BASE64_INPUT_CHARS = MAX_INLINE_ATTACHMENT_BASE64_CHARS * 2;
|
|
78062
78063
|
function isInlineAttachmentBase64WithinLimit(contentBase64) {
|
|
@@ -83454,9 +83455,16 @@ function collectAttachments(node, out = []) {
|
|
|
83454
83455
|
for (const child of node.childNodes ?? []) collectAttachments(child, out);
|
|
83455
83456
|
return out;
|
|
83456
83457
|
}
|
|
83457
|
-
async function streamToBuffer(content) {
|
|
83458
|
+
async function streamToBuffer(content, maxBytes) {
|
|
83458
83459
|
const chunks = [];
|
|
83459
|
-
|
|
83460
|
+
let total = 0;
|
|
83461
|
+
for await (const chunk of content) {
|
|
83462
|
+
total += chunk.byteLength;
|
|
83463
|
+
if (total > maxBytes) {
|
|
83464
|
+
throw new Error(`IMAP attachment exceeds the ${maxBytes / 1024 / 1024} MiB size limit.`);
|
|
83465
|
+
}
|
|
83466
|
+
chunks.push(Buffer.from(chunk));
|
|
83467
|
+
}
|
|
83460
83468
|
return Buffer.concat(chunks);
|
|
83461
83469
|
}
|
|
83462
83470
|
async function imapListAttachments(id, deps = {}) {
|
|
@@ -83493,14 +83501,24 @@ async function imapFetchAttachment(id, attachmentName, deps = {}) {
|
|
|
83493
83501
|
error: `Attachment "${attachmentName}" not found on UID ${ref.uid}. Available: ${names}.`
|
|
83494
83502
|
};
|
|
83495
83503
|
}
|
|
83496
|
-
|
|
83497
|
-
|
|
83498
|
-
|
|
83499
|
-
|
|
83500
|
-
|
|
83501
|
-
|
|
83502
|
-
|
|
83503
|
-
|
|
83504
|
+
if (match.size > MAX_IMAP_ATTACHMENT_BYTES) {
|
|
83505
|
+
return {
|
|
83506
|
+
success: false,
|
|
83507
|
+
error: `IMAP attachment "${attachmentName}" is ${match.size} bytes; the maximum is ${MAX_IMAP_ATTACHMENT_BYTES} bytes (25 MiB).`
|
|
83508
|
+
};
|
|
83509
|
+
}
|
|
83510
|
+
try {
|
|
83511
|
+
const dl = await client.download(String(ref.uid), match.part, { uid: true });
|
|
83512
|
+
const buf = await streamToBuffer(dl.content, MAX_IMAP_ATTACHMENT_BYTES);
|
|
83513
|
+
return {
|
|
83514
|
+
success: true,
|
|
83515
|
+
base64: buf.toString("base64"),
|
|
83516
|
+
bytes: buf.length,
|
|
83517
|
+
mimeType: match.mimeType
|
|
83518
|
+
};
|
|
83519
|
+
} catch (e) {
|
|
83520
|
+
return { success: false, error: `IMAP attachment fetch failed: ${errText(e)}` };
|
|
83521
|
+
}
|
|
83504
83522
|
});
|
|
83505
83523
|
}
|
|
83506
83524
|
async function imapBatch(ids, deps, op) {
|
package/package.json
CHANGED