mcp-meta-ads-incrementality 0.2.3 → 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/README.md +30 -2
- package/dist/index.js +6 -597
- package/dist/index.js.map +1 -1
- package/dist/toolDefinitions.d.ts +772 -0
- package/dist/toolDefinitions.d.ts.map +1 -0
- package/dist/toolDefinitions.js +601 -0
- package/dist/toolDefinitions.js.map +1 -0
- package/dist/writeGate.d.ts +25 -0
- package/dist/writeGate.d.ts.map +1 -0
- package/dist/writeGate.js +60 -0
- package/dist/writeGate.js.map +1 -0
- package/package.json +4 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeGate.d.ts","sourceRoot":"","sources":["../src/writeGate.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,MAAM,CAkB1C,CAAC;AAOH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAE5E;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EACpD,QAAQ,EAAE,SAAS,CAAC,EAAE,EACtB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,CAAC,EAAE,CAEL;AAED,eAAO,MAAM,sBAAsB,QAEgD,CAAC;AAEpF;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,IAAI,CAQN"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createWriteGate } from 'mcp-write-gate';
|
|
2
|
+
/**
|
|
3
|
+
* Tools that mutate Meta Ads state. These are hidden from the tool list and
|
|
4
|
+
* refused at call time unless META_ADS_MCP_WRITE=true.
|
|
5
|
+
*
|
|
6
|
+
* The env prefix is deliberately META_ADS — shared with the Python meta-ads
|
|
7
|
+
* MCP server — so one flag means "Meta writes allowed this session" across
|
|
8
|
+
* both servers.
|
|
9
|
+
*
|
|
10
|
+
* Adding a new tool? Put it in this set if it creates, updates, deletes,
|
|
11
|
+
* uploads, swaps, rebinds, edits, or renames anything. The shape test in
|
|
12
|
+
* writeGate.test.ts enforces this by name pattern.
|
|
13
|
+
*/
|
|
14
|
+
export const WRITE_TOOLS = new Set([
|
|
15
|
+
'meta_ads_update_ad_url_tags',
|
|
16
|
+
'meta_ads_rename_ad',
|
|
17
|
+
'meta_ads_swap_ad_lead_form',
|
|
18
|
+
'meta_ads_rebind_ad_creative',
|
|
19
|
+
'meta_ads_edit_creative_text',
|
|
20
|
+
'meta_ads_create_campaign',
|
|
21
|
+
'meta_ads_create_adset',
|
|
22
|
+
'meta_ads_create_ad_creative',
|
|
23
|
+
'meta_ads_create_ad',
|
|
24
|
+
'meta_ads_upload_image',
|
|
25
|
+
'meta_ads_create_leadgen_form',
|
|
26
|
+
'meta_ads_create_custom_audience',
|
|
27
|
+
'meta_ads_upload_users_to_audience',
|
|
28
|
+
'meta_ads_create_lookalike_audience',
|
|
29
|
+
'meta_ads_update_object_status',
|
|
30
|
+
'meta_ads_update_budget',
|
|
31
|
+
'meta_ads_delete_object',
|
|
32
|
+
]);
|
|
33
|
+
const gate = createWriteGate({
|
|
34
|
+
writeTools: WRITE_TOOLS,
|
|
35
|
+
envPrefix: 'META_ADS',
|
|
36
|
+
});
|
|
37
|
+
export function isWriteTool(name) {
|
|
38
|
+
return gate.isWriteTool(name);
|
|
39
|
+
}
|
|
40
|
+
export function isWriteEnabled(env = process.env) {
|
|
41
|
+
return gate.isWriteEnabled(env);
|
|
42
|
+
}
|
|
43
|
+
export function filterTools(allTools, env = process.env) {
|
|
44
|
+
return gate.filterTools(allTools, env);
|
|
45
|
+
}
|
|
46
|
+
export const WRITE_DISABLED_MESSAGE = 'Write operations are disabled. Set META_ADS_MCP_WRITE=true in the MCP server environment ' +
|
|
47
|
+
'to enable mutating tools (create/update/delete/upload/swap/rebind/edit/rename).';
|
|
48
|
+
/**
|
|
49
|
+
* Assert that a tool call is allowed under the current write-mode setting.
|
|
50
|
+
* Throws a clear Error if the tool mutates state and writes are disabled.
|
|
51
|
+
*/
|
|
52
|
+
export function assertWriteAllowed(toolName, env = process.env) {
|
|
53
|
+
try {
|
|
54
|
+
gate.assertWriteAllowed(toolName, env);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
throw new Error(`Tool "${toolName}" is a write operation. ${WRITE_DISABLED_MESSAGE}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=writeGate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeGate.js","sourceRoot":"","sources":["../src/writeGate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC;IACtD,6BAA6B;IAC7B,oBAAoB;IACpB,4BAA4B;IAC5B,6BAA6B;IAC7B,6BAA6B;IAC7B,0BAA0B;IAC1B,uBAAuB;IACvB,6BAA6B;IAC7B,oBAAoB;IACpB,uBAAuB;IACvB,8BAA8B;IAC9B,iCAAiC;IACjC,mCAAmC;IACnC,oCAAoC;IACpC,+BAA+B;IAC/B,wBAAwB;IACxB,wBAAwB;CACzB,CAAC,CAAC;AAEH,MAAM,IAAI,GAAG,eAAe,CAAC;IAC3B,UAAU,EAAE,WAAW;IACvB,SAAS,EAAE,UAAU;CACtB,CAAC,CAAC;AAEH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAyB,OAAO,CAAC,GAAG;IACjE,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,QAAsB,EACtB,MAAyB,OAAO,CAAC,GAAG;IAEpC,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GACjC,2FAA2F;IAC3F,iFAAiF,CAAC;AAEpF;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAgB,EAChB,MAAyB,OAAO,CAAC,GAAG;IAEpC,IAAI,CAAC;QACH,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,SAAS,QAAQ,2BAA2B,sBAAsB,EAAE,CACrE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-meta-ads-incrementality",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "MCP server for Meta Marketing API focused on incrementality reporting. Surfaces Meta's incremental conversion attribution alongside default 7d-click/1d-view and dda windows so agencies can see the gap between reported and incremental performance.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
"build": "tsc",
|
|
18
18
|
"start": "node dist/index.js",
|
|
19
19
|
"dev": "tsx src/index.ts",
|
|
20
|
-
"test": "vitest run",
|
|
20
|
+
"test": "vitest run && npm run test:shell",
|
|
21
21
|
"test:watch": "vitest",
|
|
22
|
+
"test:shell": "bash tests/run-mcp-keychain.test.sh",
|
|
22
23
|
"smoke": "scripts/healthcheck.sh"
|
|
23
24
|
},
|
|
24
25
|
"keywords": [
|
|
@@ -41,6 +42,7 @@
|
|
|
41
42
|
"@modelcontextprotocol/sdk": "^0.5.0",
|
|
42
43
|
"env-paths": "^3.0.0",
|
|
43
44
|
"facebook-nodejs-business-sdk": "^24.0.1",
|
|
45
|
+
"mcp-write-gate": "^1.0.0",
|
|
44
46
|
"open": "^10.0.0",
|
|
45
47
|
"zod": "^3.22.4"
|
|
46
48
|
},
|