Admob Mcp Server

io.github.ParkSangGwon由 GitHub 账号 ParkSangGwon 发布v0.2.0更新于 Oct 24, 2026

MCP server for the Google AdMob API — apps, ad units, mediation, and revenue reports

已验证STDIO仅桌面数据与分析商业与电商

概览

AI 生成的概览

一个本地 MCP 服务器,让 AI 助手用自然语言读取你的 Google AdMob 账户、应用、广告单元、中介来源和收入报告。

可以做什么
列出发布商账户及账户详情(如币种和时区),列出已注册应用及其平台、商店链接和审核状态,以及广告单元的 ID、格式和所属应用。按指定日期、指标、维度、筛选和排序生成 AdMob 网络、中介和推广活动报告,结果以平铺表格返回,金额由 micros 换算为货币单位。列出中介广告来源及其适配器,包括所需的配置键。读取内置的报告规范参考资源,并运行现成的分析提示,如表现最佳应用、收入摘要和广告格式对比。
适用场景
适合想用对话方式了解 AdMob 收入、RPM、eCPM 或中介表现,而不想手写报告查询时使用,也适合查询应用和广告单元 ID。适用于登录的 Google 账户所拥有的单个发布商账户。
运行要求
通过 npx 以 stdio 在本地运行,需要 Node.js 18 或更高版本。需要一个 AdMob 账户及拥有它的 Google 账户,并在 Google Cloud 中创建个人 OAuth 桌面客户端并启用 AdMob API;可用 auth 命令一次性登录,或通过 GOOGLE_CLIENT_ID、GOOGLE_CLIENT_SECRET 和 GOOGLE_REFRESH_TOKEN,或 gcloud 应用默认凭据。可选设置包括 ADMOB_ACCOUNT 和 ADMOB_TOOLSETS。
安装前请注意
服务器会在凭据目录中保存 OAuth 客户端文件和登录令牌;使用环境变量方式时,OAuth 密钥和刷新令牌会出现在客户端配置中。同意屏幕处于测试模式时,登录每 7 天过期。所有工具均为只读,但收入和应 用数据会发送到 Google API 并被助手看到;不会向 AdMob 写入任何内容。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Admob Mcp Server,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

AdMob MCP Server

[npm version] [CI] [license]

English | 한국어

Ask your AI assistant about your AdMob apps and earnings — in plain language:

  • "How much did my apps earn in the last 7 days, broken down by country?"
  • "Which mediation ad source had the best eCPM this month?"
  • "Compare the RPM of my banner vs. rewarded ad units."
  • "List my apps and their ad units."

[Asking Claude Code for the last 7 days of per-app AdMob revenue]

This is a Model Context Protocol (MCP) server for the Google AdMob API.
It works with Claude Code, Claude Desktop, Cursor, Gemini CLI, and any other MCP-capable AI client.

Architecture

mermaid
flowchart LR    C["MCP client<br/>Claude Code · Claude Desktop · Cursor · Gemini CLI"]
    subgraph S["admob-mcp-server — runs on your machine"]        direction TB        T["9 read-only tools in 5 toolsets<br/>accounts · apps · adunits · reports · mediation<br/>(filtered by --toolsets)"]        A["Credential resolver<br/>env vars → token.json → gcloud ADC"]        R["Report flattener<br/>chunk stream → rows · micros → currency"]    end
    G["Google AdMob API<br/>v1beta"]
    C <-->|"MCP over stdio"| T    T --> A    A <-->|"OAuth 2.0 / HTTPS"| G    G -.->|"report chunks"| R    R -.-> T

Credentials and revenue data travel only between your machine and Google — there is no third-party server in between.

Features

  • Everything the AdMob API opens to normal accounts — 9 tools across accounts, apps, ad units, reports, and mediation (why there are no write tools)
  • Reports made readable — streaming report responses are flattened into simple row tables, and monetary values (micros) are converted to real currency units
  • Read-only by design — the sign-in requests read scopes only, so the server cannot change anything in your AdMob account
  • Toolsets — enable only the tool groups you need, e.g. --toolsets reports,accounts
  • Three authentication options — one-command browser sign-in (npx admob-mcp-server auth), environment-variable refresh token, or gcloud Application Default Credentials
  • Built-in analysis prompts and report-spec reference resources

