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

facebook-ads-mcp-server

MCP.Pizza Chef: gomarble-ai

The facebook-ads-mcp-server is an MCP server that acts as a bridge to Facebook Ads, enabling programmatic access to ad data and management features. It simplifies integration with Facebook Ads APIs, allowing developers to query, manage, and automate ad campaigns within the MCP ecosystem. The server supports easy one-click setup for Windows and MacOS, making it accessible for developers to quickly connect Facebook Ads data to LLM-powered workflows and tools.

Use This MCP server To

Query Facebook Ads campaign performance data programmatically Manage Facebook Ads campaigns via MCP-enabled tools Automate ad budget adjustments based on real-time data Integrate Facebook Ads data into AI-driven marketing dashboards Generate ad performance reports using LLMs Trigger marketing actions based on ad metrics Sync Facebook Ads data with CRM or analytics platforms

README

Facebook Ads MCP Server

smithery badge

This project provides an MCP server acting as an interface to the Facebook Ads, enabling programmatic access to Facebook Ads data and management features.

claude_demo.mp4

Easy One-Click Setup

For a simpler setup experience, we offer ready-to-use installers:

  • ⊞ Windows: 👉 Download gomarble_mcp_tools.exe
  •  MacOS: 👉 Download gomarble_mcp_tools.pkg

What It Does

  • Installs and configures the MCP server locally
  • Automatically handles environment setup
  • Prompts for Facebook token authentication during the process which is optional
  • If facebook access token is not provided then connect to GoMarble's server to create the token on your behalf

Important Disclaimer

This setup does not require you to manually obtain a Facebook Developer Access Token.

Instead, it connects securely to GoMarble's server to create the token on your behalf. GoMarble does not store your token — it is saved locally on your machine for use with the MCP server.


Setup

Prerequisites

  • Python 3.10+
  • Dependencies listed in requirements.txt
  1. (Optional but Recommended) Create and Activate a Virtual Environment:

    python3 -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`

    Using a virtual environment helps manage project dependencies cleanly[Source].

  2. Install Dependencies:

    pip install -r requirements.txt
  3. Obtain Facebook Access Token: Secure a Facebook User Access Token with the necessary permissions (e.g., ads_read). You can generate this through the Facebook Developer portal. Follow this link.

Usage with MCP Clients (e.g., Cursor, Claude Desktop)

To integrate this server with an MCP-compatible client, add a configuration(Claude) similar to the following. Replace YOUR_FACEBOOK_ACCESS_TOKEN with your actual token and adjust the path to server.py if necessary.

{
  "mcpServers": {
    "fb-ads-mcp-server": {
      "command": "python",
      "args": [
        "/path/to/your/fb-ads-mcp-server/server.py",
        "--fb-token",
        "YOUR_FACEBOOK_ACCESS_TOKEN"
      ]
      // If using a virtual environment, you might need to specify the python executable within the venv:
      // "command": "/path/to/your/fb-ads-mcp-server/venv/bin/python",
      // "args": [
      //   "/path/to/your/fb-ads-mcp-server/server.py",
      //   "--fb-token",
      //   "YOUR_FACEBOOK_ACCESS_TOKEN"
      // ]
    }
  }
}

Restart the MCP Client app after making the update in the configuration.

(Note: On Windows, you might need to adjust the command structure or use cmd /k depending on your setup.)

Debugging the Server

Execute server.py, providing the access token via the --fb-token argument.

python server.py --fb-token YOUR_FACEBOOK_ACCESS_TOKEN

Available MCP Tools

This MCP server provides tools for interacting with Facebook Ads objects and data:

Tool Name Description
Account & Object Read
list_ad_accounts Lists ad accounts linked to the token.
get_details_of_ad_account Retrieves details for a specific ad account.
get_campaign_by_id Retrieves details for a specific campaign.
get_adset_by_id Retrieves details for a specific ad set.
get_ad_by_id Retrieves details for a specific ad.
get_ad_creative_by_id Retrieves details for a specific ad creative.
get_adsets_by_ids Retrieves details for multiple ad sets by their IDs.
Fetching Collections
get_campaigns_by_adaccount Retrieves campaigns within an ad account.
get_adsets_by_adaccount Retrieves ad sets within an ad account.
get_ads_by_adaccount Retrieves ads within an ad account.
get_adsets_by_campaign Retrieves ad sets within a campaign.
get_ads_by_campaign Retrieves ads within a campaign.
get_ads_by_adset Retrieves ads within an ad set.
get_ad_creatives_by_ad_id Retrieves creatives associated with an ad.
Insights & Performance Data
get_adaccount_insights Retrieves performance insights for an ad account.
get_campaign_insights Retrieves performance insights for a campaign.
get_adset_insights Retrieves performance insights for an ad set.
get_ad_insights Retrieves performance insights for an ad.
fetch_pagination_url Fetches data from a pagination URL (e.g., from insights).
Activity/Change History
get_activities_by_adaccount Retrieves change history for an ad account.
get_activities_by_adset Retrieves change history for an ad set.

(Note: Most tools support additional parameters like fields, filtering, limit, pagination, date ranges, etc. Refer to the detailed docstrings within server.py for the full list and description of arguments for each tool.)

(Note: If your Facebook access token expires, you'll need to generate a new one and update the configuration file of the MCP Client with new token to continue using the tools.)

Dependencies

  • mcp (>=1.6.0)
  • requests (>=2.32.3)

License

This project is licensed under the MIT License.


Installing via Smithery

To install Facebook Ads Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @gomarble-ai/facebook-ads-mcp-server --client claude

facebook-ads-mcp-server FAQ

How do I install the facebook-ads-mcp-server?
You can install it using the provided one-click installers for Windows and MacOS available on the GitHub repository.
Does the server support real-time Facebook Ads data access?
Yes, it provides programmatic access to Facebook Ads data and management features in real time.
Can I use this MCP server with different LLM providers?
Yes, it is provider-agnostic and works with models like OpenAI, Claude, and Gemini.
Is authentication with Facebook required?
Yes, you need to authenticate with Facebook Ads API credentials to access your ad data securely.
Can this server automate ad campaign management?
Yes, it enables automation of campaign adjustments and management through MCP workflows.
What platforms are supported for installation?
Currently, Windows and MacOS installers are provided for easy setup.
How secure is the data handled by this server?
The server follows secure authentication and scoped access principles to protect your Facebook Ads data.