@miguelarios/email-mcp 0.12.0 → 0.14.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/CHANGELOG.md +18 -0
- package/README.md +51 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +9 -2
- package/dist/main.js.map +1 -1
- package/dist/resources/imapResources.d.ts +67 -0
- package/dist/resources/imapResources.d.ts.map +1 -0
- package/dist/resources/imapResources.js +139 -0
- package/dist/resources/imapResources.js.map +1 -0
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +42 -10
- package/dist/search.js.map +1 -1
- package/dist/services/ImapService.d.ts +33 -2
- package/dist/services/ImapService.d.ts.map +1 -1
- package/dist/services/ImapService.js +52 -10
- package/dist/services/ImapService.js.map +1 -1
- package/dist/tools/emailSchemas.d.ts +8 -0
- package/dist/tools/emailSchemas.d.ts.map +1 -1
- package/dist/tools/emailSchemas.js +8 -0
- package/dist/tools/emailSchemas.js.map +1 -1
- package/dist/tools/emailTools.d.ts +11 -0
- package/dist/tools/emailTools.d.ts.map +1 -1
- package/dist/tools/emailTools.js +191 -25
- package/dist/tools/emailTools.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.14.0 (2026-09-16)
|
|
4
|
+
|
|
5
|
+
- `get_email` and `search_emails` now report attachments that carry `Content-Disposition: inline` with a filename. Apple Mail (iOS and macOS) writes forwarded file attachments that way, so a forwarded message with a real PDF attached previously reported `hasAttachments: false` and an empty `attachments` array — the part was in the MIME source the whole time, and `download_attachment` retrieved it correctly when given the `partId` by hand. Content-ID distinguishes the two inline cases: an image the HTML body references carries one, a forwarded file does not, so embedded signature logos are still not listed as attachments (PR #107, `claude/exciting-wozniak-55ly2k`).
|
|
6
|
+
- `search_emails` no longer turns a blank filter into a constraint that matches nothing. `from: ""` became a literal `SEARCH FROM ""`, and `since: ""` became `new Date("")` — an Invalid Date that serializes to `null` — so a search could return zero results for a folder that demonstrably had messages. Blank and whitespace-only values are now discarded for `from`, `to`, `cc`, `bcc`, `subject`, `body`, `hasWords`, `since` and `before`, real values are trimmed, and blank entries are dropped from `tags` (PR #108, `claude/exciting-wozniak-55ly2k-search-defaults`).
|
|
7
|
+
- An unparseable `since` or `before` is now rejected with `VALIDATION_FAILED` naming the field, instead of silently producing an empty result set. The throw happens before the IMAP connection is opened (PR #108, `claude/exciting-wozniak-55ly2k-search-defaults`).
|
|
8
|
+
- The `unread`, `flagged` and `hasAttachment` descriptions now state their semantics explicitly: `true` and `false` are both real filters, omission means "match both", and `hasAttachment: false` is not a filter at all since IMAP cannot express it. The booleans themselves are deliberately unchanged — `unread: false` ("read mail") and `flagged: false` ("unflagged mail") are legitimate queries, so a `false` is honoured rather than discarded (PR #108, `claude/exciting-wozniak-55ly2k-search-defaults`).
|
|
9
|
+
|
|
10
|
+
## 0.13.0 (2026-09-15)
|
|
11
|
+
|
|
12
|
+
- Attachments and message sources are now addressable as MCP resources, so a client can fetch the bytes with `resources/read` instead of only ever receiving them inline in a tool result: `imap://{folder}/{uid}/{partId}` serves one attachment under its own media type, `imap://{folder}/{uid}.eml` serves the raw RFC 822 source. `download_attachment` and `get_email_raw` already stamped these URIs onto the blocks they returned, but nothing could resolve one (PR #102, `claude/laughing-euler-nko3sh`).
|
|
13
|
+
- **BREAKING:** `download_attachment` and `get_email_raw` no longer embed a payload over 256 KiB. Above the limit they return a `resource_link` plus a note naming the size, the limit and the URI, and the bytes stay reachable via `resources/read`. A caller that unconditionally reads `content[0].resource.blob` must now check `structuredContent.embedded` first. Previously there was no ceiling at all: an 8 MB PDF became ~10.7 MB of base64 in one tool result, which most clients put straight into the model's context, so the call failed downstream after the bytes had already been pulled off the IMAP server (PR #103, `claude/laughing-euler-nko3sh-size-guard`).
|
|
14
|
+
- `EMAIL_MAX_INLINE_BYTES` overrides that ceiling; `0` links everything, and an unparseable value falls back to the default rather than disabling the guard. The default matches the 256 KiB `MAX_INLINE_CALENDAR_BYTES` that has guarded calendar parts since 0.12.0 (PR #103, `claude/laughing-euler-nko3sh-size-guard`).
|
|
15
|
+
- `download_attachment` and `get_email_raw` output gained `uri` and `embedded`, so a caller can tell which path it got without inspecting content blocks (PR #103, `claude/laughing-euler-nko3sh-size-guard`).
|
|
16
|
+
- Oversized payloads are no longer fetched, only to be discarded: attachment size comes from BODYSTRUCTURE before the body is read, and message size from RFC822.SIZE in a single FETCH. A server that withholds either is still held to the ceiling, after the fetch rather than before it (PR #103, `claude/laughing-euler-nko3sh-size-guard`).
|
|
17
|
+
- `send_email` attachments accept `encoding: "base64" | "utf8"` and `contentType`. `content` is a JSON string and was read as UTF-8, so binary could not be attached through it at all — the only working path for a real file was `attachments[].path`, which requires `EMAIL_ATTACHMENT_DIR`. Downloading an attachment and sending it back out now works without a directory on the server. Invalid base64 is rejected rather than attached, since `Buffer.from(s, "base64")` discards anything outside the alphabet and would otherwise deliver a silently corrupt file (PR #104, `claude/laughing-euler-nko3sh`).
|
|
18
|
+
- Attachment errors on `send_email` now report `INVALID_INPUT` and are raised before the send confirmation, instead of `INTERNAL_ERROR` after the user had already confirmed an irreversible send. This also corrects the pre-existing `EMAIL_ATTACHMENT_DIR` path rejection, which had both problems (PR #104, `claude/laughing-euler-nko3sh`).
|
|
19
|
+
- Bumped `@miguelarios/pim-core` dependency to `^0.10.0`.
|
|
20
|
+
|
|
3
21
|
## 0.12.0 (2026-08-10)
|
|
4
22
|
|
|
5
23
|
- `get_email` now detects `text/calendar` MIME parts regardless of content disposition or filename, so inline calendar invitations are no longer omitted from responses (PR #19, `claude/feature-planning-xexlsc`).
|
package/README.md
CHANGED
|
@@ -40,6 +40,12 @@ Add the server to your MCP client config (Claude Desktop, Claude Code, etc.). Cr
|
|
|
40
40
|
|
|
41
41
|
Optional env vars: `IMAP_PORT` (default 993), `IMAP_SECURE` (default true), `SMTP_PORT` (default 465), `SMTP_SECURE` (default true), `SMTP_FROM_NAME`, `PIM_TIMEZONE`.
|
|
42
42
|
|
|
43
|
+
- `EMAIL_MAX_INLINE_BYTES` — bytes above which `download_attachment` and `get_email_raw`
|
|
44
|
+
return a resource link instead of embedding the payload. Defaults to `262144` (256 KB),
|
|
45
|
+
matching the ceiling calendar parts already use. `0` links everything; an unparseable
|
|
46
|
+
value falls back to the default rather than disabling the guard. Base64 adds a third on
|
|
47
|
+
top, and most clients put a tool result straight into the model's context, so raise it
|
|
48
|
+
deliberately.
|
|
43
49
|
- `EMAIL_ATTACHMENT_DIR` — directory that gates `send_email` file attachments. Path-based attachments (`attachments[].path`) are rejected unless this is set, and only files resolving inside it are allowed. Use `attachments[].content` for inline content without setting this.
|
|
44
50
|
- `URL_RESOLVE_DISABLE` — set to `1`/`true` to skip network link-resolution when rendering email to markdown; links are left unresolved in the output.
|
|
45
51
|
- `SMTP_AUTO_SENT` — set to `true` if your provider auto-files sent mail, so the server skips the extra IMAP append to Sent.
|
|
@@ -85,6 +91,51 @@ See [docs/tools/email-mcp.md](../../docs/tools/email-mcp.md) for full parameter
|
|
|
85
91
|
| `get_email_raw` | Export email as raw .eml |
|
|
86
92
|
| `get_folder_status` | Get total and unread message counts for a folder |
|
|
87
93
|
|
|
94
|
+
## Resources
|
|
95
|
+
|
|
96
|
+
Attachments and message sources are addressable as `imap://` resources, not just
|
|
97
|
+
returned inline by a tool. A client that wants the bytes can fetch them with
|
|
98
|
+
`resources/read` on its own terms — which keeps a large payload out of the model's
|
|
99
|
+
context when only the file itself is wanted.
|
|
100
|
+
|
|
101
|
+
| URI template | Contents |
|
|
102
|
+
|--------------|----------|
|
|
103
|
+
| `imap://{folder}/{uid}/{partId}` | One attachment's bytes, under its own media type. Part IDs come from `get_email`'s attachment metadata. |
|
|
104
|
+
| `imap://{folder}/{uid}.eml` | The message's raw RFC 822 source. |
|
|
105
|
+
|
|
106
|
+
`download_attachment` and `get_email_raw` stamp these URIs onto whatever they return,
|
|
107
|
+
so a URI from a tool result can be read back directly. Under `EMAIL_MAX_INLINE_BYTES`
|
|
108
|
+
the payload is embedded as before; over it, the tool returns a `resource_link` and the
|
|
109
|
+
bytes stay one `resources/read` away instead of arriving as multi-megabyte base64.
|
|
110
|
+
Either way `structuredContent` carries the `uri` and an `embedded` flag saying which
|
|
111
|
+
happened.
|
|
112
|
+
|
|
113
|
+
The folder occupies the URI's authority and is percent-encoded whole, so a hierarchy
|
|
114
|
+
delimiter inside it survives: `Archive/2024` becomes `imap://Archive%2F2024/99/1.2`.
|
|
115
|
+
Folder case is preserved, because IMAP mailbox names are case-sensitive.
|
|
116
|
+
|
|
117
|
+
Neither template is enumerable — there is no `resources/list` entry for them, since
|
|
118
|
+
listing every attachment in an account would mean walking every message. Discover
|
|
119
|
+
them through `resources/templates/list`, and find part IDs with `get_email`.
|
|
120
|
+
|
|
121
|
+
## Sending attachments
|
|
122
|
+
|
|
123
|
+
`send_email` takes attachments three ways:
|
|
124
|
+
|
|
125
|
+
| Field | Use for |
|
|
126
|
+
|-------|---------|
|
|
127
|
+
| `content` alone | Text. Read as UTF-8, so it **corrupts binary**. |
|
|
128
|
+
| `content` + `encoding: "base64"` | Binary — a PDF, an image, or bytes from `download_attachment`. |
|
|
129
|
+
| `path` | A file on the server, only inside `EMAIL_ATTACHMENT_DIR`. |
|
|
130
|
+
|
|
131
|
+
Set `contentType` when the filename has no extension to guess from.
|
|
132
|
+
|
|
133
|
+
This is what makes the download-then-forward round trip work without a configured
|
|
134
|
+
directory: `download_attachment` returns base64, and `encoding: "base64"` is where
|
|
135
|
+
it goes. Invalid base64 is rejected rather than attached — a payload that silently
|
|
136
|
+
decoded to fewer bytes would reach the recipient as a corrupt file with no error
|
|
137
|
+
anywhere.
|
|
138
|
+
|
|
88
139
|
## License
|
|
89
140
|
|
|
90
141
|
MIT
|
package/dist/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAWzD,wBAAsB,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC,CAiCvD;AAED,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAOjD"}
|
package/dist/main.js
CHANGED
|
@@ -4,6 +4,7 @@ import { TOOL_LIST_CACHE_HINT, registerTools } from "@miguelarios/pim-core/mcp";
|
|
|
4
4
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
5
5
|
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
6
6
|
import { disposeUrlCleaner } from "./htmlToMarkdown.js";
|
|
7
|
+
import { registerImapResources } from "./resources/imapResources.js";
|
|
7
8
|
import { ImapService } from "./services/ImapService.js";
|
|
8
9
|
import { SmtpService } from "./services/SmtpService.js";
|
|
9
10
|
import { EMAIL_TOOLS } from "./tools/emailTools.js";
|
|
@@ -16,11 +17,17 @@ export async function createServer() {
|
|
|
16
17
|
smtp: new SmtpService(config),
|
|
17
18
|
};
|
|
18
19
|
const server = new McpServer({ name: "@miguelarios/email-mcp", title: "IMAP/SMTP Email", version }, {
|
|
19
|
-
capabilities: {
|
|
20
|
-
|
|
20
|
+
capabilities: {
|
|
21
|
+
tools: { listChanged: false },
|
|
22
|
+
// Attachment and message URIs are addressable but not enumerable, so
|
|
23
|
+
// there is no list to change.
|
|
24
|
+
resources: { listChanged: false },
|
|
25
|
+
},
|
|
26
|
+
instructions: "Read, search and send email over IMAP/SMTP. Folder paths are IMAP paths and default to INBOX — call list_folders to discover them. send_email, send_draft and permanent deletes ask the user to confirm first. Attachments and message sources are also addressable as imap:// resources, so their bytes can be fetched with resources/read instead of through a tool result.",
|
|
21
27
|
cacheHints: { "tools/list": TOOL_LIST_CACHE_HINT },
|
|
22
28
|
});
|
|
23
29
|
registerTools(server, EMAIL_TOOLS, services);
|
|
30
|
+
registerImapResources(server, services.imap);
|
|
24
31
|
const handleShutdown = async () => {
|
|
25
32
|
await disposeUrlCleaner();
|
|
26
33
|
process.exit(0);
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAEtE,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IACjC,MAAM,QAAQ,GAAG;QACf,IAAI,EAAE,IAAI,WAAW,CAAC,MAAM,CAAC;QAC7B,IAAI,EAAE,IAAI,WAAW,CAAC,MAAM,CAAC;KAC9B,CAAC;IAEF,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B,EAAE,IAAI,EAAE,wBAAwB,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,EACrE;QACE,Y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AC9B,SAAS,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;SAClC;QACD,YAAY,EACV,+WAA+W;QACjX,UAAU,EAAE,EAAE,YAAY,EAAE,oBAAoB,EAAE;KACnD,CACF,CAAC;IAEF,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;IAC7C,qBAAqB,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE7C,MAAM,cAAc,GAAG,KAAK,IAAI,EAAE;QAChC,MAAM,iBAAiB,EAAE,CAAC;QAC1B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;IACF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAEtC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,uEAAuE;IACvE,yEAAyE;IACzE,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,EAAE;QAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,OAAO,CAAC;KAC9E,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type McpServer } from "@modelcontextprotocol/server";
|
|
2
|
+
import type { ImapService } from "../services/ImapService.js";
|
|
3
|
+
/** RFC 6570 template for one attachment: `imap://INBOX/4471/2`. */
|
|
4
|
+
export declare const ATTACHMENT_URI_TEMPLATE = "imap://{folder}/{uid}/{partId}";
|
|
5
|
+
/** RFC 6570 template for a message's RFC 822 source: `imap://INBOX/4471.eml`. */
|
|
6
|
+
export declare const RAW_EMAIL_URI_TEMPLATE = "imap://{folder}/{uid}.eml";
|
|
7
|
+
/** The IMAP surface these handlers need — narrowed so tests can pass a stub. */
|
|
8
|
+
type AttachmentReader = Pick<ImapService, "downloadAttachment">;
|
|
9
|
+
type RawEmailReader = Pick<ImapService, "fetchRawEmail">;
|
|
10
|
+
/**
|
|
11
|
+
* The URI for one attachment.
|
|
12
|
+
*
|
|
13
|
+
* The folder occupies the authority, so it is percent-encoded whole: an IMAP
|
|
14
|
+
* hierarchy delimiter inside it (`Archive/2024`) must not become a path
|
|
15
|
+
* separator, or the parse would read `2024` as the uid.
|
|
16
|
+
*/
|
|
17
|
+
export declare function attachmentUri(folder: string, uid: number, partId: string): string;
|
|
18
|
+
/** The URI for a message's RFC 822 source. */
|
|
19
|
+
export declare function rawEmailUri(folder: string, uid: number): string;
|
|
20
|
+
/** What an `imap://` URI addresses, once parsed. */
|
|
21
|
+
export type ImapTarget = {
|
|
22
|
+
kind: "attachment";
|
|
23
|
+
folder: string;
|
|
24
|
+
uid: number;
|
|
25
|
+
partId: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: "raw";
|
|
28
|
+
folder: string;
|
|
29
|
+
uid: number;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Parses an `imap://` URI, or returns `undefined` when it is not one of ours.
|
|
33
|
+
*
|
|
34
|
+
* Parsing goes through `URL` rather than the template variables the SDK hands
|
|
35
|
+
* the read callback, so tool-minted and client-supplied URIs are read by the
|
|
36
|
+
* same code. `imap:` is not a WHATWG "special" scheme, so the authority keeps
|
|
37
|
+
* its case — which matters, because IMAP mailbox names are case-sensitive and
|
|
38
|
+
* an http-style lowercasing would silently retarget `INBOX` to `inbox`.
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseImapUri(uri: string | URL): ImapTarget | undefined;
|
|
41
|
+
/** Serves one attachment's bytes, base64-encoded under its own media type. */
|
|
42
|
+
export declare function readAttachmentResource(uri: URL, imap: AttachmentReader): Promise<{
|
|
43
|
+
contents: {
|
|
44
|
+
uri: string;
|
|
45
|
+
mimeType: string;
|
|
46
|
+
blob: string;
|
|
47
|
+
}[];
|
|
48
|
+
}>;
|
|
49
|
+
/** Serves a message's RFC 822 source. */
|
|
50
|
+
export declare function readRawEmailResource(uri: URL, imap: RawEmailReader): Promise<{
|
|
51
|
+
contents: {
|
|
52
|
+
uri: string;
|
|
53
|
+
mimeType: string;
|
|
54
|
+
text: string;
|
|
55
|
+
}[];
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Registers both templates against an {@link McpServer}.
|
|
59
|
+
*
|
|
60
|
+
* Neither template gets a `list` callback: enumerating every attachment in an
|
|
61
|
+
* account would mean walking every message in every folder, and the useful
|
|
62
|
+
* entry point is `search_emails` / `get_email` anyway. Clients still discover
|
|
63
|
+
* the shapes through `resources/templates/list`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function registerImapResources(server: McpServer, imap: AttachmentReader & RawEmailReader): void;
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=imapResources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imapResources.d.ts","sourceRoot":"","sources":["../../src/resources/imapResources.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,8BAA8B,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,mEAAmE;AACnE,eAAO,MAAM,uBAAuB,mCAAmC,CAAC;AAExE,iFAAiF;AACjF,eAAO,MAAM,sBAAsB,8BAA8B,CAAC;AAElE,gFAAgF;AAChF,KAAK,gBAAgB,GAAG,IAAI,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;AAChE,KAAK,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;AAEzD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED,8CAA8C;AAC9C,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,oDAAoD;AACpD,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACnE;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,UAAU,GAAG,SAAS,CA6BtE;AAED,8EAA8E;AAC9E,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,gBAAgB;;;;;;GAmB5E;AAED,yCAAyC;AACzC,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc;;;;;;GAaxE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,gBAAgB,GAAG,cAAc,GACtC,IAAI,CAsBN"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `imap://` resource URIs, and the `resources/read` handlers behind them.
|
|
3
|
+
*
|
|
4
|
+
* `download_attachment` and `get_email_raw` have always stamped these URIs onto
|
|
5
|
+
* their embedded resource blocks, but nothing could resolve one — the URI was a
|
|
6
|
+
* label on a payload the client had already been handed. Registering them as
|
|
7
|
+
* real resources makes them addressable, so a client can fetch the bytes on its
|
|
8
|
+
* own terms instead of only ever receiving them inline.
|
|
9
|
+
*
|
|
10
|
+
* The URI shape is this server's own, not RFC 5092's `imap://` URL: there the
|
|
11
|
+
* authority names the *server*, because a URL has to be resolvable by a third
|
|
12
|
+
* party. These never leave the session that minted them, so the authority is
|
|
13
|
+
* spent on the mailbox instead, which is the part that varies per call.
|
|
14
|
+
*/
|
|
15
|
+
import { EmailError, ErrorCode } from "@miguelarios/pim-core";
|
|
16
|
+
import { ResourceTemplate } from "@modelcontextprotocol/server";
|
|
17
|
+
/** RFC 6570 template for one attachment: `imap://INBOX/4471/2`. */
|
|
18
|
+
export const ATTACHMENT_URI_TEMPLATE = "imap://{folder}/{uid}/{partId}";
|
|
19
|
+
/** RFC 6570 template for a message's RFC 822 source: `imap://INBOX/4471.eml`. */
|
|
20
|
+
export const RAW_EMAIL_URI_TEMPLATE = "imap://{folder}/{uid}.eml";
|
|
21
|
+
/**
|
|
22
|
+
* The URI for one attachment.
|
|
23
|
+
*
|
|
24
|
+
* The folder occupies the authority, so it is percent-encoded whole: an IMAP
|
|
25
|
+
* hierarchy delimiter inside it (`Archive/2024`) must not become a path
|
|
26
|
+
* separator, or the parse would read `2024` as the uid.
|
|
27
|
+
*/
|
|
28
|
+
export function attachmentUri(folder, uid, partId) {
|
|
29
|
+
return `imap://${encodeURIComponent(folder)}/${uid}/${encodeURIComponent(partId)}`;
|
|
30
|
+
}
|
|
31
|
+
/** The URI for a message's RFC 822 source. */
|
|
32
|
+
export function rawEmailUri(folder, uid) {
|
|
33
|
+
return `imap://${encodeURIComponent(folder)}/${uid}.eml`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Parses an `imap://` URI, or returns `undefined` when it is not one of ours.
|
|
37
|
+
*
|
|
38
|
+
* Parsing goes through `URL` rather than the template variables the SDK hands
|
|
39
|
+
* the read callback, so tool-minted and client-supplied URIs are read by the
|
|
40
|
+
* same code. `imap:` is not a WHATWG "special" scheme, so the authority keeps
|
|
41
|
+
* its case — which matters, because IMAP mailbox names are case-sensitive and
|
|
42
|
+
* an http-style lowercasing would silently retarget `INBOX` to `inbox`.
|
|
43
|
+
*/
|
|
44
|
+
export function parseImapUri(uri) {
|
|
45
|
+
let url;
|
|
46
|
+
try {
|
|
47
|
+
url = typeof uri === "string" ? new URL(uri) : uri;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
if (url.protocol !== "imap:")
|
|
53
|
+
return undefined;
|
|
54
|
+
const folder = decodeSegment(url.host);
|
|
55
|
+
if (!folder)
|
|
56
|
+
return undefined;
|
|
57
|
+
const segments = url.pathname.replace(/^\//, "").split("/");
|
|
58
|
+
if (segments.length === 1) {
|
|
59
|
+
const raw = segments[0];
|
|
60
|
+
if (!raw.endsWith(".eml"))
|
|
61
|
+
return undefined;
|
|
62
|
+
const uid = parseUid(raw.slice(0, -".eml".length));
|
|
63
|
+
return uid === undefined ? undefined : { kind: "raw", folder, uid };
|
|
64
|
+
}
|
|
65
|
+
if (segments.length === 2) {
|
|
66
|
+
const uid = parseUid(segments[0]);
|
|
67
|
+
const partId = decodeSegment(segments[1]);
|
|
68
|
+
if (uid === undefined || !partId)
|
|
69
|
+
return undefined;
|
|
70
|
+
return { kind: "attachment", folder, uid, partId };
|
|
71
|
+
}
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
/** Serves one attachment's bytes, base64-encoded under its own media type. */
|
|
75
|
+
export async function readAttachmentResource(uri, imap) {
|
|
76
|
+
const target = parseImapUri(uri);
|
|
77
|
+
if (target?.kind !== "attachment") {
|
|
78
|
+
throw new EmailError(`${uri.href} is not a valid attachment URI — expected imap://<folder>/<uid>/<partId>`, ErrorCode.INVALID_INPUT);
|
|
79
|
+
}
|
|
80
|
+
const attachment = await imap.downloadAttachment(target.folder, target.uid, target.partId);
|
|
81
|
+
return {
|
|
82
|
+
contents: [
|
|
83
|
+
{
|
|
84
|
+
uri: uri.href,
|
|
85
|
+
mimeType: attachment.contentType,
|
|
86
|
+
blob: attachment.content.toString("base64"),
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/** Serves a message's RFC 822 source. */
|
|
92
|
+
export async function readRawEmailResource(uri, imap) {
|
|
93
|
+
const target = parseImapUri(uri);
|
|
94
|
+
if (target?.kind !== "raw") {
|
|
95
|
+
throw new EmailError(`${uri.href} is not a valid message URI — expected imap://<folder>/<uid>.eml`, ErrorCode.INVALID_INPUT);
|
|
96
|
+
}
|
|
97
|
+
const raw = await imap.fetchRawEmail(target.folder, target.uid);
|
|
98
|
+
return {
|
|
99
|
+
contents: [{ uri: uri.href, mimeType: "message/rfc822", text: raw }],
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Registers both templates against an {@link McpServer}.
|
|
104
|
+
*
|
|
105
|
+
* Neither template gets a `list` callback: enumerating every attachment in an
|
|
106
|
+
* account would mean walking every message in every folder, and the useful
|
|
107
|
+
* entry point is `search_emails` / `get_email` anyway. Clients still discover
|
|
108
|
+
* the shapes through `resources/templates/list`.
|
|
109
|
+
*/
|
|
110
|
+
export function registerImapResources(server, imap) {
|
|
111
|
+
server.registerResource("email-attachment", new ResourceTemplate(ATTACHMENT_URI_TEMPLATE, { list: undefined }), {
|
|
112
|
+
title: "Email Attachment",
|
|
113
|
+
description: "One attachment's bytes, addressed by folder, message UID and MIME part ID. Part IDs come from get_email's attachment metadata.",
|
|
114
|
+
}, (uri) => readAttachmentResource(uri, imap));
|
|
115
|
+
server.registerResource("email-source", new ResourceTemplate(RAW_EMAIL_URI_TEMPLATE, { list: undefined }), {
|
|
116
|
+
title: "Email Source",
|
|
117
|
+
description: "A message's raw RFC 822 source, addressed by folder and message UID.",
|
|
118
|
+
mimeType: "message/rfc822",
|
|
119
|
+
}, (uri) => readRawEmailResource(uri, imap));
|
|
120
|
+
}
|
|
121
|
+
/** A percent-decoded URI segment, or `undefined` when it is empty or malformed. */
|
|
122
|
+
function decodeSegment(segment) {
|
|
123
|
+
if (!segment)
|
|
124
|
+
return undefined;
|
|
125
|
+
try {
|
|
126
|
+
return decodeURIComponent(segment) || undefined;
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/** A UID, or `undefined` unless the text is a plain positive integer. */
|
|
133
|
+
function parseUid(text) {
|
|
134
|
+
if (!/^\d+$/.test(text))
|
|
135
|
+
return undefined;
|
|
136
|
+
const uid = Number(text);
|
|
137
|
+
return uid > 0 ? uid : undefined;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=imapResources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imapResources.js","sourceRoot":"","sources":["../../src/resources/imapResources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAkB,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhF,mEAAmE;AACnE,MAAM,CAAC,MAAM,uBAAuB,GAAG,gCAAgC,CAAC;AAExE,iFAAiF;AACjF,MAAM,CAAC,MAAM,sBAAsB,GAAG,2BAA2B,CAAC;AAMlE;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,GAAW,EAAE,MAAc;IACvE,OAAO,UAAU,kBAAkB,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;AACrF,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,GAAW;IACrD,OAAO,UAAU,kBAAkB,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC;AAC3D,CAAC;AAOD;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,GAAiB;IAC5C,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACrD,CAAC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ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAwBD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAuFrD"}
|
package/dist/search.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ValidationError } from "@miguelarios/pim-core";
|
|
1
2
|
function parseTokens(value) {
|
|
2
3
|
const tokens = [];
|
|
3
4
|
const regex = /-?"([^"]+)"|(\S+)/g;
|
|
@@ -29,17 +30,19 @@ export function buildSearchCriteria(params) {
|
|
|
29
30
|
// Address fields → base criteria (no tokenization)
|
|
30
31
|
const addressFields = ["from", "to", "cc", "bcc"];
|
|
31
32
|
for (const field of addressFields) {
|
|
32
|
-
const value = params[field];
|
|
33
|
+
const value = filled(params[field]);
|
|
33
34
|
if (value === undefined)
|
|
34
35
|
continue;
|
|
35
36
|
baseCriteria[field] = value;
|
|
36
37
|
}
|
|
37
38
|
// Date filters → base criteria
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
const since = filled(params.since);
|
|
40
|
+
if (since !== undefined) {
|
|
41
|
+
baseCriteria.since = parseDate(since, "since");
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
const before = filled(params.before);
|
|
44
|
+
if (before !== undefined) {
|
|
45
|
+
baseCriteria.before = parseDate(before, "before");
|
|
43
46
|
}
|
|
44
47
|
// Boolean flags → base criteria
|
|
45
48
|
if (params.unread !== undefined) {
|
|
@@ -53,12 +56,13 @@ export function buildSearchCriteria(params) {
|
|
|
53
56
|
baseCriteria.header = { "content-type": "multipart/mixed" };
|
|
54
57
|
}
|
|
55
58
|
// Tags → base criteria for single tag, tokenized for multiple (key collision)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
const tags = params.tags?.map((tag) => tag.trim()).filter((tag) => tag.length > 0);
|
|
60
|
+
if (tags !== undefined) {
|
|
61
|
+
if (tags.length === 1) {
|
|
62
|
+
baseCriteria.keyword = tags[0];
|
|
59
63
|
}
|
|
60
64
|
else {
|
|
61
|
-
for (const tag of
|
|
65
|
+
for (const tag of tags) {
|
|
62
66
|
tokenizedCriteria.push({ keyword: tag });
|
|
63
67
|
}
|
|
64
68
|
}
|
|
@@ -70,7 +74,7 @@ export function buildSearchCriteria(params) {
|
|
|
70
74
|
{ param: "hasWords", imapKey: "text" },
|
|
71
75
|
];
|
|
72
76
|
for (const { param, imapKey } of tokenizedFields) {
|
|
73
|
-
const value = params[param];
|
|
77
|
+
const value = filled(params[param]);
|
|
74
78
|
if (value === undefined)
|
|
75
79
|
continue;
|
|
76
80
|
const tokens = parseTokens(value);
|
|
@@ -102,4 +106,32 @@ export function buildSearchCriteria(params) {
|
|
|
102
106
|
// Both base and tokenized → fold base into each tokenized criterion
|
|
103
107
|
return tokenizedCriteria.map((tc) => ({ ...baseCriteria, ...tc }));
|
|
104
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Narrows a string filter to a meaningful one, trimmed.
|
|
111
|
+
*
|
|
112
|
+
* A blank value is not a filter under any reading: nobody searches for the
|
|
113
|
+
* empty sender. Discarding it keeps the server correct for clients that
|
|
114
|
+
* materialize every optional property rather than omitting the ones the model
|
|
115
|
+
* left unset — see the #101 regression tests. Booleans are deliberately not
|
|
116
|
+
* normalized this way, because `false` is a legitimate query.
|
|
117
|
+
*/
|
|
118
|
+
function filled(value) {
|
|
119
|
+
if (value === undefined)
|
|
120
|
+
return undefined;
|
|
121
|
+
const trimmed = value.trim();
|
|
122
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Parses a date filter, rejecting one that cannot be read.
|
|
126
|
+
*
|
|
127
|
+
* `new Date("nonsense")` yields an Invalid Date, which serializes to `null` and
|
|
128
|
+
* makes IMAP match nothing — a silent empty result rather than a usable error.
|
|
129
|
+
*/
|
|
130
|
+
function parseDate(value, field) {
|
|
131
|
+
const parsed = new Date(value);
|
|
132
|
+
if (Number.isNaN(parsed.getTime())) {
|
|
133
|
+
throw new ValidationError(`${field} is not a valid date: ${JSON.stringify(value)}. Use YYYY-MM-DD.`, field);
|
|
134
|
+
}
|
|
135
|
+
return parsed;
|
|
136
|
+
}
|
|
105
137
|
//# sourceMappingURL=search.js.map
|
package/dist/search.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../src/search.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../src/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAuBxD,SAAS,WAAW,CAAC,KAAa;IAChC,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,oBAAoB,CAAC;IACnC,IAAI,KAAK,GAA2B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtD,OAAO,KAAK,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AAI,CAAC,OAAO,EAAE,CAAC;QACb,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,oEAAoE;IACpE,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,YAAY,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,MAAM,CAAC,KAAyB;IACvC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AAClD,CAAC;AAED;;;;;GAKG;AACH,SAAS,SAAS,CAAC,KAAa,EAAE,KAAyB;IACzD,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,eAAe,CACvB,GAAG,KAAK,yBAAyB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,mBAAmB,EACzE,KAAK,CACN,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -53,12 +53,41 @@ export interface FolderInfo {
|
|
|
53
53
|
specialUse?: string;
|
|
54
54
|
delimiter: string;
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
/** What is known about an attachment without necessarily holding its bytes. */
|
|
57
|
+
export interface AttachmentMeta {
|
|
57
58
|
filename: string;
|
|
58
59
|
contentType: string;
|
|
60
|
+
/** Size in bytes as the server reports it, falling back to the fetched length. */
|
|
59
61
|
size: number;
|
|
62
|
+
}
|
|
63
|
+
/** An attachment whose bytes were fetched. */
|
|
64
|
+
export interface AttachmentBytes extends AttachmentMeta {
|
|
65
|
+
oversized: false;
|
|
60
66
|
content: Buffer;
|
|
61
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* An attachment deliberately left on the server because it exceeded the
|
|
70
|
+
* caller's `maxBytes`. Its bytes remain reachable through `resources/read` on
|
|
71
|
+
* the matching `imap://` URI.
|
|
72
|
+
*/
|
|
73
|
+
export interface AttachmentTooLarge extends AttachmentMeta {
|
|
74
|
+
oversized: true;
|
|
75
|
+
content?: undefined;
|
|
76
|
+
}
|
|
77
|
+
export type AttachmentDownload = AttachmentBytes | AttachmentTooLarge;
|
|
78
|
+
/** A message source that was fetched. */
|
|
79
|
+
export interface RawEmailSource {
|
|
80
|
+
size: number;
|
|
81
|
+
oversized: false;
|
|
82
|
+
source: string;
|
|
83
|
+
}
|
|
84
|
+
/** A message source left on the server for exceeding the caller's `maxBytes`. */
|
|
85
|
+
export interface RawEmailTooLarge {
|
|
86
|
+
size: number;
|
|
87
|
+
oversized: true;
|
|
88
|
+
source?: undefined;
|
|
89
|
+
}
|
|
90
|
+
export type RawEmailResult = RawEmailSource | RawEmailTooLarge;
|
|
62
91
|
export interface SearchOptions {
|
|
63
92
|
limit?: number;
|
|
64
93
|
offset?: number;
|
|
@@ -75,11 +104,13 @@ export declare class ImapService {
|
|
|
75
104
|
private fetchSummaries;
|
|
76
105
|
fetchEmail(folder: string, uid: number): Promise<EmailFull>;
|
|
77
106
|
fetchRawEmail(folder: string, uid: number): Promise<string>;
|
|
107
|
+
fetchRawEmail(folder: string, uid: number, maxBytes: number): Promise<RawEmailResult>;
|
|
78
108
|
moveEmails(folder: string, uids: number[], destination: string): Promise<void>;
|
|
79
109
|
markEmails(folder: string, uids: number[], flags: string[], action: "add" | "remove"): Promise<void>;
|
|
80
110
|
deleteEmails(folder: string, uids: number[], permanent?: boolean): Promise<void>;
|
|
81
111
|
createFolder(path: string): Promise<void>;
|
|
82
|
-
downloadAttachment(folder: string, uid: number, partId: string): Promise<
|
|
112
|
+
downloadAttachment(folder: string, uid: number, partId: string): Promise<AttachmentBytes>;
|
|
113
|
+
downloadAttachment(folder: string, uid: number, partId: string, maxBytes: number): Promise<AttachmentDownload>;
|
|
83
114
|
private static FALLBACK_NAMES;
|
|
84
115
|
private specialUseCache;
|
|
85
116
|
getSpecialUseFolder(flag: string): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImapService.d.ts","sourceRoot":"","sources":["../../src/services/ImapService.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAMjB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,KAAK,YAAY,EAAuB,MAAM,cAAc,CAAC;AAEtE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,EAAE,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC7C,EAAE,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,C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