# Connect Meta Ads to Claude Code in One Command

> Add your Meta ad account to Claude Code with one command, then run weekly briefs, competitor teardowns and fatigue checks from the terminal. No API keys.
- **Author**: Apurv Singh
- **Published**: 2026-09-15
- **Category**: Product
- **URL**: https://marxx.ai/posts/connect-meta-ads-to-claude-code

---

I have had my ad account inside a chat window for a while now, and it is genuinely useful. You ask what changed last week, you get an answer with the numbers behind it, you move on.

Then I connected the same thing to Claude Code, and the questions changed shape. Not because the model got better. Because in a terminal the answer does not have to stay an answer. It can become a file, a commit, a cron job, a diff against last week's file. Chat gives you a reply. A terminal agent gives you something that runs again on Monday without you.

Here is the setup, then the four things I actually use it for, then the parts that do not work.

## The one command

Claude Code talks to Marxx over MCP, so there is nothing to install and no key to paste anywhere.

```bash
claude mcp add --transport http marxx https://api.marxx.ai/mcp --scope user
```

`--scope user` is the one flag worth caring about. Default scope is local, which means the connection only exists in the directory you happened to be standing in when you ran the command. Your ad account is not a per-project dependency. Add it once at user scope and it is there in every repo.

Then, inside a session:

```
/mcp
```

That kicks you to the browser, you sign into Marxx, you approve. No token in your shell history, no secret in a dotfile, nothing for a teammate to accidentally commit. Confirm it took:

```bash
claude mcp list
```

You want `marxx ✔ Connected`. If it says `! Needs authentication`, you skipped the `/mcp` step.

That is the whole setup. Meta and Google Ads both come through the same connection, because the accounts are already connected on the Marxx side. The assistant never touches an ad platform directly.

## What it can see, and what it cannot

Roughly twenty tools, in four clusters:

- **Your accounts.** Spend, structure and creative, read out of the connected Meta and Google accounts: `marxx_my_ads_overview`, `marxx_my_ads`, `marxx_ad_detail_by_id`, `marxx_account_audit`, `marxx_performance_brief`.
- **Competitors.** Live creative from brands you track and the teardown we run on it: `marxx_competitor_ad_fetcher`, `marxx_brand_teardown`, `marxx_competitor_creative_intelligence`.
- **Trends and gaps.** What your category is shipping now, and the angles your account has never tested: `marxx_trending_tactics`, `marxx_creative_gap_recommendations`.
- **Brand and audience.** The claims, constraints and personas a generated script has to stay inside: `marxx_brand_knowledge`, `marxx_products`, `marxx_audience_personas`.

Every one of them is read-only. Both ad platforms authorise on read scopes and nothing in the tool surface writes back, so Claude Code cannot pause a campaign, move a budget or edit an ad, no matter how the prompt is phrased or how enthusiastically you approved a tool call at 1am. This matters more in a terminal than in chat, because in a terminal you are handing an agent a bash loop and walking away. Publishing still happens in the Marxx app, behind an approval, by a human.

The other half of that list is the part no ad API can give you. Meta will tell you everything about the ads you ran. It will tell you nothing about the ads your competitor ran. Roughly half the questions I ask in the terminal are about accounts I do not own.

## Why the terminal answers differently

The reason this is worth a second setup, when you already have the same server in the desktop app, comes down to one thing: platform APIs answer in ad IDs, and ad IDs are not decisions.

Ask Meta's own endpoints what happened and you get rows keyed to campaign and ad identifiers. True, useless. You cannot ship `120210983745` again. Marxx rolls the same spend up by hook, angle, format and offer, so what comes back is "founder-confession openers are carrying 61% of purchases at 40% of spend", which is a thing you can brief on Tuesday.

Once the answer is structured like that, a terminal agent can do terminal things with it:

**It can write to disk.** "Pull last week's performance brief and write it to `notes/2026-w37.md`." Now you have a directory of weekly reads that diff against each other. Ask it next month which week the CPA turn actually started and it greps its own history instead of re-querying and re-guessing.

**It can read your repo.** This is the one I did not expect. The landing page that the ads point at is checked into a repo on the same machine. "Compare the three highest-spend hooks against the H1 and the first fold of `app/page.tsx` and tell me where the promise breaks." Ad-to-page message match, checked by something that can actually read both. No amount of chat context gets you that.

**It can run without you.** Headless mode with the server allowed:

```bash
claude -p "Pull the Meta performance brief for the last 7 days. \
Flag any ad whose CPA moved more than 25% week over week. \
Write it to ~/briefs/$(date +%F).md. If nothing moved, write nothing." \
  --allowedTools "mcp__marxx" --output-format json
```

`mcp__marxx` allows every tool on that server without a prompt per call, which is what you need for a run nobody is watching. Put it behind cron on Monday at 7am and the brief is sitting in the folder before standup. The "if nothing moved, write nothing" clause is doing real work: a report that only appears when something happened is a report people read.

**It can keep standing context.** Drop the things you would otherwise retype every session into `CLAUDE.md`:

```markdown
## Ads
Meta is the primary channel; Google is branded search defence, ignore it unless asked.
Target CPA is $38. Below $30 means tracking broke, not that we won.
Never report on the last 3 days, attribution has not settled.
```

That last line alone has saved me from more wrong conclusions than any dashboard ever did.

## Four prompts worth stealing

```
Which of my ads will fatigue in the next seven days, and what should replace them?

Tear down the last twenty ads Oatly shipped and tell me which hooks I have never run.

Audit the account structure. Where is budget sitting in ad sets that stopped converting?

Write three scripts for the gap you just found, in our brand voice, for the skeptical-switcher persona.
```

The fourth one only works because brand knowledge and personas are on the same connection as the performance data. A model writing ad copy without the claims file is writing fan fiction about your product.

## What does not work

**Do not ask for everything.** "Show me all ads from the last year" is a bad instruction to give an agent with tool access. Scope it: one account, one window, one question. The chart-heavy tools compact their data before it reaches the model, but a fishing expedition still burns context and returns mush.

**Scope the workspace before you ask anything.** If you run client-isolated workspaces, the session is pinned to one at a time, and Claude Code will call `marxx_select_workspace` itself. Check which one it picked before you trust a number. A right answer about the wrong client is worse than an error.

**Project scope is a trap for this server.** `--scope project` writes a `.mcp.json` your teammates get on checkout, which sounds helpful and mostly generates "needs authentication" confusion, because each of them still has to run `/mcp` and approve with their own Marxx account. The auth is per person by design. Use user scope and let people add it themselves.

**Disconnect in Marxx, not in Claude.** Removing the connector from Claude Code only forgets the URL. Revoke it in Marxx and the server stops answering whoever asks.

## The part that comes first

None of the above is the hard part. The hard part is upstream: your Meta account has to be connected, indexed and rolled up into hooks and angles before a single tool call means anything, and your competitors have to be tracked before anyone can tear them down. That happens inside Marxx, with us, when your workspace goes live. The two-minute terminal setup is the last step, not the first.

If you want to see what your own account looks like once it is parsed this way, book a call and we will run it on your ads rather than a demo account.

---
- [More Product articles](https://marxx.ai/posts/category/product)
- [All articles](https://marxx.ai/posts)