home / mcp / facebook ads mcp server

Facebook Ads MCP Server

This read-only MCP Server allows you to connect to Facebook Ads data from Claude Desktop through CData JDBC Drivers. For full CRUD support, check out the first managed MCP platform: CData Connect AI (https://www.cdata.com/ai/).

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "cdatasoftware-facebook-ads-mcp-server-by-cdata": {
      "command": "java",
      "args": [
        "-jar",
        "/PATH/TO/CDataMCP-jar-with-dependencies.jar",
        "/PATH/TO/facebook-ads.prp"
      ]
    }
  }
}

You can run a local, read-only MCP Server that exposes Facebook Ads data through a simple MCP interface. This lets you ask natural-language questions and receive live data insights without writing SQL. The server wraps the CData JDBC Driver for Facebook Ads so you can query data sources in a straightforward way from your MCP client.

How to use

Once configured, you interact with your MCP client to read live Facebook Ads data. You do not need to write SQL queries; instead, ask questions like “What is the spend by campaign this month?” or “Show me active campaigns and their spend.” The MCP Server provides tools to discover available tables and columns, and to run queries when needed. You can retrieve a list of accessible tables, inspect columns for a chosen table, and run read-only SELECT queries to pull exact data. The server is designed for local, read-only access, making it suitable for quick data questions and exploratory analysis with an LLM.

How to install

# Prerequisites
- Java Runtime Environment (JRE) or JDK 8+ installed
- Git and Maven (for building the server)
- A CData JDBC Driver for Facebook Ads (license steps documented below)

Install and build the MCP server locally by following these steps. Copy each command as shown.

git clone https://github.com/cdatasoftware/facebook-ads-mcp-server-by-cdata.git
cd facebook-ads-mcp-server-by-cdata
mvn clean install

This process creates the MCP JAR file named CDataMCP-jar-with-dependencies.jar. Next, install and license the CData JDBC Driver for Facebook Ads, then configure the connection string and create the prp file.

# 1) Download the CData JDBC Driver for Facebook Ads from the official site
# 2) License the driver (adjust paths to your installation)
# Windows:
java -jar cdata.jdbc.facebookads.jar --license
# Enter your name, email, and TRIAL or license key as prompted
# 3) Configure the connection string using the Connection String utility
java -jar cdata.jdbc.facebookads.jar
# Test the connection and copy the connection string for later use

Create a .prp file for your JDBC connection (example facebook-ads.prp). This file defines how the MCP server will connect to Facebook Ads via the CData driver.

Prefix=facebookads
ServerName=CDataFacebookAds
ServerVersion=1.0
DriverPath=PATH\TO\cdata.jdbc.facebookads.jar
DriverClass=cdata.jdbc.facebookads.FacebookAdsDriver
JdbcUrl=jdbc:facebookads:InitiateOAuth=GETANDREFRESH;
Tables=

Run the MCP server with the prepared prp file. The command shown runs the server in stdio mode on the same machine as the client.

java -jar /PATH/TO/CDataMCP-jar-with-dependencies.jar /PATH/TO/facebook-ads.prp

Notes on configuration and usage

The server is designed for local, read-only access to Facebook Ads data via the MCP interface. If you later need full read/write access, you would configure a different MCP setup. When you have the MCP server running, your client can enumerate available tables, list columns for a table, and execute read-only queries. Use natural language prompts to ask questions about campaigns, ads, and performance.

Troubleshooting

If you cannot see the MCP Server in your client, ensure you fully quit and restart the client after starting the server so it refreshes the available servers.

If data retrieval fails, verify your JDBC connection is correctly configured. Use the Connection String utility to craft a valid URL, then copy the exact string into your prp file.

If you encounter connection issues with the data source, contact CData Support for assistance.

License

This MCP server is provided under the MIT License. You may use, modify, and distribute it in compliance with MIT terms.

All supported data sources (example)

Facebook Ads is included as a supported source through the CData JDBC Driver. The server wraps this driver to expose Facebook Ads data via MCP.

Available tools

facebookads_get_tables

Retrieves a list of tables available in the data source. Output is in CSV format, with headers on the first line.

facebookads_get_columns

Retrieves a list of columns for a specified table. Output is in CSV format with headers on the first line.

facebookads_run_query

Executes a SQL SELECT query against the connected data source and returns the results.