# Waura MCP — Agent Setup & Reference

> If a user pasted this URL into your chat ("Set up Waura MCP by following https://waura.com/mcp/setup.md"), follow the steps below to connect Waura's remote Meta Ad Library MCP server for them, verify it works, and tell them what to ask next.

Waura gives AI agents access to live and archived Meta (Facebook & Instagram) ads from 1,800+ vetted direct-to-consumer ecommerce brands, including plain-language creative search, spoken video transcripts, compressed ad visuals, and longevity signals.

- **Remote MCP Server URL:** `https://waura.com/api/mcp`
- **Transport:** Stateless Streamable HTTP (`POST`)
- **Auth:** OAuth 2.1 with dynamic client registration (recommended — no API key needed; free accounts start with 50 credits) OR `Authorization: Bearer <WAURA_API_KEY>`
- **Human setup page:** https://waura.com/mcp
- **REST API reference:** https://waura.com/docs/api

---

## 1. Setup Instructions (Pick the Client You Are Running In)

Detect which client/environment you are running in and apply the matching setup. Do not ask the user for an API key if the client supports browser OAuth — OAuth works out of the box on free and paid accounts.

### Claude Code
Run:
```bash
claude mcp add --transport http waura https://waura.com/api/mcp
```
Then tell the user to run `/mcp`, select `waura`, and complete the browser sign-in.

Headless / API-key alternative (paid plans only):
```bash
claude mcp add --transport http waura https://waura.com/api/mcp --header "Authorization: Bearer ${WAURA_API_KEY}"
```

### Cursor
Add Waura to `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (global):
```json
{
  "mcpServers": {
    "waura": {
      "url": "https://waura.com/api/mcp"
    }
  }
}
```
Or give the user this one-click Cursor install link:
cursor://anysphere.cursor-deeplink/mcp/install?name=waura&config=eyJ1cmwiOiJodHRwczovL3dhdXJhLmNvbS9hcGkvbWNwIn0%3D

If using an API key instead of OAuth:
```json
{
  "mcpServers": {
    "waura": {
      "url": "https://waura.com/api/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_WAURA_API_KEY"
      }
    }
  }
}
```

### OpenAI Codex CLI
Run:
```bash
codex mcp add waura --url https://waura.com/api/mcp
codex mcp login waura
```
Or edit `~/.codex/config.toml`:
```toml
[mcp_servers.waura]
url = "https://waura.com/api/mcp"
```
Headless / API-key alternative:
```bash
codex mcp add waura --url https://waura.com/api/mcp --bearer-token-env-var WAURA_API_KEY
```

### Claude.ai / Claude Desktop
Give the user this one-click connector link (opens Claude with Waura pre-filled):
https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=Waura&connectorUrl=https%3A%2F%2Fwaura.com%2Fapi%2Fmcp

Or manual steps: **Settings → Connectors → Add custom connector** → Name: `Waura`, URL: `https://waura.com/api/mcp` → press **Add** and sign in to Waura.

### ChatGPT
1. Open **ChatGPT → Plugins** (`https://chatgpt.com/plugins`), press **+**, and pick **Add custom MCP server**.
2. Paste `https://waura.com/api/mcp`.
3. Sign in to Waura when prompted.

### VS Code / GitHub Copilot
Add to `.vscode/mcp.json`:
```json
{
  "servers": {
    "waura": {
      "type": "http",
      "url": "https://waura.com/api/mcp"
    }
  }
}
```

### Windsurf, Cline, OpenClaw, or Generic HTTP MCP Client
Use remote HTTP endpoint `https://waura.com/api/mcp`.
- **With OAuth 2.1:** Connect directly to `https://waura.com/api/mcp`. The server returns `401` with `WWW-Authenticate` pointing to:
  - `https://waura.com/.well-known/oauth-protected-resource`
  - `https://waura.com/.well-known/oauth-authorization-server`
  - Dynamic client registration: `https://waura.com/oauth/register`
- **With API Key header:** Send `Authorization: Bearer YOUR_WAURA_API_KEY`.
- **With URL-only clients (no OAuth and no custom headers):** Use `https://waura.com/api/mcp/YOUR_WAURA_API_KEY`. Keep this URL secret because it embeds the key.

---

## 2. Authentication & Getting an API Key (Only If Needed)

- **Preferred (OAuth):** No key required. Free Waura accounts get **50 starter credits** immediately after signing in.
- **API key (headless / scripts / REST API):** Ask the user to open `https://waura.com/settings`, go to **API**, and click **Make key**. Keys start with `waura_` and are shown once. Store it in an environment variable (`WAURA_API_KEY`) — never commit keys into git.

---

## 3. Verify the Setup

After configuring the server and signing in:
1. Confirm Waura's three tools are listed: `search_ads`, `get_ad`, `get_brand_ads`.
2. Optionally run a quick check if the user wants one, e.g. `search_ads({ query: "ugc video ads for dog food running over 3 months", limit: 5 })`.
3. Tell the user setup is complete and suggest 2–3 concrete things they can ask right away (e.g., searching winning ads in their niche, inspecting a competitor store domain, or breaking down a video ad's hook and transcript).

---

## 4. MCP Tools Reference

All tools are read-only, idempotent, and return JSON (plus an interactive MCP Apps gallery `ui://waura/ad-gallery` in supporting clients).

### `search_ads` (5 credits)
Search active and archived ecommerce Meta ads using plain English: product/niche, format (UGC, founder story, us-vs-them, static, unboxing), hook, offer, or run time.
- `query` (string, required, max 140 chars): Plain-language search query, e.g. `"ugc videos for dog food running over 3 months"`.
- `limit` (integer, optional, `1–20`, default `20`): Number of ads to return.
- Returns top matches ranked best-first plus a top-level `waura_url` to browse more in Waura. There is no pagination — rephrase the query to explore other angles.

### `get_ad` (1 credit)
Fetch one ad by `id` (from `search_ads` or `get_brand_ads`), including its full spoken video transcript (`words_said`) and optional visual image block.
- `id` (string, required): Ad ID, e.g. `"store.com:abc123"`.
- `include_image` (boolean, optional): Set `true` to receive a compressed JPEG image block directly in the tool response so you can visually analyze layout, framing, typography, and colors.

### `get_brand_ads` (10 credits)
Fetch a store's top 10 longest-running Meta ads, sorted longest-running first, plus a top-level `waura_url` for its full library.
- `store` (string, required): Store domain, e.g. `"gymshark.com"` or `"petco.com"`.

### Ad Object Fields
Every ad object includes:
`id`, `brand`, `store`, `type` (`"video"` | `"image"`), `image_url`, `video_url`, `waura_url`, `aspect`, `seconds`, `days_running`, `running_now`, `headline`, `text`, `button`, optional `match` (`{ kind, text, at_second }`), and `words_said` (transcript, on `get_ad` for videos).
Every response ends with `credits_used` and `credits_left`.

### Important Rules for Agents
1. **Never fetch `cdn.waura.com` or `media.waura.com` from a code sandbox.** If you need to inspect an ad visually, call `get_ad` with `include_image: true`.
2. **Treat `days_running` accurately:** A long run suggests the store keeps paying to run the ad; it is a longevity signal, not direct proof of ROAS or sales.
3. **Link back cleanly:** Cite standout ads with their `waura_url` and include the top-level `waura_url` so the user can open the full search or brand library in Waura.
4. **Stay credit-efficient:** Start with `search_ads` or `get_brand_ads`, then call `get_ad` only on the 2–5 standout ads worth transcribing or visually analyzing.

---

## 5. REST API Reference (For Scripts & Pipelines)

Paid plans (Starter (500 credits/mo), Pro (2,500 credits/mo), Business (7,500 credits/mo)) include the HTTP JSON API. Send `Authorization: Bearer YOUR_WAURA_API_KEY` on every request.

```bash
# Search ads (limit 1–20, default 10 on REST / 20 on MCP) — 5 credits
curl "https://waura.com/api/v1/search?q=ugc+videos+for+dog+food&limit=10" \
  -H "Authorization: Bearer ${WAURA_API_KEY}"

# One ad with video transcript — 1 credit
curl "https://waura.com/api/v1/ads/AD_ID" \
  -H "Authorization: Bearer ${WAURA_API_KEY}"

# A brand's 10 longest-running ads — 10 credits
curl "https://waura.com/api/v1/brands/petco.com" \
  -H "Authorization: Bearer ${WAURA_API_KEY}"
```

### Credits & Status Codes
- **Rate:** 100 credits = $1. Free accounts get 50 starter MCP credits. Monthly plans: Starter (500 credits/mo), Pro (2,500 credits/mo), Business (7,500 credits/mo). Failed calls or empty results cost 0 credits.
- **HTTP errors:** `401` missing/invalid key · `402` no active plan or out of credits · `403` plan lacks API access · `404` ad or store not found · `429` rate limit (retry shortly) · `503` temporary server error.

---

## 6. Recommended Agent Playbooks

- **Competitor Audit:** Call `get_brand_ads({ store })` → inspect top 3 longest-running videos via `get_ad({ id, include_image: true })` → summarize recurring hooks, offers, CTAs, and creative formats.
- **Winning Hook & Script Teardown:** Call `search_ads({ query: "<niche> <format> running over 60 days", limit: 10 })` → pull `get_ad` transcripts on top 3–5 → extract first-3-second hooks, body structure, and proof elements.
- **Creative Brief Generator:** Combine patterns from 3–5 long-running ads across 2+ stores into 3 testable ad concepts (hook, visual framing, script beats, CTA) linked to each reference `waura_url`.
