Appearance
<div style="display: none;" hidden="true" aria-hidden="true">Are you an LLM? You can read better optimized documentation at /changelog/Changelog.4.117.md for this page in Markdown format</div>
Version 4
version 4.117
- [4.117.0] feat(mcp): read-only Sales & Analytics tools + token scopes (Advisable-com/ecommercen#403, #412)
- Token scopes. Each MCP token now carries one or more scopes —
seo(the existing 17 catalog/SEO edit tools) and/oranalytics(the 7 new read-only tools). The admin "MCP Connector" settings page is now a token list: generate a token with selected scopes, rotate or revoke each independently. Multiple concurrent tokens are supported. Legacy scope-less tokens are treated asseo— no change to their tool surface. Ananalytics-only token is structurally blocked from reaching any write tool. - 7 read-only analytics tools (scope:
analytics; ISO-8601 dates, Europe/Athens, amounts EUR,schema_versionin every response, date range ≤ 366 days, ~5 min cache exceptorders_list):sales_summary— period KPIs (orders_count, units_sold, gross/net revenue, VAT, shipping, discounts, avg_order_value, new/returning customers) + optionalcompare(yoy|mom|wow|prev_period) withdelta_pct.sales_timeseries— same KPIs bucketed day|week|month.sales_breakdown— metrics by dimension: product|category|brand|payment_method|shipping_method|region;sort_bynet_revenue|units|orders;limit; optionalcompare. Note: a product in multiple categories is attributed to each — category rows can exceed the grand total.orders_list— granular order rows, PII-stripped: opaque non-reversiblecustomer_id(keyed HMAC), coarse region only, no names/emails/phones/addresses/AFM. Keysetcursorpagination. Not cached.price_history— per-product price-change history from the price-tracking log.on_promoisnull(not historically recoverable →promo_history_available: false). Coverage viatracking_enabled/earliest_date.product_sales— per-product sales series (units, net_revenue, avg_selling_price) + commercial snapshot (current_price excl. VAT, cost, margin_pct, current_stock).customers_stats— aggregate-only, zero PII: new/returning (email-keyed, email not exposed), repeat_rate_pct, avg_orders_per_customer, avg_customer_value, cohorts by month|week.
- Reporting conventions (CEO-confirmed): reporting date = order
entry_datetime; ALL orders counted (phone/webignorenot excluded); no refunds metric (platform has none);gross_revenueincludes shipping. - Infrastructure. New
src/Mcp/Auth/Scopes.phpscope model; updatedTokenGuard,TokenService,TokenRepository; newsrc/Mcp/Tools/AnalyticsTools.php; newsrc/Domains/Order/SalesAnalytics/domain;McpAuditLoggerextended with alogRead()path for analytics calls. - No storefront REST API changes. Adds 11 admin i18n keys (
settings.mcp_connector.*— scope badges, token-list labels, generate/rotate) across all 8 languages; no storefront language keys.
- Token scopes. Each MCP token now carries one or more scopes —
Notes
[4.117.0] REQUIRES
php migrator.php migrate:20260630120000_add_scopes_to_mcp_connector_tokens.php— adds the nullablescopescolumn tomcp_connector_tokens. No data backfill: existing tokens keepscopes = NULL, which is treated asseoat read time (their surface is unchanged). Forward-only.
[4.117.0] New env var — set before enabling analytics tools:
APP_MCP_ANALYTICS_ID_SECRET(in.env, already added to.env.example) — a stable random secret used to derive the opaquecustomer_idinorders_list. Falls back to CodeIgniter'sencryption_key; if neither is set the tool errors rather than emit a guessable id. The value must remain stable across deployments — changing it invalidates all previously issued customer ids (cohort continuity breaks).[4.117.0] Optional registry key:
MCP_ANALYTICS/SALE_STATUSES(CSV of order status names that count as a sale; defaultPENDING_ACCEPTED, PAID_SENT, SENT, INVOICED). Override in the DB registry if the deployment uses non-standard status names.