Skip to main content
Glama
azuostech

MCP Marketing Analytics

Official
by azuostech

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

Related MCP server: Meta Ads MCP Server

Local setup

  1. Install dependencies:

    npm install
  2. Copy the environment template:

    cp .env.example .env
  3. Build the project:

    npm run build
  4. 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

  1. Create or select a Google Cloud project.

  2. Enable the Google Ads API in the Google Cloud console.

  3. Create OAuth 2.0 Client ID credentials for a desktop application.

  4. Add the following OAuth scopes to the consent screen:

    • https://www.googleapis.com/auth/adwords

  5. Use a redirect URI such as:

    • http://localhost

  6. Complete the OAuth authorization flow and store the generated refresh token in GOOGLE_ADS_REFRESH_TOKEN.

  7. Insert your Google Ads developer token and customer IDs in the environment variables above.

  • 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 to v25.

  • GOOGLE_ADS_MOCK_MODE: opt-in demo data mode; keep false for the real integration.

Local OAuth helper

A local helper is now included so you can complete the flow directly from this project.

  1. Make sure your .env contains GOOGLE_ADS_CLIENT_ID and GOOGLE_ADS_CLIENT_SECRET.

  2. Build the project:

    npm run build
  3. Start the OAuth helper:

    npm run oauth:google-ads
  4. Open the printed URL in your browser, approve the consent screen, and return to the terminal.

  5. 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.

Available Tools

5 tools
accounts_discoveryA

List connected marketing accounts for the selected data source

ParametersJSON Schema
NameRequiredDescriptionDefault
sourceNo

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden of behavioral disclosure. It communicates that this is a read-only listing operation ('List'), which is useful. However, it does not disclose the return format, pagination behavior, or potential limitations, leaving some behavioral aspects opaque.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that front-loads the core action ('List connected marketing accounts') and context. Every word adds meaning, and there is no redundant or extraneous content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the absence of an output schema and annotations, the description needs to explain return values and parameter behavior. It does neither, leaving the 'source' parameter underspecified and the response format unknown. The tool is simple, but the lack of parameter and output detail makes it incomplete for an agent to invoke reliably.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage for the 'source' parameter, and the description only vaguely references 'the selected data source' without explaining what the parameter should contain or how to use it. This is insufficient for a parameter that is an object, leaving the agent guessing about its structure.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'List' and a clear resource 'connected marketing accounts', with a context 'selected data source'. This clearly distinguishes it from sibling tools like data_source_discovery and field_discovery, which target different resource types.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'for the selected data source' implies the tool is used after a data source is selected, providing some usage context. However, it does not explicitly state when to prefer this over alternatives or mention any exclusions, so guidance is only implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

data_queryB

Execute a marketing analytics query using the selected source, accounts, fields, and date range

ParametersJSON Schema
NameRequiredDescriptionDefault
fieldsYes
sourceYes
filtersNo
accountsYes
dateRangeYes

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of disclosing behavior. It only states that the tool 'executes' a query, with no mention of whether the query is read-only, what the response format is, whether results are returned directly or via an ID, or any side effects. This is a significant transparency gap for a query execution tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that efficiently communicates the core action. There is no fluff, and the key inputs are listed early. However, it is so brief that it sacrifices informative value, but this dimension specifically rewards economy and clarity, which this achieves.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (5 parameters, nested objects, no output schema), the description is incomplete. It does not explain how the parameters interrelate, what the returned data looks like, or how the tool fits into the overall query workflow beyond the implied 'selected' inputs. The sibling tool names suggest a workflow but are not sufficient documentation for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate. It mentions source, accounts, fields, and date range, giving a high-level hint of their roles, but omits the filters parameter entirely. It doesn't describe expected formats, structures, or constraints for any parameter, leaving the agent to guess.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies the tool as executing a marketing analytics query with specific inputs (source, accounts, fields, date range). This verb-resource pairing is specific and distinguishes it from sibling discovery tools (data_source_discovery, accounts_discovery, field_discovery) and the results retrieval tool (get_query_results), as this is the step that actually runs the query.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies a workflow: use this after selecting source, accounts, and fields (likely via the discovery tools) and to execute a query. However, it does not explicitly state when to use this tool versus get_query_results or provide exclusions. The context is clear but not explicit enough for a higher score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

data_source_discoveryA

List available marketing data sources and their configuration requirements

