ads-mcp-for-snapchat 0.11.2 → 0.11.3

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 CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.3 (2026-11-26)
4
+ - **Hosted connector: you approve each change outside the chat.** When your AI asks to apply a previewed change, it now gets a link to a page of the service instead of applying it. You open it in the browser you signed in with, check the change and press Approve. The AI cannot press it: the page needs a signed cookie that only your browser holds. The approval code is not used up while waiting, so the AI repeats the same call after you approve. Nothing changes on the local version. If you connected before this release, remove the connector and add it again once so your browser gets the cookie. `HOSTED_INCHAT_APPROVAL=1` switches the page off.
5
+
3
6
  ## 0.11.2 (2026-11-26)
4
7
  More fixes from the release audit.
5
8
 
package/README.md CHANGED
@@ -121,7 +121,7 @@ A second way to use the same tools with **nothing to install**: a connector you
121
121
  What it does:
122
122
  - You add the connector, sign in with Snapchat, and choose which ad account to use (`snap_connect`).
123
123
  - **Read-only unless you tick "allow changes" on the consent page.** With changes allowed you get the same safety rules as the local version: everything created is paused, every change is previewed first with an approval code that works once for exactly that request, spending limits apply, and the change log lives in your own private database.
124
- - **Who approves a change:** the approval code only proves the change was previewed and has not moved. It does not prove that you looked at it, because your AI app receives the code. On the hosted connector the real approval is **your AI app's permission prompt**, so ticking "allow changes" is only safe if you keep that prompt on for the tools that change things.
124
+ - **Who approves a change:** every change waits for **you to press Approve on a page of this service**. When your AI asks to apply a preview, it gets a link instead; you open it in the browser you signed in with, read the change and press Approve (or Reject). The AI cannot do this for you: the page needs a cookie that only your browser has, and the AI never receives it. The approval code alone proves only that the change was previewed. If you signed in before this was added, remove the connector and add it again once. The operator can switch the page off with `HOSTED_INCHAT_APPROVAL=1` (not safer).
125
125
  - Each person gets a separate private database. `snap_disconnect` deletes everything stored about you; also revoke the app in Snapchat Business Manager.
126
126
  - Interactive cards (below) are shown in Claude with this version.
127
127
  - **Works with apps that support remote MCP servers with sign-in** (OAuth with dynamic registration, which is what this server offers). It has been **tested with Claude only**. ChatGPT's custom connectors use the same standard, but it has **not been tested there**, and what ChatGPT allows depends on your plan.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ads-mcp-for-snapchat",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
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",
package/src/index.js CHANGED
@@ -35,7 +35,7 @@ try {
35
35
  }
36
36
  // Snapshot of the non-secret settings taken at startup. Later edits to .env do not change limits or the target account.
37
37
  const settings = { ...process.env };
38
- const server = new McpServer({ name: "ads-mcp-for-snapchat", version: "0.11.2", ...BRAND }, { instructions: INSTRUCTIONS });
38
+ const server = new McpServer({ name: "ads-mcp-for-snapchat", version: "0.11.3", ...BRAND }, { instructions: INSTRUCTIONS });
39
39
  // Only the OAuth credentials are re-read from .env when a token is needed, so replacing them does not require a restart.
40
40
  const client = new SnapClient({ beforeToken: () => loadEnv(undefined, { override: true }), onNewRefreshToken: (t) => setEnvValue("SNAP_REFRESH_TOKEN", t), timeoutMs: policy.httpTimeoutMs });
41
41
  registerTools(server, client, settings);
package/src/tools.js CHANGED
@@ -114,7 +114,7 @@ const brief = (o) => ({
114
114
  const id = () => z.string().regex(/^[A-Za-z0-9_-]{1,64}$/, "must be an id (letters, digits, '-' or '_')");
115
115
  const TWO_STEP = " Two steps: confirm=false returns a preview and an approval_token; to apply, repeat the same arguments with confirm=true and that approval_token.";
116
116
 
117
- export function registerTools(server, client, env = process.env, { approvals: injectedApprovals } = {}) {
117
+ export function registerTools(server, client, env = process.env, { approvals: injectedApprovals, externalApproval = null } = {}) {
118
118
  // Safety settings are parsed once, here. Invalid settings throw, so the server does not start with a limit switched off.
119
119
  const policy = loadPolicy(env);
120
120
  // SNAP_TOOLSETS hides whole groups of tools (see toolsets.js). Prompts and settings are not affected.
@@ -447,6 +447,23 @@ export function registerTools(server, client, env = process.env, { approvals: in
447
447
  });
448
448
  }
449
449
  if (p.blocked) throw new Error(p.blocked);
450
+ // The hosted connector: the change waits until the person clicks Approve on a page of the service. The approval code is not
451
+ // used up while waiting, so the same request can be sent again once they have clicked.
452
+ if (externalApproval) {
453
+ const live = approvals.precheck(name, approval_token);
454
+ if (live.binding === binding) {
455
+ const st = externalApproval.status({ token: approval_token, tool: name, summary: { tool: name, ad_account: cfg.account ?? null, impact: added > 0 ? `Adds ${added} per day of spending.` : "Does not add daily spending.", targets: targetIds.slice(0, 10), preview: redact(p.preview) } });
456
+ if (st.state === "rejected") throw new Error("The person rejected this change on the approval page. Nothing was sent. Do not retry it; ask what they want instead.");
457
+ if (st.state !== "approved") {
458
+ return text({
459
+ waiting_for_the_persons_approval: true,
460
+ approval_link: st.url,
461
+ link_expires_in_seconds: st.expires_in_seconds,
462
+ next: "Nothing was sent. Give the person this link and ask them to open it in their browser, check the change and press Approve. The link is the only way to approve; you cannot do it for them. When they say they approved, repeat this same call (same arguments, same approval_token).",
463
+ });
464
+ }
465
+ }
466
+ }
450
467
  approvals.consume(name, approval_token, binding, detail);
451
468
  if (repeatGuard) {
452
469
  const repeat = approvals.recentRepeat(requestDigest);