ads-mcp-for-snapchat 0.9.3 → 0.9.5

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/.env.example CHANGED
@@ -7,6 +7,8 @@ SNAP_REFRESH_TOKEN=
7
7
  SNAP_AD_ACCOUNT_ID=
8
8
  # Safety limits (optional; plain numbers in account currency; an invalid value stops the server; restart to apply)
9
9
  SNAP_MAX_DAILY_BUDGET=1000
10
+ # Optional: a warning (not a limit) in the preview when a change adds more daily budget than this.
11
+ # SNAP_WARN_DAILY_BUDGET=
10
12
  SNAP_MIN_DAILY_BUDGET=5
11
13
  SNAP_MAX_BID=50
12
14
  SNAP_MAX_BUDGET_INCREASE_PCT=100
package/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.9.5 (2026-11-17)
6
+
7
+ - **Claude Desktop extension starts with changes allowed** (Read-only is off by default) and a daily budget limit of 500. Every change is still previewed and needs approval, everything created starts paused, and the limit and the new budget warning apply. `npx ... setup` still starts read-only unless you choose otherwise.
8
+
9
+ - **Budget warning.** A preview that adds a daily budget unusually large for the account now shows a `budget_warning`: more than twice the largest running ad squad, more than half the limit when nothing is running, or above the optional `SNAP_WARN_DAILY_BUDGET`. It is a warning only; the limits still apply and nothing is blocked by it.
10
+
11
+ - README: a short section on how this project relates to Snap's own read-only Ads MCP server (use theirs to look, this one to launch and change campaigns, safely).
12
+
13
+ ## 0.9.4 (2026-11-16)
14
+
15
+ - Claude Desktop extension: an icon, a link to the privacy page, and the corrected description (the shared login needs no OAuth app).
16
+
17
+ - `setup` asks less: a single ad account is chosen automatically, and one question ("use the safe defaults?", Enter = yes) replaces the budget, country and read-only questions. Answer n to get them back.
18
+ - README: a "Get started in 2 minutes" section at the top; the first section no longer says an OAuth app is required.
19
+
20
+ - Docs: PRIVACY.md and SECURITY.md name the default login service address and how to turn it off; the Claude Desktop extension description no longer says an OAuth app is required.
21
+
5
22
  ## 0.9.3 (2026-11-16)
6
23
 
7
24
  - **Shared login is live.** The login service is deployed and the package uses it by default (`npx -y ads-mcp-for-snapchat setup`, choose 1). Verified on a real Snapchat login: login, account list, saving the access, renewing it through the service, and `verify` (20 of 24 checks ran; the rest need optional settings). Snap has not yet been asked to confirm a shared app for other advertisers; own-app setup still works.
package/PRIVACY.md CHANGED
@@ -8,6 +8,8 @@ Ads MCP for Snapchat is open-source software that runs **on your own computer**.
8
8
  - Your AI app (for example Claude) sees the data the tool returns, under that app's own terms.
9
9
 
10
10
  ## The shared login service (optional)
11
+ The default service is at `https://ads-mcp-for-snapchat-login.ads-mcp.workers.dev`. It is run by the maintainer of this project on Cloudflare Workers; the code it runs is `broker/worker.js` in this repository. Set `SNAP_BROKER_URL=off` to turn it off, or point `SNAP_BROKER_URL` at your own copy.
12
+
11
13
  The service lets you log in with Snapchat without creating your own Snapchat app. It is a small, stateless program (`broker/worker.js`, running on Cloudflare Workers).
12
14
 
13
15
  **What it does**
