@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/CHANGELOG.md +44 -0
- package/LICENSE +21 -0
- package/dist/bin.cjs +74 -7
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +2 -2
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-SKCEQX3L.js → chunk-IQLCPEWI.js} +75 -7
- package/dist/chunk-IQLCPEWI.js.map +1 -0
- package/dist/index.cjs +75 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +3 -1
- package/package.json +16 -8
- package/dist/chunk-SKCEQX3L.js.map +0 -1
package/dist/bin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
createCookieMunchMcp
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IQLCPEWI.js";
|
|
5
5
|
|
|
6
6
|
// src/bin.ts
|
|
7
7
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
@@ -12,7 +12,7 @@ async function main() {
|
|
|
12
12
|
process.exit(1);
|
|
13
13
|
}
|
|
14
14
|
const baseUrl = process.env.COOKIEMUNCH_BASE_URL ?? "https://api.cookiemunch.net";
|
|
15
|
-
const server = createCookieMunchMcp({ apiKey, baseUrl });
|
|
15
|
+
const server = createCookieMunchMcp({ apiKey, baseUrl, ...process.env.COOKIEMUNCH_USER_AGENT ? { userAgent: process.env.COOKIEMUNCH_USER_AGENT } : {} });
|
|
16
16
|
const transport = new StdioServerTransport();
|
|
17
17
|
await server.connect(transport);
|
|
18
18
|
}
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * stdio entry point for the Cookie Munch MCP server. Reads COOKIEMUNCH_API_KEY\n * (required) and COOKIEMUNCH_BASE_URL (optional) from the environment, builds the\n * server, and serves it over stdio — the transport Claude Desktop / Claude Code use\n * to spawn local MCP servers.\n */\n\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { createCookieMunchMcp } from './index.js';\n\nasync function main(): Promise<void> {\n const apiKey = process.env.COOKIEMUNCH_API_KEY;\n if (!apiKey) {\n console.error('COOKIEMUNCH_API_KEY is required.');\n process.exit(1);\n }\n const baseUrl = process.env.COOKIEMUNCH_BASE_URL ?? 'https://api.cookiemunch.net';\n const server = createCookieMunchMcp({ apiKey, baseUrl });\n const transport = new StdioServerTransport();\n await server.connect(transport);\n // The process now stays alive serving MCP requests over stdio.\n}\n\nmain().catch((err) => {\n console.error('cookiemunch-mcp failed to start:', err);\n process.exit(1);\n});\n"],"mappings":";;;;;;AAQA,SAAS,4BAA4B;AAGrC,eAAe,OAAsB;AACnC,QAAM,SAAS,QAAQ,IAAI;AAC3B,MAAI,CAAC,QAAQ;AACX,YAAQ,MAAM,kCAAkC;AAChD,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,QAAM,UAAU,QAAQ,IAAI,wBAAwB;AACpD,QAAM,SAAS,qBAAqB,EAAE,QAAQ,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * stdio entry point for the Cookie Munch MCP server. Reads COOKIEMUNCH_API_KEY\n * (required) and COOKIEMUNCH_BASE_URL (optional) from the environment, builds the\n * server, and serves it over stdio — the transport Claude Desktop / Claude Code use\n * to spawn local MCP servers.\n */\n\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { createCookieMunchMcp } from './index.js';\n\nasync function main(): Promise<void> {\n const apiKey = process.env.COOKIEMUNCH_API_KEY;\n if (!apiKey) {\n console.error('COOKIEMUNCH_API_KEY is required.');\n process.exit(1);\n }\n const baseUrl = process.env.COOKIEMUNCH_BASE_URL ?? 'https://api.cookiemunch.net';\n const server = createCookieMunchMcp({ apiKey, baseUrl, ...(process.env.COOKIEMUNCH_USER_AGENT ? { userAgent: process.env.COOKIEMUNCH_USER_AGENT } : {}) });\n const transport = new StdioServerTransport();\n await server.connect(transport);\n // The process now stays alive serving MCP requests over stdio.\n}\n\nmain().catch((err) => {\n console.error('cookiemunch-mcp failed to start:', err);\n process.exit(1);\n});\n"],"mappings":";;;;;;AAQA,SAAS,4BAA4B;AAGrC,eAAe,OAAsB;AACnC,QAAM,SAAS,QAAQ,IAAI;AAC3B,MAAI,CAAC,QAAQ;AACX,YAAQ,MAAM,kCAAkC;AAChD,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,QAAM,UAAU,QAAQ,IAAI,wBAAwB;AACpD,QAAM,SAAS,qBAAqB,EAAE,QAAQ,SAAS,GAAI,QAAQ,IAAI,yBAAyB,EAAE,WAAW,QAAQ,IAAI,uBAAuB,IAAI,CAAC,EAAG,CAAC;AACzJ,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAEhC;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,UAAQ,MAAM,oCAAoC,GAAG;AACrD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
|
@@ -1509,6 +1509,21 @@ ${JSON.stringify(r, null, 2)}` : r;
|
|
|
1509
1509
|
{ subjectId: z5.string() },
|
|
1510
1510
|
(a) => client.preferences.get(a.subjectId)
|
|
1511
1511
|
);
|
|
1512
|
+
tool(
|
|
1513
|
+
"mint_preference_center_token",
|
|
1514
|
+
"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.",
|
|
1515
|
+
{
|
|
1516
|
+
cbid: z5.string().describe("A site of your organisation."),
|
|
1517
|
+
email: z5.string().optional().describe("The visitor\u2019s address. Give this or subjectId, not both."),
|
|
1518
|
+
subjectId: z5.string().optional().describe("The subject id. Give this or email, not both."),
|
|
1519
|
+
ttlSeconds: z5.number().int().min(1).max(86400).optional()
|
|
1520
|
+
},
|
|
1521
|
+
(a) => client.preferenceCenter.mintToken({
|
|
1522
|
+
cbid: a.cbid,
|
|
1523
|
+
...a.email !== void 0 ? { email: a.email } : { subjectId: a.subjectId },
|
|
1524
|
+
...a.ttlSeconds !== void 0 ? { ttlSeconds: a.ttlSeconds } : {}
|
|
1525
|
+
})
|
|
1526
|
+
);
|
|
1512
1527
|
tool(
|
|
1513
1528
|
"issue_api_key",
|
|
1514
1529
|
"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.",
|
|
@@ -1608,7 +1623,7 @@ ${JSON.stringify(r, null, 2)}` : r;
|
|
|
1608
1623
|
);
|
|
1609
1624
|
tool(
|
|
1610
1625
|
"list_cookie_presets",
|
|
1611
|
-
"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.",
|
|
1626
|
+
"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.",
|
|
1612
1627
|
{ cbid: z5.string() },
|
|
1613
1628
|
(a) => client.sites.cookiePresets(a.cbid)
|
|
1614
1629
|
);
|
|
@@ -1617,24 +1632,26 @@ ${JSON.stringify(r, null, 2)}` : r;
|
|
|
1617
1632
|
"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.",
|
|
1618
1633
|
{
|
|
1619
1634
|
cbid: z5.string(),
|
|
1620
|
-
vendor: z5.enum(["atlas", "forumulate", "chatly", "cookiemunch"]),
|
|
1635
|
+
vendor: z5.enum(["atlas", "forumulate", "chatly", "cookiemunch", "referally"]),
|
|
1621
1636
|
frontendApiHost: z5.string().optional().describe("Atlas: your frontend API host, e.g. auth.example.com."),
|
|
1622
1637
|
crossSubdomainCookies: z5.boolean().optional().describe("Atlas: default true \u2014 the cookies live on the parent domain."),
|
|
1623
1638
|
publicId: z5.string().optional().describe("Chatly: the channel public id (ch_web_\u2026)."),
|
|
1624
1639
|
dragging: z5.boolean().optional().describe("Chatly: the launcher can be dragged (adds the drag-position key)."),
|
|
1625
|
-
category: z5.string().optional().describe("Chatly: the category for its keys
|
|
1640
|
+
category: z5.string().optional().describe("Chatly: the category for its keys (default necessary). Referally: default the site's referrals category, else marketing."),
|
|
1641
|
+
cookieDomain: z5.string().optional().describe("Referally: the domain aff.js sets referally_ctx on, e.g. .example.com. Default the site domain."),
|
|
1642
|
+
cookieDays: z5.number().int().min(1).max(400).optional().describe("Referally: how long the cookie lives, 1 to 400 days. Default 60."),
|
|
1626
1643
|
dryRun: dryRunArg
|
|
1627
1644
|
},
|
|
1628
1645
|
(a) => {
|
|
1629
1646
|
const params = {};
|
|
1630
|
-
for (const k of ["frontendApiHost", "crossSubdomainCookies", "publicId", "dragging", "category"]) if (a[k] !== void 0) params[k] = a[k];
|
|
1647
|
+
for (const k of ["frontendApiHost", "crossSubdomainCookies", "publicId", "dragging", "category", "cookieDomain", "cookieDays"]) if (a[k] !== void 0) params[k] = a[k];
|
|
1631
1648
|
return client.sites.applyCookiePreset(a.cbid, a.vendor, params, a.dryRun ? { dryRun: true } : void 0);
|
|
1632
1649
|
}
|
|
1633
1650
|
);
|
|
1634
1651
|
tool(
|
|
1635
1652
|
"remove_cookie_preset",
|
|
1636
1653
|
"Remove every declaration a vendor preset made on this site.",
|
|
1637
|
-
{ cbid: z5.string(), vendor: z5.enum(["atlas", "forumulate", "chatly", "cookiemunch"]), dryRun: dryRunArg },
|
|
1654
|
+
{ cbid: z5.string(), vendor: z5.enum(["atlas", "forumulate", "chatly", "cookiemunch", "referally"]), dryRun: dryRunArg },
|
|
1638
1655
|
(a) => client.sites.removeCookiePreset(a.cbid, a.vendor, a.dryRun ? { dryRun: true } : void 0)
|
|
1639
1656
|
);
|
|
1640
1657
|
tool(
|
|
@@ -1736,6 +1753,37 @@ ${JSON.stringify(r, null, 2)}` : r;
|
|
|
1736
1753
|
return { removed: true };
|
|
1737
1754
|
}
|
|
1738
1755
|
);
|
|
1756
|
+
tool(
|
|
1757
|
+
"get_org_controller",
|
|
1758
|
+
"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.",
|
|
1759
|
+
{},
|
|
1760
|
+
() => client.org.controller.get()
|
|
1761
|
+
);
|
|
1762
|
+
tool(
|
|
1763
|
+
"set_org_controller",
|
|
1764
|
+
"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.",
|
|
1765
|
+
{
|
|
1766
|
+
legalName: z5.string().describe("Required: the legal name of the data controller."),
|
|
1767
|
+
contactEmail: z5.string().optional().describe("Where people reach the controller about their data."),
|
|
1768
|
+
address: z5.string().optional(),
|
|
1769
|
+
dpoContact: z5.string().optional().describe("The Data Protection Officer: a name, an email address, or both.")
|
|
1770
|
+
},
|
|
1771
|
+
(a) => client.org.controller.set({
|
|
1772
|
+
legalName: a.legalName,
|
|
1773
|
+
...a.contactEmail !== void 0 ? { contactEmail: a.contactEmail } : {},
|
|
1774
|
+
...a.address !== void 0 ? { address: a.address } : {},
|
|
1775
|
+
...a.dpoContact !== void 0 ? { dpoContact: a.dpoContact } : {}
|
|
1776
|
+
})
|
|
1777
|
+
);
|
|
1778
|
+
tool(
|
|
1779
|
+
"remove_org_controller",
|
|
1780
|
+
"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.",
|
|
1781
|
+
{},
|
|
1782
|
+
async () => {
|
|
1783
|
+
await client.org.controller.remove();
|
|
1784
|
+
return { removed: true };
|
|
1785
|
+
}
|
|
1786
|
+
);
|
|
1739
1787
|
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.";
|
|
1740
1788
|
const captchaInput = {
|
|
1741
1789
|
mode: z5.enum(["own", "off"]).describe(`own: your own captcha provider keys (recommended). off: no captcha. ${CAPTCHA_OFF}`),
|
|
@@ -1751,6 +1799,24 @@ ${JSON.stringify(r, null, 2)}` : r;
|
|
|
1751
1799
|
...a.secret !== void 0 ? { secret: a.secret } : {},
|
|
1752
1800
|
...a.minScore !== void 0 ? { minScore: a.minScore } : {}
|
|
1753
1801
|
});
|
|
1802
|
+
tool(
|
|
1803
|
+
"get_consent_sync_secret",
|
|
1804
|
+
"Whether hosted consent sync is set up for a site: `configured`, `secretLast4`, `createdAt`. Never returns the secret. Read-only.",
|
|
1805
|
+
{ cbid: z5.string() },
|
|
1806
|
+
(a) => client.consentSyncSecret.get(a.cbid)
|
|
1807
|
+
);
|
|
1808
|
+
tool(
|
|
1809
|
+
"rotate_consent_sync_secret",
|
|
1810
|
+
"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.",
|
|
1811
|
+
{ cbid: z5.string() },
|
|
1812
|
+
(a) => client.consentSyncSecret.rotate(a.cbid)
|
|
1813
|
+
);
|
|
1814
|
+
tool(
|
|
1815
|
+
"remove_consent_sync_secret",
|
|
1816
|
+
"Remove a site\u2019s consent-sync secret: hosted consent sync stops until a new one is minted. Needs sites:write and consent:write.",
|
|
1817
|
+
{ cbid: z5.string() },
|
|
1818
|
+
(a) => client.consentSyncSecret.remove(a.cbid)
|
|
1819
|
+
);
|
|
1754
1820
|
tool(
|
|
1755
1821
|
"get_rights_captcha",
|
|
1756
1822
|
"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.",
|
|
@@ -1992,8 +2058,9 @@ ${JSON.stringify(r, null, 2)}` : r;
|
|
|
1992
2058
|
}
|
|
1993
2059
|
|
|
1994
2060
|
// src/index.ts
|
|
2061
|
+
var MCP_VERSION = "0.5.0";
|
|
1995
2062
|
function createCookieMunchMcp(opts) {
|
|
1996
|
-
const client = opts.client ?? createCookieMunch({ apiKey: opts.apiKey, baseUrl: opts.baseUrl });
|
|
2063
|
+
const client = opts.client ?? createCookieMunch({ apiKey: opts.apiKey, baseUrl: opts.baseUrl, userAgent: opts.userAgent ?? `cookiemunch-mcp/${MCP_VERSION}` });
|
|
1997
2064
|
const server = new McpServer({ name: "cookiemunch", version: "1.0.0" });
|
|
1998
2065
|
registerTools(server, client);
|
|
1999
2066
|
return server;
|
|
@@ -2001,6 +2068,7 @@ function createCookieMunchMcp(opts) {
|
|
|
2001
2068
|
|
|
2002
2069
|
export {
|
|
2003
2070
|
registerTools,
|
|
2071
|
+
MCP_VERSION,
|
|
2004
2072
|
createCookieMunchMcp
|
|
2005
2073
|
};
|
|
2006
|
-
//# sourceMappingURL=chunk-
|
|
2074
|
+
//# sourceMappingURL=chunk-IQLCPEWI.js.map
|