Google Ads MCP Server is a FastMCP-powered solution that connects Google Ads API directly to Claude Desktop and other MCP clients. It provides seamless OAuth 2.0 authentication, automatic token refresh, GAQL querying capabilities, and keyword research tools—allowing you to interact with your Google Ads data through natural language conversations.
Before setting up the MCP server, you'll need:
client_secret_[long-string].json
in your project directoryNote: You'll initially get a test token with limited functionality. After testing, you can apply for production access.
Once approved:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
)# 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.txt
Create a .env
file in your project directory:
# Copy the example file
cp .env.example .env
Edit .env
with your credentials:
# Required: Google Ads API Developer Token
GOOGLE_ADS_DEVELOPER_TOKEN=your_developer_token_here
# Required: Path to OAuth credentials JSON file (downloaded from Google Cloud)
GOOGLE_ADS_OAUTH_CONFIG_PATH=/full/path/to/your/client_secret_file.json
Example .env
file:
GOOGLE_ADS_DEVELOPER_TOKEN=ABCDEFG1234567890
GOOGLE_ADS_OAUTH_CONFIG_PATH=/Users/john/google-ads-mcp/client_secret_138737274875-abc123.apps.googleusercontent.com.json
Find your Claude Desktop configuration file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Windows:
%APPDATA%\Claude\claude_desktop_config.json
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:
/
or double backslashes \\
in pathsyour_developer_token_here
with your actual developer tokenClose and restart Claude Desktop to load the new configuration.
"List all my Google Ads accounts"
After authentication, you should see:
google_ads_token.json
file created in your project directory"List all my Google Ads accounts"
"Show me the account details and which ones have active campaigns"
"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?"
"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"
"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"
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 DESC
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 DESC
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'
Issue | Solution |
---|---|
No tokens found | Normal for first-time setup - complete browser authentication |
Token refresh failed | Delete google_ads_token.json and re-authenticate |
OAuth flow failed | Check credentials file path and internet connection |
Permission denied | Ensure Google account has Google Ads access |
Issue | Solution |
---|---|
Environment variables missing | Check .env file and Claude config env section |
File not found | Verify absolute paths in configuration |
Module import errors | Run pip install -r requirements.txt |
Python path issues | Use absolute path to Python executable |
Issue | Solution |
---|---|
Server not connecting | Restart Claude Desktop, check config file syntax |
Invalid JSON config | Validate JSON syntax in config file |
Permission errors | Check file permissions and paths |
Issue | Solution |
---|---|
Invalid customer ID | Use 10-digit format without dashes: 1234567890 |
API quota exceeded | Wait for quota reset or request increase |
Invalid developer token | Verify token in Google Ads API Center |
GAQL syntax errors | Check GAQL syntax and field names |
For web deployment or remote access:
# Start server in HTTP mode
python3 server.py --http
Claude Desktop config for HTTP:
{
"mcpServers": {
"google-ads": {
"url": "http://127.0.0.1:8000/mcp"
}
}
}
For managing multiple accounts under an MCC:
# Add to .env file
GOOGLE_ADS_LOGIN_CUSTOMER_ID=123-456-7890
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "google-ads" '{"command":"/full/path/to/your/project/.venv/bin/python","args":["/full/path/to/your/project/server.py"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"google-ads": {
"command": "/full/path/to/your/project/.venv/bin/python",
"args": [
"/full/path/to/your/project/server.py"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"google-ads": {
"command": "/full/path/to/your/project/.venv/bin/python",
"args": [
"/full/path/to/your/project/server.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect