Google Ads MCP Server
by ThainaJardim
README.md
# Google Ads MCP Server
An [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that connects AI assistants to the Google Ads API. Query campaigns, explore account structures, and discover resource fields — all through natural language via any MCP-compatible client.
## Tools
| Tool | Description |
|---|---|
| `list_customers` | List accessible customer accounts under your MCC |
| `run_gaql_query` | Execute any [GAQL](https://developers.google.com/google-ads/api/docs/query/overview) query |
| `list_resource_fields` | Discover available fields for a resource type (campaign, ad_group, etc.) |
## Prerequisites
- Python 3.10+
- [uv](https://docs.astral.sh/uv/) (recommended) or pip
- Google Ads API credentials (OAuth2)
### Getting Google Ads credentials
1. Follow the [Google Ads API setup guide](https://developers.google.com/google-ads/api/docs/get-started/oauth-cloud-project) to create OAuth2 credentials
2. Generate a refresh token using the [OAuth2 flow](https://developers.google.com/google-ads/api/docs/client-libs/python/oauth-installed)
3. Get your [developer token](https://developers.google.com/google-ads/api/docs/get-started/dev-token)
4. Create a `google-ads.yaml` file (see [google-ads.example.yaml](google-ads.example.yaml)):
```yaml
developer_token: "YOUR_DEVELOPER_TOKEN"
client_id: "YOUR_CLIENT_ID.apps.googleusercontent.com"
client_secret: "YOUR_CLIENT_SECRET"
refresh_token: "YOUR_REFRESH_TOKEN"
login_customer_id: "YOUR_MCC_CUSTOMER_ID"
use_proto_plus: true
```
> `login_customer_id` is required if you access accounts through an MCC (Manager account). Use digits only, no dashes.
## Quick start
1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/) (if you don't have it):
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```
2. Create your `google-ads.yaml` with your credentials (see [Getting Google Ads credentials](#getting-google-ads-credentials))
3. Add the MCP server config to your client (see below) — no `git clone` or `pip install` needed
## Setup
Just point your MCP client directly to the GitHub URL. `uvx` handles the rest.
### Cursor
Add to `~/.cursor/mcp.json`:
```json
{
"mcpServers": {
"GoogleAds": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/ThainaJardim/google-ads-mcp.git",
"google-ads-mcp"
],
"env": {
"GOOGLE_ADS_CREDENTIALS": "/path/to/google-ads.yaml"
}
}
}
}
```
### Claude Code
Add to `~/.claude/settings.json`:
```json
{
"mcpServers": {
"GoogleAds": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/ThainaJardim/google-ads-mcp.git",
"google-ads-mcp"
],
"env": {
"GOOGLE_ADS_CREDENTIALS": "/path/to/google-ads.yaml"
}
}
}
}
```
### Claude Desktop
Add to your [Claude Desktop config](https://modelcontextprotocol.io/quickstart/user):
```json
{
"mcpServers": {
"GoogleAds": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/ThainaJardim/google-ads-mcp.git",
"google-ads-mcp"
],
"env": {
"GOOGLE_ADS_CREDENTIALS": "/path/to/google-ads.yaml"
}
}
}
}
```
### Local (from cloned repo)
If you prefer to clone and run locally:
```json
{
"mcpServers": {
"GoogleAds": {
"command": "uv",
"args": [
"run",
"--directory",
"/path/to/google-ads-mcp",
"google-ads-mcp"
],
"env": {
"GOOGLE_ADS_CREDENTIALS": "/path/to/google-ads.yaml"
}
}
}
}
```
## Usage examples
Once connected, you can ask your AI assistant things like:
- *"List all my Google Ads accounts"*
- *"What campaigns are running on account 1234567890?"*
- *"Show me the spend and conversions for the last 7 days"*
- *"What fields are available on the campaign resource?"*
### Example GAQL queries
**Campaign performance:**
```sql
SELECT campaign.name, metrics.impressions, metrics.clicks, metrics.cost_micros
FROM campaign
WHERE segments.date DURING LAST_7_DAYS
ORDER BY metrics.impressions DESC
```
**Ad group details:**
```sql
SELECT ad_group.name, ad_group.status, campaign.name
FROM ad_group
WHERE campaign.status = ENABLED
```
## Development
```bash
git clone https://github.com/YOUR_USERNAME/google-ads-mcp.git
cd google-ads-mcp
uv sync
GOOGLE_ADS_CREDENTIALS=/path/to/google-ads.yaml uv run google-ads-mcp
```
## License
[MIT](LICENSE)
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues