Unified Ads MCP Server
Provides tools for managing Facebook ad accounts, campaigns, ad sets, ads, and creatives, along with performance insights and activity tracking.
Provides tools for executing GAQL queries, managing Google Ads accounts, generating keyword ideas with search volume data, and analyzing campaign performance.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Unified Ads MCP Serverlist all my Google Ads accounts"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Unified Ads MCP Server 🚀
A FastMCP-powered Model Context Protocol server for Google Ads & Facebook Ads API integration with automatic OAuth 2.0 authentication
Connect both Google Ads and Facebook Ads APIs directly to Claude Desktop and other MCP clients with seamless OAuth 2.0 authentication, automatic token refresh, GAQL querying, keyword research, and comprehensive Facebook Ads management capabilities.
Your browser does not support the video tag.
Easy One-Click Setup
For a simpler setup experience, we offer ready-to-use installers:
👉 Download installer - https://gomarble.ai/mcp
Related MCP server: google-ads-mcp-server
Join our community for help and updates
👉 Slack Community - AI in Ads
🎯 Unified Platform
This server now includes both Google Ads and Facebook Ads functionality in a single, unified MCP server! No need for separate servers.
✨ Features
🔐 Authentication & Security
Automatic OAuth 2.0 - One-time browser authentication with auto-refresh
Smart Token Management - Handles expired tokens automatically
Secure Local Storage - Tokens stored locally, never exposed
📊 Google Ads Capabilities
GAQL Query Execution - Run any Google Ads Query Language queries
Account Management - List and manage Google Ads accounts
Keyword Research - Generate keyword ideas with search volume data
Campaign Analysis - Performance metrics and insights
📱 Facebook Ads Capabilities
Account Management - List and manage Facebook ad accounts
Campaign Management - Create, update, and analyze campaigns
Ad Set Management - Manage targeting and budgets
Ad Management - Create and optimize individual ads
Creative Management - Handle ad creatives and assets
Performance Insights - Comprehensive analytics and reporting
Activity Tracking - Monitor account and campaign changes
🚀 Technical Features
FastMCP Framework - Built on the modern MCP standard
Claude Desktop Ready - Direct integration with Claude Desktop
Environment-based API versions - Easy API version management
Unified Error Handling - Consistent error management across platforms
📋 Available Tools
🔍 Google Ads Tools (3 tools)
Tool | Description | Parameters | Example Usage |
| List all accessible Google Ads accounts | None | "List all my Google Ads accounts" |
| Execute GAQL queries with custom formatting |
| "Show me campaign performance for account 1234567890" |
| Generate keyword ideas with metrics |
| "Generate keyword ideas for 'digital marketing'" |
📱 Facebook Ads Tools (21 tools)
Category | Tools | Description |
Account Management |
| List and get Facebook ad account details |
Campaign Management |
| Manage Facebook campaigns |
Ad Set Management |
| Manage Facebook ad sets |
Ad Management |
| Manage individual Facebook ads |
Creative Management |
| Handle Facebook ad creatives |
Performance Insights |
| Get performance analytics |
Activity Tracking |
| Monitor account changes |
Utilities |
| Handle pagination for large datasets |
Note: All tools automatically handle authentication - no token parameters required!
🚀 Quick Start
Prerequisites
Before setting up the MCP server, you'll need:
Python 3.10+ installed
A Google Cloud Platform account
A Google Ads account with API access
🔧 Step 1: Google Cloud Platform Setup
1.1 Create Google Cloud Project
Go to Google Cloud Console
Create a new project:
Click "Select a project" → "New Project"
Enter project name (e.g., "Google Ads MCP")
Click "Create"
1.2 Enable Google Ads API
In your Google Cloud Console:
Go to "APIs & Services" → "Library"
Search for "Google Ads API"
Click on it and press "Enable"
1.3 Create OAuth 2.0 Credentials
Go to "APIs & Services" → "Credentials"
Click "+ CREATE CREDENTIALS" → "OAuth 2.0 Client ID"
Configure consent screen (if first time):
Click "Configure Consent Screen"
Choose "External" (unless you have Google Workspace)
Fill required fields:
App name: "Google Ads MCP"
User support email: Your email
Developer contact: Your email
Click "Save and Continue" through all steps
Create OAuth Client:
Application type: "Desktop application"
Name: "Google Ads MCP Client"
Click "Create"
Download credentials:
Click "Download JSON" button
Save file as
client_secret_[long-string].jsonin your project directory
🔧 Step 2: Google Ads API Setup
2.1 Get Developer Token
Sign in to Google Ads
Go to Tools & Settings (wrench icon in top navigation)
Under "Setup", click "API Center"
Accept Terms of Service if prompted
Click "Apply for token"
Fill out application form:
Describe your use case (e.g., "MCP integration for campaign analysis")
Provide technical details about your implementation
Submit and wait for approval (usually 1-3 business days)
Note: You'll initially get a test token with limited functionality. After testing, you can apply for production access.
2.2 Find Your Developer Token
Once approved:
Return to API Center in Google Ads
Copy your Developer Token (format:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX)
🔧 Step 2.5: Facebook Ads API Setup (Optional)
2.5.1 Get Facebook Access Token
Go to Facebook Developers
Create a new app or use existing app
Add Facebook Marketing API to your app
Generate a User Access Token with required permissions:
ads_readads_managementbusiness_management
Copy your Access Token (format:
EAABwzLixnjYBO...)
2.5.2 Required Facebook Permissions
Your Facebook access token needs these permissions:
ads_read- Read ad account dataads_management- Manage ads and campaignsbusiness_management- Access business accounts
🔧 Step 3: Installation & Setup
3.1 Clone and Install
# Clone the repository
git clone https://github.com/yourusername/google-ads-mcp-server.git
cd google-ads-mcp-server
# Create virtual environment (recommended)
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt3.2 Environment Configuration
Create a .env file in your project directory:
# Copy the example file
cp .env.example .envEdit .env with your credentials:
# Required: Google Ads API Configuration
GOOGLE_ADS_DEVELOPER_TOKEN=your_developer_token_here
GOOGLE_API_VERSION=v21
# Required: Facebook Ads Configuration
FACEBOOK_ACCESS_TOKEN=your_facebook_access_token_here
FB_API_VERSION=v22.0
# Required: OAuth 2.0 Credentials (for Google Ads)
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_REDIRECT_URI=http://localhost:8080/callbackExample .env file:
# Google Ads Configuration
GOOGLE_ADS_DEVELOPER_TOKEN=ABCDEFG12344444444567890
GOOGLE_API_VERSION=v21
# Facebook Ads Configuration
FACEBOOK_ACCESS_TOKEN=EAABwzLixnjYBO1234567890abcdef
FB_API_VERSION=v22.0
# OAuth 2.0 Credentials (for Google Ads)
GOOGLE_CLIENT_ID=9876544444444321-abcdefghijk.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=44444-aBcDeFgHiJkLmNoPqRs
GOOGLE_REDIRECT_URI=http://localhost:8080/callback🖥️ Step 4: Claude Desktop Integration
4.1 Locate Claude Configuration
Find your Claude Desktop configuration file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json4.2 Add MCP Server Configuration
Edit the configuration file and add your Google Ads MCP server:
{
"mcpServers": {
"google-ads": {
"command": "/full/path/to/your/project/.venv/bin/python",
"args": [
"/full/path/to/your/project/server.py"
]
}
}
}Real Example:
{
"mcpServers": {
"google-ads": {
"command": "/Users/marble-dev-01/workspace/google_ads_with_fastmcp/.venv/bin/python",
"args": [
"/Users/marble-dev-01/workspace/google_ads_with_fastmcp/server.py"
]
}
}
}Important:
Use absolute paths for all file locations
On Windows, use forward slashes
/or double backslashes\\in pathsReplace
your_developer_token_herewith your actual developer token
4.3 Restart Claude Desktop
Close and restart Claude Desktop to load the new configuration.
🔐 Step 5: First-Time Authentication
5.1 Trigger OAuth Flow
Open Claude Desktop
Try any Google Ads command, for example:
"List all my Google Ads accounts"
5.2 Complete Authentication
Browser opens automatically to Google OAuth page
Sign in with your Google account (the one with Google Ads access)
Grant permissions by clicking "Allow"
Browser shows success page
Return to Claude - your command will complete automatically!
5.3 Verify Setup
After authentication, you should see:
A
google_ads_token.jsonfile created in your project directoryYour Google Ads accounts listed in Claude's response
📖 Usage Examples
🔍 Google Ads Operations
Basic Account Operations
"List all my Google Ads accounts"
"Show me the account details and which ones have active campaigns"Campaign Analysis
"Show me campaign performance for account 1234567890 in the last 30 days"
"Get conversion data for all campaigns in the last week"
"Which campaigns have the highest cost per conversion?"Keyword Research
"Generate keyword ideas for 'digital marketing' using account 1234567890"
"Find keyword opportunities for 'AI automation' with search volume data"
"Research keywords for the page https://example.com/services"Custom GAQL Queries
"Run this GAQL query for account 1234567890:
SELECT campaign.name, metrics.clicks, metrics.cost_micros
FROM campaign
WHERE segments.date DURING LAST_7_DAYS"
"Get keyword performance data:
SELECT ad_group_criterion.keyword.text, metrics.ctr, metrics.average_cpc
FROM keyword_view
WHERE metrics.impressions > 100"📱 Facebook Ads Operations
Account Management
"List all my Facebook ad accounts"
"Get details for Facebook account act_1234567890"
"Show me the performance insights for account act_1234567890"Campaign Management
"Get all campaigns for Facebook account act_1234567890"
"Show me campaign insights for campaign 1234567890"
"Get campaigns with specific objectives like CONVERSIONS"Ad Set Management
"List all ad sets for Facebook account act_1234567890"
"Get ad sets for campaign 1234567890"
"Show me ad set performance insights for ad set 1234567890"Ad Management
"Get all ads for Facebook account act_1234567890"
"Show me ads for campaign 1234567890"
"Get ad details for ad 1234567890"Creative Management
"Get creative details for creative 1234567890"
"Show me all creatives for ad 1234567890"Activity Tracking
"Show me recent activities for Facebook account act_1234567890"
"Get activity history for ad set 1234567890"🔍 Advanced GAQL Examples
Campaign Performance with Revenue
SELECT
campaign.id,
campaign.name,
metrics.clicks,
metrics.impressions,
metrics.cost_micros,
metrics.conversions,
metrics.conversions_value
FROM campaign
WHERE segments.date DURING LAST_30_DAYS
ORDER BY metrics.cost_micros DESCKeyword Performance Analysis
SELECT
campaign.name,
ad_group_criterion.keyword.text,
ad_group_criterion.keyword.match_type,
metrics.ctr,
metrics.average_cpc,
metrics.quality_score
FROM keyword_view
WHERE segments.date DURING LAST_7_DAYS
AND metrics.impressions > 100
ORDER BY metrics.conversions DESCDevice Performance Breakdown
SELECT
campaign.name,
segments.device,
metrics.clicks,
metrics.cost_micros,
metrics.conversions
FROM campaign
WHERE segments.date DURING LAST_30_DAYS
AND campaign.status = 'ENABLED'📁 Project Structure
unified-ads-mcp-server/
├── server.py # Main unified MCP server (Google + Facebook)
├── oauth/
│ ├── __init__.py # Package initialization
│ └── google_auth.py # OAuth authentication logic
├── google_ads_token.json # Auto-generated token storage (gitignored)
├── .env # Environment variables (gitignored)
├── .env.example # Environment template
├── .gitignore # Git ignore file
├── requirements.txt # Python dependencies
├── README.md # This file
├── README_OAUTH.md # OAuth setup guide
├── g-server.py # Original Google Ads server (reference)
├── fb-server.py # Original Facebook Ads server (reference)
└── LICENSE # MIT License🔒 Security & Best Practices
File Security
✅ Credential files are gitignored - Never committed to version control
✅ Local token storage - Tokens stored in
google_ads_token.jsonlocally✅ Environment variables - Sensitive data in
.envfile✅ Automatic refresh - Minimal token exposure time
Recommended File Permissions
# Set secure permissions for sensitive files
chmod 600 .env
chmod 600 google_ads_token.json
chmod 600 client_secret_*.jsonProduction Considerations
Use environment variables instead of
.envfiles in productionImplement rate limiting to respect API quotas
Monitor API usage in Google Cloud Console
Secure token storage with proper access controls
Regular token rotation for enhanced security
🛠️ Troubleshooting
Authentication Issues
Issue | Symptoms | Solution |
No tokens found | "Starting OAuth flow" message | ✅ Normal for first-time setup - complete browser authentication |
Token refresh failed | "Refreshing token failed" error | ✅ Delete |
OAuth flow failed | Browser error or no response | Check credentials file path and internet connection |
Permission denied | "Access denied" in browser | Ensure Google account has Google Ads access |
Configuration Issues
Issue | Symptoms | Solution |
Environment variables missing | "Environment variable not set" | Check |
File not found | "FileNotFoundError" | Verify absolute paths in configuration |
Module import errors | "ModuleNotFoundError" | Run |
Python path issues | "Command not found" | Use absolute path to Python executable |
Claude Desktop Issues
Issue | Symptoms | Solution |
Server not connecting | No Google Ads tools available | Restart Claude Desktop, check config file syntax |
Invalid JSON config | Claude startup errors | Validate JSON syntax in config file |
Permission errors | "Permission denied" on startup | Check file permissions and paths |
API Issues
Issue | Symptoms | Solution |
Invalid customer ID | "Customer not found" | Use 10-digit format without dashes: |
API quota exceeded | "Quota exceeded" error | Wait for quota reset or request increase |
Invalid developer token | "Authentication failed" | Verify token in Google Ads API Center |
GAQL syntax errors | "Invalid query" | Check GAQL syntax and field names |
Debug Mode
Enable detailed logging for troubleshooting:
# Add to server.py for debugging
import logging
logging.basicConfig(level=logging.DEBUG)Getting Help
If you encounter issues:
Check the error message carefully - it usually indicates the exact problem
Verify all file paths are absolute and correct
Ensure environment variables are properly set
Check Google Cloud Console for API quotas and billing
Restart Claude Desktop after any configuration changes
🚀 Advanced Configuration
HTTP Transport Mode
For web deployment or remote access:
# Start server in HTTP mode
python3 server.py --httpClaude Desktop config for HTTP:
{
"mcpServers": {
"google-ads": {
"url": "http://127.0.0.1:8000/mcp"
}
}
}Custom Token Storage
Modify token storage location in oauth/google_auth.py:
# Custom token file location
def get_token_path():
return "/custom/secure/path/google_ads_token.json"Manager Account Configuration
For managing multiple accounts under an MCC:
# Add to .env file
GOOGLE_ADS_LOGIN_CUSTOMER_ID=123-456-7890🤝 Contributing
We welcome contributions! Here's how to get started:
Development Setup
# Fork and clone the repository
git clone https://github.com/yourusername/google-ads-mcp-server.git
cd google-ads-mcp-server
# Create development environment
python3 -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Set up development environment
cp .env.example .env
# Add your development credentials to .envMaking Changes
Create a feature branch:
git checkout -b feature/amazing-featureMake your changes with appropriate tests
Test thoroughly with different account configurations
Update documentation as needed
Commit changes:
git commit -m 'Add amazing feature'Push to branch:
git push origin feature/amazing-featureOpen a Pull Request with detailed description
Testing Your Changes
# Test authentication flow
python3 server.py --test-auth
# Test API connectivity
python3 -c "
from oauth.google_auth import get_oauth_credentials
creds = get_oauth_credentials()
print('✅ Authentication successful!')
"
# Test with Claude Desktop
# Add your server to Claude config and test various commands📊 API Limits and Quotas
Google Ads API Quotas
Basic access: 15,000 operations per day
Standard access: 40,000 operations per day
Request rate: 1,600 requests per minute per developer token
Best Practices for API Usage
Cache results when possible to reduce API calls
Use date ranges to limit data volume
Batch requests when supported
Monitor usage in Google Cloud Console
Implement retry logic for rate limit errors
Quota Management
# Monitor usage in Google Cloud Console
# Go to APIs & Services → Quotas
# Search for "Google Ads API" to see current usage📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2025 Google Ads MCP Server Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.📈 Roadmap
Upcoming Features
🔄 Enhanced keyword research with competitor analysis
📊 Built-in data visualization with charts and graphs
🤖 AI-powered optimization suggestions
📝 Campaign creation and management tools
🔍 Advanced reporting capabilities
🌐 Multi-language support
Made with ❤️ for the MCP community
Connect your Google Ads data directly to AI assistants and unlock powerful advertising insights through natural language conversations.
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/caspercrause/ads-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server