@cookiemunch/mcp 0.4.0 → 0.5.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/index.cjs CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ MCP_VERSION: () => MCP_VERSION,
23
24
  createCookieMunchMcp: () => createCookieMunchMcp,
24
25
  registerTools: () => registerTools
25
26
  });
@@ -1534,6 +1535,21 @@ ${JSON.stringify(r, null, 2)}` : r;
1534
1535
  { subjectId: import_zod5.z.string() },
1535
1536
  (a) => client.preferences.get(a.subjectId)
1536
1537
  );
1538
+ tool(
1539
+ "mint_preference_center_token",
1540
+ "Mint a hosted preference-centre token for one visitor (POST /v1/preference-center/tokens), for a page to pass to CookieMunch.setSubjectToken. Give exactly one of email (resolved as the emailed preference link resolves it; an unknown address is subject_not_found) or subjectId. The token is a credential that opens that person\u2019s subscriptions and profile until expiresAt: never paste it into a shared URL, a ticket or a log, and keep ttlSeconds short (default 3600, max 86400). Needs subscriptions:write and profile:write, plus identity:read by email.",
1541
+ {
1542
+ cbid: import_zod5.z.string().describe("A site of your organisation."),
1543
+ email: import_zod5.z.string().optional().describe("The visitor\u2019s address. Give this or subjectId, not both."),
1544
+ subjectId: import_zod5.z.string().optional().describe("The subject id. Give this or email, not both."),
1545
+ ttlSeconds: import_zod5.z.number().int().min(1).max(86400).optional()
1546
+ },
1547
+ (a) => client.preferenceCenter.mintToken({
1548
+ cbid: a.cbid,
1549
+ ...a.email !== void 0 ? { email: a.email } : { subjectId: a.subjectId },
1550
+ ...a.ttlSeconds !== void 0 ? { ttlSeconds: a.ttlSeconds } : {}
1551
+ })
1552
+ );
1537
1553
  tool(
1538
1554
  "issue_api_key",
1539
1555
  "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.",
@@ -1633,7 +1649,7 @@ ${JSON.stringify(r, null, 2)}` : r;
1633
1649
  );
1634
1650
  tool(
1635
1651
  "list_cookie_presets",
1636
- "Declaration presets for the platforms a site is built on (atlas, forumulate, chatly, cookiemunch): each one\u2019s parameters, what it has declared on this site, and whether the vendor\u2019s live manifest can be imported yet. Read-only.",
1652
+ "Declaration presets for the platforms a site is built on (atlas, forumulate, chatly, cookiemunch, referally): each one\u2019s parameters, what it has declared on this site, and whether the vendor\u2019s live manifest can be imported yet. Read-only.",
1637
1653
  { cbid: import_zod5.z.string() },
1638
1654
  (a) => client.sites.cookiePresets(a.cbid)
1639
1655
  );
@@ -1642,24 +1658,26 @@ ${JSON.stringify(r, null, 2)}` : r;
1642
1658
  "Apply (or re-sync) a vendor preset: declares exactly what that platform writes \u2014 cookies and browser storage, with domain and lifetime \u2014 marked as declared by that vendor. Re-applying removes keys the vendor no longer writes. Names the owner declared are kept (skipped). Atlas needs frontendApiHost (and crossSubdomainCookies, default true); Chatly needs publicId.",
1643
1659
  {
1644
1660
  cbid: import_zod5.z.string(),
1645
- vendor: import_zod5.z.enum(["atlas", "forumulate", "chatly", "cookiemunch"]),
1661
+ vendor: import_zod5.z.enum(["atlas", "forumulate", "chatly", "cookiemunch", "referally"]),
1646
1662
  frontendApiHost: import_zod5.z.string().optional().describe("Atlas: your frontend API host, e.g. auth.example.com."),
1647
1663
  crossSubdomainCookies: import_zod5.z.boolean().optional().describe("Atlas: default true \u2014 the cookies live on the parent domain."),
1648
1664
  publicId: import_zod5.z.string().optional().describe("Chatly: the channel public id (ch_web_\u2026)."),
1649
1665
  dragging: import_zod5.z.boolean().optional().describe("Chatly: the launcher can be dragged (adds the drag-position key)."),
1650
- category: import_zod5.z.string().optional().describe("Chatly: the category for its keys. Default necessary."),
1666
+ category: import_zod5.z.string().optional().describe("Chatly: the category for its keys (default necessary). Referally: default the site's referrals category, else marketing."),
1667
+ cookieDomain: import_zod5.z.string().optional().describe("Referally: the domain aff.js sets referally_ctx on, e.g. .example.com. Default the site domain."),
1668
+ cookieDays: import_zod5.z.number().int().min(1).max(400).optional().describe("Referally: how long the cookie lives, 1 to 400 days. Default 60."),
1651
1669
  dryRun: dryRunArg
1652
1670
  },
1653
1671
  (a) => {
1654
1672
  const params = {};
1655
- for (const k of ["frontendApiHost", "crossSubdomainCookies", "publicId", "dragging", "category"]) if (a[k] !== void 0) params[k] = a[k];
1673
+ for (const k of ["frontendApiHost", "crossSubdomainCookies", "publicId", "dragging", "category", "cookieDomain", "cookieDays"]) if (a[k] !== void 0) params[k] = a[k];
1656
1674
  return client.sites.applyCookiePreset(a.cbid, a.vendor, params, a.dryRun ? { dryRun: true } : void 0);
1657
1675
  }
1658
1676
  );
1659
1677
  tool(
1660
1678
  "remove_cookie_preset",
1661
1679
  "Remove every declaration a vendor preset made on this site.",
1662
- { cbid: import_zod5.z.string(), vendor: import_zod5.z.enum(["atlas", "forumulate", "chatly", "cookiemunch"]), dryRun: dryRunArg },
1680
+ { cbid: import_zod5.z.string(), vendor: import_zod5.z.enum(["atlas", "forumulate", "chatly", "cookiemunch", "referally"]), dryRun: dryRunArg },
1663
1681
  (a) => client.sites.removeCookiePreset(a.cbid, a.vendor, a.dryRun ? { dryRun: true } : void 0)
1664
1682
  );
1665
1683
  tool(
@@ -1761,6 +1779,37 @@ ${JSON.stringify(r, null, 2)}` : r;
1761
1779
  return { removed: true };
