Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AIFire in da houseCheck it out free

MCP-Facebook

MCP.Pizza Chef: Tisik79

MCP-Facebook is a Model Context Protocol server that integrates with the Facebook Marketing API to enable AI models like Claude to manage, create, update, and analyze Facebook advertising campaigns, ad sets, and audiences. It supports campaign lifecycle management, audience creation including custom and lookalike audiences, basic ad set operations, and provides campaign insights. The server also helps generate AI-driven prompts for campaign creation, streamlining ad management workflows.

Use This MCP server To

Create, update, and delete Facebook ad campaigns programmatically Generate AI-based prompts for Facebook campaign creation Manage custom and lookalike audiences for targeted advertising Retrieve and analyze Facebook campaign performance insights Automate ad set creation and management within campaigns Integrate Facebook ad management into AI-powered workflows Enable AI assistants to interact with Facebook Marketing API securely

README

Facebook Ads MCP Server

This project provides a Model Context Protocol (MCP) server designed to interact with the Facebook Marketing API, allowing AI assistants like Claude to manage and analyze Facebook ad campaigns, ad sets, audiences, and more.

Features

  • Campaign Management: Create, read, update, delete campaigns.
  • Audience Management: Create custom and lookalike audiences, list audiences.
  • Ad Set Management: Create ad sets (basic implementation).
  • Analytics: Get campaign insights.
  • AI Assistance: Generate prompts for campaign creation based on templates.

Prerequisites

  • Node.js (v18 or later recommended)
  • npm (comes with Node.js)
  • A Facebook App with access to the Marketing API
  • A Facebook Ad Account ID
  • An Access Token with ads_management and ads_read permissions

Installation

  1. Clone the repository:
    git clone https://github.com/Tisik79/MCP-Facebook.git
    cd MCP-Facebook
  2. Install dependencies:
    npm install
  3. Configure Environment Variables: Create a .env file in the project root and add your Facebook App credentials:
    FACEBOOK_APP_ID=YOUR_APP_ID
    FACEBOOK_APP_SECRET=YOUR_APP_SECRET
    FACEBOOK_ACCESS_TOKEN=YOUR_ACCESS_TOKEN 
    FACEBOOK_ACCOUNT_ID=act_YOUR_ACCOUNT_ID 
    Replace placeholders with your actual values. Ensure the Access Token has the ads_management permission.

Usage

  1. Build the server:

    npm run build

    This compiles the TypeScript code to JavaScript in the dist folder.

  2. Run the server:

    npm start

    The server will start and listen for MCP connections via stdio.

  3. Connect with an MCP Client (e.g., Claude Desktop): Follow the instructions in CLAUDE_DESKTOP_GUIDE.md to configure your MCP client to connect to this server using the npm start command or by directly running node dist/index.js.

Available Tools (via MCP)

  • create_campaign: Creates a new ad campaign.
  • get_campaigns: Lists existing campaigns.
  • get_campaign_details: Gets details for a specific campaign.
  • update_campaign: Updates an existing campaign.
  • delete_campaign: Deletes a campaign.
  • create_custom_audience: Creates a custom, website, or engagement audience.
  • get_audiences: Lists available custom audiences.
  • create_lookalike_audience: Creates a lookalike audience.
  • create_ad_set: Creates a new ad set.
  • get_campaign_insights: Retrieves performance insights for a campaign.
  • generate_campaign_prompt: Generates a prompt for campaign creation using a template.

Refer to the server's tool descriptions in your MCP client for detailed parameter information.

Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues.

License

This project is licensed under the MIT License.

MCP-Facebook FAQ

What permissions are required to use MCP-Facebook?
You need a Facebook Access Token with ads_management and ads_read permissions to manage and read ad data.
How does MCP-Facebook assist with campaign creation?
It generates AI-driven prompts based on templates to help create effective Facebook ad campaigns.
What Facebook Marketing API features does MCP-Facebook support?
It supports campaign, ad set, and audience management, plus campaign insights retrieval.
What are the prerequisites for installing MCP-Facebook?
Node.js v18 or later, npm, a Facebook App with Marketing API access, an Ad Account ID, and a valid Access Token.
Can MCP-Facebook be used with AI models other than Claude?
Yes, it is compatible with any MCP-compliant AI models like OpenAI's GPT-4, Anthropic's Claude, and Google's Gemini.
How secure is the interaction between AI models and Facebook data?
MCP-Facebook uses scoped permissions and secure token handling to ensure safe and controlled access to Facebook Marketing API data.
Is it possible to extend MCP-Facebook for additional Facebook Marketing API features?
Yes, the server is modular and can be extended to support more API endpoints and functionalities as needed.