🐍 ☁️ - Google Ad Manager API integration for managing campaigns, orders, line items, creatives and…
Google Ad Manager MCP Server
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
> **Automate Google Ad Manager with AI.** An MCP server that lets AI assistants like Claude, ChatGPT, Gemini, Cursor, and VS Code manage your ad campaigns, line items, creatives, and more through natural language.
Built by Matious — We build custom AI tools and MCP servers for businesses.
---
Why This Exists
Managing Google Ad Manager is tedious. Creating campaigns, uploading creatives, and configuring line items involves countless clicks through a complex UI.
**This MCP server changes that.** Connect it to Claude and manage your entire ad operations through conversation:
- *"Create a new campaign for Nike ending December 31st"*
- *"Upload all creatives from this folder and associate them with the Display line item"*
- *"Check which orders are currently delivering"*
No more clicking. Just tell Claude what you need.
Features
- **Order Management**: List, create, and manage orders
- **Line Item Management**: Create, duplicate, and configure line items
- **Creative Management**: Upload images, associate with line items, bulk upload
- **Advertiser Management**: Find, create, and list advertisers
- **Verification Tools**: Verify line item setup, check delivery status
- **Campaign Workflow**: Complete campaign creation in one operation
Installation
From PyPI (Recommended)
Or with uv:
From Source
Dependencies
- **FastMCP**: MCP server framework with native middleware support
- **googleads**: Google Ad Manager SOAP API client
Configuration
The server uses environment variables for configuration:
| Variable | Description | Required |
|----------|-------------|----------|
| GAM_CREDENTIALS_PATH | Path to service account JSON | **Yes** |
| GAM_NETWORK_CODES | Comma-separated list of GAM network codes (first is the default) | **Yes** |
| GAM_MCP_TRANSPORT | Transport mode: stdio or http | No (default: stdio) |
| GAM_MCP_HOST | Server host (HTTP mode only) | No (default: 0.0.0.0) |
| GAM_MCP_PORT | Server port (HTTP mode only) | No (default: 8000) |
| GAM_MCP_AUTH_TOKEN | Authentication token (HTTP mode only) | No (auto-generated if not set) |
Multi-Network Support
You can manage multiple GAM networks with a single server instance. List all network codes in GAM_NETWORK_CODES — the first one is the default:
All tools accept an optional network_code parameter. When omitted, the first (default) network is used. The same service account credentials are shared across all networks — just ensure the service account email has been added as a user in each network.
For Claude Code MCP configuration:
Authentication
The server implements Bearer token authentication using FastMCP native middleware, following MCP security best practices.
Security Features
- **FastMCP Native Middleware**: Uses FastMCP 2.x middleware for proper MCP lifecycle management
- **Cryptographically secure tokens**: Generated using secrets.token_hex(32)
- **Timing attack prevention**: Uses constant-time comparison (hmac.compare_digest)
- **Tool-level authentication**: Auth validated on every tool call
- **Audit logging**: All authentication failures logged
How It Works
Authentication is enforced at the tool level using FastMCP's middleware system:
- When a tool is called, the middleware validates the Authorization header
- If no token is configured (GAM_MCP_AUTH_TOKEN not set), requests are allowed
- Invalid or missing tokens return a ToolError with a helpful message
Setup
For remote deployments, set a fixed authentication token:
If not set, a random token is generated at startup and displayed in the logs.
Clients must include the token in the Authorization header:
Endpoints
| Endpoint | Description |
|----------|-------------|
| /mcp | MCP protocol endpoint (auth validated on tool calls) |