facebook-ads-mcp-server
Provides integration with the Facebook Ads platform via the Meta Marketing API, allowing management of ad accounts, campaigns, ad sets, ads, creatives, and insights.
Provides integration with the Meta Marketing API for Facebook Ads, enabling management of ad accounts, campaigns, ad sets, ads, creatives, and insights.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@facebook-ads-mcp-serverlist my ad accounts"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Facebook Ads MCP Server
MCP server for Meta/Facebook Marketing API workflows.
It provides tools to:
View ad accounts, campaigns, ad sets, ads, creatives, and activity history.
Create and update campaigns, ad sets, ads, and creatives.
Fetch insights at account/campaign/adset/ad level.
Upload ad images (local file path only).
Requirements
Python 3.10+
A Meta user access token with required scopes
Access to at least one ad account
Related MCP server: Meta Ads MCP Server
Installation
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtAuthentication
The server supports either:
CLI arg:
--fb-token <TOKEN>Environment variable:
FACEBOOK_ACCESS_TOKEN(orFB_ACCESS_TOKEN)
Recommended local setup (.env)
cp .env.example .env
# then set FACEBOOK_ACCESS_TOKEN in .envThe server automatically loads .env via python-dotenv.
Running Locally
python server.py --fb-token YOUR_META_ACCESS_TOKENor with .env configured:
python server.pyMCP Client Configuration
Example:
{
"mcpServers": {
"fb-ads-mcp-server": {
"command": "python",
"args": ["/absolute/path/to/server.py"],
"env": {
"FACEBOOK_ACCESS_TOKEN": "YOUR_META_ACCESS_TOKEN"
}
}
}
}If your client does not support env, pass --fb-token in args.
Tool Coverage
Read/List
list_ad_accountsget_details_of_ad_accountget_campaigns_by_adaccount,get_campaign_by_idget_adsets_by_adaccount,get_adsets_by_campaign,get_adsets_by_ids,get_adset_by_idget_ads_by_adaccount,get_ads_by_campaign,get_ads_by_adset,get_ad_by_idget_ad_creatives_by_ad_id,get_ad_creative_by_idget_activities_by_adaccount,get_activities_by_adset
Create/Update
create_campaign,update_campaigncreate_adset,update_adsetcreate_ad,update_adcreate_ad_creative,create_link_ad_creativeupload_ad_image
Insights
get_adaccount_insightsget_campaign_insightsget_adset_insightsget_ad_insightsfetch_pagination_url
Important: upload_ad_image Is Local Path Only
upload_ad_image intentionally accepts only:
act_idimage_pathoptional
name
It does not accept image_url.
Reason: URL ingestion through /{ad_account_id}/adimages is inconsistent across app/account capability states and commonly fails even when local upload works. Restricting this tool to local paths avoids ambiguous behavior.
Example:
upload_ad_image(
act_id="act_1234567890",
image_path="/absolute/path/to/creative.png",
name="creative_v1"
)Permissions and Access Checklist
Need the full end-to-end setup for Meta Business Center + App Dashboard? See docs/meta-business-center-setup.md.
For most ad management/read workflows, ensure the token has:
ads_managementads_readbusiness_management
Page-related creative/ad flows may additionally need page scopes such as:
pages_show_listpages_read_engagementpages_manage_ads
Operational requirements:
The user tied to the token is added to the target ad account with sufficient role (typically Advertiser/Admin).
The app is configured for Marketing API use case.
In Development mode, only app roles/test users can use the app token flow.
For non-role external users, required permissions/features must be approved for advanced access and app must be Live.
Common Failure Modes
(#200) Permissions error:Missing permission scope on token, or user lacks ad account role.
Empty ad account list:
User/token has no accessible ad accounts.
upload_ad_imagefile error:image_pathis missing, relative to wrong runtime location, or file does not exist.
Security Notes
Never commit real tokens.
.envis git-ignored; keep secrets there for local use.Rotate tokens if they were ever exposed.
Development
Run a quick syntax check:
python3 -m py_compile server.pyLicense
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/HeroBrian389/facebook-ads-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server