loading…
Search for a command to run...
loading…
Apple Search Ads API v5 (read-only). Campaigns, ad groups, keywords, performance reports.
Apple Search Ads API v5 (read-only). Campaigns, ad groups, keywords, performance reports.
Node version License andrealufino/aapl-ads-mcp MCP server
An MCP server that connects Claude (and any MCP-compatible client) to Apple Search Ads API v5.
MCP (Model Context Protocol) is an open standard that lets AI assistants call external tools. This server implements the MCP stdio transport and exposes 9 read-only tools that query your Apple Search Ads account — campaigns, ad groups, keywords, and performance reports.
You install it once, point Claude Desktop at it, and then ask questions in plain English: "Which keywords drove the most installs last month?" or "Show me campaigns with zero impressions this week."
The official ASA dashboards are good for humans but not for ad-hoc analysis or automated reporting. Existing MCP alternatives are either SaaS (you hand over your keys) or unmaintained. This is a self-hosted, open-source option you control.
All tools default to the last 30 days. Reports support HOURLY, DAILY,
WEEKLY, and MONTHLY granularity.
tapInstalls, viewInstalls, and related fields in ASA reports are populated by Apple Search Ads directly and do not require any SDK in your app. AdServices / AdAttributionKitis only needed if you want to attribute installs to specific campaigns from inside your app (e.g. for onboarding personalization).Use the modern genpkey command — it produces PKCS#8 format directly, which is what this server requires. The older ecparam -genkey produces SEC1 format and will cause a startup error.
# Generate private key (PKCS#8)
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out private-key.pem
# Derive public key
openssl pkey -in private-key.pem -pubout -out public-key.pem
Verify the private key starts with -----BEGIN PRIVATE KEY----- (not -----BEGIN EC PRIVATE KEY-----). If it starts with the EC variant, convert it:
openssl pkcs8 -topk8 -nocrypt -in ec-key.pem -out private-key.pem
Store private-key.pem outside the repository root if possible (e.g. ~/.ssh/asa-private-key.pem).
public-key.pemclient_id, team_id, and key_id from the confirmation screenorg_id in Account Settings → Overviewgit clone https://github.com/andrealufino/aapl-ads-mcp.git
cd aapl-ads-mcp
npm install
npm run build
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"aapl-ads": {
"command": "node",
"args": ["/absolute/path/to/aapl-ads-mcp/dist/index.js"], "env": { "ASA_CLIENT_ID": "SEARCHADS.your-client-id-here",
"ASA_TEAM_ID": "SEARCHADS.your-team-id-here",
"ASA_KEY_ID": "your-key-id-here",
"ASA_ORG_ID": "12345678",
"ASA_PRIVATE_KEY_PATH": "/absolute/path/to/private-key.pem"
} }
} }
**Note:** `ASA_PRIVATE_KEY_PATH` must be an absolute path. Tilde (`~`) is not
expanded by Node.js — use the full path.
For container or cloud deployments where mounting a file is impractical, set
`ASA_PRIVATE_KEY` to the inline PEM contents instead (newlines preserved). If
both are set, `ASA_PRIVATE_KEY` wins.
Restart Claude Desktop. Ask "run health check" to verify the server is
connected.
## Usage examples
These are natural-language prompts that work with Claude Desktop once the server
is running:
List my Apple Ads campaigns
Show me the last 30 days of campaign performance
Which keywords drove installs in my Brand campaign last week?
What search terms triggered my ads in the past month? Focus on ones
with impressions but no installs.
Compare weekly spend across all campaigns for Q1 2025
Show ad groups in campaign 1234567890 with their bid amounts
npm run build # compile TypeScript
npm test # run test suite (Vitest)
npm run typecheck # type-check without emitting
npm run lint # Biome lint
npm run format # Biome format (write)
To debug tool calls interactively without Claude Desktop:
npx @modelcontextprotocol/inspector node dist/index.js
Set the env vars in the Inspector UI before connecting.
Install lefthook hooks locally after cloning:
npx lefthook install
This sets up:
gitleaks protect --staged — blocks commits that contain secrets.ts filesSee docs/ARCHITECTURE.md for technical details: auth flow, HTTP client design, tool pattern, report schema quirks, and ASA v5 lessons learned during development.
Bug reports and pull requests welcome.
.env or *.pem files — both are in .gitignoreprivate-key.pem outside the repository rootMIT — see LICENSE.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"aapl-ads-mcp": {
"command": "npx",
"args": []
}
}
}PRs, issues, code search, CI status
Database, auth and storage
Reference / test server with prompts, resources, and tools.
Secure file operations with configurable access controls.