Meta Ads (Facebook/Instagram) MCP server for Claude, ChatGPT, Perplexity & Cursor — the Meta node of Pipeboard’s 5-platform family (+ Google, TikTok, Snap, Reddit). Hosted remote MCP, badged Meta Business Partner, free plan — no self-hosting required.
Python advertisingai-agentschatgptclaudefacebook-adsinstagram-adsmcpmeta-adsmodel-context-protocolpipeboard
Improve documentation structure and emphasize Remote MCP
Yves Junqueira3eac7bc352db
diff --git a/CUSTOM_META_APP.md b/CUSTOM_META_APP.mddeleted file mode 100644index 89bec4e..0000000--- a/CUSTOM_META_APP.md+++ /dev/null@@ -1,110 +0,0 @@-# Using a Custom Meta Developer App--This guide explains how to use Meta Ads MCP with your own Meta Developer App. Note that this is an alternative method - we recommend using [Pipeboard authentication](README.md) for a simpler setup.--## Create a Meta Developer App--Before using direct Meta authentication, you'll need to set up a Meta Developer App:--1. Go to [Meta for Developers](https://developers.facebook.com/) and create a new app-2. Choose the "Business" app type-3. In your app settings, add the "Marketing API" product-4. Configure your app's OAuth redirect URI to include `http://localhost:8888/callback`-5. Note your App ID (Client ID) for use with the MCP--## Installation & Usage--When using your own Meta app, you'll need to provide the App ID:--```bash-# Using uvx-uvx meta-ads-mcp --app-id YOUR_META_ADS_APP_ID--# Using pip installation-python -m meta_ads_mcp --app-id YOUR_META_ADS_APP_ID-```--## Configuration--### Cursor or Claude Desktop Integration--Add this to your `claude_desktop_config.json` or `~/.cursor/mcp.json`:--```json-"mcpServers": {- "meta-ads": {- "command": "uvx",- "args": ["meta-ads-mcp", "--app-id", "YOUR_META_ADS_APP_ID"]- }-}-```--## Authentication Flow--When using direct Meta OAuth, the MCP uses Meta's OAuth 2.0 authentication flow:--1. Starts a local callback server on your machine-2. Opens a browser window to authenticate with Meta-3. Asks you to authorize the app-4. Redirects back to the local server to extract and store the token securely--## Environment Variables--You can use these environment variables instead of command-line arguments:--```bash-# Your Meta App ID-export META_APP_ID=your_app_id-uvx meta-ads-mcp--# Or provide a direct access token (bypasses local cache)-export META_ACCESS_TOKEN=your_access_token-uvx meta-ads-mcp-```--## Testing--### CLI Testing--Run the test script to verify authentication:--```bash-# Basic test-python test_meta_ads_auth.py --app-id YOUR_APP_ID--# Force new login-python test_meta_ads_auth.py --app-id YOUR_APP_ID --force-login-```--### LLM Interface Testing--When using direct Meta authentication:-1. Test authentication by calling the `mcp_meta_ads_get_login_link` tool-2. Verify account access by calling `mcp_meta_ads_get_ad_accounts`-3. Check specific account details with `mcp_meta_ads_get_account_info`--## Troubleshooting--### Authentication Issues--1. App ID Issues- - If you encounter errors like `(#200) Provide valid app ID`, verify your App ID is correct- - Make sure you've completed the app setup steps above- - Check that your app has the Marketing API product added--2. OAuth Flow- - Run with `--force-login` to get a fresh token: `uvx meta-ads-mcp --login --app-id YOUR_APP_ID --force-login`- - Make sure the terminal has permissions to open a browser window- - Check that the callback server can run on port 8888--3. Direct Token Usage- - If you have a valid access token, you can bypass the OAuth flow:- - `export META_ACCESS_TOKEN=your_access_token`- - This will ignore the local token cache--### API Errors--If you receive errors from the Meta API:-1. Verify your app has the Marketing API product added-2. Ensure the user has appropriate permissions on the ad accounts-3. Check if there are rate limits or other restrictions on your app\ No newline at end of filediff --git a/LOCAL_INSTALLATION.md b/LOCAL_INSTALLATION.mddeleted file mode 100644index cd8246d..0000000--- a/LOCAL_INSTALLATION.md+++ /dev/null@@ -1,465 +0,0 @@-# Meta Ads MCP - Local Installation Guide--This guide covers everything you need to know about installing and running Meta Ads MCP locally on your machine. For the easier Remote MCP option, **[🚀 get started here](https://pipeboard.co)**.--## Table of Contents--- [Prerequisites](#prerequisites)-- [Installation Methods](#installation-methods)-- [Authentication Setup](#authentication-setup)-- [MCP Client Configuration](#mcp-client-configuration)-- [Development Installation](#development-installation)-- [Privacy and Security](#privacy-and-security)-- [Testing and Verification](#testing-and-verification)-- [Debugging and Logs](#debugging-and-logs)-- [Troubleshooting](#troubleshooting)-- [Advanced Configuration](#advanced-configuration)--## Prerequisites--- **Python 3.8 or higher**-- **[uv](https://docs.astral.sh/uv/) package manager** (recommended) or pip-- **Meta Ads account** with appropriate permissions-- **MCP-compatible client** (Claude Desktop, Cursor, Cherry Studio, etc.)--## Installation Methods--### Method 1: Using uvx (Recommended)--```bash-# Install via uvx (automatically handles dependencies)-uvx meta-ads-mcp-```--### Method 2: Using pip--```bash-# Install via pip-pip install meta-ads-mcp-```--### Method 3: Development Installation--```bash-# Clone the repository-git clone https://github.com/pipeboard-co/meta-ads-mcp.git-cd meta-ads-mcp--# Install in development mode-uv pip install -e .-# Or with pip-pip install -e .-```--## Authentication Setup--1. **Sign up to Pipeboard**- - Visit [Pipeboard.co](https://pipeboard.co)- - Create an account--2. **Generate API Token**- - Go to [pipeboard.co/api-tokens](https://pipeboard.co/api-tokens)- - Generate a new API token- - Copy the token securely--3. **Set Environment Variable**- ```bash- # On macOS/Linux- export PIPEBOARD_API_TOKEN=your_pipeboard_token_here-- # On Windows (Command Prompt)- set PIPEBOARD_API_TOKEN=your_pipeboard_token_here-- # On Windows (PowerShell)- $env:PIPEBOARD_API_TOKEN="your_pipeboard_token_here"- ```--4. **Make it Persistent**-- Add to your shell profile (`.bashrc`, `.zshrc`, etc.):- ```bash- echo 'export PIPEBOARD_API_TOKEN=your_pipeboard_token_here' >> ~/.bashrc- source ~/.bashrc- ```--## MCP Client Configuration--### Claude Desktop--Add to your `claude_desktop_config.json`:--**Location:**-- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`-- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`--**Configuration:**-```json-{- "mcpServers": {- "meta-ads": {- "command": "uvx",- "args": ["meta-ads-mcp"],- "env": {- "PIPEBOARD_API_TOKEN": "your_pipeboard_token"- }- }- }-}-```--### Cursor--Add to your `~/.cursor/mcp.json`:--```json-{- "mcpServers": {- "meta-ads": {- "command": "uvx",- "args": ["meta-ads-mcp"],- "env": {- "PIPEBOARD_API_TOKEN": "your_pipeboard_token"- }- }- }-}-```--### Cherry Studio--In Cherry Studio settings, add a new MCP server:-- **Name**: Meta Ads MCP-- **Command**: `uvx`-- **Arguments**: `["meta-ads-mcp"]`-- **Environment Variables**: `PIPEBOARD_API_TOKEN=your_pipeboard_token`--## Development Installation--### Setting Up Development Environment--```bash-# Clone the repository-git clone https://github.com/pipeboard-co/meta-ads-mcp.git-cd meta-ads-mcp--# Create virtual environment (optional but recommended)-python -m venv venv-source venv/bin/activate # On Windows: venv\Scripts\activate--# Install in development mode with dependencies-uv pip install -e .--# Install development dependencies-uv pip install -e ".[dev]" # If dev dependencies are defined-```--### Running from Source--```bash-# Set environment variable-export PIPEBOARD_API_TOKEN=your_token--# Run directly-python -m meta_ads_mcp--# Or if installed in development mode-meta-ads-mcp-```--### Testing Your Installation--```bash-# Test the installation-python -c "import meta_ads_mcp; print('Installation successful!')"--# Test MCP server startup-meta-ads-mcp --help-```--## Privacy and Security--### Token Storage and Caching--Meta Ads MCP follows security best practices:--1. **Secure Token Cache Location**:- - **Windows**: `%APPDATA%\meta-ads-mcp\token_cache.json`- - **macOS**: `~/Library/Application Support/meta-ads-mcp/token_cache.json`- - **Linux**: `~/.config/meta-ads-mcp/token_cache.json`--2. **Automatic Token Management**:- - Tokens are cached securely after first authentication- - You don't need to provide access tokens for each command- - Tokens are automatically refreshed when needed--3. **Environment Variable Security**:- - `PIPEBOARD_API_TOKEN` should be kept secure- - Don't commit tokens to version control- - Use environment files (`.env`) for local development--### Security Best Practices--```bash-# Create a .env file for local development (never commit this)-echo "PIPEBOARD_API_TOKEN=your_token_here" > .env--# Add .env to .gitignore-echo ".env" >> .gitignore--# Load environment variables from .env-source .env-```--## Testing and Verification--### Basic Functionality Test--Once installed and configured, test with your MCP client:--1. **Verify Account Access**- ```- Ask your LLM: "Use mcp_meta_ads_get_ad_accounts to show my Meta ad accounts"- ```--2. **Check Account Details**- ```- Ask your LLM: "Get details for account act_XXXXXXXXX using mcp_meta_ads_get_account_info"- ```--3. **List Campaigns**- ```- Ask your LLM: "Show me my active campaigns using mcp_meta_ads_get_campaigns"- ```--### Manual Testing with Python--```python-# Test authentication-from meta_ads_mcp.core.auth import get_access_token--try:- token = get_access_token()- print("Authentication successful!")- print(f"Token starts with: {token[:10]}...")-except Exception as e:- print(f"Authentication failed: {e}")-```--### Testing with MCP Client--When using Meta Ads MCP with an LLM interface:--1. Ensure the `PIPEBOARD_API_TOKEN` environment variable is set-2. Verify account access by calling `mcp_meta_ads_get_ad_accounts`-3. Check specific account details with `mcp_meta_ads_get_account_info`-4. Test campaign retrieval with `mcp_meta_ads_get_campaigns`--## Debugging and Logs--### Log File Locations--Debug logs are automatically created in platform-specific locations:--- **macOS**: `~/Library/Application\ Support/meta-ads-mcp/meta_ads_debug.log`-- **Windows**: `%APPDATA%\meta-ads-mcp\meta_ads_debug.log`-- **Linux**: `~/.config/meta-ads-mcp/meta_ads_debug.log`--### Enabling Debug Mode--```bash-# Set debug environment variable-export META_ADS_DEBUG=true--# Run with verbose output-meta-ads-mcp --verbose-```--### Viewing Logs--```bash-# On macOS/Linux-tail -f ~/Library/Application\ Support/meta-ads-mcp/meta_ads_debug.log--# On Windows-type %APPDATA%\meta-ads-mcp\meta_ads_debug.log-```--### Common Debug Commands--```bash-# Check if MCP server starts correctly-meta-ads-mcp --test-connection--# Verify environment variables-echo $PIPEBOARD_API_TOKEN--# Test Pipeboard authentication-python -c "-from meta_ads_mcp.core.pipeboard_auth import test_auth-test_auth()-"-```--## Troubleshooting--### Authentication Issues--#### Problem: "PIPEBOARD_API_TOKEN not set"-```bash-# Solution: Set the environment variable-export PIPEBOARD_API_TOKEN=your_token_here--# Verify it's set-echo $PIPEBOARD_API_TOKEN-```--#### Problem: "Invalid Pipeboard token"-1. Check your token at [pipeboard.co/api-tokens](https://pipeboard.co/api-tokens)-2. Regenerate if necessary-3. Update your environment variable--#### Problem: "Authentication failed"-```bash-# Clear cached tokens and retry-rm -rf ~/.config/meta-ads-mcp/token_cache.json # Linux-rm -rf ~/Library/Application\ Support/meta-ads-mcp/token_cache.json # macOS--# Force re-authentication-python test_pipeboard_auth.py --force-login-```--### Installation Issues--#### Problem: "Command not found: uvx"-```bash-# Install uv first-curl -LsSf https://astral.sh/uv/install.sh | sh--# Or use pip-pip install meta-ads-mcp-```--#### Problem: "Permission denied"-```bash-# Use user installation-pip install --user meta-ads-mcp--# Or use virtual environment-python -m venv venv-source venv/bin/activate-pip install meta-ads-mcp-```--#### Problem: "Python version incompatible"-```bash-# Check Python version-python --version--# Update to Python 3.8+-# Use pyenv or your system's package manager-```--### Runtime Issues--#### Problem: "Failed to connect to Meta API"-1. Check internet connection-2. Verify Meta API status-3. Check rate limits-4. Ensure account permissions--#### Problem: "MCP client can't find server"-1. Verify the command path in your MCP client config-2. Check environment variables are set in the client-3. Test the command manually in terminal--#### Problem: "SSL/TLS errors"-```bash-# Update certificates-pip install --upgrade certifi--# Or use system certificates-export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt-```--### API Errors--#### Problem: "Insufficient permissions"-- Ensure your Meta account has access to the ad accounts-- Check if your Pipeboard token has the right scopes-- Verify account roles in Meta Business Manager--#### Problem: "Rate limit exceeded"-- Wait before retrying-- Reduce request frequency-- Check if multiple instances are running--#### Problem: "Account not found"-- Verify account ID format (should be `act_XXXXXXXXX`)-- Check account access permissions-- Ensure account is active--### Performance Issues--#### Problem: "Slow response times"-```bash-# Check network latency-ping graph.facebook.com--# Clear cache-rm -rf ~/.config/meta-ads-mcp/token_cache.json--# Check system resources-top # or htop on Linux/macOS-```--## Advanced Configuration--### Custom Configuration File--Create `~/.config/meta-ads-mcp/config.json`:--```json-{- "api_version": "v21.0",- "timeout": 30,- "max_retries": 3,- "debug": false,- "cache_duration": 3600-}-```--### Environment Variables--```bash-# API Configuration-export META_API_VERSION=v21.0-export META_API_TIMEOUT=30-export META_ADS_DEBUG=true--# Cache Configuration-export META_ADS_CACHE_DIR=/custom/cache/path-export META_ADS_CACHE_DURATION=3600--# Pipeboard Configuration-export PIPEBOARD_API_TOKEN=your_token_here-```--### Transport Configuration--Meta Ads MCP uses **stdio transport** by default. For HTTP transport:--See [STREAMABLE_HTTP_SETUP.md](STREAMABLE_HTTP_SETUP.md) for streamable HTTP transport configuration.--## Getting Help--If you're still experiencing issues:--1. **Check the logs** for detailed error messages-2. **Search existing issues** on GitHub-3. **Join our Discord** at [discord.gg/YzMwQ8zrjr](https://discord.gg/YzMwQ8zrjr)-4. **Email support** at [email protected]-5. **Consider Remote MCP** at [pipeboard.co](https://pipeboard.co) as an alternative-------**Quick Alternative**: If local installation is causing issues, try our [Remote MCP service](https://pipeboard.co) - no local setup required!diff --git a/README.md b/README.mdindex eae5bf2..e660bc1 100644--- a/README.md+++ b/README.md@@ -100,25 +100,13 @@ https://mcp.pipeboard.co/meta-ads-mcp?token=YOUR_PIPEBOARD_TOKENThis bypasses the interactive login flow and authenticates immediately. Get your token at [pipeboard.co/api-tokens](https://pipeboard.co/api-tokens).-## Local Installation (Technical Users Only)+## Local Installation (Advanced Technical Users Only)-If you're a developer or need to customize the installation, you can run Meta Ads MCP locally. **Most marketers should use the Remote MCP above instead!** For complete technical setup instructions, see our **[Local Installation Guide](LOCAL_INSTALLATION.md)**.+🚀 **We strongly recommend using [Remote MCP](https://pipeboard.co) instead** - it's faster, more reliable, and requires no technical setup.-Meta Ads MCP also supports **streamable HTTP transport**, allowing you to run it as a standalone HTTP API for web applications and custom integrations. See **[Streamable HTTP Setup Guide](STREAMABLE_HTTP_SETUP.md)** for complete instructions.--### Quick Local Setup--```bash-# Install via uvx (recommended)-uvx meta-ads-mcp--# Set your Pipeboard token-export PIPEBOARD_API_TOKEN=your_pipeboard_token+For developers who need to self-host, the package is available via pip. Local installations require creating your own Meta Developer App and implementing the complete OAuth flow. See the source repository for technical details.-# Add to your MCP client configuration-```--For detailed step-by-step instructions, authentication setup, debugging, and troubleshooting, visit **[LOCAL_INSTALLATION.md](LOCAL_INSTALLATION.md)**.+Meta Ads MCP also supports **streamable HTTP transport**, allowing you to run it as a standalone HTTP API for web applications and custom integrations. See **[Streamable HTTP Setup Guide](STREAMABLE_HTTP_SETUP.md)** for complete instructions.## Features@@ -141,9 +129,9 @@ For detailed step-by-step instructions, authentication setup, debugging, and tro**[✨ Get started with Remote MCP here](https://pipeboard.co)** - no technical setup required! Just connect your Facebook Ads account and start asking AI to analyze your campaigns.-### Local Installation (Technical Users)+### Local Installation (Advanced Technical Users)-For local installation configuration, authentication options, and advanced technical setup, see our **[Local Installation Guide](LOCAL_INSTALLATION.md)**.+For advanced users who need to self-host, the package can be installed from source. Local installations require creating your own Meta Developer App. **We recommend using [Remote MCP](https://pipeboard.co) for a simpler experience.**### Available MCP Tools@@ -469,7 +457,7 @@ The only restriction is that you cannot offer this as a competing hosted serviceMeta Ads MCP follows security best practices with secure token management and automatic authentication handling.- **Remote MCP**: All authentication is handled securely in the cloud - no local token storage required-- **Local Installation**: Tokens are cached securely on your local machine - see [Local Installation Guide](LOCAL_INSTALLATION.md) for details+- **Local Installation**: Tokens are cached securely on your local machine## Testing@@ -481,7 +469,7 @@ Test your Meta Ads MCP connection with any MCP client:2. **Check Account Details**: Use `mcp_meta_ads_get_account_info` with your account ID3. **List Campaigns**: Try `mcp_meta_ads_get_campaigns` to see your ad campaigns-For detailed local installation testing, see [Local Installation Guide](LOCAL_INSTALLATION.md).+For detailed local installation testing, see the source repository.## Troubleshooting@@ -491,10 +479,4 @@ The easiest way to avoid any setup issues is to **[🎯 use our Remote MCP inste### Local Installation Issues-For comprehensive troubleshooting, debugging, and local installation issues, see our **[Local Installation Guide](LOCAL_INSTALLATION.md)** which includes:--- Authentication troubleshooting-- Installation issues and solutions-- API error resolution-- Debug logs and diagnostic commands-- Performance optimization tips+For local installation issues, refer to the source repository. **For the easiest experience, we recommend using [Remote MCP](https://pipeboard.co) instead.**diff --git a/pyproject.toml b/pyproject.tomlindex b3c9411..8c9c7dc 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -5,7 +5,7 @@ build-backend = "hatchling.build"[project]name = "meta-ads-mcp"version = "1.0.16"-description = "Model Context Protocol (MCP) server for interacting with Meta Ads API"+description = "Model Context Protocol (MCP) server for Meta Ads - Use Remote MCP at pipeboard.co for easiest setup"readme = "README.md"requires-python = ">=3.10"authors = [diff --git a/server.json b/server.jsonindex f5a9d52..5c54956 100644--- a/server.json+++ b/server.json@@ -8,16 +8,6 @@"type": "streamable-http","url": "https://mcp.pipeboard.co/meta-ads-mcp"}- ],- "packages": [- {- "registryType": "pypi",- "identifier": "meta-ads-mcp",- "version": "1.0.16",- "transport": {- "type": "stdio"- }- }]}