@remit/mcp-server 0.6.0 → 0.7.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.
@@ -2,7 +2,7 @@ import { FILTER_NO_ACTION, } from "@remit/data-ports";
2
2
  import { isNotFoundError } from "@remit/data-ports/errors";
3
3
  import { deriveAccountConfigId } from "@remit/data-ports/id";
4
4
  import { FilterClauseField, FilterMatchOperator, FilterScope, FilterState, } from "@remit/domain-enums";
5
- import { createFilter, listFilters, queueOrganizeJob, refuse, updateFilter, } from "@remit/mailbox-service";
5
+ import { accept, createFilter, listFilters, ownedAccount, queueOrganizeJob, refuse, updateFilter, } from "@remit/mailbox-service";
6
6
  import { z } from "zod";
7
7
  import { asJson, refused, toolError } from "./tool-result.js";
8
8
  const FILTER_WRITE = {
@@ -186,4 +186,31 @@ export const registerFilterTools = (server, deps, userId) => {
186
186
  }
187
187
  return asJson(toOrganizeJob(job));
188
188
  });
189
+ server.registerTool("apply_filter", {
190
+ description: "Apply a filter to existing mail now, without changing the filter. Queues the same job create_filter queues and returns its organizeJobId.",
191
+ inputSchema: {
192
+ accountId,
193
+ filterId: z.string().min(1).describe("Filter from list_filters"),
194
+ },
195
+ annotations: FILTER_WRITE,
196
+ }, async ({ accountId, filterId }) => {
197
+ const owned = await deps.account
198
+ .get(accountId)
199
+ .then((account) => ownedAccount(account, accountConfigId, "act"))
200
+ .catch(notFound);
201
+ if (!owned.ok)
202
+ return refused(owned.refusal);
203
+ const filter = await deps.filter
204
+ .get(accountConfigId, filterId)
205
+ .then(accept)
206
+ .catch(notFound);
207
+ if (!filter.ok)
208
+ return refused(filter.refusal);
209
+ const job = await queueOrganizeJob(organizeDeps, {
210
+ accountConfigId,
211
+ userId,
212
+ filterId,
213
+ });
214
+ return asJson({ organizeJobId: job.organizeJobId, state: job.state });
215
+ });
189
216
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/mcp-server",
3
- "version": "0.6.0",
3
+ "version": "0.7.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": {