Meta Ads MCP serverand Python AI tasks
qbash hosts a Meta Ads MCP server you can use in Claude, ChatGPT, Codex, Cursor, Grok Bot and Muse. Developers use qbash Tasks to write cloud-hosted Python functions that pair Meta Ads with models such as Claude and GPT.
Add the qbash MCP
Use Meta Ads from Claude Code, Codex, Cursor and other MCP clients. Connect Meta Ads in qbash, and your agent can work with its data and build Tasks that call it.
claude mcp add --transport http qbash https://mcp.qbash.com/mcp
Then run /mcp in Claude Code and sign in with qbash.
- List the ad accounts the connected user or system user can reach
- Read an ad account's currency, time zone, status and amount spent
- Read spend, impressions, clicks, results, CPA and ROAS by account, campaign, ad set or ad
- List campaigns with their objective, status and budget
- Create a campaign with an objective, special ad categories and an optional campaign budget
- Pause, activate or rename a campaign, or change its budget
Write a Meta Ads task in Python
A qbash Task is a Python function hosted in the cloud. Python is the runtime and defines the process, and built-in inline prompts run on leading models such as Claude, GPT, Gemini and Grok.
Run a Task on a schedule, from an HTTP request or when a connected app sends an event. Your agents and chat tools call it over MCP.
Each run is logged with its inputs and results, and you can turn data logging off for any Task. Every Task has version control, and each run is locked to the version it ran.
Flag the ad sets to pause from last week's CPA and ROAS
get_insights reads the last seven days for every ad set in the account. An inline prompt compares each ad set's cost per purchase and ROAS and names the ones to pause, with a reason for each.
report = qbash.integrations.meta_ads.get_insights(
object_id="act_1234567890",
level="adset",
date_preset="last_7d",
fields=["campaign_name", "adset_id", "adset_name", "spend", "impressions", "clicks", "actions", "cost_per_action_type", "purchase_roas"],
limit=200,
)
rows = report["data"]
if rows:
review = qbash.ai.run_prompt(
slug="meta-ads-pause-review",
variables={"ad_sets": json.dumps(rows)},
)
qbash.output(review)
else:
qbash.output("Meta returned no ad set delivery for this account in the last 7 days.")
Sample get_insights response
{
"status": "success",
"data": [
{
"campaign_name": "Prospecting, US",
"adset_id": "120210000000000001",
"adset_name": "Lookalike 1%, purchasers",
"spend": "842.17",
"impressions": "61204",
"clicks": "1033",
"actions": [
{
"action_type": "purchase",
"value": "19"
}
],
"cost_per_action_type": [
{
"action_type": "purchase",
"value": "44.32"
}
],
"purchase_roas": [
{
"action_type": "omni_purchase",
"value": "2.41"
}
],
"date_start": "2026-11-05",
"date_stop": "2026-11-11"
},
{
"campaign_name": "Prospecting, US",
"adset_id": "120210000000000002",
"adset_name": "Interest, home fitness",
"spend": "613.50",
"impressions": "70318",
"clicks": "688",
"actions": [
{
"action_type": "purchase",
"value": "4"
}
],
"cost_per_action_type": [
{
"action_type": "purchase",
"value": "153.38"
}
],
"purchase_roas": [
{
"action_type": "omni_purchase",
"value": "0.62"
}
],
"date_start": "2026-11-05",
"date_stop": "2026-11-11"
}
],
"paging": {
"cursors": {
"before": "MAZDZD",
"after": "MQZDZD"
}
}
}
Custom MCP server
Build a custom MCP server with Meta Ads
Create a hosted MCP server that combines Meta Ads tools with your other connectors, Tasks and memory folders. You choose each tool it exposes, so a server can share Meta Ads reads with write tools left off.
Share the server with your team, and each person adds it to the client they already use.
Meta Ads MCP questions
Does Meta Ads have an official MCP server?
Meta runs an official Ads MCP server at mcp.facebook.com/ads, and since July 2026 any developer with a Meta app can connect it to Claude, ChatGPT or their own agent. The qbash server is a separate one that puts Meta Ads on one URL with your other connectors and exposes the same methods to Python tasks.
Can the Meta Ads MCP server pause or change ads?
The update methods pause or activate campaigns, ad sets and ads and change budgets, bids and targeting. Connect with ads_read only if chat users should just read Insights and settings.
What does the Meta Ads connector need to connect?
A Meta sign-in that grants the ads_read scope for reports, plus ads_management for the methods that create or change ads. A business can use a system user token from Business Manager instead, so the connection outlasts any one employee.
Related analytics connectors
Build a Meta Ads task
Write it in Python with AI steps, or describe it to your coding agent through the qbash MCP.