Setup at a glance

One-time setup, roughly 10 minutes:

StepWhat you doWhere
1. Google Cloud setupRegister a personal "app" so Google lets you access your own databrowser
2. Sign inRun one command and log in with Googleterminal
3. Connect your AI clientAdd one config entry and restart the clientterminal

Requirements

  • Node.js 18 or newer — check with node --version; if missing, install from nodejs.org
  • An AdMob account and the Google account that owns it

Setup

Part 1 — Google Cloud setup

Why is this needed?
The AdMob API has no simple API keys — Google requires every program that accesses your data to be registered as an "OAuth app".
Here you register a personal one that only you will use.
It's free and needs no billing setup.

  1. Create (or select) a Google Cloud project: console.cloud.google.com/projectcreate — any name works; reusing an existing project is fine too.
  2. Enable the AdMob API: console.cloud.google.com/apis/library/admob.googleapis.com → check that your project is selected in the top bar → Enable.
  3. Configure the OAuth consent screen: console.cloud.google.com/auth/overview — the first visit opens a short wizard:
    • App name: anything (e.g. admob-mcp), and your email as the support/contact email
    • Audience: External
    • Finish the wizard — you do not need to submit the app for Google's verification
    • Then go to Audience → Test users → Add users and add the Google account that owns your AdMob account
  4. Create an OAuth client: console.cloud.google.com/apis/credentials → Create credentials → OAuth client ID
    • Application type: Desktop app
    • After creating it, click Download JSON — you'll use this file in Part 2

[!WARNING] While the consent screen is in Testing mode, Google expires sign-ins after 7 days, so you'll need to re-run the sign-in weekly.
To stop that, publish the app (Audience → Publish app).
Publishing for your own use doesn't require Google's verification — you'll just see an "unverified app" warning during sign-in, which is expected.

Part 2 — Sign in

Move the JSON file you downloaded to where the server looks for it, then run the sign-in command:

bash
mkdir -p ~/.admob-mcpmv ~/Downloads/client_secret_*.json ~/.admob-mcp/oauth_client.json
npx admob-mcp-server auth

(On Windows, move the file to C:\Users\<you>\.admob-mcp\oauth_client.json in Explorer, then run the npx command.)

Your browser opens.
Pick the Google account that owns your AdMob account and allow access.
If you see a "Google hasn't verified this app" warning, that's your own app from Part 1 — click "Continue".
When the terminal prints Setup complete, your sign-in is saved to ~/.admob-mcp/token.json and reused from then on.

The sign-in requests the admob.readonly and admob.report scopes — read access only.

What the auth command does:

mermaid
sequenceDiagram    autonumber    participant T as Terminal    participant S as admob-mcp-server    participant B as Browser    participant G as Google
    T->>S: npx admob-mcp-server auth    S->>S: read ~/.admob-mcp/oauth_client.json    S->>B: open consent URL (loopback redirect, random port)    B->>G: sign in & allow scopes    G-->>S: authorization code → refresh token    S->>S: save ~/.admob-mcp/token.json (reused for every later call)
Advanced: environment variables (headless / CI)

If you already have a refresh token, no files are needed:

bash
export GOOGLE_CLIENT_ID="....apps.googleusercontent.com"export GOOGLE_CLIENT_SECRET="..."export GOOGLE_REFRESH_TOKEN="..."
Advanced: gcloud Application Default Credentials

The same pattern Google's official Analytics/Ads MCP servers use:

bash
gcloud auth application-default login \  --scopes=https://www.googleapis.com/auth/admob.readonly,https://www.googleapis.com/auth/admob.report,https://www.googleapis.com/auth/cloud-platform \  --client-id-file=path/to/oauth_client.json

Credential resolution order: environment variables → token.json (from auth) → ADC.

Part 3 — Connect your AI client

Pick your client below.
MCP servers are loaded when the client starts, so restart the client after adding the config.

Claude Code

bash
claude mcp add admob -- npx -y admob-mcp-server

Verify with claude mcp list — you should see admob: ... - ✔ Connected.

