Run Meta Ads from Codex
Autonomous Meta ad management from OpenAI's Codex CLI — 36 Meta tools, scheduled agents, daily creative-fatigue and pacing checks while you sleep.
15 tool calls / month free · No credit card · Setup in ~2 minutes
Adspirer is the MCP server that connects OpenAI's Codex CLI to your Meta (Facebook + Instagram) ad accounts. Most AI clients are interactive — you ask, they answer. Codex is autonomous: define a Meta task once (e.g., "every morning, pull yesterday's spend, ROAS, and frequency by ad set, flag fatigue or pacing anomalies, send me a summary"), and the agent runs it on your schedule. Run the installer (`bash <(curl -fsSL ...codex/adspirer/install.sh)`), authenticate with `codex mcp login adspirer`, and Codex gets all 36 Meta tools — image / video / carousel / Reels / DCO campaign creation, creative-fatigue detection, audience research, placement optimization, lead-form pulls. Critically, even in autonomous mode Adspirer's safety rules hold: every new campaign creates paused, budget changes require explicit confirmation, and Adspirer cannot delete campaigns. Free tier (15 calls / month) is enough for ~3-7 daily check-ins.
What you can do
36 tools across Meta Ads. The eight you'll use most:
Launch new campaigns
Build image, video, carousel, DCO, or Reels campaigns from a brief. Adspirer validates creative against Meta's requirements, plans the ad sets, and creates everything paused so you review before going live.
Pause underperformers
Pause individual ads, ad sets, or full campaigns by name from chat. Resume them later just as easily — Adspirer cannot delete existing campaigns (hard-coded safety).
Audit creative fatigue
Surface ads that have been running 14+ days with declining CTR — Adspirer recommends which creatives to refresh before they tank performance.
Find wasted spend
Flag campaigns running under your ROAS threshold so you can pause or reallocate budget. Works across active and paused campaigns.
Research audiences
Search Meta's targeting catalog by interest, demographic, or behavior. Browse existing custom audiences (lists, lookalikes, website, engagement) before building new ones.
Pull lead-form submissions
List configured lead forms and pull recent submissions, grouped by campaign — route them into your CRM workflow without leaving chat.
Optimize placements & budget
Compare CPA across Feed, Stories, Reels, Marketplace, and Audience Network. Reallocate budget toward winning ad sets — Adspirer never increases an existing budget without explicit confirmation.
Diagnose anomalies
When CPA spikes or CTR drops, ask why. Adspirer inspects audience changes, creative rotation, and platform-level events to explain the cause and recommend a fix.
Campaign types you can launch
Every Meta Ads format Adspirer supports — request one in chat and Codex CLI builds the campaign paused for review.
Image campaigns
Single-image ads across Feed, Stories, and Marketplace. 1080×1080 minimum, validated before launch.
Video campaigns
Video ads up to 240s, 1:1 / 4:5 / 9:16 aspect ratios. MP4 or MOV, validated against Meta's spec.
Carousel campaigns
2–10 cards per ad, each with their own creative + headline + link. Great for product catalogs.
Reels campaigns
Vertical video for Instagram Reels and Facebook Reels. 9:16 aspect, optimized for mobile feeds.
Lead Gen Forms
On-platform forms that capture leads inside Facebook / Instagram — no landing page needed.
DCO (Dynamic Creative Optimization)
Provide multiple creative variants; Meta auto-mixes images, headlines, and descriptions to find winners.
Sample prompts
Codex handles long-running agent loops; brief it like you would Claude Code.
Meta performance audit — A monthly audit that surfaces which campaigns to keep, kill, or scale.
Creative fatigue check — Catch fatigued ads before they drag down ad-set performance.
Launch an image campaign — End-to-end image campaign creation, with creative validation first.
Optimize placements — Move spend toward the placements that are actually converting for you.
Lead-form pull — Quick pull of lead-gen data without leaving chat.
Diagnose a CPA spike — Anomaly diagnosis that explains *why*, not just *that*.
Who this is for
Real workflows from people running Meta Ads through Codex CLI.
Engineering team at a DTC brand running Meta as a 24/7 channel
Configure a Codex agent with default_prompt: "every 6 hours, scan all active Meta ad sets — flag any with frequency > 3, 7-day CTR decline > 25%, or CPA spike > 40% vs previous week. Post findings to #meta-alerts." The agent loops; humans approve fixes.
Outcome: Effectively a 24/7 Meta SRE — fatigue and pacing problems get caught the same day they emerge, not at the next weekly QBR.
Lean growth team with no full-time media buyer
Schedule a daily Codex agent: "each morning at 8am, pull last 24h Meta performance, compare to 7-day average, flag any campaign with CPA > 30% increase. Email me a one-paragraph summary before standup." No dashboard logins; the inbox is the dashboard.
Outcome: Replaces a daily 20-minute dashboard check with a 30-second email read; the team only opens Ads Manager when the agent flags something.
Solo founder running Meta lead gen alongside engineering
Configure a weekly Codex agent for the Meta lead-form workflow: "every Monday, pull the last 7 days of submissions from all Meta lead forms, deduplicate against Hubspot exports in `~/exports/`, write the new-leads list to `leads/$(date).csv`." Agent runs unattended.
Outcome: Lead-form data lives next to the rest of the founder's data without a Zapier subscription or a manual CSV download every week.
Agency ops engineer running Meta for multiple clients
One Codex agent per client, each with its own `~/.codex/agents/{client}.toml` and `switch_primary_account` set per client. Default prompt: "weekly Monday: wasted-spend + creative-fatigue audit for {client}, write to `clients/{client}/meta-{date}.md`." All clients audited unattended; agency ops reviews the markdown.
Outcome: Weekly Meta audits across 5+ clients run in parallel without human time; the ops engineer reviews finished markdown instead of pulling each account live.
Adspirer vs alternatives
For running Meta Ads from Codex CLI.
| Capability | Adspirer (this page) | DIY MCP server | Legacy SaaS dashboard |
|---|---|---|---|
| Install | One-line installer + `codex mcp login adspirer` | Build MCP server, write Codex agent | No CLI / agent support |
| Cost — entry tier | Free (15 calls / mo) | Hosting + maintenance | $200-500 / mo minimum |
| Autonomous / scheduled runs | Yes — Codex agents run on cron-like schedules | Whatever you build | Vendor-locked workflows |
| Multi-client agent configs | Yes — one TOML per client | Manual | Yes — but each account billed |
| Brand-workspace pattern | `$adspirer-setup` → AGENTS.md | Manual | No equivalent |
| Write capability | Image / video / carousel / Reels / DCO, paused on create | Whatever you build | Mostly read-only |
| Autonomous safety | Paused-on-create + budget-confirmation hard-coded | Up to you | Varies |
| Anomaly alerting | Native (`detect_meta_creative_fatigue`, `explain_meta_anomaly`) | Build it | Sometimes |
Pricing
Start free. Upgrade if you outgrow it.
How it works
From sign-up to your first launched campaign in three steps.
Connect
Paste the Adspirer MCP URL into Codex CLI, complete OAuth in your browser, and link your Meta Ads account. About 2 minutes.
Manage
Ask Codex CLI for an audit, launch a new campaign, pause underperformers, or pull a report. Adspirer handles the 36 Meta Ads tools behind the scenes.
Scale
Switch between accounts in chat, run the same audit across clients, and let agency SOPs live in your AI assistant — no extra dashboard logins.
Frequently asked questions
About running Meta Ads from Codex CLI.
Connect Codex CLI to Adspirer
For technical readers — the exact steps. Most users finish this in about 2 minutes. Required: OpenAI API access.
Edit your Codex MCP config
Add an adspirer entry with URL https://mcp.adspirer.com/mcp and OAuth auth.
Authenticate via OAuth
Run any Codex command — the first invocation triggers the OAuth flow.
Related integrations
Same Codex CLI, different platform — or same Meta Ads, different AI client.
Codex CLI × other platforms
Meta Ads × other AI clients
- ChatGPT × Meta Ads →
- Claude × Meta Ads →
- Claude Code × Meta Ads →
- Cursor × Meta Ads →
- Windsurf × Meta Ads →
- Gemini CLI × Meta Ads →
- OpenClaw × Meta Ads soon
- Manus × Meta Ads soon
Go deeper
Ready to connect Codex CLI to Meta Ads?
Start free — 15 tool calls per month, no credit card. Setup takes about 2 minutes.
Try Adspirer freeLast updated April 28, 2026.