Automated hourly management of Meta (Facebook) Ads via the Pipeboard MCP server and Claude.
Runs on Windows, Linux, and macOS using a pure-Python scheduler (APScheduler) - no system cron required.
This repo contains a scheduled automation that:
- Connects to Pipeboard's Meta Ads MCP server
-
- Uses Claude (via the Anthropic API with MCP connector) to evaluate ad performance
-
- Pauses underperforming ads based on configurable rules
-
-
Logs every action to
logs/automation.log -
scheduler.py (Python, APScheduler) --- runs every hour ---> pause_ads.py | v Anthropic API (Claude) | v Pipeboard MCP ---> Meta Ads API | v logs/automation.log logs/scheduler.loggit clone https://github.com/indianbill007/pipeboard.git cd pipeboardpython -m pip install -r requirements.txt
Copy
.env.exampleto.envand fill in:ANTHROPIC_API_KEY=sk-ant-... PIPEBOARD_API_KEY=pk_...Edit
config.yamlto set your thresholds (CPA, CTR, ROAS, frequency, etc.)python pause_ads.py --dry-run
python scheduler.py
That's it. The scheduler now runs
pause_ads.pyevery hour on the hour (minute 0, UTC).Keep the process alive with whichever tool is natural on your OS:
- Linux:
systemdservice,nohup,tmux,screen, or Docker -
- macOS:
launchdplist,nohup,tmux, or Docker -
-
Windows: Task Scheduler (run at login / as a service), NSSM, or Docker Desktop
-
python scheduler.py # default: hourly at minute 0 python scheduler.py --interval 30 # every 30 minutes python scheduler.py --cron "*/15 * * * *" # every 15 minutes, custom cron python scheduler.py --run-now # also run once immediately on startup python scheduler.py --dry-run # evaluate only, no ads will be paused
File Purpose scheduler.pyPlatform-independent Python scheduler (APScheduler) pause_ads.pyCore automation: fetches metrics and pauses ads config.yamlPause/action rules and thresholds requirements.txtPython dependencies .env.exampleTemplate for environment variables logs/Log output directory (auto-created) An ad will be paused if ANY of these conditions are met:
- CPA (Cost Per Action) exceeds the configured max
-
- CTR (Click-Through Rate) falls below the configured min with spend above threshold
-
- ROAS (Return On Ad Spend) drops below the configured floor over lookback window
-
- Frequency (ad fatigue) exceeds the configured max
-
-
Spend-with-zero-conversions exceeds the configured max
-
All thresholds are tunable per account in
config.yaml. -
--dry-runflag lists ads that would be paused without taking action-
- Every action writes to
logs/automation.logwith timestamp, ad id, rule triggered, metric value - Scheduler is configured with
max_instances=1andcoalesce=Trueso runs never overlap -
Ads younger than
min_age_hours(default 24h) are never touched, protecting ads still in Meta's learning phase -
MIT
- Every action writes to
-
-
- macOS:
- Linux:
-