@cookiemunch/mcp 0.1.0 → 0.1.1

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
@@ -767,25 +767,33 @@ function registerTools(server, client) {
767
767
  tool("get_site_config", "Get the banner/consent configuration for a site.", { ...cbid }, (a) => client.sites.getConfig(a.cbid));
768
768
  tool(
769
769
  "update_site_config",
770
- "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. 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
- { ...cbid, config: import_zod3.z.record(import_zod3.z.unknown()).describe("The full SiteConfig to write, not a patch. Omitted top-level fields are NOT preserved from the current config \u2014 fetch get_site_config first and merge client-side.") },
772
- (a) => client.sites.putConfig(a.cbid, a.config)
770
+ "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
+ {
772
+ ...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.")
775
+ },
776
+ (a) => a.keepUnspecified === true ? client.sites.putConfig(a.cbid, a.config, { keep: "unspecified" }) : client.sites.putConfig(a.cbid, a.config)
773
777
  );
774
778
  tool(
775
779
  "patch_site_config",
776
- "Change part of a site's banner/consent configuration. The patch is deep-merged over the stored config server-side, so any field you omit keeps its current value \u2014 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.",
777
- { ...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.') },
780
+ `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.') },
778
782
  (a) => client.sites.patchConfig(a.cbid, a.config)
779
783
  );
780
784
  tool(
781
785
  "preview_site_config",
782
- '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. Use it before any write you are not sure of.',
786
+ '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.',
783
787
  {
784
788
  ...cbid,
785
789
  config: import_zod3.z.record(import_zod3.z.unknown()).describe('The patch (or, with mode "put", the full config) to preview.'),
786
- mode: import_zod3.z.enum(["patch", "put"]).optional().describe("patch (default) merges; put replaces.")
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).')
787
792
  },
788
- (a) => client.sites.dryRunConfig(a.cbid, a.config, { mode: a.mode ?? "patch" })
793
+ (a) => client.sites.dryRunConfig(a.cbid, a.config, {
794
+ mode: a.mode ?? "patch",
795
+ ...a.keepUnspecified === true ? { keep: "unspecified" } : {}
796
+ })
789
797
  );
790
798
  tool(
791
799
  "verify_consent_log",
@@ -873,6 +881,12 @@ function registerTools(server, client) {
873
881
  return { deleted: a.id };
874
882
  }
875
883
  );
884
+ tool(
885
+ "mark_dsar_test",
886
+ "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.") },
888
+ (a) => client.dsar.markTest(a.id)
889
+ );
876
890
  tool(
877
891
  "advance_dsar",
878
892
  "Advance a DSAR to a new status (received \u2192 verifying \u2192 in_progress \u2192 completed, or rejected).",
@@ -1179,6 +1193,44 @@ function registerTools(server, client) {
1179
1193
  { cbid: import_zod3.z.string(), data: import_zod3.z.string().describe("The exported file, as text (CSV or JSON).") },
1180
1194
  (a) => client.sites.importDeclaration(a.cbid, a.data)
1181
1195
  );
1196
+ tool(
1197
+ "apply_cookie_import",
1198
+ "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() },
1200
+ (a) => client.sites.applyImport(a.cbid, a.data, a.overwrite ? { overwrite: true } : void 0)
1201
+ );
1202
+ 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).")
1209
+ };
1210
+ tool(
1211
+ "declare_cookie",
1212
+ '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 },
1214
+ (a) => {
1215
+ const { cbid: cbid2, name, ...rest } = a;
1216
+ return client.sites.declareCookie(cbid2, name, rest);
1217
+ }
1218
+ );
1219
+ tool(
1220
+ "declare_cookies",
1221
+ "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)
1224
+ );
1225
+ tool(
1226
+ "undeclare_cookie",
1227
+ "Remove a cookie declaration; the scanned/observed classification applies again.",
1228
+ { cbid: import_zod3.z.string(), name: import_zod3.z.string() },
1229
+ async (a) => {
1230
+ await client.sites.undeclareCookie(a.cbid, a.name);
1231
+ return { undeclared: a.name };
1232
+ }
1233
+ );
1182
1234
  tool(
1183
1235
  "get_blocked_pages",
1184
1236
  "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.",