@remit/mcp-server 0.13.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/dist/deps.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { RemitClient } from "@remit/backend/client";
2
2
  import type { IAccountRepository, IAccountSettingRepository, IAddressRepository, IFilterRepository, ILabelMailboxRepository, ILabelRepository, IMailboxRepository, IMailboxSpecialUseRepository, IMessageLabelRepository, IMessageRepository, IOrganizeJobRequestRepository, IThreadMessageRepository, OrganizeJobEvent, QueueProducer } from "@remit/data-ports";
3
- import type { BodyPartMaterializer, BodySyncCue, MailboxQueueService, MaterializeLogger, MessageMoveService, OrganizeJobLogger } from "@remit/mailbox-service";
3
+ import type { BodyPartMaterializer, BodySyncCue, MailboxQueueService, MaterializeLogger, MessageMoveService, OrganizeJobLogger, RescanService } from "@remit/mailbox-service";
4
4
  import type { StorageService } from "@remit/storage-service";
5
5
  export declare const FOLDER_SETTLE_TIMEOUT_MS = 20000;
6
6
  export declare const FOLDER_POLL_INTERVAL_MS = 500;
@@ -31,6 +31,7 @@ export interface McpDeps {
31
31
  storage: Pick<StorageService, "retrieveBodyPart">;
32
32
  bodySync: BodyPartMaterializer;
33
33
  bodySyncQueue: BodySyncCue;
34
+ rescan: Pick<RescanService, "rescan">;
34
35
  logger: MaterializeLogger;
35
36
  folders: FolderToolDeps;
36
37
  filters: FilterToolDeps;
package/dist/deps.js CHANGED
@@ -17,6 +17,7 @@ export const mcpDepsOf = (client, { logger, settle }) => ({
17
17
  storage: client.storage,
18
18
  bodySync: client.bodySync,
19
19
  bodySyncQueue: client.bodySyncQueue,
20
+ rescan: client.rescan,
20
21
  logger,
21
22
  folders: { mailboxQueue: client.mailboxQueue, ...settle },
22
23
  filters: { organizeQueue: client.queues.accountFanout, logger },
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { McpDeps } from "./deps.js";
3
+ export declare const registerRescanTools: (server: McpServer, deps: McpDeps, accountConfigId: string) => void;
@@ -0,0 +1,39 @@
1
+ import { ownedAccount, RESCAN_LIMIT } from "@remit/mailbox-service";
2
+ import { z } from "zod";
3
+ import { asJson, notFoundRefusal, refused } from "./tool-result.js";
4
+ const RESCAN_WRITE = {
5
+ readOnlyHint: false,
6
+ destructiveHint: false,
7
+ idempotentHint: true,
8
+ openWorldHint: true,
9
+ };
10
+ const notFound = notFoundRefusal("Use an accountId from list_mailboxes.");
11
+ export const registerRescanTools = (server, deps, accountConfigId) => {
12
+ server.registerTool("rescan_messages", {
13
+ description: `Check up to ${RESCAN_LIMIT} messages of one account again with the category classifier and the spam check, and return each verdict. Sets a category only on uncategorized mail and never labels a message the owner marked Not spam. Moves nothing unless move is true. Each message lands in successful or failed; retry only the failed ids marked retryable. To rescan a folder, page through list_threads or search_threads and send ${RESCAN_LIMIT} ids per call.`,
14
+ inputSchema: {
15
+ accountId: z
16
+ .string()
17
+ .min(1)
18
+ .describe("The account the messages belong to, from list_mailboxes"),
19
+ messageIds: z
20
+ .array(z.string().min(1))
21
+ .min(1)
22
+ .max(RESCAN_LIMIT)
23
+ .describe("Messages from list_threads, search_threads or get_thread"),
24
+ move: z
25
+ .boolean()
26
+ .default(false)
27
+ .describe("Also move a message the verdict sends to Junk"),
28
+ },
29
+ annotations: RESCAN_WRITE,
30
+ }, async ({ accountId, messageIds, move }) => {
31
+ const owned = await deps.account
32
+ .get(accountId)
33
+ .then((account) => ownedAccount(account, accountConfigId, "act"))
34
+ .catch(notFound);
35
+ if (!owned.ok)
36
+ return refused(owned.refusal);
37
+ return asJson(await deps.rescan.rescan({ accountId, accountConfigId }, { messageIds, move }));
38
+ });
39
+ };
package/dist/server.js CHANGED
@@ -7,6 +7,7 @@ import { registerFolderTools } from "./folder-tools.js";
7
7
  import { registerLabelReadTools, registerLabelWriteTools, } from "./label-tools.js";
8
8
  import { registerMoveTools } from "./move-tools.js";
9
9
  import { registerReadTools } from "./read-tools.js";
10
+ import { registerRescanTools } from "./rescan-tools.js";
10
11
  const unusedJsonSchemaValidator = {
11
12
  getValidator: () => {
12
13
  throw new Error("JSON Schema validation is unused by this server: tools validate input with zod and declare no output schema");
@@ -23,6 +24,7 @@ const buildServer = (principal, deps) => {
23
24
  registerLabelWriteTools(server, deps, deriveAccountConfigId(principal.userId));
24
25
  registerFilterTools(server, deps, principal.userId);
25
26
  registerMoveTools(server, deps, principal.userId);
27
+ registerRescanTools(server, deps, deriveAccountConfigId(principal.userId));
26
28
  }
27
29
  return server;
28
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/mcp-server",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "The remit MCP server: mail tools over streamable HTTP and the OAuth authorization server that guards them.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -25,12 +25,12 @@
25
25
  "@better-auth/oauth-provider": "^1.7.12",
26
26
  "@hono/node-server": "^2.1.3",
27
27
  "@modelcontextprotocol/sdk": "1.32.1",
28
- "@remit/auth-service": "0.3.12",
29
- "@remit/data-ports": "2.9.0",
30
- "@remit/domain-enums": "0.0.54",
31
- "@remit/drizzle-service": "3.7.0",
32
- "@remit/mailbox-service": "2.22.0",
33
- "@remit/storage-service": "0.0.40",
28
+ "@remit/auth-service": "0.3.14",
29
+ "@remit/data-ports": "2.11.0",
30
+ "@remit/domain-enums": "0.0.56",
31
+ "@remit/drizzle-service": "3.7.2",
32
+ "@remit/mailbox-service": "2.24.0",
33
+ "@remit/storage-service": "0.0.42",
34
34
  "@remit/ui": "0.0.234",
35
35
  "better-auth": "^1.7.12",
36
36
  "drizzle-orm": "1.0.0-rc.5",
@@ -38,12 +38,12 @@
38
38
  "react": "^19",
39
39
  "react-dom": "^19",
40
40
  "zod": "^4.6.7",
41
- "@remit/backend": "5.8.0",
41
+ "@remit/backend": "5.10.0",
42
42
  "@types/react": "^19",
43
43
  "@types/react-dom": "^19"
44
44
  },
45
45
  "devDependencies": {
46
- "@remit/imap-worker": "3.4.0",
46
+ "@remit/imap-worker": "3.5.1",
47
47
  "@tailwindcss/vite": "^4",
48
48
  "tailwindcss": "^4",
49
49
  "tsx": "*",