ad-revenue-reports-mcp
# ad-revenue-reports-mcp
Read-only MCP server for the [Google AdMob API](https://developers.google.com/admob/api) (v1). Ask Claude how your ads are doing: earnings, eCPM, impressions, match rate, by app, country, format or ad source, compared with the previous period. It cannot change anything in your account (OAuth scope: `admob.readonly`).
> Unofficial community project. Not affiliated with, sponsored or endorsed by Google. "Google" and "AdMob" are trademarks of Google LLC and are used here only to describe what this software works with.
## What you can ask
- "How much did I earn last week compared with the week before?"
- "Which countries earn the most this month, and what is the eCPM there?"
- "Which ad source in my mediation performs best?"
- "Earnings per day for the last 30 days."
- Slash prompt `admob_weekly_report`: a ready-made weekly summary.
You never have to type an account ID (your only account is used automatically) or calculate dates (`last_7_days`, `this_month`, ... are built in).
## Tools
| Tool | Purpose |
|---|---|
| `admob_revenue_summary` | **Start here.** Totals for a period vs the previous period of equal length (earnings, impressions, clicks, eCPM, ad requests, match/show rate), optional top-N breakdown by app/country/format/platform/ad unit/day |
| `admob_network_report` | Custom Network report: choose metrics and dimensions, filters, sorting |
| `admob_mediation_report` | Earnings, observed eCPM and latency per ad source / mediation group |
| `admob_list_accounts` | Accounts you can access |
| `admob_list_apps`, `admob_list_ad_units` | Apps and ad units (IDs for filtering) |
| `admob_list_mediation_groups` | Mediation groups: targeting, ad units, ad sources with eCPM floors/ordering (v1beta) |
| `admob_list_ad_sources`, `admob_list_adapters` | Ad networks AdMob mediation supports, and the adapters of one ad source (v1beta) |
| `admob_list_ad_unit_mappings` | Which third-party ad network placements an ad unit is mapped to (v1beta) |
Periods: `today`, `yesterday`, `last_7_days` (the 7 complete days before today), `last_30_days`, `this_month`, `last_month`, in your account's reporting time zone. Or pass `start_date` + `end_date` (`YYYY-MM-DD`). Money is returned in your account currency, not micros.
## What it cannot do
This server only reads what Google's AdMob API exposes. Many console settings are **not available through any API**, so it cannot show or change them: payments and payment profile, blocking controls, privacy & messaging (consent), app-ads.txt status, policy center, account and user settings. It also cannot create or edit apps, ad units or mediation groups (read-only by design). The v1beta tools use an API version Google may change.
## Status
Early release. It is **not published on npm yet**, so for now you run it from a local clone (instructions below). `npx` and the plugin marketplace route start working once the package is published. (Installing straight from GitHub with `npx github:...` does not work: current npm versions disable git installs by default.) The unit and mocked end-to-end tests pass, but it has **not yet been verified against a live AdMob account**, so expect rough edges and please report them. Node.js 20.3 or newer is required.
## Setup (once, about 10 minutes)
1. **Get the code and build it:**
```bash
git clone https://github.com/OrhanArslan/ad-revenue-reports-mcp.git
cd ad-revenue-reports-mcp && npm install && npm run build
```
2. **Google Cloud**: create or choose a project, enable the **AdMob API**, configure the OAuth consent screen, and create an OAuth client of type **Desktop app**. Note the client ID and secret.
- While the consent screen is in "Testing" status, refresh tokens expire after 7 days. Publish the app for a durable token.
3. **Sign in once** and store the credentials on your machine:
```bash
ADMOB_CLIENT_ID=... ADMOB_CLIENT_SECRET=... node dist/index.js auth --save
```
Open the printed URL, approve read-only access. The credentials are saved to `~/.config/ad-revenue-reports-mcp/credentials.json` (or `$XDG_CONFIG_HOME/...`), readable only by you (mode 600). Nothing else is written.
4. **Add it to your client** (use the absolute path of your clone). No environment variables are needed after step 3.
**Claude Code:**
```bash
claude mcp add admob --scope user -- node /absolute/path/to/ad-revenue-reports-mcp/dist/index.js
```
**Other MCP clients (Claude Desktop, etc.):**
```json
{
"mcpServers": {
"admob": { "command": "node", "args": ["/absolute/path/to/ad-revenue-reports-mcp/dist/index.js"] }
}
}
```
**After the npm release**, `npx -y ad-revenue-reports-mcp` replaces the `node .../dist/index.js` command everywhere above (`npx -y ad-revenue-reports-mcp auth --save` for sign-in), and the Claude Code plugin becomes available:
```
/plugin marketplace add OrhanArslan/ad-revenue-reports-mcp
/plugin install ad-revenue-reports@ad-revenue-reports-marketplace
```
**Prefer no file on disk?** Run `auth` without `--save` (it prints the refresh token) and pass `ADMOB_CLIENT_ID`, `ADMOB_CLIENT_SECRET`, `ADMOB_REFRESH_TOKEN` in the client's `env` instead. Environment variables take precedence over the file.
## Privacy
The server runs on your machine. The only network calls go to `oauth2.googleapis.com` and `admob.googleapis.com`, and no telemetry is sent anywhere. Credentials live in your environment or, if you used `auth --save`, in a file only you can read; delete it any time to sign out, and revoke access at https://myaccount.google.com/permissions.
**Report data reaches your AI assistant.** Whatever a tool returns (earnings, impressions, app and ad unit IDs) becomes part of your conversation and is processed by the AI service you use with this server, under that service's own terms and privacy policy. You are responsible for making sure that sharing your AdMob data this way is compatible with your agreements with Google and anyone else involved. Use an assistant and plan you are comfortable sharing that data with.
## Disclaimer
Provided "as is" under the MIT license, without warranty. Report figures come straight from the AdMob API and are estimates; recent days can still change and may differ from the AdMob console and from final payments. Do not use this server's output as the sole basis for financial, tax or accounting decisions. This project is not endorsed by Google; use of the AdMob API is subject to Google's own terms and policies, which you accept when you create your OAuth client.
## Development
```bash
npm install && npm run build
npm run unit && npm run smoke && npm run e2e # all offline; smoke adds a live call if the three ADMOB_* vars are set
npx @modelcontextprotocol/inspector node dist/index.js
```
## Notes
- Report `timeZone` is not sent: the API currently supports only `America/Los_Angeles`, and the account default applies.
- `AD_TYPE` dimension cannot be combined with `AD_REQUESTS`, `MATCH_RATE`, `IMPRESSION_RPM`.
- Quotas: https://developers.google.com/admob/api/quotas
## License
MIT
TDQS
Scored across 10 tools
Each list tool targets a distinct resource (accounts, apps, ad units, mediation groups, ad sources, adapters, mappings) with dependency hints that make selection clear. The three report tools overlap conceptually, but the descriptions explicitly carve out roles (quick summary vs. custom metric/dimension vs. mediation/ad-source comparison), leaving only mild risk of confusing revenue_summary with network_report.
All ten tools use a single predictable scheme: the 'admob_' prefix plus a consistent snake_case verb_noun pattern (list_*, *_report, *_summary). No camelCase or mixed verb styles appear anywhere in the set.
Ten tools is squarely in the well-scoped range: seven thin metadata list endpoints plus three reporting tools, each earning its place. Nothing feels redundant or padded.
The read-only reporting domain is well covered: account/app/ad unit discovery, full mediation metadata (groups, sources, adapters, mappings), and three report modes with comparison periods and breakdowns. Minor gaps exist — no single-resource 'get' detail tools and no cross-account or export capability — but agents can work around these with the list and report tools.