Ads MCP Server: Google Ads & TikTok Campaigns
Create cross-platform Google Ads & TikTok campaigns with an MCP server using OAuth 2.1 and progress streaming for long-running operations.
npx -y @amekala/ads-mcpOverview
The Ads MCP Server is a lightweight Model Context Protocol (MCP) server that helps developers create and manage cross-platform advertising campaigns for Google Ads and TikTok. It centralizes authentication, campaign creation workflows, and long-running orchestration, exposing REST endpoints and progress-streaming primitives so frontends and automation pipelines can monitor campaign deployment in real time.
This server is useful when you need to coordinate multi-network campaigns (for example launching the same creative on Google and TikTok) while maintaining secure OAuth 2.1 authentication, retry/refresh token handling, and visibility into long-running operations. It simplifies the repeated boilerplate around provider APIs and exposes an operational model suitable for integrations, web UIs, and CI/CD pipelines.
Features
- OAuth 2.1 compliant authentication for Google Ads and TikTok (Authorization Code + PKCE)
- Central campaign creation endpoints that target multiple ad networks
- Progress streaming for long-running operations (Server-Sent Events or WebSocket-friendly)
- Token refresh, secure storage recommendations, and session-based auth flows
- Simple REST API surface for automation and UI integrations
- Extensible adapter model to add other ad platforms or custom workflows
Installation / Configuration
Clone and install dependencies:
# assuming a Node.js-based project
Environment variables (example .env):
# Server
PORT=3000
BASE_URL=https://your-server.example.com # public URL used for OAuth redirect URIs
# Google Ads
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
GOOGLE_OAUTH_REDIRECT=${BASE_URL}/auth/google/callback
GOOGLE_SCOPES=https://www.googleapis.com/auth/adwords
# TikTok
TIKTOK_CLIENT_ID=your-tiktok-client-id
TIKTOK_CLIENT_SECRET=your-tiktok-client-secret
TIKTOK_OAUTH_REDIRECT=${BASE_URL}/auth/tiktok/callback
TIKTOK_SCOPES=advertiser.basic,advertiser.campaigns
# Persistence / tokens
DATABASE_URL=postgres://user:pass@db:5432/ads-mcp
ENCRYPTION_KEY=32-byte-random-key
Start the server:
# development
# production
Run behind HTTPS in production (use a reverse proxy like nginx or a managed TLS service). Ensure redirect URIs are registered exactly with provider consoles.
Available Resources
- GitHub repository (source & examples): https://github.com/amekala/ads-mcp
- Google Ads OAuth docs: https://developers.google.com/identity/protocols/oauth2
- TikTok for Business OAuth docs: https://ads.tiktok.com/marketing_api/docs
- Postman/OpenAPI: check the repo for OpenAPI or collection exports to import into REST clients
Typical API endpoints (may vary by release):
| Path | Method | Purpose |
|---|---|---|
| /auth/google | GET | Start Google OAuth authorization |
| /auth/tiktok | GET | Start TikTok OAuth authorization |
| /auth/:provider/callback | GET | OAuth callback handler |
| /campaigns | POST | Create a cross-platform campaign (returns operation id) |
| /operations/:id | GET | Get operation status |
| /operations/:id/stream | GET | Stream progress updates (SSE) |
Use Cases
Cross-platform campaign launch
- Use the /campaigns POST endpoint with a campaign definition (creative assets, targeting, budgets). The server will create provider-specific resources and return an operation id to monitor progress. Useful for marketing UIs where one “Launch” button provisions both Google and TikTok.
Long-running orchestration with progress streaming
- Starting large campaigns or asset uploads can take minutes. Clients can open an SSE connection to /operations/:id/stream to receive incremental progress events (queued, assets_uploaded, campaigns_created, completed) and display live status to users.
Token management and secure automation
- The MCP handles OAuth 2.1 flows including PKCE and refresh token lifecycle. CI/CD jobs or backend services can use persisted tokens (stored encrypted) to automate campaign rollouts without re-authorizing interactively.
A/B or mirrored campaigns
- Create variants of the same campaign across platforms and track each provider’s status via a single operation. Good for synchronized experiments and reporting.
Security & Best Practices
- Use Authorization Code + PKCE (OAuth 2.1 recommended) for browser flows and store client secrets server-side.
- Always run behind TLS (HTTPS) and validate redirect URIs exactly as registered with providers.
- Encrypt persisted tokens (use ENCRYPTION_KEY or a secrets manager) and limit token scope to only necessary permissions.
- Implement fine-grained access controls for API endpoints (API keys, OAuth for machine users, or session auth).
- Monitor and rate-limit provider API calls to avoid quota issues.
Next Steps
- Clone the repo, inspect the example campaign payloads and the adapters in the codebase.
- Register OAuth clients in Google and TikTok consoles, set redirect URIs to your BASE_URL endpoints, and populate .env.
- Try a local flow with ngrok for public callbacks, run a sample /campaigns request, and connect to the operations stream to observe the progress events.