Margyn MCP

Ask your store anything. Get an analyst’s answer.

Connect your AI assistant to Margyn and ask about revenue, profit, and ad performance in plain language — with real numbers, compared to the prior period.

Read-only by default · OAuth 2.1 · Works with Claude + ChatGPT

https://app.margyn.io/api/mcp/mcp

What is MCP?

MCP (Model Context Protocol) is an open standard that lets AI assistants connect to external tools and data sources. Margyn's MCP server gives your AI assistant direct access to your store's P&L metrics — so you can ask questions like "What was my profit last month?" and get an instant answer.


What it can do

55 tools, grouped by what you're trying to do. Ask in plain language — the assistant picks the right tool and compares against the prior period automatically.

Know how you're doing

Your scoreboard: revenue, profit, ROAS, ad spend, and data freshness across every store and platform.

list_clientsget_data_healthget_dashboard_metricsget_profit_lossget_net_sales_statement

Diagnose profit & cost

Where margin leaks and why a P&L line moved — split into volume × mix × rate, with what to fix first.

get_profit_healthget_cost_breakdownget_metric_change_analysisget_target_recommendationsget_profit_opportunitiesget_operating_expenses

Optimize advertising

Cross-platform ad performance, creative + audience fatigue, whether each Meta ad reaches new or existing people, attribution windows, the shopping funnel by channel, budget pacing, and Performance Max.

get_ad_performanceget_ad_commentssearch_ad_commentsget_comment_insightssave_comment_insightdraft_comment_briefsync_ad_commentsget_meta_insightsget_funnelget_budget_pacingget_pmax_analyticsrefresh_pmax_data

Customers & retention

Cohort retention, repeat-purchase cadence, and true LTV:CAC with payback.

get_cohort_analysisget_retention_kpisget_ltvget_time_between_orders

Products & inventory

Product-level margins and forward stockout / restock timing.

get_product_analyticsget_inventory_outlook

Trends & timing

Demand seasonality, anomaly alerts, growth opportunities, COD economics, and a forward action calendar.

get_sales_timeseriesget_seasonality_patternsget_anomaly_radarget_growth_opportunitiesget_cod_economicsget_growth_calendar

Record what happened

Write down what happened in the store that day — a campaign launch, a price change, a stockout, a supplier delay — so the next analysis says that instead of guessing. Only you can edit or delete a note.

log_annotation

Ad Library: what competitors run

Search the ads from competitors you follow, plus your own, with the same filters, tags and estimated winner score as the Ad Library in Margyn. Open one ad to see why it scored as it did and get a brief for making your own version: a pattern, never the competitor's words, images or logo. Save the ones worth keeping to the swipe file your whole team shares. Meta publishes no impressions, so the score is an estimate. The assistant never receives competitors' images or videos.

search_ad_libraryget_library_adlist_library_brandssave_library_ad

Create ads & research competitors

Paid · write

Test several different creative ideas in one round, with saved brand looks and the cost shown before you spend. Also forecast creative investment, reverse-engineer live competitor ads, and see what the AI has cost so far.

start_ad_campaigngenerate_ad_creativeget_generation_statusget_generation_assetget_ai_spendlist_generationslist_video_jobsgenerate_ad_videoget_video_statuscreate_style_presetlist_style_presetsdelete_style_presetget_creative_forecastanalyze_competitor_adssave_competitor_report

The full toolkit lives inside Margyn

Exactly what each tool returns and with which parameters — plus the built-in analytics playbook that wields them like an experienced operator — unlocks once you connect.

Connect Margyn

Analytics Playbook

The MCP server includes a built-in analytics playbook that auto-loads into your AI assistant. This ensures the AI analyzes your data the way an experienced e-commerce analyst would.

Profit Waterfall

RevenueCM1CM2Net Profit

CM1 = Revenue − COGS − Shipping | CM2 = CM1 − Ad Spend | Net Profit = CM2 − Operating Expenses

The playbook automatically selects the right tool for your question and compares against the previous period.


Cost Decomposition: Why a P&L Line Moved

The cost-breakdown tools split any P&L line's change into three additive effects vs a comparison period. "Shipping costs up 34%" isn't an answer — knowing which of the three drove it, is.

Δ Cost = sum of three effects

