+

Connect Meta Ads to Codex

Codex reads okaytorun from ~/.codex/config.toml and authenticates with a personal access token from an environment variable. Once connected, Codex can read campaigns, ad sets, budgets, bids and custom audiences, and stage changes that wait for your approval. About 2 minutes.

⏱ About 2 minutes7 read · 5 write toolsNo developer token

Step by step

  1. Connect Meta Ads in okaytorun

    In Meta Business Settings, open System users, add one, assign your ad account to it and click Generate token with ads_read and ads_management and no expiry (it asks for a Meta app; if you have none, create a Business app at developers.facebook.com first). Then sign in at okaytorun.com, open Connections → Meta Ads → Connect, paste the token and choose your Meta ad account. okaytorun only ever touches what you select.

  2. Create a token

    In okaytorun → Settings → AI clients, create a personal access token and export it:

    export OKAYTORUN_TOKEN=adp_pat_...
  3. Add okaytorun to ~/.codex/config.toml

    [mcp_servers.okaytorun]
    url = "https://okaytorun.com/api/mcp/okaytorun"
    bearer_token_env_var = "OKAYTORUN_TOKEN"
  4. Ask your first question

    Try: Which Meta ad sets spend the most per purchase? okaytorun reads live data and stages any change for your approval in the Changes panel.

What to ask Codex next

  • Compare cost per lead on Meta and Google Ads for the last 30 days.
  • Which ad sets have the highest frequency and falling CTR?
  • Summarize spend and results by campaign this month.
  • Which creatives are fatiguing?

What Codex can do in Meta Ads

7 read tools and 5 write tools. Writes are staged and only run after you approve them in okaytorun. See every Meta Ads tool.

  • getAccount

    Account name, currency and time zone for the selected ad account.

    Read
  • getCampaigns

    All campaigns with status, daily budget (null when the budget is lifetime or set elsewhere), budgetMode and performance (cost, clicks, impressions, conversions, conversionValue, ROAS = conversionValue / cost, CPA, CTR). ROAS is null when the platform reports no conversion value.

    Read
  • getAdSets

    All ad sets with status, bid (0 = automatic bidding), budget and performance (incl. conversionValue and ROAS). Optionally filter by campaign.

    Read
  • auditAccount

    Full account audit in one call: runs every check (budget-capped winners and ad sets spending without results) and returns findings ranked by money per week (waste or missed), each with evidence and the stage tool that fixes it. Use it first for "where am I wasting money" or "what should I fix".

    Read
  • getChangeHistory

    Changes staged, applied, denied or undone in this workspace, newest first.

    Read
  • reviewChangeImpact

    Did an applied change work? Compares the campaigns and ad groups a change touched over equal windows before and after it was applied (daily averages; the day it was applied is skipped) and returns improved / worse / neutral / inconclusive / too_early with the numbers. Pass a changeId from getChangeHistory, or omit it to review the latest applied changes. Report the verdict with its caveats: other changes and seasonality also move the numbers.

    Read
  • stageUndo

    Propose rolling back a change that was already applied, e.g. "undo what you did at 14:32" or "put the Brand budget back". Find the change with getChangeHistory first (times are UTC; convert with the account time zone from getAccount) and confirm it is the right one; only changes with canUndo can be undone. The undo waits for the user's approval in okaytorun like any other change.

    Needs approval
  • stageCampaignStatus

    Propose pausing or enabling a campaign. Requires user approval.

    Needs approval

Questions

Do I need a Meta Ads developer token or API key?

No developer token and no Meta app review. You create a System User access token in Meta Business Settings with ads_read and ads_management and paste it into okaytorun once. It is stored by our connection broker and never shown again.

Can Codex change my Meta Ads account on its own?

No. Codex can read data and stage changes, but every change waits for your approval in okaytorun's Changes panel. There is no approve tool for AI clients, and every applied change can be undone on Growth and Plus.

What does it cost?

Every plan starts with a 7-day free trial (card required, not charged until day 8). After that, Basic is $29/mo, Growth $79/mo and Plus $199/mo billed yearly. Tool calls from your own AI client count as operations, which are unlimited on Growth and Plus. See pricing.

Codex says sign-in failed. What now?

Some clients don't support OAuth for remote MCP servers yet. Create a personal access token in okaytorun → Settings → AI clients and add it as Authorization: Bearer adp_pat_….

Your next fix, already drafted.

7-day free trial on every plan. Cancel anytime before day 8.