openads-ai 0.2.9 → 0.2.10

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.
@@ -1,6 +1,5 @@
1
1
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
2
  import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
3
- import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
4
3
  import { hasGlobalRtk } from "./token-optimizer.js";
5
4
  import fs from "fs";
6
5
  import path from "path";
@@ -29,7 +28,7 @@ export default async function (pi) {
29
28
  command,
30
29
  args,
31
30
  });
32
- const googleClient = new Client({ name: "openads-google-ads-client", version: "0.2.8" }, { capabilities: {} });
31
+ const googleClient = new Client({ name: "openads-google-ads-client", version: "0.2.9" }, { capabilities: {} });
33
32
  await googleClient.connect(googleTransport);
34
33
  clients.push({ name: "google-ads", client: googleClient });
35
34
  }
@@ -37,20 +36,21 @@ export default async function (pi) {
37
36
  console.error(`[OpenAds MCP] Failed to connect to Google Ads: ${err.message}`);
38
37
  }
39
38
  }
40
- // ─── Meta Ads MCP ─────────────────────────────────────────────────
39
+ // ─── Meta Ads MCP (Local Stdio Server via meta-ads-mcp) ───────────
41
40
  if (config.metaToken) {
42
41
  try {
43
- const metaUrl = new URL("https://mcp.facebook.com/ads/sse");
44
- metaUrl.searchParams.set("access_token", config.metaToken);
45
- const metaTransport = new SSEClientTransport(metaUrl, {
46
- requestInit: {
47
- headers: {
48
- "Authorization": `Bearer ${config.metaToken}`,
49
- "META_ACCESS_TOKEN": config.metaToken
50
- }
42
+ const useRtk = hasGlobalRtk();
43
+ const command = useRtk ? 'rtk' : 'npx';
44
+ const args = useRtk ? ['npx', '-y', 'meta-ads-mcp'] : ['-y', 'meta-ads-mcp'];
45
+ const metaTransport = new StdioClientTransport({
46
+ command,
47
+ args,
48
+ env: {
49
+ ...process.env,
50
+ "META_ACCESS_TOKEN": config.metaToken
51
51
  }
52
52
  });
53
- const metaClient = new Client({ name: "openads-meta-ads-client", version: "0.2.8" }, { capabilities: {} });
53
+ const metaClient = new Client({ name: "openads-meta-ads-client", version: "0.2.9" }, { capabilities: {} });
54
54
  await metaClient.connect(metaTransport);
55
55
  clients.push({ name: "meta-ads", client: metaClient });
56
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openads-ai",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Open-source AI command center for digital marketers. Audit campaigns, write ad copy, and build strategies — from your terminal.",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {