home / mcp / facebook ads mcp server

Facebook Ads MCP Server

Provides an interface to Meta Ads, enabling programmatic access to data, campaigns, and insights via an MCP client.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "gomarble-ai-facebook-ads-mcp-server": {
      "command": "python",
      "args": [
        "/path/to/your/fb-ads-mcp-server/server.py",
        "--fb-token",
        "YOUR_META_ACCESS_TOKEN"
      ]
    }
  }
}

You can access and manage Meta Ads data programmatically through an MCP server that acts as an interface to Meta Ads. This server installs locally, handles environment setup, and guides you to connect securely for token-based authentication, enabling you to fetch data and perform common Meta Ads actions from MCP-compatible clients.

How to use

You will run the MCP server locally and connect it to an MCP client to access Meta Ads data and actions. Start the server with your Meta access token and configure your MCP client to communicate with the local process. Use the client’s MCP configuration to reference the server by a logical name, then run your client as you would for other MCP servers.

How to install

Prerequisites are Python 3.10 or newer and dependencies listed in the project’s requirements file.

Optionally, create and activate a virtual environment to isolate dependencies.

Install dependencies from the requirements file.

Obtain a Meta User Access Token with the required permissions (for example, ads_read) from the Meta Developer portal.

The server can be run with a token provided on startup, or it can connect to GoMarble’s service to obtain a token, which is stored locally on your machine for use with the MCP server.

Additional notes

To integrate with an MCP-compatible client, you add a configuration that points at the server and supplies the token. If you are using a virtual environment, you may specify the python executable inside the venv.

If your Meta access token expires, generate a new one and update the client configuration to continue using the tools.

The server exposes a set of tools to interact with Meta Ads objects, including reading accounts, campaigns, ads, creatives, and performing insights queries.

Configuration example for MCP client

{
  "mcpServers": {
    "fb-ads-mcp-server": {
      "command": "python",
      "args": [
        "/path/to/your/fb-ads-mcp-server/server.py",
        "--fb-token",
        "YOUR_META_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_META_ACCESS_TOKEN"
      // ]
    }
  }
}

Available tools

list_ad_accounts

Lists ad accounts linked to the provided token.

get_details_of_ad_account

Retrieves detailed information for a specific ad account.

get_campaign_by_id

Fetches details for a single campaign by its ID.

get_adset_by_id

Fetches details for a single ad set by its ID.

get_ad_by_id

Fetches details for a single ad by its ID.

get_ad_creative_by_id

Fetches details for a specific ad creative.

get_adsets_by_ids

Retrieves multiple ad sets by their IDs.

get_campaigns_by_adaccount

Retrieves campaigns within a given ad account.

get_adsets_by_adaccount

Retrieves ad sets within a given ad account.

get_ads_by_adaccount

Retrieves ads within a given 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 a specific ad.

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 (such as insights pagination).

get_activities_by_adaccount

Retrieves change history for an ad account.

get_activities_by_adset

Retrieves change history for an ad set.