package/README.md CHANGED
@@ -4,8 +4,26 @@ A local [MCP](https://modelcontextprotocol.io) server that lets an AI assistant
4
4
 
5
5
  > **Unofficial.** Not affiliated with or endorsed by Snap Inc. This tool can change real ad campaigns that spend real money. You use it at your own risk (see LICENSE). Check Snap's developer terms for your own use. Review every preview before approving.
6
6
 
7
+ ## Get started in 2 minutes
8
+ **Claude Desktop (no terminal):** download `ads-mcp-for-snapchat-<version>.mcpb` from the [latest release](https://github.com/Usame794/snapchat-ads-mcp/releases/latest), open it, leave Client ID and secret empty, then ask Claude: "Connect my Snapchat ad account." Log in with Snapchat and pick the ad account. In the Desktop extension, changes are **allowed from the start** (Read-only is off by default): each one is previewed and needs your approval, everything created starts paused, and the daily budget limit starts at 500 (change it in the extension's settings). Switch Read-only on there if you only want to look.
9
+
10
+ **Claude Code, Cursor, VS Code or a terminal:**
11
+ ```bash
12
+ npx -y ads-mcp-for-snapchat setup
13
+ ```
14
+ Choose **1. Shared login**, log in with Snapchat, pick the ad account, and press Enter at the safety question (it starts read-only; nothing can be changed until you allow it). Then check everything with `npx -y ads-mcp-for-snapchat verify`.
15
+
16
+ ## How this relates to Snap's own Ads MCP server
17
+ Snap runs its own hosted **Ads MCP server** (see Snap's developer documentation). According to Snap's documentation it is **read-only**: an agent can read Snapchat Ads data but cannot create, update or delete anything, and it works with several AI apps without installing anything.
18
+
19
+ - **Only need to look at your numbers?** Snap's own server is the simplest way, and you don't have to install anything.
20
+ - **Want to launch and change campaigns?** That is what this project is for: you can create campaigns, ad squads, creatives and ads and change budgets, bids, schedules and placements, with a **preview and your approval for every change**, spend limits, undo and a change log, and everything created starts **paused**. Turn on changes with `SNAP_READ_ONLY=0` (the safe default starts read-only; it is a switch, not a limit).
21
+ - You can use both side by side.
22
+
23
+ This project is unofficial and is not made, endorsed or supported by Snap. It runs on your own computer; it is not the hosted service Snap provides.
24
+
7
25
  ## What it is, and what it is not
8
- - **It runs on your machine, with your own Snapchat OAuth app and your own ad account.** Nothing is hosted or shared, and no credentials leave your computer except to Snap's API.
26
+ - **It runs on your machine, with your own ad account.** You connect with a normal Snapchat login (the shared login service) or with your own Snapchat OAuth app. The tool itself is not hosted, and no ad account data leaves your computer except to Snap's API.
9
27
  - **It is a safety-first tool, not an autopilot.** Writes are previewed first, created things start paused, and there are hard limits on money. See "Safety rules" below, and read "What the approval token is not".
10
28
  - **It is not a hosted service.** Services that only accept remote MCP servers (for example ChatGPT connectors) cannot use it as it is. Do not expose it on the internet.
11
29
  - **Money limits are in your account's currency.** Defaults (`SNAP_MAX_DAILY_BUDGET=1000`, `SNAP_MAX_BID=50`) are deliberately conservative; set your own in `.env`.
@@ -84,6 +102,7 @@ With this setting the server asks **you**, through the MCP client's own dialog (
84
102
  | Setting | Default | Meaning |
85
103
  |---|---|---|
86
104
  | `SNAP_MAX_DAILY_BUDGET` | 1000 | Highest daily budget any single campaign or ad squad may be given or enabled with |
105
+ | `SNAP_WARN_DAILY_BUDGET` | (none) | Optional **warning** level, not a limit: a change that adds more than this daily budget shows a `budget_warning` in the preview. Without it, the preview still warns when a change adds more than twice your largest running ad squad (or, on an account with none running, more than half of `SNAP_MAX_DAILY_BUDGET`). |
87
106
  | `SNAP_MIN_DAILY_BUDGET` | 5 | Lowest daily budget |
88
107
  | `SNAP_MAX_BID` | 50 | Highest max bid |
89
108
  | `SNAP_MAX_BUDGET_INCREASE_PCT` | 100 | Largest budget increase per step and per 24 hours |
@@ -272,7 +291,7 @@ Verified on the maintainer's own ad account. Anything not listed here is covered
272
291
 
273
292
  **Before the safety layer (earlier tests, on throwaway paused objects):** pause/enable (single and bulk), budget, bid, targeting, schedule, bulk edits, campaign / ad squad copy, ad and creative clone, create campaign and ad squad, lookalike and pixel audiences, customer-list audience (with fake data), influencer flow and batch, media upload (simple and chunked), async reports, health check, review issues, pixel health, and the guarded delete (on a throwaway campaign).
274
293
 
275
- **Read-only run of `verify` on the maintainer's real ad account (November 2026, 23 of 24 tools worked):** `snap_ping`; the campaign, ad squad, media and audience lists; spend pacing; anomaly check; funnel; hourly report; billing check; audience health; unused media; budget advice; landing page check; health check; review issues; dynamic template list; catalog feed status; pixel health; audience size; audience insights; and the public Ads Gallery lookup. That run found real bugs that mocked tests could not (Snap's account-level stats accept only the `spend` field; the landing page check read too much; a shop's bot protection answered 403), all fixed in 0.9.1 and after.
294
+ **Read-only run of `verify` on the maintainer's real ad account (November 2026, 23 of 24 tools worked; and 20 of 24 with none failed on a second account connected through the shared login, the rest skipped for optional settings):** `snap_ping`; the campaign, ad squad, media and audience lists; spend pacing; anomaly check; funnel; hourly report; billing check; audience health; unused media; budget advice; landing page check; health check; review issues; dynamic template list; catalog feed status; pixel health; audience size; audience insights; and the public Ads Gallery lookup. That run found real bugs that mocked tests could not (Snap's account-level stats accept only the `spend` field; the landing page check read too much; a shop's bot protection answered 403), all fixed in 0.9.1 and after.
276
295
 
277
296
  **Not verified live:**
278
297
  - Everything that **writes** and was added in 0.7.0 or later: catalog ad creation (product sets, templates, campaign, ad squad, creative, ad), frequency cap, ad schedule, placement, bid-strategy switching, and the new ad squad goals. Built from Snap's documentation and mocked tests.
package/SECURITY.md CHANGED
@@ -22,7 +22,7 @@ Everything runs on your computer. These are the only outside addresses it contac
22
22
  | `tr.snapchat.com` | Conversions API **test** events and their status (`snap_capi_*`) | Your access token and one test event; an email is hashed first. Real conversion events are never sent. |
23
23
  | `adsapi.snapchat.com/v1/ads_library/...` | Competitor ads (`snap_competitor_ads`) | The advertiser name you search for. **No token**, nothing about your account. |
24
24
  | The links of your own active ads | `snap_check_landing_pages` opens each link once | A plain request. Only `https`, never private, loopback or link-local addresses, and every redirect is checked again. No credentials. |
25
- | The shared login service (`SNAP_BROKER_URL`), only if you chose the shared login | Logging in, and renewing the 30-minute access token | Your refresh token (it must, to renew). It stores nothing; see `PRIVACY.md`. Only use a service you trust. |
25
+ | The shared login service (`SNAP_BROKER_URL`, default `ads-mcp-for-snapchat-login.ads-mcp.workers.dev`; `off` disables it), only if you chose the shared login | Logging in, and renewing the 30-minute access token | Your refresh token (it must, to renew). It stores nothing; see `PRIVACY.md`. Only use a service you trust. |
26
26
 
27
27
  Text that comes back from outside (competitors' ads, page contents, ad review reasons) is untrusted data: it is cut, marked as such in the answer, and must not be followed as instructions. `SNAP_PORTFOLIO_FILES` can only be set by you in your own settings; the AI app cannot choose which files are read. The audit log removes credentials, emails and phone numbers from logged arguments.
28
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ads-mcp-for-snapchat",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
4
4
  "description": "Unofficial local MCP server for the Snapchat Marketing API: reports, audits and safe, previewed changes to campaigns, ad squads and ads.",
5
5
  "mcpName": "io.github.Usame794/ads-mcp-for-snapchat",
6
6
  "adsMcpBroker": "https://ads-mcp-for-snapchat-login.ads-mcp.workers.dev",
@@ -0,0 +1,43 @@
1
+ // A soft warning (not a limit): tells the person when a change adds a daily budget that is large compared with what this ad
2
+ // account normally runs. The hard limits in policy.js still apply; this only makes an unusual amount hard to miss in the preview.
3
+ const round = (n) => Math.round(n * 100) / 100;
4
+ const median = (xs) => {
5
+ const s = [...xs].sort((a, b) => a - b);
6
+ const m = s.length >> 1;
7
+ return s.length % 2 ? s[m] : (s[m - 1] + s[m]) / 2;
8
+ };
9
+
10
+ // Pure. `added` is the daily budget this change adds (a new ad squad's budget, or the size of an increase).
11
+ // `squadBudgets` are the daily budgets of the ad squads that are running now.
12
+ export function judgeBudget({ added, squadBudgets = [], maxDailyBudget, warnAbove = null, currency = "" }) {
13
+ if (!(added > 0)) return null;
14
+ const unit = currency ? ` ${currency}` : "";
15
+ const budgets = squadBudgets.filter((b) => b > 0);
16
+ const largest = budgets.length ? Math.max(...budgets) : null;
17
+ const typical = budgets.length ? round(median(budgets)) : null;
18
+ const reasons = [];
19
+ if (warnAbove && added > warnAbove) reasons.push(`it is above your own warning level of ${warnAbove}${unit} a day (SNAP_WARN_DAILY_BUDGET)`);
20
+ if (largest && added > 2 * largest) reasons.push(`it is more than twice your largest running ad squad (${round(largest)}${unit} a day; typical ${typical}${unit})`);
21
+ if (!largest && maxDailyBudget && added > maxDailyBudget / 2) reasons.push(`it is more than half of your limit of ${maxDailyBudget}${unit} a day and this account has no running ad squad to compare with`);
22
+ if (!reasons.length) return null;
23
+ return {
24
+ level: "HIGHER_THAN_NORMAL",
25
+ message: `This change adds ${round(added)}${unit} of daily budget, and ${reasons.join("; ")}. Check the amount before you approve.`,
26
+ added_daily_budget: round(added),
27
+ largest_running_daily_budget: largest == null ? null : round(largest),
28
+ typical_running_daily_budget: typical,
29
+ };
30
+ }
31
+
32
+ // Reads the running ad squads' daily budgets and judges. Never blocks a preview: if the account cannot be read, there is no warning.
33
+ export async function budgetWarning(client, adAccountId, { added, policy }) {
34
+ if (!(added > 0)) return null;
35
+ let squadBudgets = [];
36
+ try {
37
+ const { items } = await client.listPaged(`/adaccounts/${adAccountId}/adsquads`, "adsquad", { maxPages: 2 });
38
+ squadBudgets = items.filter((s) => s.status === "ACTIVE" && s.daily_budget_micro > 0).map((s) => s.daily_budget_micro / 1e6);
39
+ } catch {
40
+ squadBudgets = [];
41
+ }
42
+ return judgeBudget({ added, squadBudgets, maxDailyBudget: policy.maxDailyBudget, warnAbove: policy.warnDailyBudget, currency: policy.currency ?? "" });
43
+ }
package/src/index.js CHANGED
@@ -20,7 +20,7 @@ try {
20
20
  }
21
21
  // Snapshot of the non-secret settings taken at startup. Later edits to .env do not change limits or the target account.
22
22
  const settings = { ...process.env };
23
- const server = new McpServer({ name: "ads-mcp-for-snapchat", version: "0.9.3" });
23
+ const server = new McpServer({ name: "ads-mcp-for-snapchat", version: "0.9.5" });
24
24
  // Only the OAuth credentials are re-read from .env when a token is needed, so replacing them does not require a restart.
25
25
  const client = new SnapClient({ beforeToken: () => loadEnv(undefined, { override: true }), timeoutMs: policy.httpTimeoutMs });
26
26
  registerTools(server, client, settings);
package/src/policy.js CHANGED
@@ -67,7 +67,14 @@ export function loadPolicy(env = process.env) {
67
67
  } catch (e) {
68
68
  errors.push(e.message);
69
69
  }
70
+ let warnDailyBudget = null;
71
+ if (env.SNAP_WARN_DAILY_BUDGET !== undefined && String(env.SNAP_WARN_DAILY_BUDGET).trim() !== "") {
72
+ const w = Number(String(env.SNAP_WARN_DAILY_BUDGET).trim());
73
+ if (Number.isFinite(w) && w > 0 && w <= HARD_MAX) warnDailyBudget = w;
74
+ else errors.push("SNAP_WARN_DAILY_BUDGET must be a positive number (a budget above this shows a warning in the preview).");
75
+ }
70
76
  const policy = {
77
+ warnDailyBudget,
71
78
  toolsets,
72
79
  defaultCountry: country && /^[a-z]{2}$/.test(country) ? country : null,
73
80
  defaultPhoneCode: phoneCode && /^[1-9]\d{0,3}$/.test(phoneCode) ? phoneCode : null,
package/src/setup.js CHANGED
@@ -195,7 +195,7 @@ export async function runSetup({ io, file = envFile(), fetchImpl = fetch, open =
195
195
  const accounts = await listAdAccounts(client);
196
196
  if (!accounts.length) throw new Error("This login cannot see any ad account. Ask the account's admin to add you, then run setup again.");
197
197
  accounts.forEach((a, i) => say(` ${String(i + 1).padStart(2)}. ${a.name} (${a.organization}, ${a.status}, ${a.currency})`));
198
- const pick = await askUntil(io, `Number of the ad account (1-${accounts.length}): `, (a) => (Number.isInteger(Number(a)) && Number(a) >= 1 && Number(a) <= accounts.length ? null : `Type a number from 1 to ${accounts.length}.`));
198
+ const pick = accounts.length === 1 ? "1" : await askUntil(io, `Number of the ad account (1-${accounts.length}): `, (a) => (Number.isInteger(Number(a)) && Number(a) >= 1 && Number(a) <= accounts.length ? null : `Type a number from 1 to ${accounts.length}.`));
199
199
  const chosen = accounts[Number(pick) - 1];
200
200
  if (chosen.id !== cur.SNAP_AD_ACCOUNT_ID) {
201
201
  setEnvValue("SNAP_AD_ACCOUNT_ID", chosen.id, file);
@@ -209,15 +209,26 @@ export async function runSetup({ io, file = envFile(), fetchImpl = fetch, open =
209
209
 
210
210
  // 4. Safety
211
211
  cur = readSettings(file);
212
- say("STEP 4 of 5: safety settings (Enter keeps the value in brackets)");
212
+ say("STEP 4 of 5: safety settings");
213
+ const defaultBudget = cur.SNAP_MAX_DAILY_BUDGET || 1000;
214
+ let ro = "y";
215
+ const quick = await io.ask(` Use the safe defaults (start read-only; the AI may never set a daily budget above ${defaultBudget} ${chosen.currency ?? ""})? [Y/n]: `);
216
+ if (!/^n/i.test(quick)) {
217
+ setEnvValue("SNAP_MAX_DAILY_BUDGET", String(defaultBudget), file);
218
+ setEnvValue("SNAP_READ_ONLY", "1", file);
219
+ say(" Saved. You can change these later in the settings file.");
220
+ say("");
221
+ } else {
222
+ say(" (Enter keeps the value in brackets)");
213
223
  const budget = await askUntil(io, ` Highest daily budget the AI may set, in ${chosen.currency ?? "account currency"} [${cur.SNAP_MAX_DAILY_BUDGET || 1000}]: `, (a) => (!a || (/^\d+(\.\d+)?$/.test(a) && Number(a) > 0) ? null : "A plain number, such as 300."));
214
224
  if (budget) setEnvValue("SNAP_MAX_DAILY_BUDGET", budget, file);
215
225
  const country = await askUntil(io, ` Main country, 2 letters such as us, sa, ae (Enter to skip) [${cur.SNAP_DEFAULT_COUNTRY || ""}]: `, (a) => (!a || /^[a-z]{2}$/i.test(a) ? null : "Two letters, such as us."));
216
226
  if (country) setEnvValue("SNAP_DEFAULT_COUNTRY", country.toLowerCase(), file);
217
- const ro = await io.ask(" Start in read-only mode, so nothing can be changed until you are ready? [Y/n]: ");
227
+ ro = await io.ask(" Start in read-only mode, so nothing can be changed until you are ready? [Y/n]: ");
218
228
  setEnvValue("SNAP_READ_ONLY", /^n/i.test(ro) ? "0" : "1", file);
219
229
  say(" Saved.");
220
230
  say("");
231
+ }
221
232
 
222
233
  // 5. Register
223
234
  say("STEP 5 of 5: add it to your AI app");
package/src/tools.js CHANGED
@@ -16,6 +16,7 @@ import { compareReport, healthCheck, pixelHealth, reviewIssues } from "./audit.j
16
16
  import { fatigueReport } from "./fatigue.js";
17
17
  import { buildDynamicCreative, buildDynamicTemplate, buildProductSet, creativeProductSet, describeFilter, squadProductSet, TEMPLATE_LAYOUTS, TEMPLATE_TEXT_FIELDS } from "./catalog-ads.js";
18
18
  import { brokerUrlFrom, startBrokerLogin } from "./broker.js";
19
+ import { budgetWarning } from "./budget-warning.js";
19
20
  import { audienceInsights, buildTestEvent, capiStatus, capiTest, CAPI_TEST_EVENTS, competitorAds, GALLERY_COUNTRIES, INSIGHT_CATEGORIES } from "./intel.js";
20
21
  import { anomalyCheck, blendedRoas, landingPageReport } from "./checks.js";
21
22
  import { toolAllowed } from "./toolsets.js";
@@ -206,8 +207,10 @@ export function registerTools(server, client, env = process.env) {
206
207
  if (p.blocked) return text(p.preview);
207
208
  const repeat = repeatGuard ? approvals.recentRepeat(requestDigest) : null;
208
209
  const issued = approvals.issue(name, binding, detail);
210
+ const budgetWarn = added > 0 ? await budgetWarning(client, account(), { added, policy }) : null;
209
211
  return text({
210
212
  ...p.preview,
213
+ ...(budgetWarn ? { budget_warning: budgetWarn } : {}),
211
214
  ...(repeat ? { duplicate_warning: `An identical request was executed ${repeat.seconds_ago}s ago and will be refused if confirmed: ${JSON.stringify(repeat.summary)}` } : {}),
212
215
  ...(ledger ? { spend_impact: ledger } : {}),
213
216
  ...(policy.readOnly ? { read_only: "SNAP_READ_ONLY is on: this preview cannot be applied." } : {}),