@kbzowski/mcp-inbox 0.1.0 → 0.2.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 +0 -2
- package/dist/cache/db.d.ts +11 -0
- package/dist/cache/queries.d.ts +10 -0
- package/dist/imap/search.d.ts +28 -14
- package/dist/index.js +418 -99
- package/dist/index.js.map +4 -4
- package/dist/tools/emails/delete-multiple.d.ts +6 -0
- package/dist/tools/emails/mark-read-multiple.d.ts +9 -0
- package/dist/tools/emails/move-multiple.d.ts +6 -0
- package/dist/tools/emails/search-emails.d.ts +5 -0
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -6,8 +6,6 @@ Works with any IMAP/SMTP provider: Gmail, Outlook, Fastmail, iCloud, Proton Mail
|
|
|
6
6
|
|
|
7
7
|
**On attachments:** `imap_get_email` surfaces attachment metadata (filename, content type, size) by default - enough for the agent to describe what's attached without any download. When the agent genuinely needs to read content inside an attachment (search a PDF, extract a table from a CSV), `imap_get_attachment` fetches the bytes inline as base64 for one response. Nothing is cached on disk; re-requesting the same attachment refetches from the server.
|
|
8
8
|
|
|
9
|
-
**Status:** 0.1.0, early. See `CLAUDE.md` for architecture notes.
|
|
10
|
-
|
|
11
9
|
---
|
|
12
10
|
|
|
13
11
|
## Requirements
|
package/dist/cache/db.d.ts
CHANGED
|
@@ -32,3 +32,14 @@ export interface CacheHandle {
|
|
|
32
32
|
* need a migration history.
|
|
33
33
|
*/
|
|
34
34
|
export declare function openCache(path: string, migrationsFolder?: string): CacheHandle;
|
|
35
|
+
/**
|
|
36
|
+
* Turn whatever better-sqlite3 threw into an actionable message. The old
|
|
37
|
+
* version of this code always said "Check IMAP_CACHE_DIR permissions",
|
|
38
|
+
* which is almost never the real cause - the common ones are:
|
|
39
|
+
* - the native binding failed to load (bad prebuild / wrong Node ABI)
|
|
40
|
+
* - the db file is locked by another mcp-inbox instance
|
|
41
|
+
* - actual permission denied (rare, but covered)
|
|
42
|
+
*
|
|
43
|
+
* Exported for unit tests.
|
|
44
|
+
*/
|
|
45
|
+
export declare function diagnoseOpenError(path: string, err: unknown): string;
|
package/dist/cache/queries.d.ts
CHANGED
|
@@ -39,6 +39,16 @@ export declare function countEmailsInFolder(db: CacheDb, folder: string): number
|
|
|
39
39
|
* a FLAGS update.
|
|
40
40
|
*/
|
|
41
41
|
export declare function setEmailFlags(db: CacheDb, folder: string, uid: number, flags: string[]): void;
|
|
42
|
+
/**
|
|
43
|
+
* Apply a flag-set mutation to each of the given UIDs. `mutate` receives
|
|
44
|
+
* the current flags and returns the new flags. Can't be a single SQL
|
|
45
|
+
* UPDATE because existing flags vary per row (we're adding/removing
|
|
46
|
+
* \Seen, not replacing). Wrapped in a transaction so either all rows
|
|
47
|
+
* update or none do.
|
|
48
|
+
*
|
|
49
|
+
* No-ops on empty UID list.
|
|
50
|
+
*/
|
|
51
|
+
export declare function mutateEmailFlagsForUids(db: CacheDb, folder: string, uids: number[], mutate: (current: string[]) => string[]): void;
|
|
42
52
|
/**
|
|
43
53
|
* Wipe every cached message in a folder. Invoked when UIDVALIDITY changes
|
|
44
54
|
* on the server - all our UIDs have been invalidated at once.
|
package/dist/imap/search.d.ts
CHANGED
|
@@ -2,27 +2,41 @@ import type { SearchObject } from 'imapflow';
|
|
|
2
2
|
/**
|
|
3
3
|
* Typed IMAP search criteria, produced by our Zod-validated tool inputs.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Recursive via `or` and `not`: tools can build `{subject, or: [{from}, {from}]}`
|
|
6
|
+
* which maps to `subject=X AND (from=a OR from=b)` at the IMAP layer.
|
|
7
|
+
*
|
|
8
|
+
* The type stays narrower than ImapFlow's full `SearchObject` - we don't
|
|
9
|
+
* expose modseq, Gmail extensions, or custom keywords yet.
|
|
9
10
|
*/
|
|
10
11
|
export interface EmailSearchCriteria {
|
|
11
|
-
subject?: string;
|
|
12
|
-
from?: string;
|
|
13
|
-
to?: string;
|
|
14
|
-
body?: string;
|
|
12
|
+
subject?: string | undefined;
|
|
13
|
+
from?: string | undefined;
|
|
14
|
+
to?: string | undefined;
|
|
15
|
+
body?: string | undefined;
|
|
15
16
|
/** If true, only messages without `\Seen`. If undefined/false, no filter. */
|
|
16
|
-
unseen?: boolean;
|
|
17
|
-
/** Only messages received on/after this date
|
|
18
|
-
since?: Date;
|
|
17
|
+
unseen?: boolean | undefined;
|
|
18
|
+
/** Only messages received on/after this date. */
|
|
19
|
+
since?: Date | undefined;
|
|
19
20
|
/** Only messages received before this date. */
|
|
20
|
-
before?: Date;
|
|
21
|
+
before?: Date | undefined;
|
|
22
|
+
/** Only messages larger than this many bytes. */
|
|
23
|
+
larger_than_bytes?: number | undefined;
|
|
24
|
+
/** Only messages smaller than this many bytes. */
|
|
25
|
+
smaller_than_bytes?: number | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Array of sub-criteria (>=2); at least one must match. Maps to IMAP OR.
|
|
28
|
+
* IMAP OR is strictly binary on the wire but ImapFlow unrolls arrays
|
|
29
|
+
* for us, so `or: [a, b, c]` works as (a OR b OR c).
|
|
30
|
+
*/
|
|
31
|
+
or?: EmailSearchCriteria[] | undefined;
|
|
32
|
+
/** Sub-criteria that must NOT match. Maps to IMAP NOT. */
|
|
33
|
+
not?: EmailSearchCriteria | undefined;
|
|
21
34
|
}
|
|
22
35
|
/**
|
|
23
36
|
* Convert our typed criteria into ImapFlow's `SearchObject`.
|
|
24
37
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
38
|
+
* Recurses into `or` and `not` so full boolean trees survive the
|
|
39
|
+
* translation. Empty criteria objects yield `{ all: true }`, matching
|
|
40
|
+
* every message - preserves the old behavior when no filters are set.
|
|
27
41
|
*/
|
|
28
42
|
export declare function buildImapSearch(c: EmailSearchCriteria): SearchObject;
|