@kbzowski/mcp-inbox 0.1.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.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +396 -0
  3. package/dist/cache/db.d.ts +34 -0
  4. package/dist/cache/idle.d.ts +32 -0
  5. package/dist/cache/queries.d.ts +66 -0
  6. package/dist/cache/schema.d.ts +456 -0
  7. package/dist/cache/sync.d.ts +38 -0
  8. package/dist/config/env.d.ts +103 -0
  9. package/dist/errors/mapper.d.ts +10 -0
  10. package/dist/errors/types.d.ts +25 -0
  11. package/dist/formatters/markdown.d.ts +13 -0
  12. package/dist/imap/client.d.ts +37 -0
  13. package/dist/imap/folders.d.ts +19 -0
  14. package/dist/imap/mime-builder.d.ts +32 -0
  15. package/dist/imap/search.d.ts +28 -0
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.js +2572 -0
  18. package/dist/index.js.map +7 -0
  19. package/dist/migrations/0000_mean_the_santerians.sql +49 -0
  20. package/dist/migrations/0001_wooden_doomsday.sql +2 -0
  21. package/dist/migrations/meta/0000_snapshot.json +337 -0
  22. package/dist/migrations/meta/0001_snapshot.json +224 -0
  23. package/dist/migrations/meta/_journal.json +20 -0
  24. package/dist/server.d.ts +8 -0
  25. package/dist/smtp/client.d.ts +28 -0
  26. package/dist/tools/attachments/get-attachment.d.ts +43 -0
  27. package/dist/tools/define-tool.d.ts +61 -0
  28. package/dist/tools/drafts/create-draft.d.ts +11 -0
  29. package/dist/tools/drafts/get-draft.d.ts +10 -0
  30. package/dist/tools/drafts/list-drafts.d.ts +11 -0
  31. package/dist/tools/drafts/update-draft.d.ts +12 -0
  32. package/dist/tools/emails/delete-email.d.ts +6 -0
  33. package/dist/tools/emails/get-email.d.ts +10 -0
  34. package/dist/tools/emails/list-emails.d.ts +14 -0
  35. package/dist/tools/emails/mark-read.d.ts +9 -0
  36. package/dist/tools/emails/move-to-folder.d.ts +6 -0
  37. package/dist/tools/emails/search-emails.d.ts +17 -0
  38. package/dist/tools/emails/shared.d.ts +74 -0
  39. package/dist/tools/folders/list-folders.d.ts +7 -0
  40. package/dist/tools/registry.d.ts +21 -0
  41. package/dist/tools/send/forward.d.ts +11 -0
  42. package/dist/tools/send/reply.d.ts +12 -0
  43. package/dist/tools/send/send-draft.d.ts +5 -0
  44. package/dist/tools/send/send-email.d.ts +10 -0
  45. package/dist/tools/send/shared.d.ts +40 -0
  46. package/dist/utils/logger.d.ts +40 -0
  47. package/package.json +90 -0
@@ -0,0 +1,19 @@
1
+ import type { ListResponse } from 'imapflow';
2
+ /**
3
+ * RFC 6154 SPECIAL-USE attributes. These are the standard flags IMAP
4
+ * servers advertise on the mailbox list response. All modern providers
5
+ * (Gmail, Fastmail, Outlook, modern Dovecot) support this; only ancient
6
+ * Courier installs fall back to name-probing.
7
+ */
8
+ export type SpecialUseAttr = '\\Drafts' | '\\Sent' | '\\Trash' | '\\Junk' | '\\All' | '\\Flagged';
9
+ /**
10
+ * Resolve a special-use folder to its mailbox path.
11
+ *
12
+ * Strategy: prefer the RFC 6154 `specialUse` property from the server's
13
+ * LIST response; fall back to a name-probe against known provider-specific
14
+ * conventions if no folder advertises the attribute.
15
+ *
16
+ * Returns `undefined` if no matching folder exists - callers should handle
17
+ * that explicitly (e.g. by creating the folder or surfacing an error).
18
+ */
19
+ export declare function findSpecialFolder(folders: readonly ListResponse[], attr: SpecialUseAttr): string | undefined;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Input shape for building a raw RFC 2822 message.
3
+ *
4
+ * This is a narrowed view of nodemailer's `Mail.Options` - we expose only
5
+ * the fields the draft/reply/forward tools actually use. Nodemailer handles
6
+ * RFC 2047 encoded-word for non-ASCII headers, RFC 5322 line folding,
7
+ * multipart boundaries, and Message-ID generation automatically.
8
+ */
9
+ export interface BuildMessageInput {
10
+ from: string;
11
+ to: string | string[];
12
+ cc?: string | string[];
13
+ bcc?: string | string[];
14
+ subject: string;
15
+ text?: string;
16
+ html?: string;
17
+ /** Threading headers - required for reply/forward. */
18
+ inReplyTo?: string;
19
+ references?: string | string[];
20
+ /** Optional extra headers (e.g. X-Mailer). */
21
+ headers?: Record<string, string>;
22
+ }
23
+ /**
24
+ * Build a raw RFC 2822 message buffer, suitable for `IMAP APPEND` to the
25
+ * Drafts folder, a Sent-folder backup after SMTP send, or any other
26
+ * on-the-wire scenario that needs a parseable message.
27
+ *
28
+ * Never hand-roll this - non-ASCII subjects, international recipients,
29
+ * and long bodies all have rules that are easy to get wrong. Reuse
30
+ * nodemailer's battle-tested builder.
31
+ */
32
+ export declare function buildRawMessage(input: BuildMessageInput): Promise<Buffer>;
@@ -0,0 +1,28 @@
1
+ import type { SearchObject } from 'imapflow';
2
+ /**
3
+ * Typed IMAP search criteria, produced by our Zod-validated tool inputs.
4
+ *
5
+ * This type is the single source of truth for what every `imap_*_emails`
6
+ * tool accepts. It stays deliberately narrow - ImapFlow's `SearchObject`
7
+ * is much richer (flags, modseq, gmail extensions) but most of that
8
+ * surface isn't exposed to tool callers.
9
+ */
10
+ export interface EmailSearchCriteria {
11
+ subject?: string;
12
+ from?: string;
13
+ to?: string;
14
+ body?: string;
15
+ /** If true, only messages without `\Seen`. If undefined/false, no filter. */
16
+ unseen?: boolean;
17
+ /** Only messages received on/after this date (Date or ISO string). */
18
+ since?: Date;
19
+ /** Only messages received before this date. */
20
+ before?: Date;
21
+ }
22
+ /**
23
+ * Convert our typed criteria into ImapFlow's `SearchObject`.
24
+ *
25
+ * An empty criteria object yields `{ all: true }` - ImapFlow sends that
26
+ * as a bare IMAP `ALL`, matching every message in the mailbox.
27
+ */
28
+ export declare function buildImapSearch(c: EmailSearchCriteria): SearchObject;
@@ -0,0 +1 @@
1
+ export {};