Claude Desktop — open Settings → Developer → Edit Config, which opens claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\), and add:

json
{  "mcpServers": {    "admob": {      "command": "npx",      "args": ["-y", "admob-mcp-server"]    }  }}

Restart the app; the admob tools appear in the tools menu of the chat input.

Cursor — add the same mcpServers block to ~/.cursor/mcp.json, then check Settings → MCP shows admob as enabled.

Gemini CLI — add the same mcpServers block to ~/.gemini/settings.json, then check with /mcp inside the CLI.

[!TIP] If you used the environment-variable sign-in, pass the variables through your client's env block (Claude Code: repeat --env KEY=value before --; JSON configs: add an "env": { ... } object next to "args").

Try it

You don't call tools yourself — just ask in plain language and the assistant picks the right tools.
Some starters:

  • "What did my apps earn last week?"
  • "Break down this month's revenue by country and app."
  • "Which ad format had the highest RPM in the last 30 days?"
  • "How is my mediation doing? Compare ad sources by observed eCPM."
  • "List my apps and their ad units."

Most clients ask for your permission before each tool call, so nothing runs without your approval.

Configuration

All configuration is optional — the defaults work for a single AdMob account.

Environment variables

VariableDescriptionDefault
ADMOB_ACCOUNTPublisher ID (pub-XXXXXXXXXXXXXXXX). Only needed when your login can access multiple accountsauto-discovered
ADMOB_TOOLSETSComma-separated toolsets to enableall
ADMOB_CREDENTIALS_DIRDirectory for oauth_client.json / token.json~/.admob-mcp
ADMOB_OAUTH_CLIENT_FILEPath to the OAuth client JSON used by auth<credentials dir>/oauth_client.json
GOOGLE_CLIENT_IDOAuth client ID (env sign-in; also used by auth instead of the JSON file)—
GOOGLE_CLIENT_SECRETOAuth client secret (env sign-in)—
GOOGLE_REFRESH_TOKENOAuth refresh token (env sign-in)—

CLI flags

FlagDescription
--toolsets <names>Same as ADMOB_TOOLSETS, e.g. --toolsets reports,apps
--account <pub-id>Same as ADMOB_ACCOUNT
--client-file <path>Same as ADMOB_OAUTH_CLIENT_FILE (for auth)

CLI flags take precedence over environment variables.
Flags go after the command in your client config, e.g. npx -y admob-mcp-server --toolsets reports.

Tools

A "tool" is a function the AI assistant can call on your behalf.
Tools are grouped into five toolsets; all are enabled by default:

ToolsetTools
accountslist_accounts, get_account
appslist_apps
adunitslist_ad_units
reportsgenerate_network_report, generate_mediation_report, generate_campaign_report
mediationlist_ad_sources, list_adapters

All tools are read-only and require the admob.readonly / admob.report scopes.

Why there are no write tools

The AdMob API does expose write methods (adUnits.create, apps.create, the whole mediationGroups resource), but Google marks each of them limited access:

This method has limited access. If you see a 403 permission denied error, please reach out to your account manager for access.

A normal publisher account gets PERMISSION_DENIED from all of them even with a valid admob.monetization token — and the same wall blocks mediationGroups.list and adUnitMappings.list, which are reads. Since these tools cannot work without an allowlisted account, they are not shipped: an assistant that sees them will try them and fail. Create ad units and mediation groups in the AdMob console instead.

accounts

ToolDescription
list_accountsList accessible publisher accounts — use to find your pub-... ID
get_accountGet account details: publisher ID, reporting currency, reporting time zone

apps

ToolDescription
list_appsList registered apps with app ID, platform, store link, and approval state

adunits

ToolDescription
list_ad_unitsList ad units with their IDs, formats, and owning apps

reports

All report tools take startDate / endDate (YYYY-MM-DD), metrics, and optional dimensions, dimensionFilters, sortConditions, maxReportRows (default 1000), currencyCode.
Responses are flat tables; monetary metrics are converted from micros to currency units.