ParametersJSON Schema
NameRequiredDescriptionDefault
searchNo

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description carries the burden. The verb 'List' implies a read-only operation, and 'configuration requirements' provides some behavioral context. However, it doesn't disclose authentication needs, pagination, or any limitations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that clearly states the tool's purpose. It is front-loaded and contains no redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple, but the description leaves the 'search' parameter unexplained and gives no usage guidance relative to siblings. Given the simple schema and lack of output schema, some gaps are acceptable, but the param gap makes it incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has one optional 'search' object with no description, and the description does not mention this parameter at all. At 0% schema description coverage, the description fails to compensate, leaving the parameter's purpose and format unclear.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool lists available marketing data sources along with their configuration requirements. It distinguishes from sibling tools like accounts_discovery and field_discovery by focusing specifically on data sources.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use when you need to see data sources, but it doesn't explicitly mention alternatives or when not to use this tool. No guidance is provided about how it relates to other discovery tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

field_discoveryB

List available fields for a given marketing data source

ParametersJSON Schema
NameRequiredDescriptionDefault
searchNo
sourceNo

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden; it only states a read-like action but fails to disclose behavioral aspects such as permissions, rate limits, or response behavior, and doesn't clarify what happens without a source.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence with no redundant words, front-loading the action and resource effectively.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that there are no annotations, no output schema, and sparse schema descriptions, the description is incomplete: it lacks parameter explanations (especially 'search'), usage context, and behavioral details, making it insufficient for reliable tool selection.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description only indirectly explains 'source' (as the marketing data source); the 'search' parameter is completely undocumented in both schema and description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'List' and resource 'available fields' with scope 'for a given marketing data source,' clearly distinguishing from sibling tools like data_source_discovery and accounts_discovery.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives; the description merely implies usage for listing fields, without specifying prerequisites or comparing to data_source_discovery/accounts_discovery.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_query_resultsA

Retrieve the result of a previously executed query by schedule ID

ParametersJSON Schema
NameRequiredDescriptionDefault
scheduleIdYes

TDQS

A3.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. 'Retrieve' implies a read operation, but it does not disclose whether the result is immediately available, whether it can be fetched multiple times, or any error conditions (e.g., invalid schedule ID). For a retrieval tool, more behavioral context would be valuable.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that is front-loaded and contains no extraneous words. It efficiently communicates the tool's core function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with one parameter and no output schema, the description adequately conveys the purpose and parameter semantics. It could be improved by mentioning the return format or potential delays, but the current level of detail is sufficient for basic invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, and the only parameter 'scheduleId' is just a string in the schema. The description adds meaning by stating it is the ID of a previously executed query, which directly ties the parameter to the tool's purpose.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Retrieve'), the resource ('the result of a previously executed query'), and the key identifier ('by schedule ID'). This distinguishes it from sibling tools like data_query, which likely executes a query, and discovery tools, which explore metadata.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'previously executed query' implies this tool is used after a query has been run, but it does not explicitly state when to use this vs. alternatives like data_query. No direct alternative or exclusion is mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv0.1.0
    • First observedaccounts_discovery
    • First observeddata_query
    • First observeddata_source_discovery
    • First observedfield_discovery
    • First observedget_query_results

TDQS

A3.7/5.0

Scored across 5 tools

Disambiguation5/5

Each tool targets a distinct step in the analytics workflow: source discovery, account discovery, field discovery, query execution, and result retrieval. There is no overlap between these purposes, so an agent can confidently select the right tool.

Naming Consistency3/5

The first three tools follow a consistent 'X_discovery' pattern, but the last two deviate with 'data_query' and 'get_query_results', mixing structural conventions. While all names use snake_case, the inconsistency in pattern makes the naming less predictable.

Tool Count5/5

With only five tools, the set is well-scoped for a focused marketing analytics server. Each tool serves a necessary function in the pipeline without redundancy or bloat.

Completeness5/5

The tool set covers the full discovery-to-results lifecycle: discover sources, accounts, fields, execute a query, and retrieve results. There are no obvious gaps for read-only analytics operations.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    MCP server that provides tools and resources for interacting with Google Ads API, enabling search, metadata retrieval, and account management through natural language.
    3
    2,477 PyPI
    963
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Python MCP server that exposes Meta Marketing API data, providing tools to manage ad accounts, campaigns, and analytics through natural language interfaces.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server for Google Ads campaign reporting and management via Claude, enabling GAQL queries, performance metrics, and campaign modifications.
    20 npm
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server for managing Google Ads campaigns through the official Google Ads API, covering accounts, campaigns, budgets, keywords, search terms, and keyword ideas. It provides tools for both reading and mutating live ads data, such as pausing campaigns, updating budgets, and adding keywords.
    MIT