by brijr
MCP Server for connecting to the Meta Marketing API
# Add to your Claude Code skills
git clone https://github.com/brijr/meta-mcpA comprehensive Model Context Protocol (MCP) server that enables AI assistants like Claude to interact with Facebook/Instagram advertising data through the Meta Marketing API. This server provides full campaign lifecycle management, analytics, audience targeting, and creative optimization capabilities.
npm install -g meta-ads-mcp
Create or edit your MCP config:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonMinimal config:
{
"mcpServers": {
"meta-ads": {
"command": "npx",
"args": ["-y", "meta-ads-mcp"],
"env": {
"META_ACCESS_TOKEN": "your_access_token_here"
}
}
}
}
If your app requires appsecret_proof, add META_APP_SECRET:
{
"mcpServers": {
"meta-ads": {
"command": "npx",
"args": ["-y", "meta-ads-mcp"],
"env": {
"META_ACCESS_TOKEN": "your_access_token_here",
"META_APP_SECRET": "your_app_secret"
}
}
}
}
npm run health-check
No comments yet. Be the first to share your thoughts!
npm install -g meta-ads-mcp
git clone https://github.com/wipsoft/meta-mcp.git
cd meta-ads-mcp
npm install
npm run build
# Clone the repository first
git clone https://github.com/wipsoft/meta-mcp.git
cd meta-ads-mcp
# Run the interactive setup
npm run setup
The setup script will:
ads_read and ads_management permissionsappsecret_proof, set META_APP_SECRET (see below)~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonIf the file doesn't exist, create it with the following content:
{
"mcpServers": {
"meta-ads": {
"command": "npx",
"args": ["-y", "meta-ads-mcp"],
"env": {
"META_ACCESS_TOKEN": "your_access_token_here"
}
}
}
}
{
"mcpServers": {
"meta-ads": {
"command": "npx",
"args": ["-y", "meta-ads-mcp"],
"env": {
"META_ACCESS_TOKEN": "your_access_token_here",
"META_APP_ID": "your_app_id",
"META_APP_SECRET": "your_app_secret",
"META_AUTO_REFRESH": "true",
"META_BUSINESS_ID": "your_business_id"
}
}
}
}
If you've cloned the repository locally:
{
"mcpServers": {
"meta-ads": {
"command": "node",
"args": ["/absolute/path/to/meta-ads-mcp/build/index.js"],
"env": {
"META_ACCESS_TOKEN": "your_access_token_here"
}
}
}
}
Cursor uses the same MCP configuration as Claude Desktop. Add the configuration to your Cursor settings:
# Run health check to verify everything is working
npm run health-check
# Install Node.js if not installed
# macOS: brew install node
# Windows: Download from nodejs.org
# Linux: Use your package manager
# Verify installation
node --version
npm --version
npx --version
# Fix npm permissions (macOS/Linux)
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
# Or install without sudo
npm config set prefix ~/.npm-global
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
# Test your token manually
curl -G \
-d "access_token=YOUR_ACCESS_TOKEN" \
"https://graph.facebook.com/v23.0/me/adaccounts"
If the response says appsecret_proof is required, set META_APP_SECRET in your MCP server environment.
~/Library/Logs/Claude/mcp*.log%APPDATA%\Claude\logs\mcp*.log# macOS/Linux - View logs
tail -f ~/Library/Logs/Claude/mcp*.log
# Windows - View logs
type "%APPDATA%\Claude\logs\mcp*.log"
# Test the MCP server directly
npx -y meta-ads-mcp
# Or if installed locally
node build/index.js
Enable debug logging by adding to your environment:
{
"mcpServers": {
"meta-ads": {
"command": "npx",
"args": ["-y", "meta-ads-mcp"],
"env": {
"META_ACCESS_TOKEN": "your_access_token_here",
"META_MCP_DEBUG": "1",
"NODE_ENV": "development"
}
}
}
}
For web applications, you can deploy this server to Vercel and expose an HTTP MCP endpoint:
https://your-project.vercel.app/api/mcp{
"mcpServers": {
"meta-ads-remote": {
"url": "https://your-project.vercel.app/api/mcp",
"headers": {
"Authorization": "Bearer your_session_token"
}
}
}
}
Note: You need to authenticate against your deployment to get a session token.
For Vercel deployments, use mcp-remote to bridge HTTP to stdio:
{
"mcpServers": {
"meta-ads": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://your-project.vercel.app/api/mcp",
"--header",
"Authorization:${META_AUTH_HEADER}"
],
"env": {
"META_AUTH_HEADER": "Bearer your_session_token_here"
}
}
}
}
This MCP server provides 25 comprehensive tools across all major Meta advertising categories:
get_insights - Get detailed performance metrics (impressions, clicks, ROAS, CTR, CPC, etc.)compare_performance - Side-by-side performance comparison of multiple campaigns/adsexport_insights - Export performance data in JSON or CSV formatscreate_campaign - Create new advertising campaigns with full configuration (includes special_ad_categories)update_campaign - Modify existing campaigns (name, budget, status, etc.)pause_campaign - Pause active campaignsresume_campaign - Resume/activate paused campaignscreate_ad_set - Create ad sets with detailed targeting, budgets, and optimization goalslist_ad_sets - List and filter ad sets within campaignscreate_ad - Create individual ads within ad sets using creative IDslist_ads - List and filter ads by ad set, campaign, or accountlist_audiences - List all custom audiences for an accountcreate_custom_audience - Create custom audiences from various sourcescreate_lookalike_audience - Generate lookalike audiences from source audiencesget_audience_info - Get detailed information about specific audienceslist_ad_creatives - List all ad creatives for an accountcreate_ad_creative - Create new ad creatives with rich specifications (supports external image URLs)health_check - C