@kbzowski/mcp-inbox 0.3.1 → 0.4.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 +1 -18
- package/dist/app.js +45 -13
- package/dist/app.js.map +2 -2
- package/dist/cache/queries.d.ts +8 -1
- package/dist/cache/sync.d.ts +8 -1
- package/dist/index.js +1 -4
- package/dist/index.js.map +2 -2
- package/package.json +3 -1
package/dist/cache/queries.d.ts
CHANGED
|
@@ -32,7 +32,14 @@ export interface ListEmailsOptions {
|
|
|
32
32
|
* provider returns envelope-only rows without dates.
|
|
33
33
|
*/
|
|
34
34
|
export declare function listEmailsByFolder(db: CacheDb, folder: string, opts?: ListEmailsOptions): Email[];
|
|
35
|
-
export declare function countEmailsInFolder(db: CacheDb, folder: string): number;
|
|
35
|
+
export declare function countEmailsInFolder(db: CacheDb, folder: string, opts?: ListEmailsOptions): number;
|
|
36
|
+
/**
|
|
37
|
+
* Return every cached UID for a folder. Used by the sync reconciliation
|
|
38
|
+
* path to detect ghost entries (UIDs we have locally that are gone on
|
|
39
|
+
* the server - e.g. messages deleted by another client while IDLE was
|
|
40
|
+
* disconnected).
|
|
41
|
+
*/
|
|
42
|
+
export declare function listCachedUidsForFolder(db: CacheDb, folder: string): number[];
|
|
36
43
|
/**
|
|
37
44
|
* Replace the flag set on a cached email. Used for write-through
|
|
38
45
|
* invalidation after mark-read/mark-unread, and when IDLE delivers
|
package/dist/cache/sync.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { ImapFlow, MessageStructureObject } from 'imapflow';
|
|
1
|
+
import type { FetchMessageObject, ImapFlow, MessageStructureObject } from 'imapflow';
|
|
2
2
|
import type { CacheDb } from './db';
|
|
3
|
+
import type { EmailInsert } from './schema';
|
|
3
4
|
export interface SyncContext {
|
|
4
5
|
db: CacheDb;
|
|
5
6
|
imap: ImapFlow;
|
|
@@ -26,6 +27,12 @@ export interface SyncResult {
|
|
|
26
27
|
* 5. Persist the new folder sync state.
|
|
27
28
|
*/
|
|
28
29
|
export declare function syncFolder(ctx: SyncContext, folderPath: string): Promise<SyncResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Map an ImapFlow message into the EmailInsert shape. Exported so tools
|
|
32
|
+
* that fetch envelopes outside the main sync path (e.g. search auto-fill)
|
|
33
|
+
* can reuse exactly the same projection.
|
|
34
|
+
*/
|
|
35
|
+
export declare function messageToInsert(folderPath: string, msg: FetchMessageObject, cachedAt: number): EmailInsert | null;
|
|
29
36
|
/**
|
|
30
37
|
* Walk an IMAP body structure tree, returning true if any part looks like
|
|
31
38
|
* a real attachment. A part counts when:
|
package/dist/index.js
CHANGED
|
@@ -29,10 +29,7 @@ var [nodeMajor] = process.versions.node.split(".").map(Number);
|
|
|
29
29
|
if (nodeMajor < 24) {
|
|
30
30
|
process.stderr.write(
|
|
31
31
|
`mcp-inbox requires Node.js 24 or later (running ${process.version}).
|
|
32
|
-
|
|
33
|
-
\u2022 proto users: run 'proto pin node 24 --global' once to set the global default.
|
|
34
|
-
\u2022 pnpm dlx / pnpx: if proto shims resolve to an older version outside your
|
|
35
|
-
project directory, set a global default or use 'npx -y @kbzowski/mcp-inbox'.
|
|
32
|
+
Upgrade: https://nodejs.org/en/download
|
|
36
33
|
`
|
|
37
34
|
);
|
|
38
35
|
process.exit(1);
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/utils/suppress-sqlite-warning.ts", "../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["// Side-effect-only module. Must be imported before anything that touches\n// `node:sqlite` (directly or via drizzle-orm/node-sqlite). ESM evaluates\n// imports depth-first, so importing this first guarantees process.emitWarning\n// is patched before the sqlite module loads and emits its\n// ExperimentalWarning at init time.\n\nconst originalEmitWarning = process.emitWarning.bind(process);\n\ntype EmitWarningArgs = Parameters<typeof process.emitWarning>;\n\nprocess.emitWarning = ((...args: EmitWarningArgs) => {\n const [warning, typeOrOpts] = args;\n const name =\n typeof typeOrOpts === 'string'\n ? typeOrOpts\n : (typeOrOpts as { type?: string } | undefined)?.type;\n const text =\n typeof warning === 'string' ? warning : ((warning as Error | undefined)?.message ?? '');\n if (name === 'ExperimentalWarning' && /SQLite is an experimental feature/i.test(text)) {\n return;\n }\n return originalEmitWarning(...args);\n}) as typeof process.emitWarning;\n\n// Also drop any listener Node's bootstrap installed before us.\nfor (const listener of process.listeners('warning')) {\n process.removeListener('warning', listener);\n}\nprocess.on('warning', (w) => {\n if (w.name === 'ExperimentalWarning' && /SQLite is an experimental feature/i.test(w.message)) {\n return;\n }\n process.stderr.write(`${w.stack ?? w.message}\\n`);\n});\n", "// Tiny ESM entry point. The only thing it does synchronously is install\n// the warning filter so node:sqlite's ExperimentalWarning is swallowed\n// before anything else loads it. Then it dynamically imports the app,\n// which is what pulls in drizzle-orm/node-sqlite (and therefore\n// node:sqlite itself).\n//\n// Static ESM imports are hoisted above top-level statements, so the\n// override cannot go here as a normal import statement - the sqlite\n// module would load first. A dynamic import() runs after the preamble.\n\n// Must run before anything that imports node:sqlite (drizzle-orm/node-sqlite\n// calls StatementSync.setReturnArrays which only exists in Node 24+).\nconst [nodeMajor] = process.versions.node.split('.').map(Number);\nif (nodeMajor! < 24) {\n process.stderr.write(\n `mcp-inbox requires Node.js 24 or later (running ${process.version}).\\n` +\n `
|
|
5
|
-
"mappings": ";;;;;AAMA,IAAM,sBAAsB,QAAQ,YAAY,KAAK,OAAO;AAI5D,QAAQ,eAAe,IAAI,SAA0B;AACnD,QAAM,CAAC,SAAS,UAAU,IAAI;AAC9B,QAAM,OACJ,OAAO,eAAe,WAClB,aACC,YAA8C;AACrD,QAAM,OACJ,OAAO,YAAY,WAAW,UAAY,SAA+B,WAAW;AACtF,MAAI,SAAS,yBAAyB,qCAAqC,KAAK,IAAI,GAAG;AACrF;AAAA,EACF;AACA,SAAO,oBAAoB,GAAG,IAAI;AACpC;AAGA,WAAW,YAAY,QAAQ,UAAU,SAAS,GAAG;AACnD,UAAQ,eAAe,WAAW,QAAQ;AAC5C;AACA,QAAQ,GAAG,WAAW,CAAC,MAAM;AAC3B,MAAI,EAAE,SAAS,yBAAyB,qCAAqC,KAAK,EAAE,OAAO,GAAG;AAC5F;AAAA,EACF;AACA,UAAQ,OAAO,MAAM,GAAG,EAAE,SAAS,EAAE,OAAO;AAAA,CAAI;AAClD,CAAC;;;ACrBD,IAAM,CAAC,SAAS,IAAI,QAAQ,SAAS,KAAK,MAAM,GAAG,EAAE,IAAI,MAAM;AAC/D,IAAI,YAAa,IAAI;AACnB,UAAQ,OAAO;AAAA,IACb,mDAAmD,QAAQ,OAAO;AAAA;AAAA;AAAA
|
|
4
|
+
"sourcesContent": ["// Side-effect-only module. Must be imported before anything that touches\n// `node:sqlite` (directly or via drizzle-orm/node-sqlite). ESM evaluates\n// imports depth-first, so importing this first guarantees process.emitWarning\n// is patched before the sqlite module loads and emits its\n// ExperimentalWarning at init time.\n\nconst originalEmitWarning = process.emitWarning.bind(process);\n\ntype EmitWarningArgs = Parameters<typeof process.emitWarning>;\n\nprocess.emitWarning = ((...args: EmitWarningArgs) => {\n const [warning, typeOrOpts] = args;\n const name =\n typeof typeOrOpts === 'string'\n ? typeOrOpts\n : (typeOrOpts as { type?: string } | undefined)?.type;\n const text =\n typeof warning === 'string' ? warning : ((warning as Error | undefined)?.message ?? '');\n if (name === 'ExperimentalWarning' && /SQLite is an experimental feature/i.test(text)) {\n return;\n }\n return originalEmitWarning(...args);\n}) as typeof process.emitWarning;\n\n// Also drop any listener Node's bootstrap installed before us.\nfor (const listener of process.listeners('warning')) {\n process.removeListener('warning', listener);\n}\nprocess.on('warning', (w) => {\n if (w.name === 'ExperimentalWarning' && /SQLite is an experimental feature/i.test(w.message)) {\n return;\n }\n process.stderr.write(`${w.stack ?? w.message}\\n`);\n});\n", "// Tiny ESM entry point. The only thing it does synchronously is install\n// the warning filter so node:sqlite's ExperimentalWarning is swallowed\n// before anything else loads it. Then it dynamically imports the app,\n// which is what pulls in drizzle-orm/node-sqlite (and therefore\n// node:sqlite itself).\n//\n// Static ESM imports are hoisted above top-level statements, so the\n// override cannot go here as a normal import statement - the sqlite\n// module would load first. A dynamic import() runs after the preamble.\n\n// Must run before anything that imports node:sqlite (drizzle-orm/node-sqlite\n// calls StatementSync.setReturnArrays which only exists in Node 24+).\nconst [nodeMajor] = process.versions.node.split('.').map(Number);\nif (nodeMajor! < 24) {\n process.stderr.write(\n `mcp-inbox requires Node.js 24 or later (running ${process.version}).\\n` +\n `Upgrade: https://nodejs.org/en/download\\n`,\n );\n process.exit(1);\n}\n\nimport './utils/suppress-sqlite-warning';\n\n// The `.js` extension is required at runtime (esbuild emits dist/app.js).\n// TS `moduleResolution: Bundler` lets us write it this way in source.\nawait import('./app.js');\n"],
|
|
5
|
+
"mappings": ";;;;;AAMA,IAAM,sBAAsB,QAAQ,YAAY,KAAK,OAAO;AAI5D,QAAQ,eAAe,IAAI,SAA0B;AACnD,QAAM,CAAC,SAAS,UAAU,IAAI;AAC9B,QAAM,OACJ,OAAO,eAAe,WAClB,aACC,YAA8C;AACrD,QAAM,OACJ,OAAO,YAAY,WAAW,UAAY,SAA+B,WAAW;AACtF,MAAI,SAAS,yBAAyB,qCAAqC,KAAK,IAAI,GAAG;AACrF;AAAA,EACF;AACA,SAAO,oBAAoB,GAAG,IAAI;AACpC;AAGA,WAAW,YAAY,QAAQ,UAAU,SAAS,GAAG;AACnD,UAAQ,eAAe,WAAW,QAAQ;AAC5C;AACA,QAAQ,GAAG,WAAW,CAAC,MAAM;AAC3B,MAAI,EAAE,SAAS,yBAAyB,qCAAqC,KAAK,EAAE,OAAO,GAAG;AAC5F;AAAA,EACF;AACA,UAAQ,OAAO,MAAM,GAAG,EAAE,SAAS,EAAE,OAAO;AAAA,CAAI;AAClD,CAAC;;;ACrBD,IAAM,CAAC,SAAS,IAAI,QAAQ,SAAS,KAAK,MAAM,GAAG,EAAE,IAAI,MAAM;AAC/D,IAAI,YAAa,IAAI;AACnB,UAAQ,OAAO;AAAA,IACb,mDAAmD,QAAQ,OAAO;AAAA;AAAA;AAAA,EAEpE;AACA,UAAQ,KAAK,CAAC;AAChB;AAMA,MAAM,OAAO,UAAU;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kbzowski/mcp-inbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "MCP server exposing IMAP/SMTP email over a fast local cache. Read, search, compose, and manage email from any IMAP provider with near-instant response times via background sync and IDLE push.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"format": "prettier --write .",
|
|
60
60
|
"format:check": "prettier --check .",
|
|
61
61
|
"db:generate": "drizzle-kit generate",
|
|
62
|
+
"prepare": "lefthook install",
|
|
62
63
|
"prepublishOnly": "npm run typecheck && npm run lint && npm run test && npm run build",
|
|
63
64
|
"release": "changeset publish"
|
|
64
65
|
},
|
|
@@ -79,6 +80,7 @@
|
|
|
79
80
|
"esbuild": "^0.28.0",
|
|
80
81
|
"eslint": "^10.0.0",
|
|
81
82
|
"eslint-config-prettier": "^10.0.0",
|
|
83
|
+
"lefthook": "^2.1.6",
|
|
82
84
|
"prettier": "^3.4.0",
|
|
83
85
|
"testcontainers": "^11.14.0",
|
|
84
86
|
"tsx": "^4.19.0",
|