google-ad-manager
MCP server for Google Ad Manager. Manage ad campaigns, orders, line items, and creatives through AI assistants like Claude, ChatGPT, Gemini, Cursor, and VS Code. Automate your ad operations with natural language instead of clicking through the GAM UI. Built by Matious.
claude mcp add --transport stdio matiouscorp-google-ad-manager-mcp python -m gam_mcp.server \ --env GAM_MCP_HOST="<server host for HTTP mode, default 0.0.0.0>" \ --env GAM_MCP_PORT="<server port for HTTP mode, default 8000>" \ --env GAM_NETWORK_CODE="<Your Ad Manager network code>" \ --env GAM_MCP_TRANSPORT="<stdio|http> (default: stdio)" \ --env GAM_MCP_AUTH_TOKEN="<optional fixed token for HTTP mode>" \ --env GAM_CREDENTIALS_PATH="<path to your Google Ad Manager service account credentials JSON>"
How to use
This MCP server provides a Python-based integration for Google Ad Manager that enables AI assistants to manage campaigns, orders, line items, creatives, and advertisers through natural language. It exposes an MCP protocol endpoint and uses FastMCP middleware for authentication and lifecycle management. You can run it locally or in a container and connect it to AI assistants like Claude, ChatGPT, Gemini, or others via Claude Desktop or HTTP endpoints. Typical interactions include creating campaigns, uploading creatives, configuring line items, and verifying delivery status, all through natural language prompts that are translated into Ad Manager API calls by the server.
Once the server is running, you can invoke tools through the MCP endpoint at /mcp. If you enable HTTP transport, clients will authenticate with a Bearer token (by default a random token is generated at startup if GAM_MCP_AUTH_TOKEN is not set). Ensure you supply GAM_NETWORK_CODE and credentials path to access Ad Manager data. The server handles authentication at the tool level and logs authentication failures for auditing.
How to install
Prerequisites:
- Python 3.10+ installed on your system
- Git (optional, for cloning the repo)
- Network access to install Python packages from PyPI
Install from PyPI (recommended):
pip install google-ad-manager-mcp
Or install via uv (if you prefer uvx for Python tool virtual environments):
uv pip install google-ad-manager-mcp
Install from source:
git clone https://github.com/MatiousCorp/google-ad-manager-mcp.git
cd google-ad-manager-mcp
pip install -e .
Dependencies include:
- FastMCP: MCP server framework with native middleware support
- googleads: Google Ad Manager SOAP API client
Optional: Use a Python virtual environment to isolate dependencies.
python -m venv env
source env/bin/activate # on Unix/macOS
.
env\Scripts\activate # on Windows
Additional notes
Environment variables:
- GAM_CREDENTIALS_PATH is required and must point to your Google service account credentials JSON file.
- GAM_NETWORK_CODE is required and must be your Ad Manager network code.
- GAM_MCP_TRANSPORT defaults to stdio; switch to http for HTTP mode.
- GAM_MCP_HOST and GAM_MCP_PORT apply only in HTTP mode, defaulting to 0.0.0.0:8000.
- GAM_MCP_AUTH_TOKEN is optional. If not set, a random token will be generated at startup and displayed in logs. For production, set a fixed token to enforce token-based access.
Common issues:
- Ensure credentials JSON has the necessary permissions for Ad Manager API operations.
- If running in Docker, mount credentials and pass network code as environment variables; ensure the container has network access.
- When using HTTP mode, remember to include the Authorization header with Bearer token on tool calls.
Tips:
- For AI assistants, consider using Claude Desktop in uvx or Docker configuration as shown in the repo examples to simplify deployment.
- Review logs if authentication errors occur to confirm whether a fixed token is configured or if a random token was generated at startup.
Related MCP Servers
repomix
📦 Repomix is a powerful tool that packs your entire repository into a single, AI-friendly file. Perfect for when you need to feed your codebase to Large Language Models (LLMs) or other AI tools like Claude, ChatGPT, DeepSeek, Perplexity, Gemini, Gemma, Llama, Grok, and more.
bytebot
Bytebot is a self-hosted AI desktop agent that automates computer tasks through natural language commands, operating within a containerized Linux desktop environment.
awesome-agent-skills
A curated list of skills, tools, tutorials, and capabilities for AI coding agents (Claude, Codex, Antigravity, Copilot, VS Code)
yutu
A fully functional MCP server and CLI for YouTube
claude-historian
📜 An MCP server for conversation history search and retrieval in Claude Code
mcp-mail
📧 MCP Mail Tool - AI-powered email management tool | 基于 MCP 的智能邮件管理工具