MCP Marketing Analytics
A minimal MCP server for marketing analytics data discovery and querying, supporting Google Ads integration with mock fallback and real API access.
README
MCP Marketing Analytics
A minimal MCP server for marketing analytics data discovery and querying, starting with a Google Ads integration layer.
Features
- Data source discovery
- Google Ads account discovery
- Field discovery for metrics and dimensions
- Data query execution with mock fallback and real Google Ads support when configured
Local setup
- Install dependencies:
npm install - Copy the environment template:
cp .env.example .env - Build the project:
npm run build - Start the server:
npm start
Testing with MCP Inspector
Run the inspector against the local server:
npx @modelcontextprotocol/inspector node dist/server.js
Example tool calls
Health check:
{
"name": "health_check",
"arguments": {}
}
Discover sources:
{
"name": "data_source_discovery",
"arguments": {
"search": "google"
}
}
Discover accounts:
{
"name": "accounts_discovery",
"arguments": {
"source": "AW"
}
}
Discover fields:
{
"name": "field_discovery",
"arguments": {
"source": "AW",
"search": "cost"
}
}
Run a query:
{
"name": "data_query",
"arguments": {
"source": "AW",
"accounts": ["1234567890"],
"fields": ["date", "campaign_name", "clicks", "cost"],
"dateRange": {
"start": "2026-07-01",
"end": "2026-07-07"
},
"filters": ["clicks > 100"]
}
}
Retrieve query result:
{
"name": "get_query_results",
"arguments": {
"scheduleId": "schedule-123"
}
}
Google Ads configuration
Public multi-tenant connector
Production uses OAuth per user. The service keeps only its Google Ads developer
token and Google OAuth application credentials in Vercel; each user's Google
refresh token is encrypted and stored separately in Supabase. See
docs/multi-tenant-oauth.md for database migration,
redirect URI, environment configuration, and rollout instructions.
Local single-user mode
To enable the real Google Ads API flow, define these environment variables in your .env file:
GOOGLE_ADS_DEVELOPER_TOKEN=
GOOGLE_ADS_CLIENT_ID=
GOOGLE_ADS_CLIENT_SECRET=
GOOGLE_ADS_REFRESH_TOKEN=
GOOGLE_ADS_CUSTOMER_ID=
GOOGLE_ADS_LOGIN_CUSTOMER_ID=
GOOGLE_ADS_API_VERSION=v25
GOOGLE_ADS_MOCK_MODE=false
OAuth 2.0 setup for Google Ads
- Create or select a Google Cloud project.
- Enable the Google Ads API in the Google Cloud console.
- Create OAuth 2.0 Client ID credentials for a desktop application.
- Add the following OAuth scopes to the consent screen:
https://www.googleapis.com/auth/adwords
- Use a redirect URI such as:
http://localhost
- Complete the OAuth authorization flow and store the generated refresh token in
GOOGLE_ADS_REFRESH_TOKEN. - Insert your Google Ads developer token and customer IDs in the environment variables above.
Recommended values for the environment file
GOOGLE_ADS_DEVELOPER_TOKEN: your Google Ads manager/developer token.GOOGLE_ADS_CLIENT_ID: OAuth client ID from Google Cloud.GOOGLE_ADS_CLIENT_SECRET: OAuth client secret from Google Cloud.GOOGLE_ADS_REFRESH_TOKEN: refresh token obtained after the OAuth flow.GOOGLE_ADS_CUSTOMER_ID: the Google Ads customer ID you want to query.GOOGLE_ADS_LOGIN_CUSTOMER_ID: the manager/customer ID used for login context, often the same as the customer ID.GOOGLE_ADS_API_VERSION: Google Ads API version; defaults tov25.GOOGLE_ADS_MOCK_MODE: opt-in demo data mode; keepfalsefor the real integration.
Local OAuth helper
A local helper is now included so you can complete the flow directly from this project.
- Make sure your
.envcontainsGOOGLE_ADS_CLIENT_IDandGOOGLE_ADS_CLIENT_SECRET. - Build the project:
npm run build - Start the OAuth helper:
npm run oauth:google-ads - Open the printed URL in your browser, approve the consent screen, and return to the terminal.
- The helper will exchange the authorization code for tokens and print the response.
Example OAuth flow
If you want to test the flow manually, use the standard OAuth 2.0 desktop-app flow:
https://accounts.google.com/o/oauth2/v2/auth?client_id=YOUR_CLIENT_ID&redirect_uri=http://localhost:3000/callback&response_type=code&access_type=offline&scope=https://www.googleapis.com/auth/adwords&prompt=consent
Then exchange the returned authorization code for a refresh token using the local helper above.
Important notes
- The Google Ads API requires a valid developer token and OAuth credentials.
- The current implementation uses mock data whenever the required credentials are missing.
- Once the credentials are present, the server will attempt to call the real Google Ads API endpoints.
Connection diagnostics
Use the google_ads_connection_status MCP tool to verify production configuration
without returning credential values. Missing credentials now produce a clear error;
mock responses are used only when GOOGLE_ADS_MOCK_MODE=true.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.