ToolDescription
generate_network_reportAdMob Network performance: earnings, impressions, clicks, match rate, RPM, ...
generate_mediation_reportMediation performance across ad sources: earnings, observed eCPM per AD_SOURCE / MEDIATION_GROUP
generate_campaign_reportCross-promotion campaign stats (last 30 days only): impressions, clicks, installs, cost

Valid dimensions/metrics per report are exposed as MCP resources (reference documents the assistant can read): admob://reference/network-report-spec, mediation-report-spec, campaign-report-spec.

mediation

ToolDescription
list_ad_sourcesList available mediation ad sources (ad networks) and their IDs
list_adaptersList adapters of an ad source, incl. required configuration keys

Mediation groups and ad unit mappings are not covered — see Why there are no write tools.

Prompts

Prompts are ready-made analysis requests.
Your client surfaces them as slash commands or a prompt picker (e.g. /top_performing_apps in Claude Code).
All take an optional days argument:

PromptWhat it does
top_performing_appsRanks your apps by revenue with RPM and match-rate context
revenue_summaryDaily revenue trend with anomaly call-outs
compare_ad_formatsCompares earnings and efficiency across ad formats

Security & privacy

  • The server runs entirely on your computer.
    Your data flows only between your machine and Google's API — never through any third-party server.
  • Two files are stored locally, both readable only by your user account: ~/.admob-mcp/oauth_client.json (your OAuth app) and ~/.admob-mcp/token.json (your sign-in).
  • To sign out: delete ~/.admob-mcp/token.json, and optionally revoke the app's access at myaccount.google.com/permissions.
  • Nothing can be modified: the sign-in requests read scopes only, and every tool is a read.

Troubleshooting

Install & connection

command not found: npx / spawn npx ENOENT
  • Cause: Node.js is not installed, or your client can't find it.
  • Fix: install Node 18+ from nodejs.org, then restart the client.
The server doesn't appear in the client
  • Cause: MCP servers load at client startup, or the server fails to start.
  • Fix: restart the client first.
    Then check its MCP status (Claude Code: claude mcp list, Gemini CLI: /mcp), and make sure npx -y admob-mcp-server runs in a terminal without errors.

Sign-in & auth

"No usable Google credentials found"
invalid_grant / "token has been expired or revoked"
  • Cause: your sign-in expired.
    With a consent screen in Testing mode this happens every 7 days.
  • Fix: re-run npx admob-mcp-server auth.
    To stop it recurring, publish the app (Audience → Publish app).
access_denied during browser sign-in
  • Cause: the Google account you picked is not a test user of the consent screen.
  • Fix: add it under Audience → Test users, or publish the app.
"The publisher could not be authenticated"
  • Cause: the Google account you signed in with has no active AdMob account.
  • Fix: re-run npx admob-mcp-server auth and pick the account that owns your AdMob account in the account chooser.

API errors

403 PERMISSION_DENIED
  • Cause: the AdMob API isn't enabled, the wrong Google account is signed in, or the token predates a scope change.
  • Fix: check the following:
    1. The AdMob API is enabled in the same project as your OAuth client
    2. You signed in with the account that owns the AdMob account
    3. Your token covers admob.readonly and admob.report — re-run npx admob-mcp-server auth to refresh it
429 RESOURCE_EXHAUSTED
  • Cause: AdMob API quota hit (usage limits).
  • Fix: retry later, or reduce the request — narrower date range, fewer dimensions.
"Multiple AdMob accounts found"
  • Cause: your Google login can access several publisher accounts.
  • Fix: set ADMOB_ACCOUNT=pub-... (find IDs with list_accounts).

Development

bash
git clone https://github.com/ParkSangGwon/admob-mcp-server.gitcd admob-mcp-servernpm installnpm testnpm run build
# debug with the MCP Inspectornpm run inspect

To run a local build in a client, point it at the built entry instead of npx: node /path/to/admob-mcp-server/dist/index.js.

Releases: pushing a v* tag runs CI and publishes to npm with provenance (see .github/workflows/release.yml).

Contributing

Issues and pull requests are welcome.
For larger changes, please open an issue first to discuss the direction.
Make sure npm run lint, npm run format:check, and npm test pass.

License

MIT

来源:README.md,提交 f613490

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.2.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分