1762
1780
  }
1763
1781
  );
1782
+ tool(
1783
+ "get_org_controller",
1784
+ "The organisation\u2019s own data-controller identity: who every rights notice names, before any site config controller block. `set: false` when there is none. Read-only.",
1785
+ {},
1786
+ () => client.org.controller.get()
1787
+ );
1788
+ tool(
1789
+ "set_org_controller",
1790
+ "Set the organisation\u2019s data-controller identity. Replaces it: a field left out is removed. Needed for a notice on a rights request filed without a cbid when the organisation has several sites. Needs an unscoped key or rights:write. Audited.",
1791
+ {
1792
+ legalName: import_zod5.z.string().describe("Required: the legal name of the data controller."),
1793
+ contactEmail: import_zod5.z.string().optional().describe("Where people reach the controller about their data."),
1794
+ address: import_zod5.z.string().optional(),
1795
+ dpoContact: import_zod5.z.string().optional().describe("The Data Protection Officer: a name, an email address, or both.")
1796
+ },
1797
+ (a) => client.org.controller.set({
1798
+ legalName: a.legalName,
1799
+ ...a.contactEmail !== void 0 ? { contactEmail: a.contactEmail } : {},
1800
+ ...a.address !== void 0 ? { address: a.address } : {},
1801
+ ...a.dpoContact !== void 0 ? { dpoContact: a.dpoContact } : {}
1802
+ })
1803
+ );
1804
+ tool(
1805
+ "remove_org_controller",
1806
+ "Remove the organisation\u2019s data-controller identity. Notices then name the request\u2019s site config controller block; a request without a cbid in an organisation with several sites gets no notice.",
1807
+ {},
1808
+ async () => {
1809
+ await client.org.controller.remove();
1810
+ return { removed: true };
1811
+ }
1812
+ );
1764
1813
  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.";
1765
1814
  const captchaInput = {
1766
1815
  mode: import_zod5.z.enum(["own", "off"]).describe(`own: your own captcha provider keys (recommended). off: no captcha. ${CAPTCHA_OFF}`),
@@ -1776,6 +1825,24 @@ ${JSON.stringify(r, null, 2)}` : r;
1776
1825
  ...a.secret !== void 0 ? { secret: a.secret } : {},
1777
1826
  ...a.minScore !== void 0 ? { minScore: a.minScore } : {}
1778
1827
  });
1828
+ tool(
1829
+ "get_consent_sync_secret",
1830
+ "Whether hosted consent sync is set up for a site: `configured`, `secretLast4`, `createdAt`. Never returns the secret. Read-only.",
1831
+ { cbid: import_zod5.z.string() },
1832
+ (a) => client.consentSyncSecret.get(a.cbid)
1833
+ );
1834
+ tool(
1835
+ "rotate_consent_sync_secret",
1836
+ "Mint a site\u2019s consent-sync signing secret, or rotate it. The answer carries `secret` this once; the site owner\u2019s server signs consent-sync tokens with it (mintConsentSyncToken in @cookiemunch/sdk). Rotating stops the old secret at once, so every page holding a token signed with it stops syncing until it gets a new token. Never put the secret in a page. Needs sites:write and consent:write.",
1837
+ { cbid: import_zod5.z.string() },
1838
+ (a) => client.consentSyncSecret.rotate(a.cbid)
1839
+ );
1840
+ tool(
1841
+ "remove_consent_sync_secret",
1842
+ "Remove a site\u2019s consent-sync secret: hosted consent sync stops until a new one is minted. Needs sites:write and consent:write.",
1843
+ { cbid: import_zod5.z.string() },
1844
+ (a) => client.consentSyncSecret.remove(a.cbid)
1845
+ );
1779
1846
  tool(
1780
1847
  "get_rights_captcha",
1781
1848
  "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.",
@@ -2017,14 +2084,16 @@ ${JSON.stringify(r, null, 2)}` : r;
2017
2084
  }
2018
2085
 
2019
2086
  // src/index.ts
2087
+ var MCP_VERSION = "0.5.0";
2020
2088
  function createCookieMunchMcp(opts) {
2021
- const client = opts.client ?? (0, import_sdk.createCookieMunch)({ apiKey: opts.apiKey, baseUrl: opts.baseUrl });
2089
+ const client = opts.client ?? (0, import_sdk.createCookieMunch)({ apiKey: opts.apiKey, baseUrl: opts.baseUrl, userAgent: opts.userAgent ?? `cookiemunch-mcp/${MCP_VERSION}` });
2022
2090
  const server = new import_mcp.McpServer({ name: "cookiemunch", version: "1.0.0" });
2023
2091
  registerTools(server, client);
2024
2092
  return server;
2025
2093
  }
2026
2094
  // Annotate the CommonJS export names for ESM import in node:
2027
2095
  0 && (module.exports = {
2096
+ MCP_VERSION,
2028
2097
  createCookieMunchMcp,
2029
2098
  registerTools
2030
2099
  });