@channel47/meta-ads-mcp
v1.0.0
Published
Meta Ads MCP Server - Query and mutate Meta/Facebook/Instagram ads data via Graph API
Maintainers
Readme
@channel47/meta-ads-mcp
MCP server for Meta Ads (Facebook + Instagram) using the Graph API (v25.0).
This server exposes three tools expected by channel47 Meta workflows:
list_accountsquerymutate
Installation
Standalone
npx @channel47/meta-ads-mcp@latestMonorepo Development
cd mcps
npm install
npm run testConfiguration
Required
| Variable | Description |
|----------|-------------|
| META_ADS_ACCESS_TOKEN | Meta Graph API access token (long-lived user token or system user token) |
Optional
| Variable | Description |
|----------|-------------|
| META_ADS_ACCOUNT_ID | Default ad account ID used when account_id is omitted |
| META_ADS_READ_ONLY | Set to true to disable live mutations |
| META_ADS_REQUEST_TIMEOUT_MS | HTTP request timeout in milliseconds (default 30000) |
Tool Reference
list_accounts
List accessible ad accounts from GET /me/adaccounts.
Params:
status(optional): status filter (ACTIVE,DISABLED, etc.)
Notes:
- Account IDs are normalized without
act_prefix - Includes raw
account_statusand mapped status text - Follows Graph API cursor pagination to return all accessible accounts
query
Structured query wrapper for Meta Graph API entities:
campaignsadsetsadsinsightsaudiencescreatives
Core params:
entity(required)account_id(optional ifMETA_ADS_ACCOUNT_IDexists)fields,filters,sort,limitinline_insights_fields(optional on non-insightsentities): appends nested inline projection likeinsights{spend,ctr,frequency}
Insights params:
date_range: preset (today,yesterday,last_7d,last_14d,last_30d,this_month,this_week_mon_today,last_quarter) or{ since, until }level:campaign,adset, oradtime_increment:1,7,monthly, etc.breakdowns: array of dimensions (age,gender,publisher_platform, etc.)
mutate
Mutation tool with dry-run safety by default.
Operation format:
{
"entity": "campaign",
"action": "update",
"id": "123456789",
"params": {
"daily_budget": "5000"
}
}Supported entities:
campaignadsetadaudiencecreative
Supported actions:
createupdatepauseenablearchivedelete
Top-level params:
operations(required)dry_run(defaulttrue)partial_failure(defaulttrue)
Behavior Notes
- Auth is sent via
Authorization: Bearer <token>request header - API retries once on:
- HTTP
429 - Graph error codes
17and32
- HTTP
- For throttled retries,
Retry-Afterheader is used when available; otherwise fallback is60s - Requests are aborted on timeout (default
30000ms, configurable viaMETA_ADS_REQUEST_TIMEOUT_MS) - Budgets are returned in minor currency units (example:
5000means$50.00USD)
Development Commands
cd meta-ads
npm test
node server/index.jsLicense
MIT
