ads-mcp
Enables querying mobile ad revenue from Google AdMob and Huawei Petal Ads through natural language, with read-only tools for account, app, ad unit, and revenue reports.
README
ads-mcp
A Model Context Protocol server that puts your mobile ad revenue in one conversational interface: Google AdMob and Huawei Petal Ads (Publisher Service), side by side.
Ask Claude things like:
"How much did I earn across AdMob and Petal Ads last week?"
"Which AdMob ad units are underperforming?"
"Break down my Petal Ads revenue by app"
"Compare yesterday's eCPM by country"
Tools
| Tool | Network | Description |
|---|---|---|
admob_list_accounts |
AdMob | List publisher accounts |
admob_get_account |
AdMob | Account details (currency, timezone) |
admob_list_apps |
AdMob | List apps (paginated) |
admob_list_ad_units |
AdMob | List ad units (paginated) |
admob_network_report |
AdMob | Network report with full dimension/metric/filter/sort control |
admob_mediation_report |
AdMob | Mediation report (per ad-source performance) |
petal_report |
Petal Ads | Publisher report with full group-by/filter/order/pagination control |
petal_revenue_summary |
Petal Ads | Daily earnings trend + totals for a date range |
petal_apps_performance |
Petal Ads | Per-app (and per-placement) earnings breakdown |
ads_revenue_overview |
Both | Combined totals + daily breakdown across both networks |
ads_auth_status |
Both | Check which networks are configured/authorized |
All tools are read-only — this server never mutates your ad accounts.
Prerequisites
- Node.js 18+
- For AdMob: a Google Cloud project with the AdMob API enabled and an OAuth 2.0 Desktop app client
- For Petal Ads: a HUAWEI Developers OAuth client with the Publisher Service Reporting API (Ads Kit) enabled
Setup
1. Install and build
git clone https://github.com/qalvinahmad/ads-mcp.git
cd ads-mcp
npm install
npm run build
cp .env.example .env
2. Google AdMob
- Open Google Cloud Console → select/create a project.
- Enable the AdMob API in the API Library.
- APIs & Services → Credentials → Create Credentials → OAuth client ID → Desktop app, then download the JSON.
- Save it as
secrets/client_secret.json(or pointADMOB_CLIENT_SECRET_PATHin.envat it). - Run the one-time authorization (opens a browser):
npm run auth:admob
If your OAuth consent screen is in "Testing" status, add your Google account as a test user (otherwise you'll get an authorization error, and refresh tokens expire after 7 days).
3. Huawei Petal Ads
- Open HUAWEI Developers Console → HMS API Services → Credentials.
- Create an OAuth 2.0 client ID (server type) with the Ads Kit / Publisher Service Reporting API enabled.
- Put the credentials in
.env:
HUAWEI_CLIENT_ID=your_client_id
HUAWEI_CLIENT_SECRET=your_client_secret
Or, if you keep them as a single combined key:
HUAWEI_ADS_API_KEY=client_id:client_secret
No browser flow is needed — Petal Ads uses OAuth client-credentials (server-to-server).
4. Verify
npm run doctor # checks both networks; tests the Huawei token endpoint
npm run smoke # boots the server and validates the MCP handshake + tool list
Register with an MCP client
Claude Code (CLI)
claude mcp add ads -- node /absolute/path/to/ads-mcp/dist/index.js
Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"ads": {
"command": "node",
"args": ["/absolute/path/to/ads-mcp/dist/index.js"]
}
}
}
Cursor / Windsurf / Cline
"ads": {
"command": "node",
"args": ["/absolute/path/to/ads-mcp/dist/index.js"]
}
Configuration is read from ads-mcp/.env automatically (the server resolves it relative to its own install directory, not the client's working directory).
Environment variables
| Variable | Default | Description |
|---|---|---|
ADMOB_CLIENT_SECRET_PATH |
secrets/client_secret.json |
Google OAuth Desktop-app client JSON |
ADMOB_TOKEN_PATH |
secrets/admob-token.json |
Cached authorized user token |
ADMOB_OAUTH_PORT |
8089 |
Localhost port for the one-time OAuth flow |
HUAWEI_CLIENT_ID / HUAWEI_CLIENT_SECRET |
— | Huawei OAuth client (preferred) |
HUAWEI_ADS_API_KEY |
— | Combined client_id:client_secret fallback |
HUAWEI_DEFAULT_CURRENCY |
USD |
Default report currency (CNY, USD, EUR) |
HUAWEI_OAUTH_TOKEN_URL |
Huawei production | Override for testing |
HUAWEI_ADS_REPORT_URL |
Huawei production | Override for testing |
Security notes
secrets/and.envare gitignored — never commit credentials.- The AdMob token file is written with
0600permissions. - Huawei access tokens are cached in memory only.
- All tools are read-only against both ad networks.
API references
- AdMob API v1 (
admob.googleapis.com/v1) - Petal Ads Publisher Service Reporting API (
ads.cloud.huawei.com/openapi/monetization/reports/v1/publisher)
Credits
- AdMob client and OAuth flow adapted from willhou/admob-mcp (MIT).
- Petal Ads integration follows the official HMS-Core/hms-ads-severdemo reference.
License
MIT — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。