Skip to main content
Glama
admob-mcp

admob-mcp

by oleksandrtry

admob-mcp

A read-only Model Context Protocol server for Google AdMob. It lets Claude Code, Claude Desktop, Cursor, VS Code or any MCP client pull your AdMob data and analyze it with you:

  • revenue, eCPM, fill and CTR, broken down by app, ad unit, country, format, platform or version;

  • mediation performance per ad network;

  • period-over-period drivers;

  • anomaly detection.

"Why did revenue drop yesterday?" → compare_periods and detect_anomalies show that Puzzle Quest lost 48% of earnings, almost all of it volume (impressions −47%), not price (eCPM flat).

Why this server

  • Read-only by design. It requests only the admob.readonly and admob.report scopes, and every tool is annotated readOnlyHint.

  • Your credentials, your machine. It uses your own OAuth client. The token is stored locally with 0600 permissions. There is no telemetry, and the only network calls go to Google.

  • Small and auditable. Runtime dependencies are the official MCP SDK, zod and Google's google-auth-library. AdMob REST calls are a ~150-line fetch client.

  • Built for agents:

    • human units (no micros);

    • date presets in the account time zone;

    • request validation with precise errors before calling the API;

    • correct totals for ratio metrics;

    • compact tables plus typed structuredContent;

    • CSV export for big reports.

  • Analytics, not just endpoints: one-call earnings summary, period comparison ranked by contribution, and transparent anomaly detection.

Related MCP server: ga-gsc-analytics

Quick start

Set up with an AI agent

Copy this prompt and paste it into any AI coding agent (Claude Code, Cursor, Antigravity, VS Code Copilot, Codex, etc.) to have it guide you through installation, Google Cloud OAuth setup, verification, and client configuration:

Help me set up and connect the `admob-mcp` read-only Google AdMob MCP server on my machine.

Repo: https://github.com/oleksandrtry/admob-mcp
Docs: docs/setup-google-cloud.md and docs/troubleshooting.md

Follow these steps and check my environment before asking me to do anything manual:
1. Check Node.js (`node -v`, requires >= 20). Install `admob-mcp` from GitHub if not already installed:
   - If we are inside a local clone of `admob-mcp`, run `npm install && npm run build` (optionally `npm link`) and use `node <ABS_PATH>/dist/index.js`.
   - Otherwise, install globally from GitHub (`npm install -g github:oleksandrtry/admob-mcp`) so `admob-mcp` is available on PATH, or clone the repo into a folder and build it.
2. Run `<cmd> doctor` first to see if valid AdMob credentials already exist.
3. If not authenticated yet, never ask me to paste secrets or JSON files into chat. Instead:
   - On macOS/Linux/WSL with a local clone, offer to run `./scripts/setup-google-cloud.sh`, OR walk me step-by-step through `docs/setup-google-cloud.md`:
     a) Create/select a Google Cloud project and enable `admob.googleapis.com`.
     b) Configure OAuth consent screen (External), add read-only scopes `https://www.googleapis.com/auth/admob.readonly` and `https://www.googleapis.com/auth/admob.report`, and click **Publish app** ("In production") so the refresh token does not expire after 7 days.
     c) Create a **Desktop app** OAuth client and download the JSON (for example to `~/.config/admob-mcp/client_secret.json`).
   - Then run `<cmd> auth --client-secret <path-to-client_secret.json>` and tell me when to complete sign-in in the browser (note: for an unverified personal app, click Advanced -> Go to app (unsafe) and tick both AdMob scopes).
4. Run `<cmd> doctor` to confirm credentials, access token, and AdMob account ID(s).
5. Configure the MCP server in the MCP client I am currently using (or ask which client I want if unclear), using `admob-mcp` (if installed globally) or `node <ABS_PATH>/dist/index.js` (if built from a clone), and setting `ADMOB_ACCOUNT_ID` if `doctor` lists multiple accounts.
6. Tell me when to reload/restart the client and offer to test the connection with `list_accounts` or `get_earnings_summary`.

Manual setup

1. Install from GitHub. Needs Node.js ≥ 20.

Either install globally from GitHub:

npm install -g github:oleksandrtry/admob-mcp

Or clone the repo and build locally (this also gives you the interactive setup wizard):

git clone https://github.com/oleksandrtry/admob-mcp.git
cd admob-mcp
npm install && npm run build
# Optional: make `admob-mcp` available globally
npm link

2. Create a Google OAuth client and sign in (once, ~10 min).

  • Guided script (macOS / Linux / WSL): run ./scripts/setup-google-cloud.sh from a cloned repo — it walks you through Google Cloud, runs auth and doctor, and can register the server in Claude Code.

  • Or manually: follow docs/setup-google-cloud.md (create a project, enable the AdMob API, publish the consent screen, download a Desktop app OAuth JSON), then run:

admob-mcp auth --client-secret ./client_secret.json
admob-mcp doctor

(Without global install/npm link, use node dist/index.js instead of admob-mcp.)

