palaz-mcp-server

v0.6.3
palaz-mcp-server Checked 3 days ago Published 18 hours ago

MCP server exposing Palaz performance data to Claude (media-buying audit agents).

Exposes Palaz performance data to Claude (the media-buying audit agents) via the Model Context Protocol. Talks to the read-only Palaz API (api-v1 edge function); auth and per-brand scoping are enforced server-side by an API key. Forty tools, one per API route. period takes last_7_days, last_14_days, last_30_days, last_90_days, mtd or YYYY-MM-DD:YYYY-MM-DD. Routes marked full_access need a full_access key (the agency key is one; client keys get the rest). palaz_post_feed_card puts a finding or recommendation into the client's Palaz feed as a draft only the operator sees.

Summary extracted from the README.

Palaz MCP Server

Exposes Palaz performance data to Claude (the media-buying audit agents) via the Model Context Protocol. Talks to the read-only Palaz API (api-v1 edge function); auth and per-brand scoping are enforced server-side by an API key.

Architecture

Claude (Cowork / scheduled tasks)
   → palaz_* MCP tools
      → this server (stdio)
         → GET https://api.app-palaz.io/functions/v1/api-v1/...  (Bearer key)
            → Postgres read functions (api_* )

Tools

Forty tools, one per API route. period takes last_7_days, last_14_days, last_30_days, last_90_days, mtd or YYYY-MM-DD:YYYY-MM-DD. Routes marked full_access need a full_access key (the agency key is one; client keys get the rest).

Paid media (ads table):

Tool Endpoint
palaz_list_clients /clients
palaz_account_overview /clients/:id/overview
palaz_campaign_performance /clients/:id/campaigns
palaz_creative_performance /clients/:id/creatives
palaz_daily_spend /clients/:id/daily-spend
palaz_customer_type_breakdown /clients/:id/customer-types
palaz_ai_search_traffic /clients/:id/ai-search
palaz_funnel_performance /clients/:id/funnel (full_access)
palaz_revenue_summary /clients/:id/revenue-summary (full_access)
palaz_growth_levers /clients/:id/growth-levers?goal_pct (full_access)
palaz_attribution_comparison /clients/:id/attribution (full_access)
palaz_pixel_health /clients/:id/pixel-health (full_access)
palaz_conversion_lag /clients/:id/conversion-lag (full_access)
palaz_search_terms /clients/:id/search-terms (full_access)
palaz_platform_health /clients/:id/platform-health (full_access)
palaz_amazon_metrics, palaz_amazon_keywords /clients/:id/amazon-* (full_access, scaffold)

Subscriptions (Recharge / Skio):

Tool Endpoint
palaz_subscription_overview /clients/:id/subscriptions
palaz_subscription_churn /clients/:id/subscription-churn
palaz_subscription_revenue /clients/:id/subscription-revenue
palaz_subscription_acquisition /clients/:id/subscription-acquisition
palaz_subscription_economics /clients/:id/subscription-economics
palaz_subscription_cohorts /clients/:id/subscription-cohorts

Audience and orders:

Tool Endpoint
palaz_audience_segments /clients/:id/audience-segments
palaz_subscriber_segments /clients/:id/subscriber-segments
palaz_email_segment_results /clients/:id/email-segments (emailed vs not, per Palaz segment)
palaz_segment_customers /clients/:id/segment-customers
palaz_audience_overview /clients/:id/audience-overview
palaz_audience_retention /clients/:id/audience-retention
palaz_audience_geography /clients/:id/audience-geography
palaz_order_mix /clients/:id/order-mix
palaz_new_customer_value /clients/:id/new-customer-value
palaz_cohort_value /clients/:id/cohort-value
palaz_product_launches /clients/:id/product-launches

Email, creators, creative, organic:

Tool Endpoint
palaz_email_performance /clients/:id/email-performance
palaz_email_orders /clients/:id/email-orders
palaz_creators /clients/:id/creators
palaz_creator_content /clients/:id/creator-content
palaz_creative_reads /clients/:id/creative-reads
palaz_creative_brief /clients/:id/creative-brief
palaz_organic_posts /clients/:id/organic-posts
palaz_instagram_account /clients/:id/instagram-account

The feed (the agents' own cards):

Tool Endpoint
palaz_feed_cards GET /clients/:id/feed-cards
palaz_post_feed_card POST /clients/:id/feed-cards (write-enabled key)

palaz_post_feed_card puts a finding or recommendation into the client's Palaz feed as a draft only the operator sees. The operator approves or dismisses it in Palaz; only approved cards reach the client. Re-posting the same external_id updates the card. A card can carry a check (metric, direction, target, date) that Palaz scores hit / miss / too early once the date passes; palaz_feed_cards returns the scores, so the next run can open with last week's calls scored.

Writing needs an API key with can_write set (update api_keys set can_write = true where id = '…'). Read-only keys get a 403 from the write route.

The tool descriptions (src/tools.ts) say what each payload holds; agents read them at connect time, so the descriptions are the contract.

What this returns — and what it doesn't

Palaz stores a focused dataset. Endpoints return only fields backed by real data; fields the platform can't source yet are omitted (and noted in each payload's _meta). Currently omitted:

  • roas_click / roas_view and full attribution tiers (MTA/view)
  • per-campaign new vs returning, nc_roas / nc_cpa
  • hook_rate / hold_rate / video_completion_rate, landing_page_cvr
  • learning_phase, campaign_type, daily_budget
  • rolling reach / CPIR, account health flags

roas_backend = Shopify-attributed revenue (account/platform level only). returning_customers is an approximation (no order-event table) — see _meta. These are scoped for a future Phase 2 (admin-tier key + new sync pipelines); see PLAN.md.

Example scheduled task (per client)

Schedule: 0 12 * * 1  (Mondays at noon)

"Run the weekly Performance Audit for <Client>.
 1. palaz_account_overview(client_id='<id>', period='last_14_days')
 2. palaz_campaign_performance(client_id='<id>', period='last_14_days')
 3. palaz_daily_spend(client_id='<id>', period='last_14_days')
 4. palaz_customer_type_breakdown(client_id='<id>', period='last_14_days')
 Then run the media-buying-auditor skill and produce the Weekly Account
 Audit Report (vital signs, platform breakdown, hidden winners/losers,
 anomalies, prioritized actions). Note any field marked omitted in _meta."

Security

  • The API key is a secret: it lives only in the MCP env block, never in git.
  • All endpoints are read-only (GET). The key is scoped to specific brands.
  • Rotate by issuing a new key and revoking the old one (api_keys.revoked_at).