IIL Sales Analytics API

System online · v1.6

A Laravel API that turns Ismail Industries' raw SQL Server sales, stock, production and forecasting data into structured analytics endpoints — consumed directly, or through a companion MCP server that exposes the same data as tools inside Claude.

How it works

STEP 1

SQL Server views

Read-only views (llm.VW_PRIMARY_SALE, VW_SECONDARY_SALE, VW_PRIMARY_STOCK, VW_PRODUCTION, and more) hold the source data.

STEP 2

Query services

Laravel services and traits query, validate, cache and shape the data for each domain — sales, stock, production, forecasting, executive summaries.

STEP 3

REST API

Results are served as JSON over /api/analytics/* endpoints, keyed by an API key.

STEP 4

MCP server

A companion Node server exposes these same endpoints as tools inside Claude, gated behind an OAuth login for approved users.

Available endpoints

Endpoint Purpose
/api/analytics/executive-queryExecutive summary across sales, stock & production
/api/analytics/forecast-queryDemand & sales forecasting
/api/analytics/integrated-queryCross-domain risk view
/api/analytics/customer-hierarchy-queryCustomer & distributor hierarchy
/api/analytics/production-queryProduction analytics
/api/analytics/stock-queryPrimary stock analytics
/api/analytics/secondary-stock-querySecondary (distributor) stock analytics
/api/analytics/secondary-sale-querySecondary sale analytics
/api/analytics/shipment-queryShipment analytics
/api/analytics/queryGeneral analytics query

Analytics endpoints are intended to be accessed via the MCP server or another authenticated backend client — not directly from the browser.