3. Connect your client.

The examples below assume admob-mcp is installed globally (npm install -g github:oleksandrtry/admob-mcp or npm link). If you built from a clone without linking, use "command": "node", "args": ["/absolute/path/to/admob-mcp/dist/index.js"] (or node /absolute/path/to/admob-mcp/dist/index.js in claude mcp add). With nvm, prefer the absolute path to admob-mcp or node.

claude mcp add admob --scope user -- admob-mcp

With several AdMob accounts, set a default:

claude mcp add admob --scope user --env ADMOB_ACCOUNT_ID=pub-1234567890123456 -- admob-mcp

Add this to claude_desktop_config.json (Settings → Developer → Edit Config):

{
  "mcpServers": {
    "admob": {
      "command": "admob-mcp"
    }
  }
}

Add this to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "admob": { "command": "admob-mcp" }
  }
}

Add this to .vscode/mcp.json, or run MCP: Add Server:

{
  "servers": {
    "admob": { "type": "stdio", "command": "admob-mcp" }
  }
}

Any stdio MCP client works. Run admob-mcp (or node /absolute/path/to/admob-mcp/dist/index.js), with optional environment variables from the configuration table.

Then ask things like:

  • "How did my apps do last week?"

  • "Compare this month with the same period last year by country."

  • "Did anything break in the last 3 days?"

  • "Which mediation network has the best eCPM for interstitials?"

  • "Export daily earnings per ad unit for September to september.csv."

Tools

Tool

Purpose

list_accounts

Publisher accounts, currency, time zone

list_apps

Apps with IDs, platform, store ID, approval state

list_ad_units

Ad units with IDs, app, format

list_ad_sources

Mediation ad sources (networks)

run_network_report

Flexible AdMob Network report: any dimensions, metrics, filters, sort, CSV export

run_mediation_report

Mediation report by ad source, instance, mediation group…

run_campaign_report

House-ad / cross-promo campaign report (≤ 30 days)

get_earnings_summary

KPIs, daily trend and top contributors in one call

compare_periods

Period vs baseline, groups ranked by contribution to the change, volume vs price

detect_anomalies

Recent days vs baseline median, flags drops and spikes per app, country…

Prompts (slash commands in Claude Code: /mcp__admob__…): weekly_revenue_review, investigate_revenue_drop, mediation_performance_audit, country_breakdown.

See docs/tools.md for parameters, units and the exact anomaly method.

Configuration

Variable

Purpose

ADMOB_ACCOUNT_ID

Default publisher ID (pub-…) when the Google user has several accounts

ADMOB_CURRENCY

Default report currency (ISO 4217), e.g. USD. Defaults to the account currency

ADMOB_CLIENT_ID, ADMOB_CLIENT_SECRET, ADMOB_REFRESH_TOKEN

Use these instead of the saved credentials file (CI, containers)

ADMOB_CONFIG_DIR

Directory holding credentials.json (default ~/.config/admob-mcp, %APPDATA%\admob-mcp on Windows)

Credentials are looked up in this order:

  1. The environment variables above.

  2. credentials.json.

  3. Google Application Default Credentials.

CLI

admob-mcp                 Start the MCP server on stdio
admob-mcp auth            Sign in with Google (--client-secret <file>, --no-browser)
admob-mcp doctor          Check credentials and API access
admob-mcp logout          Delete saved credentials

Security and privacy

  • Scopes: admob.readonly and admob.report only. The server cannot change apps, ad units or mediation, and it never touches payments.

  • Local token storage: the refresh token lives in credentials.json (mode 0600, directory 0700) in Google's authorized_user format.

  • No telemetry: the server makes no network calls other than oauth2.googleapis.com and admob.googleapis.com.

  • File writes: the server writes files only when you ask a report tool for save_csv_path.

  • Revoking access: run admob-mcp logout, then remove the app at https://myaccount.google.com/permissions.

Troubleshooting

See docs/troubleshooting.md. Most issues are an expired Testing-mode token (publish the consent screen) or the AdMob API not being enabled in the client's project.

Development

The project needs Node.js ≥ 20.

npm install
npm run build        # compile to dist/
npm test             # unit tests (vitest)
npm run typecheck
npm run lint

Run your local build in Claude Code:

claude mcp add admob-dev --scope user -- node /absolute/path/to/admob-mcp/dist/index.js

You can also inspect it with the MCP Inspector:

npx @modelcontextprotocol/inspector node dist/index.js

License

MIT

Not affiliated with Google. AdMob is a trademark of Google LLC.

Available Tools

10 tools
compare_periodsCompare two periodsA
Read-onlyIdempotent

Compares AdMob Network KPIs between a period and a baseline (previous period, same period last year, or custom), overall and per app / ad unit / country / format / platform / version. Rows are ranked by their absolute contribution to the change, and show whether it came from volume (impressions) or price (eCPM). Use for 'why did revenue change?'.

Inputs: top_n, rank_by, baseline, dimension, +4 more. Returns: groups, current, baseline, currency, +3 more