Volume+Mix+Rate
  • Volume effect: the business is just bigger — more orders, same mix, same rates.
  • Mix effect: shares among groups shifted (e.g. customers using a pricier gateway, a heavier carrier).
  • Rate effect: a provider raised their rate — same mix is now more expensive.

Example: "Payment costs up 34.5% — why?"

The AI calls get_cost_breakdown with costType="payment" grouped by gateway and reads the three effects:

  • • Volume +12% — more orders.
  • • Mix +21% — customers shifted to Barion (3.2% fee) away from Shopify Payments (2.4%).
  • • Rate +1% — no real fee structure change.

"Most of the 34.5% jump is mix — customers are using Barion more, which charges 0.8pp more than Shopify Payments. Route more checkouts back to Shopify Payments and you recover ~21% of the increase."


Connecting

Claude

Works on claude.ai web and the Claude Desktop app.

  1. 1Open Settings > Connectors
  2. 2Click "Add custom connector"
  3. 3Paste the server URL:
https://app.margyn.io/api/mcp/mcp
  1. 4Approve the OAuth authentication in the popup
  2. 5Done! Start asking questions about your store.

High-Value Prompts

Try these right after connecting:

Overview

“How's my store doing this month?”

“Why did my profit drop last week?”

“Is my data fresh across every platform?”

“How are my TikTok, Meta and Google ads performing side by side?”

Products

“Which are my most profitable products?”

“Which products waste ad budget without profit?”

Performance Max

“How are my PMax campaigns performing by channel?”

“Which PMax assets are working best?”

“Is PMax driving brand or non-brand searches?”

Customers

“Show me cohort retention for the last 6 months.”

“How much do new vs returning customers spend on average?”

“What is my new-customer CPA and ROAS by channel?”

“What is my LTV:CAC ratio and how long until I make my ad spend back?”

“Do my cohorts pay back their CAC, and when?”

Meta ads deep-dive

“Which of my creatives have the best hook rate?”

“Which audiences are burning out — show me frequency and CTR drift.”

“How much does 7-day click attribution add to my reported ROAS vs 1-day?”

“Which campaigns are overspending or underspending vs daily budget?”

“Which Meta ads have the best completion rate on video?”

Decision support

“What ROAS do I need to be profitable? What is my breakeven ROAS?”

“Why did my margin change last week — break it down by component.”

“How many of my products are missing cost data?”

“Where am I losing the most money — what should I fix first?”

Competitors & new ads

“Analyze [competitor]'s Meta ads: what works for them, and what should I test?”

“What are my competitors not doing that I could try?”

“Give me 5 ad ideas for my best-selling product.”

“What are the best ads from the competitors I follow?”

“Show me the longest-running offer ads from [competitor] and what they have in common.”

“Make a brief from that ad for my best-selling product, and save it to our swipe file.”

What happened that day

“Why did revenue jump on the 14th? Is there a note about it?”

“Log that the summer sale started on the 14th.”

“Which changes last month have a note, and which do not?”

“We were down for half a day on the 9th — log it, and tell me what it cost.”

Cost diagnostics

“Why did payment costs go up last month?”

“Which carrier raised rates — break shipping cost down by provider.”

“What's driving refunds — product issue or fulfilment issue?”

“Are discounts eating my margin? Show me by code.”


Security

Connecting an AI to your financial data should be safe by default. Here is how it is:

Read-only by default

The connector reads your analytics. It never touches your orders, products, costs or settings.

OAuth 2.1 + PKCE

Scoped, revocable sign-in. No API keys to paste or leak.

What Margyn keeps

Every answer is fetched live. Your conversation stays with your AI assistant, under its own settings — Margyn never sees it. Margyn logs which tools your assistant used and with what settings, to improve the product, and keeps what you save: a chart note, an ad image or a competitor report.

Scoped per store

Access is checked on every call — the AI only sees stores you're a member of.

Paid tools (ad-creative generation, AI video generation) stay off until an admin turns them on. Video generation is priced far above the rest: a single clip can cost several dollars, making it the single most expensive action this connection can take. Because of that, a store needs approval for video specifically, separate from and in addition to image generation, before it can be used. Video generation also carries its own permission scope, so a connection that already approved image generation does not gain the ability to generate video when it renews; that has to be approved again by name. (Downloading a clip that was already generated is not gated by this scope.) Everything that writes — a note on your chart, a saved competitor report — needs an admin account, and each one is named on the approval screen.


FAQ

MCP Server | Margyn Docs