@cookiemunch/mcp 0.1.1 → 0.3.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/bin.cjs CHANGED
@@ -9,7 +9,7 @@ var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
9
9
  var import_sdk = require("@cookiemunch/sdk");
10
10
 
11
11
  // src/tools.ts
12
- var import_zod3 = require("zod");
12
+ var import_zod4 = require("zod");
13
13
 
14
14
  // src/tools-config.ts
15
15
  var import_zod = require("zod");
@@ -197,7 +197,7 @@ function registerConfigTools(tool, client) {
197
197
  preset: import_zod.z.enum(["bar", "box", "full"]).optional().describe("Named shape that sets type/secondLayer (and layout for box): bar = slim one-row bar + categories in a modal; box = centred card + modal; full = every category in the first layer."),
198
198
  secondLayer: import_zod.z.enum(["expand", "popup", "modal"]).optional().describe("Where the categories open from an inline banner."),
199
199
  density: import_zod.z.enum(["comfortable", "compact"]).optional().describe("compact = one-row bar from 760px wide."),
200
- theme: import_zod.z.record(import_zod.z.unknown()).optional().describe("Partial ThemeTokens \u2014 deep-merged onto the existing banner theme."),
200
+ theme: import_zod.z.record(import_zod.z.unknown()).optional().describe("Partial ThemeTokens \u2014 deep-merged onto the existing banner theme. Includes `scrollbar`: { style: themed|thin|native|hidden, thumb?, thumbHover?, track?, width? 4\u201316, radius? 0\u2013999 }."),
201
201
  content: import_zod.z.record(import_zod.z.unknown()).optional().describe("Partial BannerContent \u2014 banner copy overrides (title, body, button labels, policyUrl, etc.).")
202
202
  });
203
203
  tool(
@@ -549,9 +549,29 @@ function registerPlatformTools(tool, client) {
549
549
  secretKey: import_zod2.z.string().describe("Its API key, with whatever scope that system needs to export and erase a user."),
550
550
  webhookSecret: import_zod2.z.string().optional().describe("Signing secret of its webhook endpoint. Optional: polling closes tasks without it."),
551
551
  auto: import_zod2.z.boolean().optional().describe("Open a sub-task automatically when a request reaches fulfilment. Default true."),
552
- profile: import_zod2.z.record(import_zod2.z.unknown()).describe("How to drive that system: { open, poll, statuses } required, plus optional subjectLookup, auth, idempotencyHeader and webhook. See the connected-systems docs for the shape.")
552
+ profile: import_zod2.z.record(import_zod2.z.unknown()).describe("How to drive that system: { open, poll, statuses } required, plus optional subjectLookup, auth, idempotencyHeader and webhook. See the connected-systems docs for the shape."),
553
+ dryRun: import_zod2.z.boolean().optional().describe("Validate everything and answer the connection that would be created, storing nothing.")
553
554
  },
554
- (a) => client.fulfillment.connectExecutor(a)
555
+ (a) => {
556
+ const { dryRun, ...input } = a;
557
+ return dryRun === true ? client.fulfillment.dryRunConnectExecutor(input) : client.fulfillment.connectExecutor(input);
558
+ }
559
+ );
560
+ tool(
561
+ "test_dsar_executor_webhook",
562
+ "Would this webhook delivery from a connected system verify? Runs the receiver's exact check (headers, timestamp tolerance, prefix, HMAC) on headers and a raw body you supply, acts on nothing, and returns { verified, stage, reason } naming the stage that failed. `body` must be the raw request body string, byte for byte. Read-only.",
563
+ {
564
+ id: import_zod2.z.string().describe("The connection id."),
565
+ headers: import_zod2.z.record(import_zod2.z.string()).describe("The delivery headers, e.g. its id, timestamp and signature headers."),
566
+ body: import_zod2.z.string().describe("The raw body exactly as it was signed.")
567
+ },
568
+ (a) => client.fulfillment.testExecutorWebhook(a.id, { headers: a.headers, body: a.body })
569
+ );
570
+ tool(
571
+ "list_dsar_executor_webhook_deliveries",
572
+ "The last 50 deliveries to a connected system's webhook, newest first, each with whether it verified and, if not, the stage and reason. Never includes the secret, the signature or the body (only a short hash and size). Read-only.",
573
+ { id: import_zod2.z.string().describe("The connection id.") },
574
+ (a) => client.fulfillment.executorWebhookDeliveries(a.id)
555
575
  );
556
576
  tool(
557
577
  "disconnect_dsar_executor",
@@ -664,10 +684,176 @@ function registerPlatformTools(tool, client) {
664
684
  );
665
685
  }
666
686
 
687
+ // src/tools-rights-page.ts
688
+ var import_zod3 = require("zod");
689
+ function registerRightsTools(tool, client) {
690
+ const cbid = { cbid: import_zod3.z.string().describe("Site identifier (cbid). Must belong to your org.") };
691
+ const base = {
692
+ baseUpdatedAt: import_zod3.z.union([import_zod3.z.number().int(), import_zod3.z.string(), import_zod3.z.null()]).optional().describe("The draft\u2019s updatedAt from your last read (null if it had none). If someone saved since, the write is refused with 409 draft_conflict and the current draft; omit to overwrite regardless.")
693
+ };
694
+ const baseOpt = (a) => a.baseUpdatedAt !== void 0 ? { baseUpdatedAt: a.baseUpdatedAt } : {};
695
+ tool("get_rights_page", "Read the site\u2019s rights page DRAFT (the default page until first saved), with warnings that would block publishing.", cbid, (a) => client.rightsPage.get(a.cbid));
696
+ tool(
697
+ "update_rights_page",
698
+ "Replace the rights page draft with a full document (theme, sections, form, i18n, seo, customCss). Nothing goes live until publish_rights_page. Prefer patch_rights_page for small changes and preview_rights_page when unsure. Pass baseUpdatedAt (from get_rights_page) to avoid overwriting someone else\u2019s save: a mismatch is 409 draft_conflict with the current draft.",
699
+ { ...cbid, page: import_zod3.z.record(import_zod3.z.unknown()).describe("The whole RightsPage document (v: 1)."), ...base },
700
+ (a) => client.rightsPage.put(a.cbid, a.page, baseOpt(a))
701
+ );
702
+ tool(
703
+ "patch_rights_page",
704
+ "Change part of the rights page draft: objects merge, arrays (sections, request types, fields) replace whole, null removes a field. baseUpdatedAt works as on update_rights_page (409 draft_conflict).",
705
+ { ...cbid, patch: import_zod3.z.record(import_zod3.z.unknown()), ...base },
706
+ (a) => client.rightsPage.patch(a.cbid, a.patch, baseOpt(a))
707
+ );
708
+ tool(
709
+ "preview_rights_page",
710
+ 'Validate a rights-page write WITHOUT saving: returns the document as it would be stored and any publish warnings. mode "patch" (default) or "put".',
711
+ { ...cbid, page: import_zod3.z.record(import_zod3.z.unknown()), mode: import_zod3.z.enum(["patch", "put"]).optional() },
712
+ (a) => client.rightsPage.dryRun(a.cbid, a.page, { mode: a.mode ?? "patch" })
713
+ );
714
+ tool("get_published_rights_page", "Read the LIVE rights page document (404 not_published while the site shows the default page).", cbid, (a) => client.rightsPage.getPublished(a.cbid));
715
+ tool(
716
+ "publish_rights_page",
717
+ "Publish the draft as the next version: it goes live at once, to every visitor. Refused unless the page has exactly one form section and an enabled request type. Pass baseUpdatedAt (from get_rights_page) so only the draft you read goes live; without it, whatever the draft holds now is published, including someone else\u2019s later edits. A mismatch is 409 draft_conflict with the current draft.",
718
+ { ...cbid, ...base },
719
+ (a) => client.rightsPage.publish(a.cbid, baseOpt(a))
720
+ );
721
+ tool("list_rights_page_versions", "Published versions of the rights page, newest first, each with publishedBy, publishedByEmail (null for an API key) and publishedVia.", cbid, (a) => client.rightsPage.versions(a.cbid));
722
+ tool(
723
+ "rollback_rights_page",
724
+ "Publish an earlier version of the rights page again (as a new version): it goes live at once and REPLACES the current draft, so unpublished edits are lost and cannot be recovered (versions hold only published documents). Pass baseUpdatedAt (from get_rights_page) to refuse with 409 draft_conflict if anyone saved the draft since you read it.",
725
+ { ...cbid, version: import_zod3.z.number().int().min(1), ...base },
726
+ (a) => client.rightsPage.rollback(a.cbid, a.version, baseOpt(a))
727
+ );
728
+ }
729
+ function registerRightsPageTools(tool, client) {
730
+ const site = import_zod3.z.object({ cbid: import_zod3.z.string().describe("Site identifier (cbid). Must belong to your org.") });
731
+ const host = site.extend({
732
+ hostname: import_zod3.z.string().describe("The custom hostname, e.g. privacy.example.com (unicode or punycode).")
733
+ });
734
+ tool(
735
+ "list_rights_page_domains",
736
+ "List the custom hostnames serving a site's rights page, each with its status (pending_dns, verifying, issuing, active, error), the exact DNS records to create, and the plan's allowance.",
737
+ site.shape,
738
+ (a) => client.rightsPage.listDomains(site.parse(a).cbid)
739
+ );
740
+ tool(
741
+ "add_rights_page_domain",
742
+ "Add a custom hostname for a site's rights page (e.g. privacy.example.com). Returns the DNS records the owner must create: a CNAME to this domain's own <token>.cname.cookiemunch.net (a CNAME to anything else never verifies it), or for an apex / flattened / proxied record the _cookiemunch TXT. Then call verify_rights_page_domain. Plans include Free 0, Starter 1, Pro 5, Scale unlimited.",
743
+ host.shape,
744
+ (a) => {
745
+ const { cbid, hostname } = host.parse(a);
746
+ return client.rightsPage.addDomain(cbid, hostname);
747
+ }
748
+ );
749
+ tool(
750
+ "verify_rights_page_domain",
751
+ "Check a custom hostname now: DNS while it is pending or in error, the HTTPS answer once it is routed. Returns the domain as it now stands; lastError and dnsSeen say what is missing.",
752
+ host.shape,
753
+ (a) => {
754
+ const { cbid, hostname } = host.parse(a);
755
+ return client.rightsPage.verifyDomain(cbid, hostname);
756
+ }
757
+ );
758
+ tool(
759
+ "remove_rights_page_domain",
760
+ "Remove a custom hostname from a site's rights page. It stops being served at once and its certificate is no longer renewed.",
761
+ host.shape,
762
+ async (a) => {
763
+ const { cbid, hostname } = host.parse(a);
764
+ await client.rightsPage.removeDomain(cbid, hostname);
765
+ return { removed: hostname };
766
+ }
767
+ );
768
+ }
769
+
770
+ // src/design-warnings.ts
771
+ function whereText(f) {
772
+ const w = f.where ?? {};
773
+ const bits = [
774
+ f.layer === "banner" ? "first layer" : `${f.layer} layer`,
775
+ w.view ? `view "${w.view}"` : "",
776
+ w.variant && w.variant !== "base" ? `variant ${w.variant}` : "",
777
+ w.theme === "dark" ? "dark theme" : "",
778
+ w.breakpoint === "mobile" ? "mobile" : "",
779
+ w.language ? `language ${w.language}` : "",
780
+ w.url ? w.url : ""
781
+ ].filter(Boolean);
782
+ return bits.join(", ");
783
+ }
784
+ function styleText(s) {
785
+ const parts = [
786
+ s.background ? `background ${s.background}` : "",
787
+ s.color ? `text ${s.color}` : "",
788
+ s.borderColor ? `border ${s.borderWidth ?? 1}px ${s.borderColor}` : "",
789
+ s.fontSize ? `font ${s.fontSize}px` : "",
790
+ s.fontWeight ? `weight ${s.fontWeight}` : "",
791
+ s.width && s.height ? `${Math.round(s.width)}\xD7${Math.round(s.height)}px` : ""
792
+ ].filter(Boolean);
793
+ return parts.join(", ");
794
+ }
795
+ var CONTEXT_TEXT = {
796
+ saved: "The config was saved as sent; this is a warning, not an error.",
797
+ preview: "Nothing was saved: this is a preview of the write.",
798
+ lint: "Nothing was saved: this is a lint of a proposed config.",
799
+ read: "This describes the config as it is stored now; nothing was changed.",
800
+ scan: "This was measured on the live site by the last cookie scan; fix the banner, then scan again."
801
+ };
802
+ function designContext(tool, value) {
803
+ const v = value && typeof value === "object" ? value : {};
804
+ if (tool === "lint_banner_config") return "lint";
805
+ if (v.dryRun === true || tool.startsWith("preview_")) return "preview";
806
+ if (v.buttonParity && typeof v.buttonParity === "object") return "scan";
807
+ if (/^(update|patch|set|edit|create|assign|apply)_/.test(tool)) return "saved";
808
+ return "read";
809
+ }
810
+ function designWarningText(findings, suggested, context = "read") {
811
+ if (!Array.isArray(findings) || findings.length === 0) return "";
812
+ const warnings = findings.filter((f) => f.severity === "warning");
813
+ const notices = findings.filter((f) => f.severity !== "warning");
814
+ const lines = [];
815
+ if (warnings.length) {
816
+ lines.push(
817
+ `Design warning: the Accept button is more prominent than Reject (${warnings.length} issue${warnings.length === 1 ? "" : "s"}). Regulators treat this as a dark pattern (EDPB Guidelines 03/2022, the EDPB cookie banner taskforce, CNIL). Make both buttons the same style. ${CONTEXT_TEXT[context]}`
818
+ );
819
+ for (const f of warnings) lines.push(`- [${f.code}] (${whereText(f)}) ${f.detail} Fix: ${f.fix}`);
820
+ }
821
+ if (notices.length) {
822
+ lines.push(
823
+ `Design notice: ${notices.length} thing${notices.length === 1 ? "" : "s"} to check about how Reject compares with Accept.` + (warnings.length ? "" : ` ${CONTEXT_TEXT[context]}`)
824
+ );
825
+ for (const f of notices) lines.push(`- [${f.code}] (${whereText(f)}) ${f.detail} Fix: ${f.fix}`);
826
+ }
827
+ const fixes = suggested && suggested.length ? suggested : findings.filter((f) => f.accept && f.reject).slice(0, 1).map((f) => ({ ...f.accept, layer: f.layer, view: f.where?.view }));
828
+ for (const s of fixes) {
829
+ const style = styleText(s);
830
+ if (style) {
831
+ lines.push(
832
+ `Suggested fix: style Reject all${s.view ? ` in view "${s.view}"` : ""} with ${style} \u2014 the same as Accept all. In a flow design, give the Reject button the same \`variant\` and size as the Accept button.`
833
+ );
834
+ }
835
+ }
836
+ return lines.join("\n");
837
+ }
838
+ function withDesignWarnings(value, body, tool = "") {
839
+ if (!value || typeof value !== "object") return body;
840
+ const nested = value.buttonParity;
841
+ const v = nested && typeof nested === "object" ? nested : value;
842
+ if (!Array.isArray(v.designWarnings) || v.designWarnings.length === 0) return body;
843
+ const head = designWarningText(
844
+ v.designWarnings,
845
+ Array.isArray(v.suggestedReject) ? v.suggestedReject : void 0,
846
+ designContext(tool, value)
847
+ );
848
+ return head ? `${head}
849
+
850
+ ${body}` : body;
851
+ }
852
+
667
853
  // src/tools.ts
668
- function text(value) {
854
+ function text(value, tool = "") {
669
855
  const body = typeof value === "string" ? value : JSON.stringify(value, null, 2);
670
- return { content: [{ type: "text", text: body }] };
856
+ return { content: [{ type: "text", text: withDesignWarnings(value, body, tool) }] };
671
857
  }
672
858
  function fail(err) {
673
859
  const message = err instanceof Error ? err.message : String(err);
@@ -677,16 +863,16 @@ function registerTools(server, client) {
677
863
  const tool = (name, description, inputSchema, run) => {
678
864
  server.registerTool(name, { description, inputSchema }, async (args) => {
679
865
  try {
680
- return text(await run(args));
866
+ return text(await run(args), name);
681
867
  } catch (err) {
682
868
  return fail(err);
683
869
  }
684
870
  });
685
871
  };
686
- const cbid = { cbid: import_zod3.z.string().describe("Site identifier (cbid). Must belong to your org.") };
872
+ const cbid = { cbid: import_zod4.z.string().describe("Site identifier (cbid). Must belong to your org.") };
687
873
  const range = {
688
- from: import_zod3.z.number().optional().describe("Epoch-ms lower bound."),
689
- to: import_zod3.z.number().optional().describe("Epoch-ms upper bound.")
874
+ from: import_zod4.z.number().optional().describe("Epoch-ms lower bound."),
875
+ to: import_zod4.z.number().optional().describe("Epoch-ms upper bound.")
690
876
  };
691
877
  tool(
692
878
  "whoami",
@@ -704,19 +890,19 @@ function registerTools(server, client) {
704
890
  tool(
705
891
  "get_site",
706
892
  "One site: its domain, cbid and verification status. Read-only.",
707
- { cbid: import_zod3.z.string() },
893
+ { cbid: import_zod4.z.string() },
708
894
  (a) => client.sites.get(a.cbid)
709
895
  );
710
896
  tool(
711
897
  "get_site_banner",
712
898
  "Which banner design a site uses, or bannerId null when none is assigned. Read-only.",
713
- { cbid: import_zod3.z.string() },
899
+ { cbid: import_zod4.z.string() },
714
900
  (a) => client.sites.banner(a.cbid)
715
901
  );
716
902
  tool(
717
903
  "get_privacy_policy",
718
904
  "Generate the site's privacy and cookie policy as Markdown, naming the org's data controller. Needs a contact email: the one given, else the org controller's, else the owner's. Read-only \u2014 nothing is published.",
719
- { cbid: import_zod3.z.string(), contactEmail: import_zod3.z.string().optional(), effectiveDate: import_zod3.z.string().optional().describe("YYYY-MM-DD; defaults to today."), jurisdictions: import_zod3.z.array(import_zod3.z.string()).optional() },
905
+ { cbid: import_zod4.z.string(), contactEmail: import_zod4.z.string().optional(), effectiveDate: import_zod4.z.string().optional().describe("YYYY-MM-DD; defaults to today."), jurisdictions: import_zod4.z.array(import_zod4.z.string()).optional() },
720
906
  (a) => client.sites.policy(a.cbid, {
721
907
  ...a.contactEmail ? { contactEmail: a.contactEmail } : {},
722
908
  ...a.effectiveDate ? { effectiveDate: a.effectiveDate } : {},
@@ -726,7 +912,7 @@ function registerTools(server, client) {
726
912
  tool(
727
913
  "set_ad_personalization",
728
914
  "Add or remove the separate 'personalised ads' choice on the site's live banner. With it on, accepting marketing no longer implies personalised ads unless `default` is true.",
729
- { cbid: import_zod3.z.string(), enabled: import_zod3.z.boolean(), default: import_zod3.z.boolean().optional(), label: import_zod3.z.string().optional() },
915
+ { cbid: import_zod4.z.string(), enabled: import_zod4.z.boolean(), default: import_zod4.z.boolean().optional(), label: import_zod4.z.string().optional() },
730
916
  (a) => client.sites.setAdPersonalization(a.cbid, {
731
917
  enabled: a.enabled,
732
918
  ...a.default !== void 0 ? { default: a.default } : {},
@@ -737,11 +923,11 @@ function registerTools(server, client) {
737
923
  "analyze_session",
738
924
  "Analyse a captured browsing session against the consent it ran under: which trackers fired after the visitor opted out, and what personal data left the page. Read-only.",
739
925
  {
740
- cbid: import_zod3.z.string(),
741
- har: import_zod3.z.unknown().optional().describe("A HAR export of the session."),
742
- requests: import_zod3.z.array(import_zod3.z.unknown()).optional().describe("Or the requests directly."),
743
- consent: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.boolean()).optional(),
744
- gpc: import_zod3.z.boolean().optional()
926
+ cbid: import_zod4.z.string(),
927
+ har: import_zod4.z.unknown().optional().describe("A HAR export of the session."),
928
+ requests: import_zod4.z.array(import_zod4.z.unknown()).optional().describe("Or the requests directly."),
929
+ consent: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.boolean()).optional(),
930
+ gpc: import_zod4.z.boolean().optional()
745
931
  },
746
932
  (a) => client.sites.analyzeSession(a.cbid, {
747
933
  ...a.har !== void 0 ? { har: a.har } : {},
@@ -753,14 +939,14 @@ function registerTools(server, client) {
753
939
  tool(
754
940
  "create_site",
755
941
  "Create a new site. The cbid is auto-generated if you omit it.",
756
- { domain: import_zod3.z.string().describe("The site domain, e.g. example.com."), cbid: import_zod3.z.string().optional().describe("Optional explicit cbid.") },
942
+ { domain: import_zod4.z.string().describe("The site domain, e.g. example.com."), cbid: import_zod4.z.string().optional().describe("Optional explicit cbid.") },
757
943
  (a) => client.sites.create({ domain: a.domain, ...typeof a.cbid === "string" ? { cbid: a.cbid } : {} })
758
944
  );
759
945
  tool(
760
946
  "create_sites_bulk",
761
947
  "Create up to 100 sites in one call. Partial success: each item reports ok or its own error, and a bad or duplicate item fails only itself.",
762
948
  {
763
- sites: import_zod3.z.array(import_zod3.z.object({ domain: import_zod3.z.string(), cbid: import_zod3.z.string().optional(), platform: import_zod3.z.string().optional() })).min(1).max(100)
949
+ sites: import_zod4.z.array(import_zod4.z.object({ domain: import_zod4.z.string(), cbid: import_zod4.z.string().optional(), platform: import_zod4.z.string().optional() })).min(1).max(100)
764
950
  },
765
951
  (a) => client.sites.createBulk(a.sites)
766
952
  );
@@ -770,15 +956,15 @@ function registerTools(server, client) {
770
956
  "Replace (overwrite) the banner/consent configuration for a site via PUT. This is destructive, not a merge: any top-level SiteConfig field you omit from `config` reverts to its default rather than keeping its current value \u2014 unless keepUnspecified is true, in which case omitted top-level fields keep their stored value and only the fields you send are replaced (each whole). A top-level field sent as null reverts to its default. To change one setting, use patch_site_config instead \u2014 it merges server-side. Prefer the narrower set_* tools (set_blocking, set_banner_basics, etc.) when they cover your change.",
771
957
  {
772
958
  ...cbid,
773
- config: import_zod3.z.record(import_zod3.z.unknown()).describe("The full SiteConfig to write, not a patch. Without keepUnspecified, omitted top-level fields are NOT preserved from the current config."),
774
- keepUnspecified: import_zod3.z.boolean().optional().describe("PUT ?keep=unspecified: keep the stored value of every top-level field `config` omits, instead of reverting it to its default.")
959
+ config: import_zod4.z.record(import_zod4.z.unknown()).describe("The full SiteConfig to write, not a patch. Without keepUnspecified, omitted top-level fields are NOT preserved from the current config."),
960
+ keepUnspecified: import_zod4.z.boolean().optional().describe("PUT ?keep=unspecified: keep the stored value of every top-level field `config` omits, instead of reverting it to its default.")
775
961
  },
776
962
  (a) => a.keepUnspecified === true ? client.sites.putConfig(a.cbid, a.config, { keep: "unspecified" }) : client.sites.putConfig(a.cbid, a.config)
777
963
  );
778
964
  tool(
779
965
  "patch_site_config",
780
966
  `Change part of a site's banner/consent configuration. The patch is a JSON Merge Patch (RFC 7386) over the stored config server-side: any field you omit keeps its current value, and a field set to null is REMOVED (it falls back to its default) \u2014 e.g. { "banner": { "i18n": { "es": null } } } drops the Spanish override. This is the safe way to flip one setting, and it needs no read-modify-write. Use update_site_config only when you genuinely mean to replace the whole document.`,
781
- { ...cbid, config: import_zod3.z.record(import_zod3.z.unknown()).describe('The subset of SiteConfig to change, e.g. { "banner": { "showRightsLink": true } }. Everything else is preserved; null removes a field.') },
967
+ { ...cbid, config: import_zod4.z.record(import_zod4.z.unknown()).describe('The subset of SiteConfig to change, e.g. { "banner": { "showRightsLink": true } }. Everything else is preserved; null removes a field.') },
782
968
  (a) => client.sites.patchConfig(a.cbid, a.config)
783
969
  );
784
970
  tool(
@@ -786,15 +972,30 @@ function registerTools(server, client) {
786
972
  'Preview a config change WITHOUT saving it: returns the config as it would be saved, a diff of every field that would change, and any warnings (plan-gated or unrecognised fields). mode "patch" (default) previews patch_site_config; mode "put" previews update_site_config, and its diff lists everything a replace would revert to its default (unless keepUnspecified is true). Use it before any write you are not sure of.',
787
973
  {
788
974
  ...cbid,
789
- config: import_zod3.z.record(import_zod3.z.unknown()).describe('The patch (or, with mode "put", the full config) to preview.'),
790
- mode: import_zod3.z.enum(["patch", "put"]).optional().describe("patch (default) merges; put replaces."),
791
- keepUnspecified: import_zod3.z.boolean().optional().describe('With mode "put": preview update_site_config with keepUnspecified (omitted top-level fields keep their stored value).')
975
+ config: import_zod4.z.record(import_zod4.z.unknown()).describe('The patch (or, with mode "put", the full config) to preview.'),
976
+ mode: import_zod4.z.enum(["patch", "put"]).optional().describe("patch (default) merges; put replaces."),
977
+ keepUnspecified: import_zod4.z.boolean().optional().describe('With mode "put": preview update_site_config with keepUnspecified (omitted top-level fields keep their stored value).')
792
978
  },
793
979
  (a) => client.sites.dryRunConfig(a.cbid, a.config, {
794
980
  mode: a.mode ?? "patch",
795
981
  ...a.keepUnspecified === true ? { keep: "unspecified" } : {}
796
982
  })
797
983
  );
984
+ tool(
985
+ "lint_banner_config",
986
+ 'Check a banner config for consent-button parity WITHOUT saving it: is "Accept all" more prominent than "Reject all" anywhere \u2014 a brighter or more saturated colour, a bigger or bolder button, Reject styled as a link, hidden, below the fold, set apart, missing from the first layer, or worded to guilt-trip? Regulators (EDPB, CNIL) treat that as a dark pattern. Returns findings, a 0\u2013100 score and the reject style that would match Accept. It checks exactly what the write would store: merged over the stored config as patch_site_config would, or with replace: true replaced as update_site_config would. Run it before writing any banner design.',
987
+ {
988
+ ...cbid,
989
+ config: import_zod4.z.record(import_zod4.z.unknown()).describe("The proposed SiteConfig (or a partial one, or a v2 flow design)."),
990
+ replace: import_zod4.z.boolean().optional().describe("Check what update_site_config (a full replace) would store, instead of what patch_site_config (a merge) would.")
991
+ },
992
+ async (a) => {
993
+ const r = await client.sites.lintConfig(a.cbid, a.config, a.replace === true ? { replace: true } : {});
994
+ return r.designWarnings.length === 0 ? `No design warnings: Accept all and Reject all have equal weight on every surface checked (score ${r.score}). Nothing was saved.
995
+
996
+ ${JSON.stringify(r, null, 2)}` : r;
997
+ }
998
+ );
798
999
  tool(
799
1000
  "verify_consent_log",
800
1001
  "Verify a site's consent log has not been tampered with. Each record carries the hash of the one before it, so an edited, reordered or deleted record breaks the chain and this returns valid: false. This is the evidence behind a consent log \u2014 what you check when someone asks whether the record can be trusted, not just what it says.",
@@ -810,7 +1011,7 @@ function registerTools(server, client) {
810
1011
  tool(
811
1012
  "get_consent_log",
812
1013
  "Get recent anonymised consent records for a site.",
813
- { ...cbid, ...range, limit: import_zod3.z.number().optional().describe("Max records to return (default 200).") },
1014
+ { ...cbid, ...range, limit: import_zod4.z.number().optional().describe("Max records to return (default 200).") },
814
1015
  (a) => client.consent.log(a.cbid, {
815
1016
  from: a.from,
816
1017
  to: a.to,
@@ -820,49 +1021,53 @@ function registerTools(server, client) {
820
1021
  tool(
821
1022
  "get_subject_consent",
822
1023
  "One person's consent records across every site in the org \u2014 web, mobile and desktop \u2014 by the subjectId your apps attach. Consent data: needs the consent:read scope. Read-only.",
823
- { subjectId: import_zod3.z.string() },
1024
+ { subjectId: import_zod4.z.string() },
824
1025
  (a) => client.subjects.consent(a.subjectId)
825
1026
  );
826
1027
  tool("list_dsar", "List all Data Subject Access Requests for your organization.", {}, () => client.dsar.list());
827
1028
  tool(
828
1029
  "update_dsar_executor",
829
- "Change a connected system in place \u2014 its profile, address, credential or auto flag. Only what you pass changes; the stored credential is kept unless you give a new one.",
830
- { id: import_zod3.z.string(), patch: import_zod3.z.record(import_zod3.z.unknown()) },
831
- (a) => client.fulfillment.updateExecutor(a.id, a.patch)
1030
+ "Change a connected system in place \u2014 its profile, address, credential or auto flag. Only what you pass changes; the stored credential is kept unless you give a new one. With dryRun, answers the connection as it would be and a diff, and changes nothing.",
1031
+ {
1032
+ id: import_zod4.z.string(),
1033
+ patch: import_zod4.z.record(import_zod4.z.unknown()),
1034
+ dryRun: import_zod4.z.boolean().optional().describe("Validate and diff without saving.")
1035
+ },
1036
+ (a) => a.dryRun === true ? client.fulfillment.dryRunUpdateExecutor(a.id, a.patch) : client.fulfillment.updateExecutor(a.id, a.patch)
832
1037
  );
833
1038
  tool(
834
1039
  "get_dsar",
835
1040
  "One rights request by id, including its status and the deadline it must be answered by.",
836
- { id: import_zod3.z.string() },
1041
+ { id: import_zod4.z.string() },
837
1042
  (a) => client.dsar.get(a.id)
838
1043
  );
839
1044
  tool(
840
1045
  "erase_dsar_subject",
841
1046
  "For a deletion request that is past identity verification: erase the person\u2019s consent records on one site, identified by their consent stamp. Irreversible. The erasure is noted on the request. If the response carries a warning, nothing was cryptographically erased \u2014 tell the user.",
842
- { id: import_zod3.z.string(), cbid: import_zod3.z.string(), stamp: import_zod3.z.string() },
1047
+ { id: import_zod4.z.string(), cbid: import_zod4.z.string(), stamp: import_zod4.z.string() },
843
1048
  (a) => client.dsar.erase(a.id, a.cbid, a.stamp)
844
1049
  );
845
1050
  tool(
846
1051
  "export_dsar_subject",
847
1052
  "For an access or portability request that is past identity verification: the person\u2019s consent records on one site, identified by their consent stamp. The export is noted on the request.",
848
- { id: import_zod3.z.string(), cbid: import_zod3.z.string(), stamp: import_zod3.z.string() },
1053
+ { id: import_zod4.z.string(), cbid: import_zod4.z.string(), stamp: import_zod4.z.string() },
849
1054
  (a) => client.dsar.export(a.id, a.cbid, a.stamp)
850
1055
  );
851
1056
  tool(
852
1057
  "get_dsar_response_notice",
853
1058
  "The subject-facing response notice for a request, as plain text \u2014 what to send the person. Read-only; nothing is sent.",
854
- { id: import_zod3.z.string() },
1059
+ { id: import_zod4.z.string() },
855
1060
  (a) => client.dsar.response(a.id)
856
1061
  );
857
1062
  tool(
858
1063
  "create_dsar",
859
1064
  "Open a new Data Subject Access Request.",
860
1065
  {
861
- type: import_zod3.z.enum(["access", "deletion", "rectification", "portability", "opt-out"]).describe("DSAR right being exercised."),
862
- subjectEmail: import_zod3.z.string().describe("The data subject\u2019s email."),
863
- regulation: import_zod3.z.enum(["gdpr", "ccpa"]).describe("Governing regulation."),
864
- note: import_zod3.z.string().optional().describe("Optional free-text note."),
865
- test: import_zod3.z.boolean().optional().describe("Mark it as a test request: kept off the SLA board and deletable afterwards with delete_test_dsar.")
1066
+ type: import_zod4.z.enum(["access", "deletion", "rectification", "portability", "opt-out"]).describe("DSAR right being exercised."),
1067
+ subjectEmail: import_zod4.z.string().describe("The data subject\u2019s email."),
1068
+ regulation: import_zod4.z.enum(["gdpr", "ccpa"]).describe("Governing regulation."),
1069
+ note: import_zod4.z.string().optional().describe("Optional free-text note."),
1070
+ test: import_zod4.z.boolean().optional().describe("Mark it as a test request: kept off the SLA board and deletable afterwards with delete_test_dsar.")
866
1071
  },
867
1072
  (a) => client.dsar.create({
868
1073
  type: a.type,
@@ -872,10 +1077,26 @@ function registerTools(server, client) {
872
1077
  ...a.test === true ? { test: true } : {}
873
1078
  })
874
1079
  );
1080
+ tool(
1081
+ "create_rights_link",
1082
+ "Mint a signed, single-use link to a site\u2019s hosted rights page for a person you know is signed in to that site. On the page their email is filled in and locked and the email-code step is skipped; the filed request is recorded as verified by their account. Give the link only to that person. Expires in 15 minutes by default (max 1 hour). Needs dsar:write.",
1083
+ {
1084
+ cbid: import_zod4.z.string().describe("Site identifier (cbid). Must belong to your org."),
1085
+ email: import_zod4.z.string().describe("The signed-in person\u2019s verified email address."),
1086
+ userId: import_zod4.z.string().optional().describe("Your own account id for them; recorded on the request."),
1087
+ rights: import_zod4.z.array(import_zod4.z.enum(["access", "erasure", "rectification", "portability", "restriction", "objection", "opt_out_sale", "opt_out_targeted", "limit_sensitive"])).min(1).optional().describe("Limit the link to these rights. Default: every right the page offers."),
1088
+ ttlSeconds: import_zod4.z.number().int().min(60).max(3600).optional().describe("How long the link works, in seconds (default 900).")
1089
+ },
1090
+ (a) => client.rightsLinks.create(a.cbid, {
1091
+ subject: { email: a.email, ...typeof a.userId === "string" ? { userId: a.userId } : {} },
1092
+ ...Array.isArray(a.rights) ? { rights: a.rights } : {},
1093
+ ...typeof a.ttlSeconds === "number" ? { ttlSeconds: a.ttlSeconds } : {}
1094
+ })
1095
+ );
875
1096
  tool(
876
1097
  "delete_test_dsar",
877
1098
  "Delete a TEST rights request (one created with test: true), with its tasks and their upstream log. Real requests cannot be deleted and are refused. The deletion is recorded in the audit log.",
878
- { id: import_zod3.z.string().describe("The test request id.") },
1099
+ { id: import_zod4.z.string().describe("The test request id.") },
879
1100
  async (a) => {
880
1101
  await client.dsar.delete(a.id);
881
1102
  return { deleted: a.id };
@@ -884,15 +1105,15 @@ function registerTools(server, client) {
884
1105
  tool(
885
1106
  "mark_dsar_test",
886
1107
  "Mark a CLOSED rights request (completed or rejected) as a test request, after the fact \u2014 for trial requests filed before test: true existed. An open request is refused (request_not_closed), so a live obligation can never be relabelled. Recorded in the audit log; afterwards delete_test_dsar can remove it. Returns { request, changed }.",
887
- { id: import_zod3.z.string().describe("The closed request id.") },
1108
+ { id: import_zod4.z.string().describe("The closed request id.") },
888
1109
  (a) => client.dsar.markTest(a.id)
889
1110
  );
890
1111
  tool(
891
1112
  "advance_dsar",
892
1113
  "Advance a DSAR to a new status (received \u2192 verifying \u2192 in_progress \u2192 completed, or rejected).",
893
1114
  {
894
- id: import_zod3.z.string().describe("The DSAR id."),
895
- toStatus: import_zod3.z.enum(["received", "verifying", "in_progress", "completed", "rejected"]).describe("Target status.")
1115
+ id: import_zod4.z.string().describe("The DSAR id."),
1116
+ toStatus: import_zod4.z.enum(["received", "verifying", "in_progress", "completed", "rejected"]).describe("Target status.")
896
1117
  },
897
1118
  (a) => client.dsar.advance(a.id, a.toStatus)
898
1119
  );
@@ -905,7 +1126,7 @@ function registerTools(server, client) {
905
1126
  tool(
906
1127
  "get_receipt",
907
1128
  "Fetch the signed consent receipt for a single consent record (by stamp).",
908
- { ...cbid, stamp: import_zod3.z.string().describe("The consent record stamp/id.") },
1129
+ { ...cbid, stamp: import_zod4.z.string().describe("The consent record stamp/id.") },
909
1130
  (a) => client.consent.receipt(a.cbid, a.stamp)
910
1131
  );
911
1132
  tool("delete_site", "Delete a site (cbid) and its configuration from your org.", { ...cbid }, async (a) => {
@@ -917,13 +1138,13 @@ function registerTools(server, client) {
917
1138
  "create_vendor",
918
1139
  "Register a vendor (processor) and compute its risk score.",
919
1140
  {
920
- name: import_zod3.z.string().describe("Vendor name."),
921
- category: import_zod3.z.string().describe("Vendor category, e.g. analytics."),
922
- dataShared: import_zod3.z.array(import_zod3.z.string()).describe("Categories of data shared with the vendor."),
923
- dpaSigned: import_zod3.z.boolean().describe("Whether a Data Processing Agreement is signed."),
924
- subprocessors: import_zod3.z.number().describe("Number of subprocessors."),
925
- certifications: import_zod3.z.array(import_zod3.z.string()).describe("Compliance certifications, e.g. ISO27001."),
926
- region: import_zod3.z.string().describe("Primary processing region, e.g. EU.")
1141
+ name: import_zod4.z.string().describe("Vendor name."),
1142
+ category: import_zod4.z.string().describe("Vendor category, e.g. analytics."),
1143
+ dataShared: import_zod4.z.array(import_zod4.z.string()).describe("Categories of data shared with the vendor."),
1144
+ dpaSigned: import_zod4.z.boolean().describe("Whether a Data Processing Agreement is signed."),
1145
+ subprocessors: import_zod4.z.number().describe("Number of subprocessors."),
1146
+ certifications: import_zod4.z.array(import_zod4.z.string()).describe("Compliance certifications, e.g. ISO27001."),
1147
+ region: import_zod4.z.string().describe("Primary processing region, e.g. EU.")
927
1148
  },
928
1149
  (a) => client.vendors.create({
929
1150
  name: a.name,
@@ -941,13 +1162,13 @@ function registerTools(server, client) {
941
1162
  "create_ropa",
942
1163
  "Create a Record of Processing Activity (RoPA) entry.",
943
1164
  {
944
- name: import_zod3.z.string().describe("Activity name."),
945
- purpose: import_zod3.z.string().describe("Purpose of processing."),
946
- legalBasis: import_zod3.z.enum(["consent", "contract", "legal-obligation", "vital-interests", "public-task", "legitimate-interests"]).describe("GDPR legal basis."),
947
- dataCategories: import_zod3.z.array(import_zod3.z.string()).describe("Categories of personal data."),
948
- recipients: import_zod3.z.array(import_zod3.z.string()).describe("Recipients of the data."),
949
- retentionDays: import_zod3.z.number().describe("Retention period in days."),
950
- crossBorderTransfer: import_zod3.z.boolean().describe("Whether data is transferred across borders.")
1165
+ name: import_zod4.z.string().describe("Activity name."),
1166
+ purpose: import_zod4.z.string().describe("Purpose of processing."),
1167
+ legalBasis: import_zod4.z.enum(["consent", "contract", "legal-obligation", "vital-interests", "public-task", "legitimate-interests"]).describe("GDPR legal basis."),
1168
+ dataCategories: import_zod4.z.array(import_zod4.z.string()).describe("Categories of personal data."),
1169
+ recipients: import_zod4.z.array(import_zod4.z.string()).describe("Recipients of the data."),
1170
+ retentionDays: import_zod4.z.number().describe("Retention period in days."),
1171
+ crossBorderTransfer: import_zod4.z.boolean().describe("Whether data is transferred across borders.")
951
1172
  },
952
1173
  (a) => client.ropa.create({
953
1174
  name: a.name,
@@ -967,15 +1188,23 @@ function registerTools(server, client) {
967
1188
  );
968
1189
  tool(
969
1190
  "scan_site",
970
- "Trigger a cookie scan for a site. Returns the scan job state.",
971
- { ...cbid },
972
- (a) => client.sites.scan(a.cbid)
1191
+ "Trigger a cookie crawl of a site (at most 90 s). Returns its scanId and state (queued). With wait: true, returns once it is done or failed \u2014 state, cookieCount, pagesVisited, durationMs, error. The stored list keeps cookies earlier crawls and real visits found; retire one the site no longer sets.",
1192
+ { ...cbid, wait: import_zod4.z.boolean().optional().describe("Wait for the scan to finish (up to 100 s) and return its outcome.") },
1193
+ async (a) => {
1194
+ let started;
1195
+ try {
1196
+ started = await client.sites.scan(a.cbid);
1197
+ } catch (err) {
1198
+ if (!a.wait || err.status !== 409) throw err;
1199
+ }
1200
+ return a.wait ? client.sites.waitForScan(a.cbid, { timeoutMs: 1e5 }) : started;
1201
+ }
973
1202
  );
974
1203
  tool(
975
1204
  "get_scan_status",
976
- "Get the status/result of a site\u2019s most recent cookie scan.",
977
- { ...cbid },
978
- (a) => client.sites.scanStatus(a.cbid)
1205
+ "Get a site\u2019s last cookie scan: state (queued, scanning, done, failed), scanId, durationMs, cookieCount, pagesVisited and error when it failed.",
1206
+ { ...cbid, wait: import_zod4.z.number().min(0).max(60).optional().describe("Seconds (\u226460) to wait for a running scan to settle before answering.") },
1207
+ (a) => a.wait !== void 0 ? client.sites.scanStatus(a.cbid, { wait: a.wait }) : client.sites.scanStatus(a.cbid)
979
1208
  );
980
1209
  tool(
981
1210
  "get_ab_results",
@@ -993,9 +1222,9 @@ function registerTools(server, client) {
993
1222
  "create_webhook",
994
1223
  "Create a webhook subscription. The response includes the signing secret (shown once).",
995
1224
  {
996
- url: import_zod3.z.string().describe("HTTPS endpoint to deliver events to."),
997
- events: import_zod3.z.array(import_zod3.z.string()).describe("Event names to subscribe to, e.g. consent.created."),
998
- cbid: import_zod3.z.string().optional().describe("Optional site cbid to scope the subscription to.")
1225
+ url: import_zod4.z.string().describe("HTTPS endpoint to deliver events to."),
1226
+ events: import_zod4.z.array(import_zod4.z.string()).describe("Event names to subscribe to, e.g. consent.created."),
1227
+ cbid: import_zod4.z.string().optional().describe("Optional site cbid to scope the subscription to.")
999
1228
  },
1000
1229
  (a) => client.webhooks.create({
1001
1230
  url: a.url,
@@ -1006,13 +1235,13 @@ function registerTools(server, client) {
1006
1235
  tool(
1007
1236
  "roll_webhook_secret",
1008
1237
  "Rotate a webhook subscription\u2019s signing secret. The new secret is returned once; the receiving endpoint must be updated to verify with it.",
1009
- { id: import_zod3.z.string() },
1238
+ { id: import_zod4.z.string() },
1010
1239
  (a) => client.webhooks.rollSecret(a.id)
1011
1240
  );
1012
1241
  tool(
1013
1242
  "test_webhook",
1014
1243
  "Send a signed test event to a webhook subscription now, and report what the endpoint answered.",
1015
- { id: import_zod3.z.string() },
1244
+ { id: import_zod4.z.string() },
1016
1245
  (a) => client.webhooks.test(a.id)
1017
1246
  );
1018
1247
  tool(
@@ -1024,18 +1253,18 @@ function registerTools(server, client) {
1024
1253
  tool(
1025
1254
  "replay_webhook_dead_letter",
1026
1255
  "Deliver a dead-lettered webhook event again, to the subscription as it is now.",
1027
- { id: import_zod3.z.string() },
1256
+ { id: import_zod4.z.string() },
1028
1257
  (a) => client.webhooks.replayDeadLetter(a.id)
1029
1258
  );
1030
1259
  tool(
1031
1260
  "update_webhook",
1032
1261
  "Change a webhook subscription, or pause it with active:false (delivery stops; the subscription is kept). Only the fields given change. cbid: null widens it to every property in the org.",
1033
1262
  {
1034
- id: import_zod3.z.string(),
1035
- url: import_zod3.z.string().optional(),
1036
- events: import_zod3.z.array(import_zod3.z.string()).optional(),
1037
- cbid: import_zod3.z.string().nullable().optional(),
1038
- active: import_zod3.z.boolean().optional()
1263
+ id: import_zod4.z.string(),
1264
+ url: import_zod4.z.string().optional(),
1265
+ events: import_zod4.z.array(import_zod4.z.string()).optional(),
1266
+ cbid: import_zod4.z.string().nullable().optional(),
1267
+ active: import_zod4.z.boolean().optional()
1039
1268
  },
1040
1269
  (a) => client.webhooks.update(a.id, {
1041
1270
  ...a.url !== void 0 ? { url: a.url } : {},
@@ -1044,20 +1273,20 @@ function registerTools(server, client) {
1044
1273
  ...a.active !== void 0 ? { active: a.active } : {}
1045
1274
  })
1046
1275
  );
1047
- tool("delete_webhook", "Delete a webhook subscription by id.", { id: import_zod3.z.string().describe("The webhook subscription id.") }, async (a) => {
1276
+ tool("delete_webhook", "Delete a webhook subscription by id.", { id: import_zod4.z.string().describe("The webhook subscription id.") }, async (a) => {
1048
1277
  await client.webhooks.delete(a.id);
1049
1278
  return { ok: true };
1050
1279
  });
1051
1280
  tool(
1052
1281
  "verify_site",
1053
1282
  "Verify that your organization controls a domain by one of three challenge methods (dns / meta / file). Required to unlock consent export and signed receipts.",
1054
- { ...cbid, method: import_zod3.z.enum(["dns", "meta", "file"]).describe("Challenge method: dns (TXT record), meta (HTML tag), or file (/.well-known/cookiemunch-verify.txt).") },
1283
+ { ...cbid, method: import_zod4.z.enum(["dns", "meta", "file"]).describe("Challenge method: dns (TXT record), meta (HTML tag), or file (/.well-known/cookiemunch-verify.txt).") },
1055
1284
  (a) => client.sites.verify(a.cbid, a.method)
1056
1285
  );
1057
1286
  tool(
1058
1287
  "get_verification_challenge",
1059
1288
  "Exactly what to publish to prove control of a site\u2019s domain: the DNS TXT record, the meta tag, the file, or installing the embed. Read-only \u2014 publish one, then call verify_site.",
1060
- { cbid: import_zod3.z.string() },
1289
+ { cbid: import_zod4.z.string() },
1061
1290
  (a) => client.sites.verifyChallenge(a.cbid)
1062
1291
  );
1063
1292
  tool(
@@ -1069,15 +1298,15 @@ function registerTools(server, client) {
1069
1298
  tool(
1070
1299
  "get_flow",
1071
1300
  "Get the v2 banner flow config for a site, including current views, categories, and any lint issues.",
1072
- { cbid: import_zod3.z.string().describe("Site identifier (cbid).") },
1301
+ { cbid: import_zod4.z.string().describe("Site identifier (cbid).") },
1073
1302
  (a) => client.sites.getFlow(a.cbid)
1074
1303
  );
1075
1304
  tool(
1076
1305
  "edit_flow",
1077
1306
  "Apply a batch of structured edit operations to a site's v2 banner flow. All ops are validated server-side and the final config must be lint-clean before it is saved.",
1078
1307
  {
1079
- cbid: import_zod3.z.string().describe("Site identifier (cbid)."),
1080
- operations: import_zod3.z.array(import_zod3.z.record(import_zod3.z.unknown())).describe(
1308
+ cbid: import_zod4.z.string().describe("Site identifier (cbid)."),
1309
+ operations: import_zod4.z.array(import_zod4.z.record(import_zod4.z.unknown())).describe(
1081
1310
  'Ordered list of ops. Each must have an "op" field: addView | removeView | addElement | setButtonTransition | addCustomCategory.'
1082
1311
  )
1083
1312
  },
@@ -1087,19 +1316,21 @@ function registerTools(server, client) {
1087
1316
  "set_flow",
1088
1317
  "Wholesale replace a site's v2 banner flow with a complete config (e.g. from a template). Validated server-side before it is saved.",
1089
1318
  {
1090
- cbid: import_zod3.z.string().describe("Site identifier (cbid)."),
1091
- config: import_zod3.z.record(import_zod3.z.unknown()).describe("A full v2 FlowConfig object ({ v:2, flow, categories, ... }).")
1319
+ cbid: import_zod4.z.string().describe("Site identifier (cbid)."),
1320
+ config: import_zod4.z.record(import_zod4.z.unknown()).describe("A full v2 FlowConfig object ({ v:2, flow, categories, ... }).")
1092
1321
  },
1093
1322
  (a) => client.sites.setFlow(a.cbid, a.config)
1094
1323
  );
1095
1324
  registerConfigTools(tool, client);
1096
1325
  registerPlatformTools(tool, client);
1326
+ registerRightsTools(tool, client);
1327
+ registerRightsPageTools(tool, client);
1097
1328
  tool(
1098
1329
  "invite_member",
1099
1330
  "Invite a person to your organization by email. role must be admin, member, or viewer. The org is derived from the API key \u2014 you cannot invite into a different org.",
1100
1331
  {
1101
- email: import_zod3.z.string().describe("Email address of the person to invite."),
1102
- role: import_zod3.z.enum(["admin", "member", "viewer"]).describe("Role to assign: admin, member, or viewer. owner is not assignable via API key.")
1332
+ email: import_zod4.z.string().describe("Email address of the person to invite."),
1333
+ role: import_zod4.z.enum(["admin", "member", "viewer"]).describe("Role to assign: admin, member, or viewer. owner is not assignable via API key.")
1103
1334
  },
1104
1335
  (a) => client.members.invite(a.email, a.role)
1105
1336
  );
@@ -1107,8 +1338,8 @@ function registerTools(server, client) {
1107
1338
  "set_member_role",
1108
1339
  "Change the role of a member in your organization. The org owner's role cannot be changed.",
1109
1340
  {
1110
- userId: import_zod3.z.string().describe("The userId of the member whose role to change."),
1111
- role: import_zod3.z.enum(["admin", "member", "viewer"]).describe("New role: admin, member, or viewer.")
1341
+ userId: import_zod4.z.string().describe("The userId of the member whose role to change."),
1342
+ role: import_zod4.z.enum(["admin", "member", "viewer"]).describe("New role: admin, member, or viewer.")
1112
1343
  },
1113
1344
  (a) => client.members.setRole(a.userId, a.role)
1114
1345
  );
@@ -1116,7 +1347,7 @@ function registerTools(server, client) {
1116
1347
  "remove_member",
1117
1348
  "Remove a member from your organization. The org owner cannot be removed.",
1118
1349
  {
1119
- userId: import_zod3.z.string().describe("The userId of the member to remove.")
1350
+ userId: import_zod4.z.string().describe("The userId of the member to remove.")
1120
1351
  },
1121
1352
  async (a) => {
1122
1353
  await client.members.remove(a.userId);
@@ -1127,11 +1358,11 @@ function registerTools(server, client) {
1127
1358
  "create_brand_kit",
1128
1359
  "Create a reusable brand kit (colors, logo, typography) for your organization's consent banners.",
1129
1360
  {
1130
- name: import_zod3.z.string().describe("Display name for the brand kit."),
1131
- theme: import_zod3.z.record(import_zod3.z.unknown()).describe("Theme tokens (colors, fonts, etc.) as a JSON object."),
1132
- content: import_zod3.z.record(import_zod3.z.unknown()).optional().describe("Optional banner copy overrides."),
1133
- logoUrl: import_zod3.z.string().optional().describe("Optional URL for your org logo."),
1134
- customCss: import_zod3.z.string().optional().describe("Optional custom CSS string to inject into the banner.")
1361
+ name: import_zod4.z.string().describe("Display name for the brand kit."),
1362
+ theme: import_zod4.z.record(import_zod4.z.unknown()).describe("Theme tokens (colors, fonts, etc.) as a JSON object."),
1363
+ content: import_zod4.z.record(import_zod4.z.unknown()).optional().describe("Optional banner copy overrides."),
1364
+ logoUrl: import_zod4.z.string().optional().describe("Optional URL for your org logo."),
1365
+ customCss: import_zod4.z.string().optional().describe("Optional custom CSS string to inject into the banner.")
1135
1366
  },
1136
1367
  (a) => client.brandKits.create({
1137
1368
  name: a.name,
@@ -1145,7 +1376,7 @@ function registerTools(server, client) {
1145
1376
  "delete_brand_kit",
1146
1377
  "Delete a brand kit by id. The kit must belong to your organization (cross-org deletes are rejected).",
1147
1378
  {
1148
- id: import_zod3.z.string().describe("The brand kit id to delete.")
1379
+ id: import_zod4.z.string().describe("The brand kit id to delete.")
1149
1380
  },
1150
1381
  async (a) => {
1151
1382
  await client.brandKits.delete(a.id);
@@ -1156,25 +1387,25 @@ function registerTools(server, client) {
1156
1387
  "save_preference",
1157
1388
  "Save or update the consent preferences for an end-user (by subjectId) within your organization. purposes is a map of purpose-name \u2192 boolean.",
1158
1389
  {
1159
- subjectId: import_zod3.z.string().describe("The end-user identifier (e.g. email or internal user id)."),
1160
- purposes: import_zod3.z.record(import_zod3.z.boolean()).describe('Map of purpose names to consent values, e.g. { "newsletter": true, "analytics": false }.')
1390
+ subjectId: import_zod4.z.string().describe("The end-user identifier (e.g. email or internal user id)."),
1391
+ purposes: import_zod4.z.record(import_zod4.z.boolean()).describe('Map of purpose names to consent values, e.g. { "newsletter": true, "analytics": false }.')
1161
1392
  },
1162
1393
  (a) => client.preferences.save(a.subjectId, a.purposes)
1163
1394
  );
1164
1395
  tool(
1165
1396
  "get_preference",
1166
1397
  "One end-user\u2019s saved preferences, by subjectId. Read-only.",
1167
- { subjectId: import_zod3.z.string() },
1398
+ { subjectId: import_zod4.z.string() },
1168
1399
  (a) => client.preferences.get(a.subjectId)
1169
1400
  );
1170
1401
  tool(
1171
1402
  "issue_api_key",
1172
1403
  "Issue a new API key. The secret is returned once and never again. Prefer the least privilege the job needs: `scopes` limits what it can do, `cbids` locks it to specific sites (it then cannot reach anything org-wide), `expiresInDays` retires it. Omitting all three mints a full-access, org-wide, non-expiring key.",
1173
1404
  {
1174
- name: import_zod3.z.string().optional(),
1175
- scopes: import_zod3.z.array(import_zod3.z.string()).optional(),
1176
- cbids: import_zod3.z.array(import_zod3.z.string()).min(1).optional(),
1177
- expiresInDays: import_zod3.z.number().int().min(1).max(3650).optional()
1405
+ name: import_zod4.z.string().optional(),
1406
+ scopes: import_zod4.z.array(import_zod4.z.string()).optional(),
1407
+ cbids: import_zod4.z.array(import_zod4.z.string()).min(1).optional(),
1408
+ expiresInDays: import_zod4.z.number().int().min(1).max(3650).optional()
1178
1409
  },
1179
1410
  (a) => client.keys.issue({
1180
1411
  ...a.name ? { name: a.name } : {},
@@ -1183,74 +1414,105 @@ function registerTools(server, client) {
1183
1414
  ...a.expiresInDays !== void 0 ? { expiresInDays: a.expiresInDays } : {}
1184
1415
  })
1185
1416
  );
1186
- tool("revoke_api_key", "Revoke an API key by its prefix. Takes effect immediately; anything using that key stops working.", { prefix: import_zod3.z.string() }, async (a) => {
1417
+ tool("revoke_api_key", "Revoke an API key by its prefix. Takes effect immediately; anything using that key stops working.", { prefix: import_zod4.z.string() }, async (a) => {
1187
1418
  await client.keys.revoke(a.prefix);
1188
1419
  return { revoked: a.prefix };
1189
1420
  });
1190
1421
  tool(
1191
1422
  "import_cookie_declaration",
1192
1423
  "Read a cookie declaration exported from another CMP (OneTrust, Cookiebot, CookieYes, or any CSV/JSON with the same columns) and translate its categories into ours. Nothing is applied \u2014 it comes back for review, with the rows whose category could not be placed listed separately.",
1193
- { cbid: import_zod3.z.string(), data: import_zod3.z.string().describe("The exported file, as text (CSV or JSON).") },
1424
+ { cbid: import_zod4.z.string(), data: import_zod4.z.string().describe("The exported file, as text (CSV or JSON).") },
1194
1425
  (a) => client.sites.importDeclaration(a.cbid, a.data)
1195
1426
  );
1196
1427
  tool(
1197
1428
  "apply_cookie_import",
1198
1429
  "Import a cookie declaration exported from another CMP AND declare it: every row whose category mapped to ours and that has a purpose becomes a site declaration; the rest come back in `skipped` with the reason. Cookies the site already declared are kept unless overwrite is true. Prefer import_cookie_declaration first to review.",
1199
- { cbid: import_zod3.z.string(), data: import_zod3.z.string().describe("The exported file, as text (CSV or JSON)."), overwrite: import_zod3.z.boolean().optional() },
1430
+ { cbid: import_zod4.z.string(), data: import_zod4.z.string().describe("The exported file, as text (CSV or JSON)."), overwrite: import_zod4.z.boolean().optional() },
1200
1431
  (a) => client.sites.applyImport(a.cbid, a.data, a.overwrite ? { overwrite: true } : void 0)
1201
1432
  );
1202
1433
  const declarationShape = {
1203
- category: import_zod3.z.string().describe("necessary, preferences, statistics, marketing, or one of the site\u2019s categories.custom ids."),
1204
- purpose: import_zod3.z.string().describe("What the cookie does, as visitors will read it."),
1205
- provider: import_zod3.z.string().optional(),
1206
- expiry: import_zod3.z.string().optional().describe('e.g. "Session", "30 days", "1 year" (the banner localises these forms).'),
1207
- domain: import_zod3.z.string().optional(),
1208
- pattern: import_zod3.z.boolean().optional().describe("Treat the name as a prefix wildcard (a trailing * does the same).")
1434
+ category: import_zod4.z.string().describe("necessary, preferences, statistics, marketing, or one of the site\u2019s categories.custom ids."),
1435
+ purpose: import_zod4.z.string().describe("What the cookie does, as visitors will read it \u2014 and the fallback for any language purposes lacks."),
1436
+ purposes: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.string().max(1e3)).nullable().optional().describe('The purpose in other languages, keyed by BCP-47 tag: {"es": "\u2026", "pt-BR": "\u2026"}. The banner, data-cc="declaration" and cookie-declaration.js draw the visitor\u2019s language. null clears.'),
1437
+ provider: import_zod4.z.string().optional(),
1438
+ expiry: import_zod4.z.string().optional().describe('e.g. "Session", "30 days", "1 year" (the banner localises these forms).'),
1439
+ domain: import_zod4.z.string().optional(),
1440
+ pattern: import_zod4.z.boolean().optional().describe("Treat the name as a prefix wildcard (a trailing * does the same).")
1209
1441
  };
1442
+ const dryRunArg = import_zod4.z.boolean().optional().describe("Store nothing: answer with the would-be declarations and a diff (added / removed / changed) to check first.");
1210
1443
  tool(
1211
1444
  "declare_cookie",
1212
1445
  'Declare what one of the site\u2019s cookies is. Overrides the scanner, observed visits and the cookie database everywhere the declaration is shown (API, preference modal, data-cc="declaration"). Use for the site\u2019s own cookies the database cannot know. A name ending in * covers every cookie with that prefix.',
1213
- { cbid: import_zod3.z.string(), name: import_zod3.z.string(), ...declarationShape },
1446
+ { cbid: import_zod4.z.string(), name: import_zod4.z.string(), ...declarationShape, dryRun: dryRunArg },
1214
1447
  (a) => {
1215
- const { cbid: cbid2, name, ...rest } = a;
1216
- return client.sites.declareCookie(cbid2, name, rest);
1448
+ const { cbid: cbid2, name, dryRun, ...rest } = a;
1449
+ return client.sites.declareCookie(cbid2, name, rest, dryRun ? { dryRun: true } : void 0);
1217
1450
  }
1218
1451
  );
1219
1452
  tool(
1220
1453
  "declare_cookies",
1221
1454
  "Declare many cookies at once. All-or-nothing: one invalid item refuses the whole request and nothing is saved. replace: true also removes every declaration the list does not name.",
1222
- { cbid: import_zod3.z.string(), cookies: import_zod3.z.array(import_zod3.z.object({ name: import_zod3.z.string(), ...declarationShape })).max(500), replace: import_zod3.z.boolean().optional() },
1223
- (a) => client.sites.declareCookies(a.cbid, a.cookies, a.replace ? { replace: true } : void 0)
1455
+ { cbid: import_zod4.z.string(), cookies: import_zod4.z.array(import_zod4.z.object({ name: import_zod4.z.string(), ...declarationShape })).max(500), replace: import_zod4.z.boolean().optional(), dryRun: dryRunArg },
1456
+ (a) => {
1457
+ const o = { ...a.replace ? { replace: true } : {}, ...a.dryRun ? { dryRun: true } : {} };
1458
+ return client.sites.declareCookies(a.cbid, a.cookies, Object.keys(o).length ? o : void 0);
1459
+ }
1224
1460
  );
1225
1461
  tool(
1226
1462
  "undeclare_cookie",
1227
1463
  "Remove a cookie declaration; the scanned/observed classification applies again.",
1228
- { cbid: import_zod3.z.string(), name: import_zod3.z.string() },
1464
+ { cbid: import_zod4.z.string(), name: import_zod4.z.string(), dryRun: dryRunArg },
1229
1465
  async (a) => {
1466
+ if (a.dryRun) return client.sites.undeclareCookie(a.cbid, a.name, { dryRun: true });
1230
1467
  await client.sites.undeclareCookie(a.cbid, a.name);
1231
1468
  return { undeclared: a.name };
1232
1469
  }
1233
1470
  );
1471
+ tool(
1472
+ "retire_cookie",
1473
+ 'Retire a cookie the site renamed or stopped setting: it leaves the banner\u2019s cookie list, data-cc="declaration" and the public feed, and stays listed for the owner with retired. A name ending in * retires every cookie with that prefix; the name must match a scanned, observed or declared cookie. If a crawl or a real visit sees it again afterwards, it is listed again with review: retired_but_seen.',
1474
+ {
1475
+ cbid: import_zod4.z.string(),
1476
+ name: import_zod4.z.string(),
1477
+ renamedTo: import_zod4.z.string().max(256).optional().describe("The cookie\u2019s new name, if it was renamed."),
1478
+ note: import_zod4.z.string().max(1e3).optional(),
1479
+ dryRun: import_zod4.z.boolean().optional().describe("Store nothing: answer with the would-be retirement and list to check first.")
1480
+ },
1481
+ (a) => {
1482
+ const input = { ...a.renamedTo ? { renamedTo: a.renamedTo } : {}, ...a.note ? { note: a.note } : {} };
1483
+ return client.sites.retireCookie(a.cbid, a.name, input, a.dryRun ? { dryRun: true } : void 0);
1484
+ }
1485
+ );
1486
+ tool(
1487
+ "unretire_cookie",
1488
+ "Un-retire a cookie: it is listed again everywhere.",
1489
+ { cbid: import_zod4.z.string(), name: import_zod4.z.string(), dryRun: import_zod4.z.boolean().optional().describe("Store nothing: answer with what the list would be.") },
1490
+ async (a) => {
1491
+ if (a.dryRun) return client.sites.unretireCookie(a.cbid, a.name, { dryRun: true });
1492
+ await client.sites.unretireCookie(a.cbid, a.name);
1493
+ return { unretired: a.name };
1494
+ }
1495
+ );
1234
1496
  tool(
1235
1497
  "get_blocked_pages",
1236
1498
  "Pages where the embed could not load its banner renderer \u2014 the page\u2019s Content Security Policy or Trusted Types policy refused it, so nobody there can be asked for consent. An empty list is healthy. Read-only.",
1237
- { cbid: import_zod3.z.string() },
1499
+ { cbid: import_zod4.z.string() },
1238
1500
  (a) => client.sites.blocked(a.cbid)
1239
1501
  );
1240
1502
  tool(
1241
1503
  "roll_api_key",
1242
1504
  "Rotate an API key: returns a new secret once, with the same name, scopes, property lock and expiry. The old secret stops working immediately \u2014 if it is the key this server runs with, this server stops working too until it is reconfigured.",
1243
- { prefix: import_zod3.z.string() },
1505
+ { prefix: import_zod4.z.string() },
1244
1506
  (a) => client.keys.roll(a.prefix)
1245
1507
  );
1246
1508
  tool(
1247
1509
  "update_api_key",
1248
1510
  "Rename an API key, or replace its scopes or the properties it is locked to. Only the fields given change; the secret does not.",
1249
1511
  {
1250
- prefix: import_zod3.z.string(),
1251
- name: import_zod3.z.string().optional(),
1252
- scopes: import_zod3.z.array(import_zod3.z.string()).optional(),
1253
- cbids: import_zod3.z.array(import_zod3.z.string()).min(1).optional()
1512
+ prefix: import_zod4.z.string(),
1513
+ name: import_zod4.z.string().optional(),
1514
+ scopes: import_zod4.z.array(import_zod4.z.string()).optional(),
1515
+ cbids: import_zod4.z.array(import_zod4.z.string()).min(1).optional()
1254
1516
  },
1255
1517
  (a) => client.keys.update(a.prefix, {
1256
1518
  ...a.name !== void 0 ? { name: a.name } : {},
@@ -1262,31 +1524,170 @@ function registerTools(server, client) {
1262
1524
  tool(
1263
1525
  "update_org",
1264
1526
  "Rename your organisation or set its logo. logoUrl: null removes the logo; upload an image with upload_asset to get a URL. Deleting the organisation is not possible here.",
1265
- { name: import_zod3.z.string().min(1).optional(), logoUrl: import_zod3.z.string().nullable().optional() },
1527
+ { name: import_zod4.z.string().min(1).optional(), logoUrl: import_zod4.z.string().nullable().optional() },
1266
1528
  (a) => client.org.update({
1267
1529
  ...a.name !== void 0 ? { name: a.name } : {},
1268
1530
  ...a.logoUrl !== void 0 ? { logoUrl: a.logoUrl } : {}
1269
1531
  })
1270
1532
  );
1533
+ tool(
1534
+ "get_mail_provider",
1535
+ "Your own mail provider for rights-request mail (verification codes and other privacy-request mail), if any. Never returns the credential, only its last four characters. `sender` says whether verification codes are mailed through it now (own) or not at all (none) \u2014 there is no shared sender. Read-only.",
1536
+ {},
1537
+ () => client.org.mailProvider.get()
1538
+ );
1539
+ tool(
1540
+ "set_mail_provider",
1541
+ "Connect your own mail provider for rights-request mail \u2014 recommended, so codes come from your own domain. Replaces the stored one. It carries mail only after test_mail_provider succeeds; every save clears that. Omit secret to keep the stored one (same provider only).",
1542
+ {
1543
+ provider: import_zod4.z.enum(["brevo", "sendgrid", "postmark", "resend", "ses", "smtp"]),
1544
+ fromEmail: import_zod4.z.string().describe("An address on a domain your provider has verified."),
1545
+ fromName: import_zod4.z.string().max(100).nullable().optional(),
1546
+ replyTo: import_zod4.z.string().nullable().optional(),
1547
+ secret: import_zod4.z.string().optional().describe("API key (Brevo, SendGrid, Resend), server token (Postmark), secret access key (SES) or SMTP password. Write-only."),
1548
+ ses: import_zod4.z.object({ region: import_zod4.z.string(), accessKeyId: import_zod4.z.string() }).optional().describe("Required for ses."),
1549
+ smtp: import_zod4.z.object({ host: import_zod4.z.string(), port: import_zod4.z.union([import_zod4.z.literal(25), import_zod4.z.literal(465), import_zod4.z.literal(587), import_zod4.z.literal(2525)]), security: import_zod4.z.enum(["tls", "starttls"]), username: import_zod4.z.string() }).optional().describe("Required for smtp. TLS is always required.")
1550
+ },
1551
+ (a) => client.org.mailProvider.set(a)
1552
+ );
1553
+ tool(
1554
+ "test_mail_provider",
1555
+ "Send a test message through your own mail provider (never Cookie Munch\u2019s) and report what it answered. Success marks the configuration verified, after which it carries all rights mail.",
1556
+ { to: import_zod4.z.string().optional().describe("Recipient. Default: the reply-to, else the from address.") },
1557
+ (a) => client.org.mailProvider.test(a.to)
1558
+ );
1559
+ tool(
1560
+ "remove_mail_provider",
1561
+ "Remove your own mail provider. Rights mail goes back to Cookie Munch\u2019s shared sender, labelled as sending on your site\u2019s behalf.",
1562
+ {},
1563
+ async () => {
1564
+ await client.org.mailProvider.remove();
1565
+ return { removed: true };
1566
+ }
1567
+ );
1568
+ const CAPTCHA_OFF = "Off removes spam protection beyond the hidden spam-trap field, the rate limits and the email code: expect more spam requests. Own keys are recommended.";
1569
+ const captchaInput = {
1570
+ mode: import_zod4.z.enum(["own", "off"]).describe(`own: your own captcha provider keys (recommended). off: no captcha. ${CAPTCHA_OFF}`),
1571
+ provider: import_zod4.z.enum(["turnstile", "hcaptcha", "recaptcha_v2", "recaptcha_v3"]).optional().describe("Required for own."),
1572
+ siteKey: import_zod4.z.string().optional().describe("Required for own: the public site key. List your rights-page hostnames on it at the provider."),
1573
+ secret: import_zod4.z.string().optional().describe("The provider secret key. Write-only; never returned. Omit to keep the stored one (same provider)."),
1574
+ minScore: import_zod4.z.number().min(0.1).max(0.9).optional().describe("reCAPTCHA v3 only. Default 0.5.")
1575
+ };
1576
+ const captchaBody = (a) => ({
1577
+ mode: a.mode,
1578
+ ...a.provider !== void 0 ? { provider: a.provider } : {},
1579
+ ...a.siteKey !== void 0 ? { siteKey: a.siteKey } : {},
1580
+ ...a.secret !== void 0 ? { secret: a.secret } : {},
1581
+ ...a.minScore !== void 0 ? { minScore: a.minScore } : {}
1582
+ });
1583
+ tool(
1584
+ "get_rights_captcha",
1585
+ "The captcha on a site\u2019s hosted rights page: its own setting, else the organisation default, else off (`source` says which). Never returns the secret. Read-only.",
1586
+ { cbid: import_zod4.z.string() },
1587
+ (a) => client.rightsCaptcha.get(a.cbid)
1588
+ );
1589
+ tool(
1590
+ "set_rights_captcha",
1591
+ `Set a site\u2019s rights-page captcha: your own Turnstile, hCaptcha or reCAPTCHA keys (recommended; the provider must accept the secret before it is saved), or off. ${CAPTCHA_OFF} Audited with the old and new mode.`,
1592
+ { cbid: import_zod4.z.string(), ...captchaInput },
1593
+ (a) => client.rightsCaptcha.set(a.cbid, captchaBody(a))
1594
+ );
1595
+ tool(
1596
+ "remove_rights_captcha",
1597
+ "Remove a site\u2019s own captcha setting: it inherits the organisation default again (or off). Returns the setting now in force.",
1598
+ { cbid: import_zod4.z.string() },
1599
+ (a) => client.rightsCaptcha.remove(a.cbid)
1600
+ );
1601
+ tool(
1602
+ "get_rights_captcha_default",
1603
+ "The organisation default captcha for its rights pages, used by every site without its own setting. Never returns the secret. Read-only.",
1604
+ {},
1605
+ () => client.org.rightsCaptcha.get()
1606
+ );
1607
+ tool(
1608
+ "set_rights_captcha_default",
1609
+ `Set the organisation default captcha for its rights pages: your own keys (recommended) or off. ${CAPTCHA_OFF}`,
1610
+ captchaInput,
1611
+ (a) => client.org.rightsCaptcha.set(captchaBody(a))
1612
+ );
1613
+ tool(
1614
+ "remove_rights_captcha_default",
1615
+ "Remove the organisation default: sites without their own setting then have no captcha. Returns the setting now in force.",
1616
+ {},
1617
+ () => client.org.rightsCaptcha.remove()
1618
+ );
1619
+ const IDENTITY_NOTE = "The JWKS is fetched and checked before anything is saved. The session token must carry the email and a verified-email claim (default email_verified) set to true (Clerk: add email: {{user.primary_email_address}} to the session token; Clerk documents no claim for whether that address is verified, so either add your own or set trustEmailClaim). oidc_jwt needs an audience or authorizedParties.";
1620
+ const identityInput = {
1621
+ type: import_zod4.z.enum(["clerk", "atlas", "oidc_jwt"]).describe("clerk, atlas (Clerk-shaped), or oidc_jwt (any issuer that signs session JWTs with a published JWKS)."),
1622
+ issuer: import_zod4.z.string().describe("https URL exactly as in the token\u2019s iss (Clerk: your Frontend API URL)."),
1623
+ jwksUrl: import_zod4.z.string().optional().describe("Required for oidc_jwt; clerk/atlas default to <issuer>/.well-known/jwks.json."),
1624
+ audience: import_zod4.z.string().optional().describe("Expected aud. For oidc_jwt an audience or authorizedParties is required (a shared issuer mints tokens for every app)."),
1625
+ authorizedParties: import_zod4.z.array(import_zod4.z.string()).optional().describe("Your own origins (https://www.example.com) the token\u2019s azp must be one of. Required for clerk and atlas; for oidc_jwt when there is no audience."),
1626
+ emailClaim: import_zod4.z.string().optional().describe("Default email."),
1627
+ emailVerifiedClaim: import_zod4.z.string().optional().describe("Default email_verified; must be exactly true."),
1628
+ sessionCookieName: import_zod4.z.string().optional().describe("Default __session: the cookie the hosted page on your custom domain reads."),
1629
+ trustEmailClaim: import_zod4.z.boolean().optional().describe("clerk/atlas only, default false. True: a token without the verified claim is accepted, its email claim taken as verified. Set only if every address your provider puts in that claim is verified.")
1630
+ };
1631
+ const identityBody = (a) => {
1632
+ const out = { type: a.type, issuer: a.issuer };
1633
+ for (const k of ["jwksUrl", "audience", "authorizedParties", "emailClaim", "emailVerifiedClaim", "sessionCookieName", "trustEmailClaim"]) if (a[k] !== void 0) out[k] = a[k];
1634
+ return out;
1635
+ };
1636
+ tool(
1637
+ "get_rights_identity",
1638
+ "The sign-in provider a site\u2019s rights requests are verified with: its own setting, else the organisation default, else none (`source` says which). Read-only.",
1639
+ { cbid: import_zod4.z.string() },
1640
+ (a) => client.rightsIdentity.get(a.cbid)
1641
+ );
1642
+ tool(
1643
+ "set_rights_identity",
1644
+ `Connect a site\u2019s sign-in provider so a visitor signed in to the site is verified by their session, with no code mail. ${IDENTITY_NOTE} Audited.`,
1645
+ { cbid: import_zod4.z.string(), ...identityInput },
1646
+ (a) => client.rightsIdentity.set(a.cbid, identityBody(a))
1647
+ );
1648
+ tool(
1649
+ "remove_rights_identity",
1650
+ "Remove a site\u2019s own sign-in provider: it inherits the organisation default again (or none). Returns the setting now in force.",
1651
+ { cbid: import_zod4.z.string() },
1652
+ (a) => client.rightsIdentity.remove(a.cbid)
1653
+ );
1654
+ tool(
1655
+ "get_rights_identity_default",
1656
+ "The organisation default sign-in provider for its rights requests, used by every site without its own. Read-only.",
1657
+ {},
1658
+ () => client.org.rightsIdentity.get()
1659
+ );
1660
+ tool(
1661
+ "set_rights_identity_default",
1662
+ `Set the organisation default sign-in provider for its rights requests. ${IDENTITY_NOTE}`,
1663
+ identityInput,
1664
+ (a) => client.org.rightsIdentity.set(identityBody(a))
1665
+ );
1666
+ tool(
1667
+ "remove_rights_identity_default",
1668
+ "Remove the organisation default sign-in provider. Returns the setting now in force.",
1669
+ {},
1670
+ () => client.org.rightsIdentity.remove()
1671
+ );
1271
1672
  tool(
1272
1673
  "get_audit_log",
1273
1674
  "The organisation\u2019s audit log, newest first: administrative changes made in the dashboard or through the API, and who made them. Read-only.",
1274
- { limit: import_zod3.z.number().int().min(1).max(500).optional() },
1675
+ { limit: import_zod4.z.number().int().min(1).max(500).optional() },
1275
1676
  (a) => client.audit(a.limit)
1276
1677
  );
1277
1678
  tool(
1278
1679
  "upload_asset",
1279
1680
  "Upload an image \u2014 a banner logo \u2014 and get its public URL. data is base64 (a data: URL also works); PNG, JPEG, WebP, GIF or SVG, up to 1,000,000 bytes.",
1280
1681
  {
1281
- data: import_zod3.z.string(),
1282
- contentType: import_zod3.z.enum(["image/png", "image/jpeg", "image/webp", "image/gif", "image/svg+xml"])
1682
+ data: import_zod4.z.string(),
1683
+ contentType: import_zod4.z.enum(["image/png", "image/jpeg", "image/webp", "image/gif", "image/svg+xml"])
1283
1684
  },
1284
1685
  (a) => client.assets.upload({ data: a.data, contentType: a.contentType })
1285
1686
  );
1286
1687
  tool(
1287
1688
  "delete_asset",
1288
1689
  "Delete a stored image by its URL (or file name). Only your own organisation\u2019s images can be named.",
1289
- { url: import_zod3.z.string().describe("The URL upload_asset returned, or just its file name.") },
1690
+ { url: import_zod4.z.string().describe("The URL upload_asset returned, or just its file name.") },
1290
1691
  async (a) => {
1291
1692
  await client.assets.delete(a.url);
1292
1693
  return { deleted: a.url };
@@ -1301,18 +1702,18 @@ function registerTools(server, client) {
1301
1702
  tool(
1302
1703
  "get_customer",
1303
1704
  "One child org: its controller details and usage. Read-only.",
1304
- { id: import_zod3.z.string() },
1705
+ { id: import_zod4.z.string() },
1305
1706
  (a) => client.reseller.get(a.id)
1306
1707
  );
1307
1708
  tool(
1308
1709
  "provision_customer",
1309
1710
  "Create a new child org under this reseller. With `mintKey`, its first API key is returned once. Counts toward the reseller plan\u2019s pooled limits.",
1310
1711
  {
1311
- name: import_zod3.z.string(),
1312
- ownerEmail: import_zod3.z.string().optional(),
1313
- delegatedAccess: import_zod3.z.boolean().optional().describe("Whether this reseller may act inside the child."),
1314
- mintKey: import_zod3.z.boolean().optional(),
1315
- keyScopes: import_zod3.z.array(import_zod3.z.string()).optional()
1712
+ name: import_zod4.z.string(),
1713
+ ownerEmail: import_zod4.z.string().optional(),
1714
+ delegatedAccess: import_zod4.z.boolean().optional().describe("Whether this reseller may act inside the child."),
1715
+ mintKey: import_zod4.z.boolean().optional(),
1716
+ keyScopes: import_zod4.z.array(import_zod4.z.string()).optional()
1316
1717
  },
1317
1718
  (a) => client.reseller.create({
1318
1719
  name: a.name,
@@ -1326,10 +1727,10 @@ function registerTools(server, client) {
1326
1727
  "update_customer",
1327
1728
  "Change a child org\u2019s status, delegated access or DSAR routing. `dsarRouting: null` clears the override.",
1328
1729
  {
1329
- id: import_zod3.z.string(),
1330
- status: import_zod3.z.enum(["active", "suspended"]).optional(),
1331
- delegatedAccess: import_zod3.z.boolean().optional(),
1332
- dsarRouting: import_zod3.z.enum(["reseller", "child"]).nullable().optional()
1730
+ id: import_zod4.z.string(),
1731
+ status: import_zod4.z.enum(["active", "suspended"]).optional(),
1732
+ delegatedAccess: import_zod4.z.boolean().optional(),
1733
+ dsarRouting: import_zod4.z.enum(["reseller", "child"]).nullable().optional()
1333
1734
  },
1334
1735
  (a) => client.reseller.update(a.id, {
1335
1736
  ...a.status ? { status: a.status } : {},
@@ -1340,7 +1741,7 @@ function registerTools(server, client) {
1340
1741
  tool(
1341
1742
  "suspend_customer",
1342
1743
  "Suspend a child org: it stops ingesting consent and its keys stop working, and it can be reactivated with update_customer. Its data is kept. (Permanent deletion is deliberately not available here.)",
1343
- { id: import_zod3.z.string() },
1744
+ { id: import_zod4.z.string() },
1344
1745
  async (a) => {
1345
1746
  await client.reseller.deprovision(a.id);
1346
1747
  return { suspended: a.id };
@@ -1349,72 +1750,72 @@ function registerTools(server, client) {
1349
1750
  tool(
1350
1751
  "list_customer_keys",
1351
1752
  "A child org's API key prefixes. Never the secrets. Read-only.",
1352
- { id: import_zod3.z.string() },
1753
+ { id: import_zod4.z.string() },
1353
1754
  (a) => client.reseller.listKeys(a.id)
1354
1755
  );
1355
1756
  tool(
1356
1757
  "issue_customer_key",
1357
1758
  "Mint an API key for a child org. The secret is returned once. Prefer scopes and a property lock over a full-access key.",
1358
- { id: import_zod3.z.string(), name: import_zod3.z.string().optional(), scopes: import_zod3.z.array(import_zod3.z.string()).optional(), cbids: import_zod3.z.array(import_zod3.z.string()).min(1).optional() },
1759
+ { id: import_zod4.z.string(), name: import_zod4.z.string().optional(), scopes: import_zod4.z.array(import_zod4.z.string()).optional(), cbids: import_zod4.z.array(import_zod4.z.string()).min(1).optional() },
1359
1760
  (a) => client.reseller.mintKey(a.id, {
1360
1761
  ...a.name ? { name: a.name } : {},
1361
1762
  ...a.scopes ? { scopes: a.scopes } : {},
1362
1763
  ...a.cbids ? { cbids: a.cbids } : {}
1363
1764
  })
1364
1765
  );
1365
- tool("revoke_customer_key", "Revoke a child org's API key by prefix. Takes effect immediately.", { id: import_zod3.z.string(), prefix: import_zod3.z.string() }, async (a) => {
1766
+ tool("revoke_customer_key", "Revoke a child org's API key by prefix. Takes effect immediately.", { id: import_zod4.z.string(), prefix: import_zod4.z.string() }, async (a) => {
1366
1767
  await client.reseller.revokeKey(a.id, a.prefix);
1367
1768
  return { revoked: a.prefix };
1368
1769
  });
1369
1770
  tool(
1370
1771
  "erase_subject_data",
1371
1772
  "IRREVERSIBLY crypto-erase a data subject's consent records by their consent-receipt stamp (GDPR/CCPA deletion). Destroys the encryption key; the tamper-evident chain stays intact.",
1372
- { cbid: import_zod3.z.string(), stamp: import_zod3.z.string() },
1773
+ { cbid: import_zod4.z.string(), stamp: import_zod4.z.string() },
1373
1774
  (a) => client.consent.eraseSubject(a.cbid, a.stamp)
1374
1775
  );
1375
1776
  tool(
1376
1777
  "export_subject_data",
1377
1778
  "Export a data subject's consent records (GDPR access/portability).",
1378
- { cbid: import_zod3.z.string(), stamp: import_zod3.z.string() },
1779
+ { cbid: import_zod4.z.string(), stamp: import_zod4.z.string() },
1379
1780
  (a) => client.consent.exportSubject(a.cbid, a.stamp)
1380
1781
  );
1381
1782
  tool("list_banners", "List reusable banner designs in your org.", {}, () => client.banners.list());
1382
1783
  tool(
1383
1784
  "create_banner",
1384
1785
  "Create a reusable banner design.",
1385
- { name: import_zod3.z.string(), json: import_zod3.z.record(import_zod3.z.unknown()).describe("A v2 BannerConfig.") },
1786
+ { name: import_zod4.z.string(), json: import_zod4.z.record(import_zod4.z.unknown()).describe("A v2 BannerConfig.") },
1386
1787
  (a) => client.banners.create({ name: a.name, json: a.json })
1387
1788
  );
1388
- tool("get_banner", "Get a banner design by id.", { id: import_zod3.z.string() }, (a) => client.banners.get(a.id));
1789
+ tool("get_banner", "Get a banner design by id.", { id: import_zod4.z.string() }, (a) => client.banners.get(a.id));
1389
1790
  tool(
1390
1791
  "update_banner",
1391
1792
  "Update a banner design (name and/or config).",
1392
- { id: import_zod3.z.string(), name: import_zod3.z.string().optional(), json: import_zod3.z.record(import_zod3.z.unknown()).optional() },
1793
+ { id: import_zod4.z.string(), name: import_zod4.z.string().optional(), json: import_zod4.z.record(import_zod4.z.unknown()).optional() },
1393
1794
  (a) => client.banners.update(a.id, {
1394
1795
  ...a.name !== void 0 ? { name: a.name } : {},
1395
1796
  ...a.json !== void 0 ? { json: a.json } : {}
1396
1797
  })
1397
1798
  );
1398
- tool("delete_banner", "Delete a banner design (fails if assigned to sites).", { id: import_zod3.z.string() }, async (a) => {
1799
+ tool("delete_banner", "Delete a banner design (fails if assigned to sites).", { id: import_zod4.z.string() }, async (a) => {
1399
1800
  await client.banners.delete(a.id);
1400
1801
  return { ok: true };
1401
1802
  });
1402
1803
  tool(
1403
1804
  "get_banner_assignments",
1404
1805
  "The sites (cbids) a banner design is currently assigned to. Read-only.",
1405
- { id: import_zod3.z.string() },
1806
+ { id: import_zod4.z.string() },
1406
1807
  (a) => client.banners.assignments(a.id)
1407
1808
  );
1408
1809
  tool(
1409
1810
  "assign_banner",
1410
1811
  "Set which sites (cbids) use a banner design.",
1411
- { id: import_zod3.z.string(), cbids: import_zod3.z.array(import_zod3.z.string()) },
1812
+ { id: import_zod4.z.string(), cbids: import_zod4.z.array(import_zod4.z.string()) },
1412
1813
  (a) => client.banners.setAssignments(a.id, a.cbids)
1413
1814
  );
1414
1815
  tool(
1415
1816
  "publish_banner",
1416
1817
  "Publish a design live to all its assigned sites.",
1417
- { id: import_zod3.z.string() },
1818
+ { id: import_zod4.z.string() },
1418
1819
  (a) => client.banners.publish(a.id)
1419
1820
  );
1420
1821
  }
@@ -1434,7 +1835,7 @@ async function main() {
1434
1835
  console.error("COOKIEMUNCH_API_KEY is required.");
1435
1836
  process.exit(1);
1436
1837
  }
1437
- const baseUrl = process.env.COOKIEMUNCH_BASE_URL ?? "http://localhost:8787";
1838
+ const baseUrl = process.env.COOKIEMUNCH_BASE_URL ?? "https://api.cookiemunch.net";
1438
1839
  const server = createCookieMunchMcp({ apiKey, baseUrl });
1439
1840
  const transport = new import_stdio.StdioServerTransport();
1440
1841
  await server.connect(transport);