detect_anomaliesDetect anomaliesA
Read-onlyIdempotent

Finds apps / ad units / countries / formats / platforms whose recent daily performance deviates sharply from their own baseline. Method: mean of the last recent_days days vs the MEDIAN daily value of the preceding baseline_days days; flagged when the change is at least threshold_pct. Low-volume groups are skipped. Today is excluded by default because its data is incomplete.

Inputs: metric, dimension, direction, account_id, +5 more. Returns: total, metric, recent, baseline, +6 more

get_earnings_summaryEarnings summaryA
Read-onlyIdempotent

One-call overview of AdMob Network performance for a period: KPI totals (earnings, impressions, eCPM, requests, match rate, show rate, CTR), a daily (or weekly, for ranges over 35 days) trend, and the top contributors by app, ad unit, country, format or platform. Best starting point for 'how are we doing?' questions.

Inputs: top_n, group_by, account_id, date_range. Returns: top, trend, others, totals, +5 more

list_accountsList AdMob accountsA
Read-onlyIdempotent

Lists the AdMob publisher accounts the signed-in Google user can access, with their currency and reporting time zone. Call this first if you are unsure which account_id to use.

Inputs: no named parameters. Returns: accounts

list_ad_sourcesList mediation ad sourcesA
Read-onlyIdempotent

Lists the mediation ad sources (ad networks) available to the account, e.g. AdMob Network, Meta Audience Network. IDs match the AD_SOURCE dimension of mediation reports.

Inputs: account_id. Returns: account_id, ad_sources

list_ad_unitsList ad unitsA
Read-onlyIdempotent

Lists ad units (ca-app-pub-…/…) with their app and format. Ad unit IDs can be used as AD_UNIT filter values in reports.

Inputs: app_id, format, account_id. Returns: ad_units, account_id

list_appsList appsA
Read-onlyIdempotent

Lists apps in an AdMob account with their app IDs (ca-app-pub-…~…), platform, store ID and approval state. App IDs can be used as APP filter values in reports.

Inputs: search, platform, account_id. Returns: apps, account_id

run_campaign_reportAdMob Campaign reportA
Read-onlyIdempotent

Runs an AdMob Campaign report for house-ad / cross-promotion campaigns (impressions, clicks, installs, cost). Date range is limited to 30 days. Filtering and sorting are applied after fetching.

Inputs: sort, filters, metrics, max_rows, +5 more. Returns: rows, report, totals, csv_path, +8 more

run_mediation_reportAdMob Mediation reportA
Read-onlyIdempotent

Runs an AdMob Mediation report: performance per ad source (network), ad source instance and mediation group, alongside app / ad unit / country breakdowns. Use to compare networks in your waterfall/bidding setup. OBSERVED_ECPM is the third-party network's estimated eCPM.

Inputs: sort, filters, metrics, currency, +6 more. Returns: rows, report, totals, csv_path, +8 more

run_network_reportAdMob Network reportA
Read-onlyIdempotent

Runs an AdMob Network report: earnings and performance of ads served by the AdMob Network, broken down by any dimensions (date, app, ad unit, country, format, platform, versions…). Use for most revenue questions. Money is in currency units (not micros); eCPM = IMPRESSION_RPM.

Inputs: sort, filters, metrics, currency, +6 more. Returns: rows, report, totals, csv_path, +8 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 10 tools

    Disambiguation4/5

    The four list_* tools target clearly separate resources, and the three run_*_report tools map to distinct report types (network, mediation, campaign). The only real overlap is get_earnings_summary versus run_network_report, which both cover AdMob Network performance, though the descriptions differentiate them as a quick overview versus a customizable breakdown.

    Naming Consistency5/5

    All ten tools follow a consistent snake_case verb_noun pattern (list_accounts, run_network_report, get_earnings_summary, compare_periods, detect_anomalies). The verbs are meaningful and predictably paired with the resource or operation they act on.

    Tool Count5/5

    Ten tools is well within the ideal range and each one earns its place: four discovery/list tools, three report runners, and three analysis helpers. Nothing appears redundant or padding.

    Completeness4/5

    The reporting surface is thorough, covering network, mediation, and campaign reports plus summary, comparison, and anomaly detection. Minor gaps exist: there is no listing of mediation groups or ad source instances, and no per-app or per-ad-unit detail lookup beyond the bulk list tools.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides read-only access to Google Ads account data including campaigns, ad groups, keywords, and performance reports. Enables querying via GAQL through an MCP interface.
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables read-only access to Google Analytics 4 and Google Search Console data, allowing users to run reports, query search analytics, and generate combined snapshots for reporting.
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables read-only inspection of Google Ads accounts through MCP, including account inventory, reporting, metadata, change history, and safe GAQL queries.
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Enables read-only access to Google Ads data through GAQL queries, resource exploration, recommendations, keyword planning and forecasts, and change history across manager and customer accounts.
      11
      28 PyPI
      MIT