{"swagger":"2.0","info":{"title":"Supermetrics MCP Server","description":"Supermetrics MCP Server - An MCP (Model Context Protocol) server providing access to marketing data from connected platforms like Google Analytics, Facebook Ads, Google Ads, and more.\n\nThis API enables LLMs to query marketing data, discover data sources and accounts, explore available fields, and retrieve performance metrics.","version":"1.0.0","contact":{"name":"Supermetrics","url":"https://supermetrics.com"},"license":{"name":"Proprietary"}},"host":"mcp.supermetrics.com","schemes":["https"],"basePath":"/","security":[{"oauth2":[]}],"x-ms-connector-metadata":[{"propertyName":"Website","propertyValue":"https://supermetrics.com"},{"propertyName":"Privacy policy","propertyValue":"https://supermetrics.com/privacy"},{"propertyName":"Categories","propertyValue":"Marketing"}],"securityDefinitions":{"oauth2":{"type":"oauth2","flow":"accessCode","authorizationUrl":"https://api.supermetrics.com/oauth/authorize","tokenUrl":"https://api.supermetrics.com/oauth/token","scopes":{},"description":"OAuth 2.0 authorization with DCR (Dynamic Client Registration) support"}},"definitions":{"Error":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","description":"Error message"}},"required":["success","error"]},"SuccessResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","description":"Response data"}}},"AccountsdiscoveryResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"accounts":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string"},"account_name":{"type":"string"}}}}}},"notes":{"type":"array","items":{"type":"string"},"description":"Actionable guidance for the user, e.g. licensing or usage instructions."}},"required":["success","data"]},"CampaignandresourcegetResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","description":"Response data"},"notes":{"type":"array","items":{"type":"string"},"description":"Actionable guidance for the user, e.g. licensing or usage instructions."}},"required":["success","data"]},"CampaigncreateResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"campaign_id":{"type":"string","example":"123456789"},"name":{"type":"string","example":"Spring Sale 2026"},"status":{"type":"string","example":"ENABLED"},"platform":{"type":"string","example":"google_ads"},"budget_amount":{"type":"number","example":100.0},"budget_type":{"type":"string","example":"DAILY"},"start_date":{"type":"string","format":"date"},"end_date":{"type":"string","format":"date"},"platform_details":{"type":"object","description":"Platform-specific details","properties":{"campaign_type":{"type":"string"},"bidding_strategy":{"type":"string"}},"additionalProperties":true},"ad_groups":{"type":"array","items":{"type":"object","properties":{"ad_group_id":{"type":"string"},"name":{"type":"string"},"ads":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}}}}}}}},"notes":{"type":"array","items":{"type":"string"},"description":"Actionable guidance for the user, e.g. licensing or usage instructions."}},"required":["success","data"]},"CampaignupdateResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"campaign_id":{"type":"string","example":"123456789"},"name":{"type":"string","example":"Spring Sale 2026"},"status":{"type":"string","example":"ENABLED"},"platform":{"type":"string","example":"google_ads"},"budget_amount":{"type":"number","example":100.0},"budget_type":{"type":"string","example":"DAILY"},"platform_details":{"type":"object","description":"Platform-specific details","properties":{"campaign_type":{"type":"string"},"bidding_strategy":{"type":"string"}},"additionalProperties":true}}},"notes":{"type":"array","items":{"type":"string"},"description":"Actionable guidance for the user, e.g. licensing or usage instructions."}},"required":["success","data"]},"ContactsupermetricsResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","description":"Response data"},"notes":{"type":"array","items":{"type":"string"},"description":"Actionable guidance for the user, e.g. licensing or usage instructions."}},"required":["success","data"]},"DataqueryResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"schedule_id":{"type":"string"}}},"notes":{"type":"array","items":{"type":"string"},"description":"Actionable guidance for the user, e.g. licensing or usage instructions."}},"required":["success","data"]},"DatasourcediscoveryResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"data_sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"category":{"type":"string"}}}}}},"notes":{"type":"array","items":{"type":"string"},"description":"Actionable guidance for the user, e.g. licensing or usage instructions."}},"required":["success","data"]},"FielddiscoveryResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"data_source":{"type":"string"},"total":{"type":"integer"},"metrics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"}}}},"dimensions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"}}}}}},"notes":{"type":"array","items":{"type":"string"},"description":"Actionable guidance for the user, e.g. licensing or usage instructions."}},"required":["success","data"]},"GetasyncqueryresultsResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","additionalProperties":true}},"status":{"type":"string"}}},"notes":{"type":"array","items":{"type":"string"},"description":"Actionable guidance for the user, e.g. licensing or usage instructions."}},"required":["success","data"]},"GettodayResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"date":{"type":"string","format":"date"},"iso_string":{"type":"string"},"timestamp":{"type":"integer"}}},"notes":{"type":"array","items":{"type":"string"},"description":"Actionable guidance for the user, e.g. licensing or usage instructions."}},"required":["success","data"]},"ManagedashboardsResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","description":"Response data"},"notes":{"type":"array","items":{"type":"string"},"description":"Actionable guidance for the user, e.g. licensing or usage instructions."}},"required":["success","data"]},"ManageuserandteamResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","description":"Response data"},"notes":{"type":"array","items":{"type":"string"},"description":"Actionable guidance for the user, e.g. licensing or usage instructions."}},"required":["success","data"]},"ResourcesmanageResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","description":"Response data"},"notes":{"type":"array","items":{"type":"string"},"description":"Actionable guidance for the user, e.g. licensing or usage instructions."}},"required":["success","data"]},"UserinfoResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"license":{"type":"object","properties":{"license_id":{"type":"integer","example":48390},"team_id":{"type":"integer","example":51},"license_model":{"type":"string","example":"FULL"},"start_date":{"type":"string","format":"date","example":"2018-11-14"},"end_date":{"type":"string","format":"date","example":"2035-11-28"},"license_status":{"type":"string","example":"VALID"},"license_days_left":{"type":"integer","example":3598},"license_url":{"type":"string","format":"uri","example":"https://hub.ismtip.com/subscriptions/48390"}},"required":["license_id","team_id","license_model","start_date","end_date","license_status","license_days_left","license_url"]},"product":{"type":"object","properties":{"product_code":{"type":"string","example":"API"},"product_full_title":{"type":"string","example":"Supermetrics API"},"product_logo_url":{"type":"string","format":"uri","example":"https://assets.supermetrics.com/images/productLogo/icon-api.svg"}},"required":["product_code","product_full_title","product_logo_url"]},"user":{"type":"object","properties":{"sub":{"type":"string","example":"86f0d65c38ef07c74aa9ccbab097f6ca58976552"},"name":{"type":"string","example":"John Doe"},"given_name":{"type":"string","example":"John"},"family_name":{"type":"string","example":"Doe"},"email":{"type":"string","format":"email","example":"john.doe@example.com"},"user_info":{"type":"object","properties":{"type":{"type":"string","example":"user"},"user_id":{"type":"string","example":"usr_13"},"email":{"type":"string","format":"email","example":"john.doe@example.com"}},"required":["type","user_id","email"]},"team_info":{"type":"object","properties":{"type":{"type":"string","example":"team"},"team_id":{"type":"string","example":"tm_51"},"name":{"type":"string","example":"Marketing Team"},"display_id":{"type":"string","example":"4444444"},"company_name":{"type":"string","example":"Acme Corp"},"company_country":{"type":"string","example":"US"}},"required":["type","team_id","name","display_id","company_name","company_country"]},"team_permissions":{"type":"object","properties":{"user_role":{"type":"string","example":"OWNER"}},"required":["user_role"]}},"required":["sub","name","given_name","family_name","email","user_info","team_info","team_permissions"]}},"required":["license","product","user"]},"notes":{"type":"array","items":{"type":"string"},"description":"Actionable guidance for the user, e.g. licensing or usage instructions."}},"required":["success","data"]}},"paths":{"/mcp/accounts_discovery":{"post":{"summary":"List connected accounts","description":"Discover connected accounts for a data source. Only call if data_source_discovery config shows has_account_list=true. RETURNS: account_id, account_name, group_name (when present), tags (when present).","operationId":"accountsdiscovery","tags":["Discovery"],"consumes":["application/json"],"produces":["application/json"],"x-ms-visibility":"important","parameters":[{"name":"body","in":"body","required":true,"schema":{"type":"object","properties":{"ds_id":{"type":"string","description":"Data source ID from data_source_discovery (e.g. 'FA', 'AW', 'GAWA')","title":"Data Source ID"},"compress":{"type":"boolean","description":"Always recommended. Encodes response as compact text, reducing size and token usage.","title":"Compress response"},"filter":{"type":"string","description":"Case-insensitive filter against account ID, name, group, tags (comma-separated)","title":"Filter accounts"}},"required":["ds_id"],"example":{"ds_id":"GAWA"}}}],"responses":{"200":{"description":"Successful response","schema":{"$ref":"#/definitions/AccountsdiscoveryResponse"}},"400":{"description":"Invalid request parameters","schema":{"$ref":"#/definitions/Error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}},"/mcp/campaign_and_resource_get":{"post":{"summary":"Campaign & Resource Get","description":"Get campaigns or related resources. resource_type options (pass options in params): - campaigns (default): list or get single campaign.","operationId":"campaignandresourceget","tags":["Campaign Management"],"consumes":["application/json"],"produces":["application/json"],"x-ms-visibility":"important","parameters":[{"name":"body","in":"body","required":true,"schema":{"type":"object","properties":{"ds_id":{"type":"string","description":"Ad platform: AW (Google), FA (Meta), AC (Microsoft), TIK (TikTok), LIA (LinkedIn)"},"account_id":{"type":"string","description":"Ad account ID from accounts_discovery (e.g. '1234567890' or 'act_123456')"},"max_rows":{"type":"integer","description":"Max results (default 50; raise e.g. 200 for more)"},"resource_type":{"type":"string","description":"Resource to fetch (default: campaigns). See tool description for valid values and params."},"params":{"type":"string","description":"Resource-type-specific parameters"}},"required":["ds_id","account_id"]}}],"responses":{"200":{"description":"Successful response","schema":{"$ref":"#/definitions/CampaignandresourcegetResponse"}},"400":{"description":"Invalid request parameters","schema":{"$ref":"#/definitions/Error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}},"/mcp/campaign_create":{"post":{"summary":"Create Campaign","description":"Create a campaign (AW/FA/TIK/LIA/AC/CGPTA). budget_amount is required. Partial success possible: campaign created but ad group/ad failed — check notes, don't retry blindly.","operationId":"campaigncreate","tags":["Campaign Management"],"consumes":["application/json"],"produces":["application/json"],"x-ms-visibility":"important","parameters":[{"name":"body","in":"body","required":true,"schema":{"type":"object","properties":{"ds_id":{"type":"string","description":"Ad platform: AW (Google), FA (Meta), AC (Microsoft), TIK (TikTok), LIA (LinkedIn)"},"account_id":{"type":"string","description":"Ad account ID from accounts_discovery (e.g. '1234567890' or 'act_123456')"},"name":{"type":"string","description":"Campaign name"},"status":{"type":"string","description":"Always created as PAUSED"},"budget_amount":{"type":"number","description":"Budget in account currency"},"budget_type":{"type":"string","description":"DAILY or LIFETIME. LIA/CGPTA: LIFETIME only at campaign level."},"start_date":{"type":"string","description":"YYYY-MM-DD"},"end_date":{"type":"string","description":"YYYY-MM-DD (required for LIFETIME budgets)"},"targeting":{"type":"string","description":"Campaign-level targeting defaults"},"extensions":{"type":"string","description":"Ad extensions (AW/AC only)"},"platform_settings":{"type":"object","additionalProperties":true,"description":"AW: {campaign_type: SEARCH|DISPLAY|SHOPPING|PERFORMANCE_MAX|DEMAND_GEN|MULTI_CHANNEL (App), product_filter: {mode: include|exclude, conditions: [{dimension, values}]} for retail campaigns (merchant_id auto-detected). Dimensions: custom_label_0..4, product_item_id, brand, condition, product_type_l1..l5, channel}. AW PERFORMANCE_MAX also: {conversion_goals (category names e.g. PURCHASE,LEAD,SIGNUP to narrow the campaign to specific conversion goals; non-account goals are ignored with a note), brand_exclusions (brand names to exclude, resolved via Google; max 20), final_url_expansion (bool, default true; false opts out of expanding to other landing pages)}. AC: {campaign_type: SEARCH|AUDIENCE|SHOPPING|PERFORMANCE_MAX}. FA: {objective: OUTCOME_TRAFFIC|OUTCOME_ENGAGEMENT|OUTCOME_LEADS|OUTCOME_SALES|OUTCOME_AWARENESS, campaign_budget_optimization (true=CBO budget at campaign; false=ABO budget per ad set)}. TIK: {objective_type: TRAFFIC|CONVERSIONS|REACH|LEAD_GENERATION|VIDEO_VIEWS}. CGPTA: {locations limited to US|CA|AU|NZ}. bidding_config: {target_roas (float, 3.5=350%), target_cpa (float)}."},"bidding_strategy":{"type":"string","description":"AW: MANUAL_CPC|MAXIMIZE_CLICKS|MAXIMIZE_CONVERSIONS|MAXIMIZE_CONVERSION_VALUE|TARGET_CPA|TARGET_ROAS. FA: LOWEST_COST_WITHOUT_CAP|LOWEST_COST_WITH_BID_CAP|COST_CAP|TARGET_ROAS. AC: MAX_CLICKS|MAX_CONVERSIONS|MANUAL_CPC|ENHANCED_CPC|TARGET_CPA|TARGET_ROAS."},"ad_groups":{"type":"array","items":{"type":"string"},"description":"Ad groups (AW/AC) or ad sets (FA/TIK)"},"url_tags":{"type":"string","description":"URL tracking parameters for ad links"}},"required":["ds_id","account_id","name"],"example":{"ds_id":"AW","account_id":"1234567890","name":"Spring Sale 2026","status":"PAUSED","budget_amount":100.0,"budget_type":"DAILY","platform_settings":{"campaign_type":"SEARCH","bidding_strategy":"MAXIMIZE_CONVERSIONS"}}}}],"responses":{"200":{"description":"Successful response","schema":{"$ref":"#/definitions/CampaigncreateResponse"}},"400":{"description":"Invalid request parameters","schema":{"$ref":"#/definitions/Error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}},"/mcp/campaign_update":{"post":{"summary":"Update Campaign","description":"Update an existing campaign. Also creates new ad groups/ads — see ad_groups param. Only provided fields are changed. There is no update_type parameter; operations are inferred from id presence/absence.","operationId":"campaignupdate","tags":["Campaign Management"],"consumes":["application/json"],"produces":["application/json"],"x-ms-visibility":"important","parameters":[{"name":"body","in":"body","required":true,"schema":{"type":"object","properties":{"ds_id":{"type":"string","description":"Ad platform: AW (Google), FA (Meta), AC (Microsoft), TIK (TikTok), LIA (LinkedIn)"},"account_id":{"type":"string","description":"Ad account ID from accounts_discovery (e.g. '1234567890' or 'act_123456')"},"campaign_id":{"type":"string","description":"Campaign ID from campaign_and_resource_get"},"status":{"type":"string","description":"ENABLED, PAUSED, or REMOVED"},"name":{"type":"string","description":"New campaign name"},"budget_amount":{"type":"number","description":"Budget in account currency"},"budget_type":{"type":"string","description":"DAILY or LIFETIME. LIA/CGPTA: LIFETIME only at campaign level."},"start_date":{"type":"string","description":"YYYY-MM-DD"},"end_date":{"type":"string","description":"YYYY-MM-DD"},"targeting":{"type":"string","description":"Replace campaign targeting"},"extensions":{"type":"string","description":"Replace extensions (AW/AC only)"},"platform_settings":{"type":"object","additionalProperties":true,"description":"Platform-specific update settings. campaign_type/objective cannot be changed after creation. AW: {product_filter (replaces existing product listing groups), bidding_config, ad_schedule, bid_adjustments}."},"bidding_strategy":{"type":"string","description":"AW: MANUAL_CPC|MAXIMIZE_CLICKS|MAXIMIZE_CONVERSIONS|MAXIMIZE_CONVERSION_VALUE|TARGET_CPA|TARGET_ROAS. FA: LOWEST_COST_WITHOUT_CAP|LOWEST_COST_WITH_BID_CAP|COST_CAP|TARGET_ROAS. FA: requires CBO (campaign budget); ABO campaigns can't change strategy; LOWEST_COST_WITH_BID_CAP needs bid_amount on each ad set. AC: MAX_CLICKS|MAX_CONVERSIONS|MANUAL_CPC|ENHANCED_CPC|TARGET_CPA|TARGET_ROAS."},"ad_groups":{"type":"array","items":{"type":"string"},"description":"Ad groups/ad sets to create or update. Create ads in existing ad set: [{id: 'ad_set_id', ads: [{name, creative, platform_settings}]}]. Create new ad set: [{name, ads: [...]}] (no id). Update ad set settings: [{id: 'ad_set_id', budget_amount, ...}]."},"url_tags":{"type":"string","description":"URL tracking parameters for ad links"},"remove_ad_ids":{"type":"array","items":{"type":"string"},"description":"Ad IDs to remove"},"remove_ad_group_ids":{"type":"array","items":{"type":"string"},"description":"Ad group IDs to remove"}},"required":["ds_id","account_id","campaign_id"],"example":{"ds_id":"AW","account_id":"1234567890","campaign_id":"123456789","name":"Updated Campaign Name","budget_amount":200.0}}}],"responses":{"200":{"description":"Successful response","schema":{"$ref":"#/definitions/CampaignupdateResponse"}},"400":{"description":"Invalid request parameters","schema":{"$ref":"#/definitions/Error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}},"/mcp/contact_supermetrics":{"post":{"summary":"Contact Supermetrics","description":"Send feedback, create a support ticket, or submit a sales enquiry. Only create support tickets when explicitly authorized by the user. For standard purchases, direct users to buy online at https://supermetrics.com/pricing.","operationId":"contactsupermetrics","tags":["Tools"],"consumes":["application/json"],"produces":["application/json"],"x-ms-visibility":"advanced","parameters":[{"name":"body","in":"body","required":true,"schema":{"type":"object","properties":{"type":{"type":"string","description":"feedback, support, or sales"},"subject":{"type":"string","description":"Brief summary"},"message":{"type":"string","description":"Detailed description with relevant context including trace IDs"},"category":{"type":"string","description":"Support ticket category"},"ds_id":{"type":"string","description":"Related data source ID (e.g. 'FA', 'AW')"},"firstname":{"type":"string","description":"First name (required for sales)"},"lastname":{"type":"string","description":"Last name (required for sales)"},"company":{"type":"string","description":"Company (required for sales)"},"country":{"type":"string","description":"Country (required for sales)"},"industry":{"type":"string","description":"Contact's industry. Used when type is 'sales'"}},"required":["type","subject","message"]}}],"responses":{"200":{"description":"Successful response","schema":{"$ref":"#/definitions/ContactsupermetricsResponse"}},"400":{"description":"Invalid request parameters","schema":{"$ref":"#/definitions/Error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}},"/mcp/data_query":{"post":{"summary":"Run a data query","description":"Query data from Google Ads, Facebook Ads, Google Analytics, LinkedIn Ads, TikTok Ads, Microsoft Ads, Shopify, HubSpot, and 200+ other platforms. Use discovery tools first: data_source_discovery for config, accounts_discovery for account IDs, field_discovery for fields.","operationId":"dataquery","tags":["Data Query"],"consumes":["application/json"],"produces":["application/json"],"x-ms-visibility":"important","parameters":[{"name":"body","in":"body","required":true,"schema":{"type":"object","properties":{"ds_id":{"type":"string","description":"Data source ID from data_source_discovery (e.g. 'FA', 'AW', 'GAWA')","title":"Data Source ID"},"ds_accounts":{"type":"array","items":{"type":"string"},"description":"Account IDs from accounts_discovery, or free-text identifier when is_free_text_account_required=true. Required when has_account_list=true.","title":"Data Source Accounts"},"fields":{"type":"array","items":{"type":"string"},"description":"Field IDs from field_discovery, comma-separated. List dimensions before metrics (e.g. 'date,clicks,cost'); if unsure whether a field is a dimension or metric, check field_discovery. All fields must share a common report_type if the source uses report types.","title":"Data Source Fields"},"date_range_type":{"type":"string","description":"Required when is_date_range_required=true in data_source_discovery config. Use 'custom' with start_date/end_date, or a relative range: last_7_days, last_30_days, last_month, this_month, yesterday, etc. Append '_inc' to include current period.","title":"Date Range Type"},"start_date":{"type":"string","description":"YYYY-MM-DD. Required when date_range_type=custom.","title":"Start Date"},"end_date":{"type":"string","description":"YYYY-MM-DD. Required when date_range_type=custom.","title":"End Date"},"timezone":{"type":"string","description":"IANA timezone (e.g. 'America/New_York'). Default: UTC.","title":"Timezone"},"filters":{"type":"string","description":"Filter expression: field_name operator value, combined with AND/OR. Operators: ==, !=, >, >=, <, <=, =@ (contains), !@ (not contains), =~ (regex), !~ (not regex), [] (in list). Example: \"country == US AND clicks > 100\"","title":"Filters"},"settings":{"type":"object","additionalProperties":true,"description":"Data source settings from data_source_discovery as a JSON object. Include report_type and all setting_ids here. ","title":"Settings"},"compare_type":{"type":"string","description":"prev_range, prev_year, prev_year_weekday, or custom (with compare_start/end_date)","title":"Comparison Period Type"},"compare_show":{"type":"string","description":"perc_change (default), abs_change, or value","title":"Comparison Value Type"},"compare_start_date":{"type":"string","description":"YYYY-MM-DD (when compare_type=custom)","title":"Comparison Start"},"compare_end_date":{"type":"string","description":"YYYY-MM-DD (when compare_type=custom)","title":"Comparison End"},"max_rows":{"type":"integer","description":"Max rows to return (default 1000, max 10000)","title":"Maximum Rows"}},"required":["ds_id"],"example":{"ds_id":"GAWA","ds_accounts":["123456789"],"fields":["date","sessions","pageviews"],"date_range_type":"last_7_days"}}}],"responses":{"200":{"description":"Successful response","schema":{"$ref":"#/definitions/DataqueryResponse"}},"400":{"description":"Invalid request parameters","schema":{"$ref":"#/definitions/Error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}},"/mcp/data_source_discovery":{"post":{"summary":"List available data sources","description":"Discover data sources or get a source's configuration. Without ds_id: lists all sources with auth status. With ds_id: returns config (capabilities, report_types, settings, login link if needed). With filter: narrows the list; single match returns full config automatically.","operationId":"datasourcediscovery","tags":["Discovery"],"consumes":["application/json"],"produces":["application/json"],"x-ms-visibility":"important","parameters":[{"name":"body","in":"body","required":false,"schema":{"type":"object","properties":{"compress":{"type":"boolean","description":"Always recommended. Encodes response as compact text, reducing size and token usage.","title":"Compress response"},"ds_id":{"type":"string","description":"When provided, returns full config for this source. Omit to list all.","title":"Data Source ID"},"filter":{"type":"string","description":"Case-insensitive filter against ID, name, categories (e.g. 'ads,social')","title":"Filter data sources"}}}}],"responses":{"200":{"description":"Successful response","schema":{"$ref":"#/definitions/DatasourcediscoveryResponse"}},"400":{"description":"Invalid request parameters","schema":{"$ref":"#/definitions/Error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}},"/mcp/field_discovery":{"post":{"summary":"List fields for a data source","description":"Discover available fields (metrics and dimensions) for a data source. Only call if data_source_discovery config shows has_fields=true. Fields in a query must share a common report_type if the source uses report types.","operationId":"fielddiscovery","tags":["Discovery"],"consumes":["application/json"],"produces":["application/json"],"x-ms-visibility":"important","parameters":[{"name":"body","in":"body","required":true,"schema":{"type":"object","properties":{"ds_id":{"type":"string","description":"Data source ID from data_source_discovery (e.g. 'FA', 'AW', 'GAWA')","title":"Data Source ID"},"compress":{"type":"boolean","description":"Always recommended. Encodes response as compact text, reducing size and token usage.","title":"Compress response"},"filter":{"type":"string","description":"Case-insensitive filter against field ID, name, type, group (e.g. 'click,impression')","title":"Filter fields"}},"required":["ds_id"],"example":{"ds_id":"GAWA","filter":"click"}}}],"responses":{"200":{"description":"Successful response","schema":{"$ref":"#/definitions/FielddiscoveryResponse"}},"400":{"description":"Invalid request parameters","schema":{"$ref":"#/definitions/Error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}},"/mcp/get_async_query_results":{"post":{"summary":"Get query results","description":"Retrieve results from a data_query using its schedule_id. Call immediately after data_query returns; keep polling until status is 'completed' or failed. Map columns by requested_field_ids/canonical_field_ids, not the row-0 display names.","operationId":"getasyncqueryresults","tags":["Data Query"],"consumes":["application/json"],"produces":["application/json"],"x-ms-visibility":"important","parameters":[{"name":"body","in":"body","required":true,"schema":{"type":"object","properties":{"schedule_id":{"type":"string","description":"Schedule ID from data_query response. Copy verbatim.","title":"Schedule ID"},"compress":{"type":"boolean","description":"Always recommended. Encodes response as compact text, reducing size and token usage.","title":"Compress response"}},"required":["schedule_id"],"example":{"schedule_id":"abc123-def456-ghi789"}}}],"responses":{"200":{"description":"Successful response","schema":{"$ref":"#/definitions/GetasyncqueryresultsResponse"}},"400":{"description":"Invalid request parameters","schema":{"$ref":"#/definitions/Error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}},"/mcp/get_today":{"post":{"summary":"Get today's date","description":"Get current UTC date and time. Use before data_query with custom date ranges to resolve relative date references (e.g. \"last month\") into specific dates.","operationId":"gettoday","tags":["Utilities"],"consumes":["application/json"],"produces":["application/json"],"x-ms-visibility":"advanced","parameters":[{"name":"body","in":"body","required":false,"schema":{"type":"object","properties":{}}}],"responses":{"200":{"description":"Successful response","schema":{"$ref":"#/definitions/GettodayResponse"}},"400":{"description":"Invalid request parameters","schema":{"$ref":"#/definitions/Error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}},"/mcp/manage_dashboards":{"post":{"summary":"Manage dashboards","description":"Share live dashboards in Supermetrics Studio — self-contained pages that re-query the user's data on each view, so a shared link always shows current numbers. Actions: - 'upload': Upload a new dashboard or replace an existing one. Requires title, code, allowed_tools, allowed_accounts.","operationId":"managedashboards","tags":["Tools"],"consumes":["application/json"],"produces":["application/json"],"x-ms-visibility":"advanced","parameters":[{"name":"body","in":"body","required":true,"schema":{"type":"object","properties":{"action":{"type":"string","description":"Action to perform: 'upload' to upload a new dashboard or replace an existing one, 'get' to retrieve dashboard code and metadata, 'edit' to apply targeted patches to dashboard code, 'changelog' to view version history and change descriptions."},"dashboard_id":{"type":"string","description":"UUID of the dashboard. Required for 'get' and 'edit'. For 'upload', omit to upload a new dashboard or provide to replace an existing one."},"title":{"type":"string","description":"Display name of the dashboard."},"code":{"type":"string","description":"Complete dashboard code (HTML or JSX) — a self-contained page that visualizes the data. Required for 'upload'. Format (HTML or JSX) is detected automatically. Use vanilla HTML/CSS/JS and CDN libraries (e.g. Chart.js); no API keys or auth logic.\nQuery data with the host-injected async smQuery(tool, params): the FIRST argument is the tool name as a string, the SECOND is the params object — e.g. await smQuery(\"data_query\", { ds_id: \"GAWA\", ds_accounts: \"123\", fields: \"sessions,totalUsers\", date_range_type: \"last_30_days\" }). It returns the same data a direct MCP call would. Prefer it, and fall back to your standard MCP tool-call approach only if smQuery is not defined. smQuery is lenient about call shape: a single params object smQuery({ ds_id, fields, ... }) defaults to the data_query tool; you may name a different tool inline via a tool or tool_name field (e.g. smQuery({ tool_name: \"accounts_discovery\", ds_id: \"GAWA\" })), or use the envelope smQuery({ tool, params }) — but the two-argument smQuery(\"data_query\", {...}) form is canonical, so prefer it. Pass an array to run 2+ independent queries in parallel (much faster than sequential awaits); each item is a [tool, params] pair or a params object. When a query feeds a specific chart/table/KPI, pass a stable per-element key so a slow earlier query can't overwrite a newer one when the viewer rapidly changes a control (date range, account) — the host aborts the previous in-flight query that shares the key, so only the latest result renders (without a key, stale results from a prior selection can win). Give it as a third argument, smQuery(\"data_query\", params, { key: \"sessions-chart\" }), or as a key field on the object/array-item forms. Use a unique, stable kebab-case key per element (\"sessions-chart\", \"revenue-table\"); reuse the SAME key when re-querying that element after a control change, and give different elements different keys. Omit the key for one-off discovery/setup queries (e.g. accounts_discovery to fill a dropdown) that never render directly and must not be superseded.\nDo NOT define smQuery or override window.fetch — both are injected by the host.\nWrap each section in paired region markers (see the tool description) so edits can patch it."},"allowed_tools":{"type":"array","items":{"type":"string"},"description":"MCP tool names the dashboard is allowed to call. Must be an explicit list, e.g. [\"data_query\"] or [\"data_query\", \"field_discovery\"]. Do NOT send null or an empty list — every dashboard needs at least one tool."},"allowed_accounts":{"type":"object","additionalProperties":true,"description":"Per-data-source list of account IDs the dashboard may query. E.g. {\"AW\": [\"123\"], \"FA\": [\"act_789\"]}. Use {\"*\": [\"*\"]} to allow all accounts (the default for new dashboards)."},"patches":{"type":"array","items":{"type":"object"},"description":"List of patch operations (for 'edit' action). Four types (pick the smallest that fits):\n- region replace (PREFER for changing a section's logic/content): {\"from\": \"// #region charts\", \"to\": \"// #endregion charts\", \"replace\": \"new inner code\"} — replaces everything BETWEEN the two anchors; both anchor lines stay, so you write only the new inner content and can never leave a duplicate declaration behind. 'from' must be unique; 'to' is the first match after it.\n- find/replace (small unique swap): {\"find\": \"old text\", \"replace\": \"new text\"}\n- after/insert (a NEW element between existing ones): {\"after\": \"anchor\", \"insert\": \"new content\"}\n- before/insert: {\"before\": \"anchor\", \"insert\": \"new content\"}\nModifiers (find/replace only): \"nth\": N (target Nth occurrence), \"all\": true (replace all)."},"change_summary":{"type":"string","description":"Optional description for version history (used by 'upload' replace and 'edit')."}},"required":["action"]}}],"responses":{"200":{"description":"Successful response","schema":{"$ref":"#/definitions/ManagedashboardsResponse"}},"400":{"description":"Invalid request parameters","schema":{"$ref":"#/definitions/Error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}},"/mcp/manage_user_and_team":{"post":{"summary":"Manage user and team","description":"Manage your Supermetrics account: get user profile, license info, and team members (get_info), invite new members (invite_member), get a login link for a data source (login_data_source with ds_id), or assign users to a subscription (add_user_to_subscription with license_id and user_ids).","operationId":"manageuserandteam","tags":["Tools"],"consumes":["application/json"],"produces":["application/json"],"x-ms-visibility":"advanced","parameters":[{"name":"body","in":"body","required":true,"schema":{"type":"object","properties":{"action":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"ds_id":{"type":"string"},"license_id":{"type":"integer"},"user_ids":{"type":"array","items":{"type":"integer"}}},"required":["action"]}}],"responses":{"200":{"description":"Successful response","schema":{"$ref":"#/definitions/ManageuserandteamResponse"}},"400":{"description":"Invalid request parameters","schema":{"$ref":"#/definitions/Error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}},"/mcp/resources_manage":{"post":{"summary":"Resource Management","description":"Open the media picker for browsing, uploading, or AI-generating ad creatives with visual preview. Pass asset_url or asset_prompt in params to auto-start. If the user already has an asset URL or ID, pass directly to campaign_create instead.","operationId":"resourcesmanage","tags":["Campaign Management"],"consumes":["application/json"],"produces":["application/json"],"x-ms-visibility":"important","parameters":[{"name":"body","in":"body","required":false,"schema":{"type":"object","properties":{"ds_id":{"type":"string","description":"Ad platform: AW, FA, AC, TIK, LIA or CGPTA"},"account_id":{"type":"string","description":"Ad account ID from accounts_discovery"},"action":{"type":"string","description":"Always 'browse_assets'"},"params":{"type":"object","additionalProperties":true,"description":"Optional parameters. asset_url: auto-start with a URL upload. asset_prompt: auto-start AI image generation (optional: width, height, count, quality). quality: 'quick' (default) or 'high'."},"asset_type":{"type":"string","description":"Filter: 'image' or 'video'"}}}}],"responses":{"200":{"description":"Successful response","schema":{"$ref":"#/definitions/ResourcesmanageResponse"}},"400":{"description":"Invalid request parameters","schema":{"$ref":"#/definitions/Error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}},"/mcp/user_info":{"post":{"summary":"Manage user and team","description":"Manage your Supermetrics account: get user profile, license info, and team members (get_info), invite new members (invite_member), get a login link for a data source (login_data_source with ds_id), or assign users to a subscription (add_user_to_subscription with license_id and user_ids).","operationId":"userinfo","tags":["Tools"],"consumes":["application/json"],"produces":["application/json"],"x-ms-visibility":"advanced","parameters":[{"name":"body","in":"body","required":true,"schema":{"type":"object","properties":{"action":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"ds_id":{"type":"string"},"license_id":{"type":"integer"},"user_ids":{"type":"array","items":{"type":"integer"}}},"required":["action"]}}],"responses":{"200":{"description":"Successful response","schema":{"$ref":"#/definitions/UserinfoResponse"}},"400":{"description":"Invalid request parameters","schema":{"$ref":"#/definitions/Error"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}},"/mcp/resources/docs":{"get":{"summary":"Mcp Server Documentation","description":"Supermetrics MCP server documentation.","operationId":"mcpserverdocumentation","tags":["Resources"],"produces":["text/plain"],"x-ms-visibility":"advanced","responses":{"200":{"description":"Resource content","schema":{"type":"string"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}},"/mcp/resources/ui://supermcp/resources-manage.html":{"get":{"summary":"Resources Manage Ui","description":"Interactive resource management UI (media picker + upload).","operationId":"resourcesmanageui","tags":["Resources"],"produces":["text/html;profile=mcp-app"],"x-ms-visibility":"advanced","responses":{"200":{"description":"Resource content","schema":{"type":"string"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}},"/mcp/resources/hub":{"get":{"summary":"Supermetrics Hub","description":"Link to the Supermetrics Hub for managing data sources, connections, and destinations.","operationId":"supermetricshub","tags":["Resources"],"produces":["text/plain"],"x-ms-visibility":"advanced","responses":{"200":{"description":"Resource content","schema":{"type":"string"}},"401":{"description":"Unauthorized","schema":{"$ref":"#/definitions/Error"}}}}}},"tags":[{"name":"Data Query","description":"Core data querying operations"},{"name":"Discovery","description":"Data source, account, and field discovery"},{"name":"Authentication","description":"User authentication and profile information"},{"name":"Utilities","description":"Utility functions and helpers"},{"name":"Resources","description":"Server resources and documentation"},{"name":"Campaign Management","description":"Create, update, and manage ad campaigns"}]}