adtech-mcp-server
<p align="right">
<a href="./README.es.md">🇪🇸 Leer en Español</a>
</p>
<p align="center">
<img src="./assets/banner.svg" alt="AdTech MCP Server Banner" width="100%" />
</p>
<p align="center">
<img src="https://img.shields.io/badge/MCP_SDK-v2_TypeScript-818CF8?style=for-the-badge&logo=modelcontextprotocol&logoColor=white" alt="MCP SDK v2" />
<img src="https://img.shields.io/badge/Zod-v4_Schemas-38BDF8?style=for-the-badge&logo=zod&logoColor=white" alt="Zod v4" />
<img src="https://img.shields.io/badge/AdTech-CAPI_+_ROAS_+_LTV-34D399?style=for-the-badge" alt="AdTech" />
<img src="https://img.shields.io/badge/License-MIT-F59E0B?style=for-the-badge" alt="MIT License" />
</p>
# adtech-mcp-server
A **Model Context Protocol (MCP) TypeScript SDK v2** server (`@modelcontextprotocol/server` + `zod/v4`) that equips any MCP-compatible AI host (Gemini, Claude Code, Cursor, VS Code) with deterministic **AdTech & Growth Engineering tools**: ROAS anomaly auditing, Meta CAPI SHA-256 payload generation, and e-commerce LTV/CAC payback math.
---
## Why Deterministic MCP Tools Matter for AdTech
<p align="center">
<img src="./assets/mcp-tool-architecture.svg" alt="Prompt-only vs Deterministic MCP v2 Server" width="100%" />
</p>
---
## Protocol Architecture
```mermaid
flowchart LR
Host["AI Host / Cursor / Claude / Gemini"] -->|"JSON-RPC 2.0 stdio"| Server["McpServer v2"]
Server -->|"Zod v4 Validation"| T1["audit_roas_anomalies"]
Server -->|"Zod v4 Validation"| T2["build_meta_capi_event"]
Server -->|"Zod v4 Validation"| T3["calculate_ltv_cac_payback"]
```
---
## Quick Start
```bash
git clone https://github.com/stephanocamoretti-dotcom/adtech-mcp-server.git
cd adtech-mcp-server
npm install
npm run build
npm run inspect
```
---
## Scaling Ideas for Production
1. **Streamable HTTP Transport**: Swap `serveStdio` for the MCP v2 HTTP/Hono adapter with OAuth 2.1 bearer verification so remote agency teams can share one hosted AdTech MCP endpoint.
2. **Live Meta & Google Ads Connectors**: Connect `audit_roas_anomalies` directly to Meta Insights API `v27.0` and Google Ads GAQL queries for real-time portfolio diagnostics inside chat.
3. **MCP Resources & Prompts**: Expose brand-specific target CPA/ROAS guardrails as MCP Resources (`adtech://clients/{id}/targets`).
---
## References
- [MCP TypeScript SDK v2 Documentation (`@modelcontextprotocol/server`)](https://ts.sdk.modelcontextprotocol.io/v2/)
- [Model Context Protocol — Build an MCP Server](https://modelcontextprotocol.io/docs/2026-07-28/develop/build-server)
- [Model Context Protocol TypeScript SDK on GitHub](https://github.com/modelcontextprotocol/typescript-sdk)
TDQS
Scored across 3 tools
Each tool targets a clearly different job: statistical anomaly detection on ROAS/spend, constructing a Meta CAPI event payload, and LTV/CAC unit-economics modeling. There is no overlap in inputs, outputs, or intent, so an agent can select without confusion.
All three names use a consistent snake_case verb_noun pattern (audit_, build_, calculate_) with domain-specific qualifiers. The verb variation reflects genuinely different actions rather than inconsistency.
Three tools is at the low end for an adtech server and the three functions feel somewhat like a grab bag rather than one cohesive workflow. Each tool is substantive and earns its place, but the surface is thin.
The server covers anomaly detection, CAPI event building, and LTV/CAC math, but lacks obvious adjacent operations: fetching campaign metrics from Meta/Google, budget pacing or reallocation recommendations, and any alerting or remediation after an anomaly is detected. Detection without follow-through leaves dead ends.