@yoryoboy/bi-mcp 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/README.md +346 -0
  2. package/bin/bi-mcp.js +2 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/index.js +768 -0
  5. package/dist/index.js.map +7 -0
  6. package/dist/mcp-use.json +7 -0
  7. package/dist/public/favicon.ico +0 -0
  8. package/dist/public/icon.svg +6 -0
  9. package/dist/src/analytics/ga4-channel-groups.js +20 -0
  10. package/dist/src/analytics/ga4-channel-groups.js.map +7 -0
  11. package/dist/src/analytics/ga4-report-utils.js +117 -0
  12. package/dist/src/analytics/ga4-report-utils.js.map +7 -0
  13. package/dist/src/config/benchmarks.js +128 -0
  14. package/dist/src/config/benchmarks.js.map +7 -0
  15. package/dist/src/config/google.js +41 -0
  16. package/dist/src/config/google.js.map +7 -0
  17. package/dist/src/config/vtex.js +26 -0
  18. package/dist/src/config/vtex.js.map +7 -0
  19. package/dist/src/google-ads/report-utils.js +78 -0
  20. package/dist/src/google-ads/report-utils.js.map +7 -0
  21. package/dist/src/prompts/reporte-ventas.js +75 -0
  22. package/dist/src/prompts/reporte-ventas.js.map +7 -0
  23. package/dist/src/search-console/search-console-utils.js +275 -0
  24. package/dist/src/search-console/search-console-utils.js.map +7 -0
  25. package/dist/src/services/analytics/ga4-client.js +69 -0
  26. package/dist/src/services/analytics/ga4-client.js.map +7 -0
  27. package/dist/src/services/analytics/oauth.js +30 -0
  28. package/dist/src/services/analytics/oauth.js.map +7 -0
  29. package/dist/src/services/google-ads/google-ads-client.js +54 -0
  30. package/dist/src/services/google-ads/google-ads-client.js.map +7 -0
  31. package/dist/src/services/search-console/search-console-client.js +45 -0
  32. package/dist/src/services/search-console/search-console-client.js.map +7 -0
  33. package/dist/src/services/vtex/vtex-api.js +51 -0
  34. package/dist/src/services/vtex/vtex-api.js.map +7 -0
  35. package/dist/src/services/vtex/vtex-catalog.js +18 -0
  36. package/dist/src/services/vtex/vtex-catalog.js.map +7 -0
  37. package/dist/src/services/vtex/vtex-logistics.js +151 -0
  38. package/dist/src/services/vtex/vtex-logistics.js.map +7 -0
  39. package/dist/src/services/vtex/vtex-orders.js +143 -0
  40. package/dist/src/services/vtex/vtex-orders.js.map +7 -0
  41. package/dist/src/services/vtex/vtex-pricing.js +17 -0
  42. package/dist/src/services/vtex/vtex-pricing.js.map +7 -0
  43. package/dist/src/tools/analytics/attribution-gaps.js +109 -0
  44. package/dist/src/tools/analytics/attribution-gaps.js.map +7 -0
  45. package/dist/src/tools/analytics/channel-mix.js +74 -0
  46. package/dist/src/tools/analytics/channel-mix.js.map +7 -0
  47. package/dist/src/tools/analytics/ecommerce-tracking-health.js +89 -0
  48. package/dist/src/tools/analytics/ecommerce-tracking-health.js.map +7 -0
  49. package/dist/src/tools/analytics/engagement-overview.js +71 -0
  50. package/dist/src/tools/analytics/engagement-overview.js.map +7 -0
  51. package/dist/src/tools/analytics/index.js +12 -0
  52. package/dist/src/tools/analytics/index.js.map +7 -0
  53. package/dist/src/tools/analytics/list-accessible-properties.js +46 -0
  54. package/dist/src/tools/analytics/list-accessible-properties.js.map +7 -0
  55. package/dist/src/tools/analytics/property-info.js +54 -0
  56. package/dist/src/tools/analytics/property-info.js.map +7 -0
  57. package/dist/src/tools/analytics/revenue-by-channel.js +70 -0
  58. package/dist/src/tools/analytics/revenue-by-channel.js.map +7 -0
  59. package/dist/src/tools/analytics/revenue-overview.js +77 -0
  60. package/dist/src/tools/analytics/revenue-overview.js.map +7 -0
  61. package/dist/src/tools/analytics/revenue-trend.js +69 -0
  62. package/dist/src/tools/analytics/revenue-trend.js.map +7 -0
  63. package/dist/src/tools/analytics/source-medium-breakdown.js +86 -0
  64. package/dist/src/tools/analytics/source-medium-breakdown.js.map +7 -0
  65. package/dist/src/tools/analytics/top-landing-pages.js +79 -0
  66. package/dist/src/tools/analytics/top-landing-pages.js.map +7 -0
  67. package/dist/src/tools/google-ads/account-overview.js +103 -0
  68. package/dist/src/tools/google-ads/account-overview.js.map +7 -0
  69. package/dist/src/tools/google-ads/account-risks.js +267 -0
  70. package/dist/src/tools/google-ads/account-risks.js.map +7 -0
  71. package/dist/src/tools/google-ads/break-even-analysis.js +107 -0
  72. package/dist/src/tools/google-ads/break-even-analysis.js.map +7 -0
  73. package/dist/src/tools/google-ads/campaign-performance.js +157 -0
  74. package/dist/src/tools/google-ads/campaign-performance.js.map +7 -0
  75. package/dist/src/tools/google-ads/channel-mix.js +129 -0
  76. package/dist/src/tools/google-ads/channel-mix.js.map +7 -0
  77. package/dist/src/tools/google-ads/compare-accounts.js +122 -0
  78. package/dist/src/tools/google-ads/compare-accounts.js.map +7 -0
  79. package/dist/src/tools/google-ads/customer-clients.js +77 -0
  80. package/dist/src/tools/google-ads/customer-clients.js.map +7 -0
  81. package/dist/src/tools/google-ads/customer-info.js +64 -0
  82. package/dist/src/tools/google-ads/customer-info.js.map +7 -0
  83. package/dist/src/tools/google-ads/index.js +12 -0
  84. package/dist/src/tools/google-ads/index.js.map +7 -0
  85. package/dist/src/tools/google-ads/scaling-health.js +174 -0
  86. package/dist/src/tools/google-ads/scaling-health.js.map +7 -0
  87. package/dist/src/tools/google-ads/search-terms-summary.js +131 -0
  88. package/dist/src/tools/google-ads/search-terms-summary.js.map +7 -0
  89. package/dist/src/tools/google-ads/time-series.js +126 -0
  90. package/dist/src/tools/google-ads/time-series.js.map +7 -0
  91. package/dist/src/tools/index.js +5 -0
  92. package/dist/src/tools/index.js.map +7 -0
  93. package/dist/src/tools/search-console/country-breakdown.js +85 -0
  94. package/dist/src/tools/search-console/country-breakdown.js.map +7 -0
  95. package/dist/src/tools/search-console/device-breakdown.js +85 -0
  96. package/dist/src/tools/search-console/device-breakdown.js.map +7 -0
  97. package/dist/src/tools/search-console/high-impression-low-click-queries.js +95 -0
  98. package/dist/src/tools/search-console/high-impression-low-click-queries.js.map +7 -0
  99. package/dist/src/tools/search-console/index.js +15 -0
  100. package/dist/src/tools/search-console/index.js.map +7 -0
  101. package/dist/src/tools/search-console/list-accessible-sites.js +42 -0
  102. package/dist/src/tools/search-console/list-accessible-sites.js.map +7 -0
  103. package/dist/src/tools/search-console/low-ctr-opportunities.js +98 -0
  104. package/dist/src/tools/search-console/low-ctr-opportunities.js.map +7 -0
  105. package/dist/src/tools/search-console/page-performance.js +104 -0
  106. package/dist/src/tools/search-console/page-performance.js.map +7 -0
  107. package/dist/src/tools/search-console/product-demand-low-capture-queries.js +93 -0
  108. package/dist/src/tools/search-console/product-demand-low-capture-queries.js.map +7 -0
  109. package/dist/src/tools/search-console/query-page-matrix.js +99 -0
  110. package/dist/src/tools/search-console/query-page-matrix.js.map +7 -0
  111. package/dist/src/tools/search-console/query-performance.js +109 -0
  112. package/dist/src/tools/search-console/query-performance.js.map +7 -0
  113. package/dist/src/tools/search-console/quick-win-opportunities.js +93 -0
  114. package/dist/src/tools/search-console/quick-win-opportunities.js.map +7 -0
  115. package/dist/src/tools/search-console/rising-non-brand-queries.js +121 -0
  116. package/dist/src/tools/search-console/rising-non-brand-queries.js.map +7 -0
  117. package/dist/src/tools/search-console/search-performance.js +89 -0
  118. package/dist/src/tools/search-console/search-performance.js.map +7 -0
  119. package/dist/src/tools/search-console/site-context.js +43 -0
  120. package/dist/src/tools/search-console/site-context.js.map +7 -0
  121. package/dist/src/tools/search-console/visibility-declines.js +146 -0
  122. package/dist/src/tools/search-console/visibility-declines.js.map +7 -0
  123. package/dist/src/tools/vtex/computed-price.js +48 -0
  124. package/dist/src/tools/vtex/computed-price.js.map +7 -0
  125. package/dist/src/tools/vtex/index.js +11 -0
  126. package/dist/src/tools/vtex/index.js.map +7 -0
  127. package/dist/src/tools/vtex/inventory-check.js +148 -0
  128. package/dist/src/tools/vtex/inventory-check.js.map +7 -0
  129. package/dist/src/tools/vtex/order-details.js +56 -0
  130. package/dist/src/tools/vtex/order-details.js.map +7 -0
  131. package/dist/src/tools/vtex/orders-summary.js +83 -0
  132. package/dist/src/tools/vtex/orders-summary.js.map +7 -0
  133. package/dist/src/tools/vtex/product-offers.js +28 -0
  134. package/dist/src/tools/vtex/product-offers.js.map +7 -0
  135. package/dist/src/tools/vtex/sku-offers.js +30 -0
  136. package/dist/src/tools/vtex/sku-offers.js.map +7 -0
  137. package/dist/src/tools/vtex/sku-price.js +42 -0
  138. package/dist/src/tools/vtex/sku-price.js.map +7 -0
  139. package/dist/src/tools/vtex/update-inventory.js +43 -0
  140. package/dist/src/tools/vtex/update-inventory.js.map +7 -0
  141. package/dist/src/tools/vtex/update-lead-time.js +32 -0
  142. package/dist/src/tools/vtex/update-lead-time.js.map +7 -0
  143. package/dist/src/tools/vtex/warehouse-inventory.js +42 -0
  144. package/dist/src/tools/vtex/warehouse-inventory.js.map +7 -0
  145. package/dist/src/utils/case-conversion.js +21 -0
  146. package/dist/src/utils/case-conversion.js.map +7 -0
  147. package/dist/src/utils/currency.js +52 -0
  148. package/dist/src/utils/currency.js.map +7 -0
  149. package/dist/src/utils/format-order-details.js +137 -0
  150. package/dist/src/utils/format-order-details.js.map +7 -0
  151. package/dist/src/utils/google-ads.js +78 -0
  152. package/dist/src/utils/google-ads.js.map +7 -0
  153. package/dist/src/utils/money.js +83 -0
  154. package/dist/src/utils/money.js.map +7 -0
  155. package/dist/src/utils/order-status.js +11 -0
  156. package/dist/src/utils/order-status.js.map +7 -0
  157. package/dist/src/utils/pagination.js +45 -0
  158. package/dist/src/utils/pagination.js.map +7 -0
  159. package/dist/src/utils/strip-payload.js +40 -0
  160. package/dist/src/utils/strip-payload.js.map +7 -0
  161. package/dist/src/utils/type-guards.js +7 -0
  162. package/dist/src/utils/type-guards.js.map +7 -0
  163. package/package.json +66 -0
  164. package/public/favicon.ico +0 -0
  165. package/public/icon.svg +6 -0
package/dist/index.js ADDED
@@ -0,0 +1,768 @@
1
+ import { createRequire } from "node:module";
2
+ import { pathToFileURL } from "node:url";
3
+ import { MCPServer } from "mcp-use/server";
4
+ import {
5
+ reporteVentasPromptHandler,
6
+ reporteVentasPromptSchema
7
+ } from "./src/prompts/reporte-ventas.js";
8
+ import { getBenchmarksHandler, getBenchmarksSchema } from "./src/config/benchmarks.js";
9
+ import {
10
+ googleAdsAccountRisksHandler,
11
+ googleAdsAccountRisksSchema,
12
+ googleAdsAccountOverviewHandler,
13
+ googleAdsAccountOverviewSchema,
14
+ googleAdsBreakEvenAnalysisHandler,
15
+ googleAdsBreakEvenAnalysisSchema,
16
+ googleAdsCampaignPerformanceHandler,
17
+ googleAdsCampaignPerformanceSchema,
18
+ googleAdsChannelMixHandler,
19
+ googleAdsChannelMixSchema,
20
+ googleAdsCompareAccountsHandler,
21
+ googleAdsCompareAccountsSchema,
22
+ googleAdsCustomerClientsHandler,
23
+ googleAdsCustomerClientsSchema,
24
+ googleAdsCustomerInfoHandler,
25
+ googleAdsCustomerInfoSchema,
26
+ googleAdsSearchTermsSummaryHandler,
27
+ googleAdsSearchTermsSummarySchema,
28
+ googleAdsScalingHealthHandler,
29
+ googleAdsScalingHealthSchema,
30
+ googleAdsTimeSeriesHandler,
31
+ googleAdsTimeSeriesSchema,
32
+ listAccessibleSitesHandler,
33
+ listAccessibleSitesSchema,
34
+ attributionGapsHandler,
35
+ attributionGapsSchema,
36
+ channelMixHandler,
37
+ channelMixSchema,
38
+ computedPriceHandler,
39
+ computedPriceSchema,
40
+ ecommerceTrackingHealthHandler,
41
+ ecommerceTrackingHealthSchema,
42
+ engagementOverviewHandler,
43
+ engagementOverviewSchema,
44
+ inventoryCheckHandler,
45
+ inventoryCheckSchema,
46
+ listAccessiblePropertiesHandler,
47
+ listAccessiblePropertiesSchema,
48
+ searchConsoleCountryBreakdownHandler,
49
+ searchConsoleCountryBreakdownSchema,
50
+ searchConsoleDeviceBreakdownHandler,
51
+ searchConsoleDeviceBreakdownSchema,
52
+ searchConsoleHighImpressionLowClickQueriesHandler,
53
+ searchConsoleHighImpressionLowClickQueriesSchema,
54
+ searchConsoleLowCtrOpportunitiesHandler,
55
+ searchConsoleLowCtrOpportunitiesSchema,
56
+ searchConsolePagePerformanceHandler,
57
+ searchConsolePagePerformanceSchema,
58
+ searchConsoleProductDemandLowCaptureQueriesHandler,
59
+ searchConsoleProductDemandLowCaptureQueriesSchema,
60
+ searchConsoleQueryPageMatrixHandler,
61
+ searchConsoleQueryPageMatrixSchema,
62
+ searchConsoleQueryPerformanceHandler,
63
+ searchConsoleQueryPerformanceSchema,
64
+ searchConsoleQuickWinOpportunitiesHandler,
65
+ searchConsoleQuickWinOpportunitiesSchema,
66
+ searchConsoleRisingNonBrandQueriesHandler,
67
+ searchConsoleRisingNonBrandQueriesSchema,
68
+ searchConsoleSearchPerformanceHandler,
69
+ searchConsoleSearchPerformanceSchema,
70
+ searchConsoleSiteContextHandler,
71
+ searchConsoleSiteContextSchema,
72
+ searchConsoleVisibilityDeclinesHandler,
73
+ searchConsoleVisibilityDeclinesSchema,
74
+ orderDetailsHandler,
75
+ orderDetailsSchema,
76
+ ordersSummaryHandler,
77
+ ordersSummarySchema,
78
+ propertyInfoHandler,
79
+ propertyInfoSchema,
80
+ productOffersHandler,
81
+ productOffersSchema,
82
+ revenueByChannelHandler,
83
+ revenueByChannelSchema,
84
+ revenueOverviewHandler,
85
+ revenueOverviewSchema,
86
+ revenueTrendHandler,
87
+ revenueTrendSchema,
88
+ skuOffersHandler,
89
+ skuOffersSchema,
90
+ skuPriceHandler,
91
+ skuPriceSchema,
92
+ sourceMediumBreakdownHandler,
93
+ sourceMediumBreakdownSchema,
94
+ topLandingPagesHandler,
95
+ topLandingPagesSchema,
96
+ updateInventoryHandler,
97
+ updateInventorySchema,
98
+ updateLeadTimeHandler,
99
+ updateLeadTimeSchema,
100
+ warehouseInventoryHandler,
101
+ warehouseInventorySchema
102
+ } from "./src/tools/index.js";
103
+ const server = new MCPServer({
104
+ name: "bi-mcp",
105
+ title: "BI MCP",
106
+ version: "1.0.0",
107
+ description: "Business Intelligence MCP server with VTEX tools and room for additional data sources.",
108
+ baseUrl: process.env.MCP_URL || "http://localhost:3000",
109
+ favicon: "favicon.ico",
110
+ icons: [
111
+ {
112
+ src: "icon.svg",
113
+ mimeType: "image/svg+xml",
114
+ sizes: ["512x512"]
115
+ }
116
+ ]
117
+ });
118
+ server.tool(
119
+ {
120
+ name: "vtex_get_orders_summary",
121
+ description: "Get aggregated orders summary by date range with currency-aware BI metrics.",
122
+ schema: ordersSummarySchema,
123
+ annotations: {
124
+ readOnlyHint: true,
125
+ destructiveHint: false,
126
+ openWorldHint: true
127
+ }
128
+ },
129
+ ordersSummaryHandler
130
+ );
131
+ server.tool(
132
+ {
133
+ name: "vtex_get_order_details",
134
+ description: "Get BI-focused detailed information for one or more orders.",
135
+ schema: orderDetailsSchema,
136
+ annotations: {
137
+ readOnlyHint: true,
138
+ destructiveHint: false,
139
+ openWorldHint: true
140
+ }
141
+ },
142
+ orderDetailsHandler
143
+ );
144
+ server.tool(
145
+ {
146
+ name: "vtex_check_inventory",
147
+ description: "Check global SKU inventory and infer stock health status.",
148
+ schema: inventoryCheckSchema,
149
+ annotations: {
150
+ readOnlyHint: true,
151
+ destructiveHint: false,
152
+ openWorldHint: true
153
+ }
154
+ },
155
+ inventoryCheckHandler
156
+ );
157
+ server.tool(
158
+ {
159
+ name: "vtex_get_warehouse_inventory",
160
+ description: "Get SKU inventory details for a specific warehouse.",
161
+ schema: warehouseInventorySchema,
162
+ annotations: {
163
+ readOnlyHint: true,
164
+ destructiveHint: false,
165
+ openWorldHint: true
166
+ }
167
+ },
168
+ warehouseInventoryHandler
169
+ );
170
+ server.tool(
171
+ {
172
+ name: "vtex_update_inventory",
173
+ description: "Update SKU inventory quantity or unlimited mode for a warehouse.",
174
+ schema: updateInventorySchema,
175
+ annotations: {
176
+ readOnlyHint: false,
177
+ destructiveHint: true,
178
+ openWorldHint: true
179
+ }
180
+ },
181
+ updateInventoryHandler
182
+ );
183
+ server.tool(
184
+ {
185
+ name: "vtex_update_lead_time",
186
+ description: "Update SKU lead time for a warehouse.",
187
+ schema: updateLeadTimeSchema,
188
+ annotations: {
189
+ readOnlyHint: false,
190
+ destructiveHint: true,
191
+ openWorldHint: true
192
+ }
193
+ },
194
+ updateLeadTimeHandler
195
+ );
196
+ server.tool(
197
+ {
198
+ name: "vtex_get_sku_price",
199
+ description: "Get base pricing information for one SKU.",
200
+ schema: skuPriceSchema,
201
+ annotations: {
202
+ readOnlyHint: true,
203
+ destructiveHint: false,
204
+ openWorldHint: true
205
+ }
206
+ },
207
+ skuPriceHandler
208
+ );
209
+ server.tool(
210
+ {
211
+ name: "vtex_get_computed_price",
212
+ description: "Get computed SKU price by price table context.",
213
+ schema: computedPriceSchema,
214
+ annotations: {
215
+ readOnlyHint: true,
216
+ destructiveHint: false,
217
+ openWorldHint: true
218
+ }
219
+ },
220
+ computedPriceHandler
221
+ );
222
+ server.tool(
223
+ {
224
+ name: "vtex_get_product_offers",
225
+ description: "Get offers for all SKUs under a product.",
226
+ schema: productOffersSchema,
227
+ annotations: {
228
+ readOnlyHint: true,
229
+ destructiveHint: false,
230
+ openWorldHint: true
231
+ }
232
+ },
233
+ productOffersHandler
234
+ );
235
+ server.tool(
236
+ {
237
+ name: "vtex_get_sku_offers",
238
+ description: "Get offers for a specific SKU under a product.",
239
+ schema: skuOffersSchema,
240
+ annotations: {
241
+ readOnlyHint: true,
242
+ destructiveHint: false,
243
+ openWorldHint: true
244
+ }
245
+ },
246
+ skuOffersHandler
247
+ );
248
+ server.tool(
249
+ {
250
+ name: "config_get_benchmarks",
251
+ description: "Devuelve benchmarks de Argentina para c\xE1lculos financieros: IIBB por provincia, costos de cuotas sin inter\xE9s (Ahora 12, Plan Z), fees de pasarelas de pago (Mercado Pago, Mobbex, Payway, dLocal), costos log\xEDsticos por zona y calendario comercial con impacto de revenue.",
252
+ schema: getBenchmarksSchema,
253
+ annotations: {
254
+ readOnlyHint: true,
255
+ destructiveHint: false,
256
+ openWorldHint: false
257
+ }
258
+ },
259
+ getBenchmarksHandler
260
+ );
261
+ server.tool(
262
+ {
263
+ name: "gads_get_channel_mix",
264
+ description: "Get Google Ads mix by advertising channel type for a date range, including spend, clicks, impressions, conversions, conversion value, and channel share.",
265
+ schema: googleAdsChannelMixSchema,
266
+ annotations: {
267
+ readOnlyHint: true,
268
+ destructiveHint: false,
269
+ openWorldHint: true
270
+ }
271
+ },
272
+ googleAdsChannelMixHandler
273
+ );
274
+ server.tool(
275
+ {
276
+ name: "gads_get_customer_info",
277
+ description: "Get summary information for one Google Ads customer account, including name, currency, timezone, and whether the account is a manager (MCC).",
278
+ schema: googleAdsCustomerInfoSchema,
279
+ annotations: {
280
+ readOnlyHint: true,
281
+ destructiveHint: false,
282
+ openWorldHint: true
283
+ }
284
+ },
285
+ googleAdsCustomerInfoHandler
286
+ );
287
+ server.tool(
288
+ {
289
+ name: "gads_list_customer_clients",
290
+ description: "List visible child accounts for a Google Ads customer account, usually used to inspect manager (MCC) account structure.",
291
+ schema: googleAdsCustomerClientsSchema,
292
+ annotations: {
293
+ readOnlyHint: true,
294
+ destructiveHint: false,
295
+ openWorldHint: true
296
+ }
297
+ },
298
+ googleAdsCustomerClientsHandler
299
+ );
300
+ server.tool(
301
+ {
302
+ name: "gads_get_account_overview",
303
+ description: "Get a Google Ads account overview for a date range, including spend, clicks, impressions, conversions, conversion value, CTR, CPC, CPA, and ROAS.",
304
+ schema: googleAdsAccountOverviewSchema,
305
+ annotations: {
306
+ readOnlyHint: true,
307
+ destructiveHint: false,
308
+ openWorldHint: true
309
+ }
310
+ },
311
+ googleAdsAccountOverviewHandler
312
+ );
313
+ server.tool(
314
+ {
315
+ name: "gads_get_campaign_performance",
316
+ description: "Get Google Ads campaign-level performance for a date range with spend, clicks, impressions, conversions, conversion value, CTR, CPC, CPA, and ROAS.",
317
+ schema: googleAdsCampaignPerformanceSchema,
318
+ annotations: {
319
+ readOnlyHint: true,
320
+ destructiveHint: false,
321
+ openWorldHint: true
322
+ }
323
+ },
324
+ googleAdsCampaignPerformanceHandler
325
+ );
326
+ server.tool(
327
+ {
328
+ name: "gads_get_time_series",
329
+ description: "Get Google Ads daily or weekly time series for a date range with spend, clicks, impressions, conversions, conversion value, CPA, and ROAS.",
330
+ schema: googleAdsTimeSeriesSchema,
331
+ annotations: {
332
+ readOnlyHint: true,
333
+ destructiveHint: false,
334
+ openWorldHint: true
335
+ }
336
+ },
337
+ googleAdsTimeSeriesHandler
338
+ );
339
+ server.tool(
340
+ {
341
+ name: "gads_get_search_terms_summary",
342
+ description: "Get a ranked summary of Google Ads search terms for a date range, including spend, clicks, impressions, conversions, conversion value, CPA, and ROAS.",
343
+ schema: googleAdsSearchTermsSummarySchema,
344
+ annotations: {
345
+ readOnlyHint: true,
346
+ destructiveHint: false,
347
+ openWorldHint: true
348
+ }
349
+ },
350
+ googleAdsSearchTermsSummaryHandler
351
+ );
352
+ server.tool(
353
+ {
354
+ name: "gads_get_account_risks",
355
+ description: "Evaluate Google Ads account risks for a date range, including concentration, low efficiency, weak conversion volume, and recent deterioration signals.",
356
+ schema: googleAdsAccountRisksSchema,
357
+ annotations: {
358
+ readOnlyHint: true,
359
+ destructiveHint: false,
360
+ openWorldHint: true
361
+ }
362
+ },
363
+ googleAdsAccountRisksHandler
364
+ );
365
+ server.tool(
366
+ {
367
+ name: "gads_get_break_even_analysis",
368
+ description: "Compare current Google Ads performance against a user-provided break-even ROAS and optional CPA target.",
369
+ schema: googleAdsBreakEvenAnalysisSchema,
370
+ annotations: {
371
+ readOnlyHint: true,
372
+ destructiveHint: false,
373
+ openWorldHint: true
374
+ }
375
+ },
376
+ googleAdsBreakEvenAnalysisHandler
377
+ );
378
+ server.tool(
379
+ {
380
+ name: "gads_get_scaling_health",
381
+ description: "Assess whether a Google Ads account is ready to scale using break-even ROAS, optional CPA target, concentration, stability, and conversion volume.",
382
+ schema: googleAdsScalingHealthSchema,
383
+ annotations: {
384
+ readOnlyHint: true,
385
+ destructiveHint: false,
386
+ openWorldHint: true
387
+ }
388
+ },
389
+ googleAdsScalingHealthHandler
390
+ );
391
+ server.tool(
392
+ {
393
+ name: "gads_compare_accounts",
394
+ description: "Compare multiple Google Ads accounts across the same date range and rank them by basic risk and efficiency signals.",
395
+ schema: googleAdsCompareAccountsSchema,
396
+ annotations: {
397
+ readOnlyHint: true,
398
+ destructiveHint: false,
399
+ openWorldHint: true
400
+ }
401
+ },
402
+ googleAdsCompareAccountsHandler
403
+ );
404
+ server.tool(
405
+ {
406
+ name: "gsc_list_accessible_sites",
407
+ description: "List all Search Console sites accessible with the configured Google credentials.",
408
+ schema: listAccessibleSitesSchema,
409
+ annotations: {
410
+ readOnlyHint: true,
411
+ destructiveHint: false,
412
+ openWorldHint: true
413
+ }
414
+ },
415
+ listAccessibleSitesHandler
416
+ );
417
+ server.tool(
418
+ {
419
+ name: "gsc_get_site_context",
420
+ description: "Validate one Search Console site and return the resolved site context used by the module.",
421
+ schema: searchConsoleSiteContextSchema,
422
+ annotations: {
423
+ readOnlyHint: true,
424
+ destructiveHint: false,
425
+ openWorldHint: true
426
+ }
427
+ },
428
+ searchConsoleSiteContextHandler
429
+ );
430
+ server.tool(
431
+ {
432
+ name: "gsc_get_search_performance",
433
+ description: "Run a flexible Search Console performance query with custom dimensions and filters.",
434
+ schema: searchConsoleSearchPerformanceSchema,
435
+ annotations: {
436
+ readOnlyHint: true,
437
+ destructiveHint: false,
438
+ openWorldHint: true
439
+ }
440
+ },
441
+ searchConsoleSearchPerformanceHandler
442
+ );
443
+ server.tool(
444
+ {
445
+ name: "gsc_get_query_performance",
446
+ description: "Get Search Console performance grouped by search query for a date range.",
447
+ schema: searchConsoleQueryPerformanceSchema,
448
+ annotations: {
449
+ readOnlyHint: true,
450
+ destructiveHint: false,
451
+ openWorldHint: true
452
+ }
453
+ },
454
+ searchConsoleQueryPerformanceHandler
455
+ );
456
+ server.tool(
457
+ {
458
+ name: "gsc_get_page_performance",
459
+ description: "Get Search Console performance grouped by landing page for a date range.",
460
+ schema: searchConsolePagePerformanceSchema,
461
+ annotations: {
462
+ readOnlyHint: true,
463
+ destructiveHint: false,
464
+ openWorldHint: true
465
+ }
466
+ },
467
+ searchConsolePagePerformanceHandler
468
+ );
469
+ server.tool(
470
+ {
471
+ name: "gsc_get_query_page_matrix",
472
+ description: "Get a Search Console matrix crossing queries and landing pages for a date range.",
473
+ schema: searchConsoleQueryPageMatrixSchema,
474
+ annotations: {
475
+ readOnlyHint: true,
476
+ destructiveHint: false,
477
+ openWorldHint: true
478
+ }
479
+ },
480
+ searchConsoleQueryPageMatrixHandler
481
+ );
482
+ server.tool(
483
+ {
484
+ name: "gsc_get_device_breakdown",
485
+ description: "Break down Search Console performance by device for a date range.",
486
+ schema: searchConsoleDeviceBreakdownSchema,
487
+ annotations: {
488
+ readOnlyHint: true,
489
+ destructiveHint: false,
490
+ openWorldHint: true
491
+ }
492
+ },
493
+ searchConsoleDeviceBreakdownHandler
494
+ );
495
+ server.tool(
496
+ {
497
+ name: "gsc_get_country_breakdown",
498
+ description: "Break down Search Console performance by country for a date range.",
499
+ schema: searchConsoleCountryBreakdownSchema,
500
+ annotations: {
501
+ readOnlyHint: true,
502
+ destructiveHint: false,
503
+ openWorldHint: true
504
+ }
505
+ },
506
+ searchConsoleCountryBreakdownHandler
507
+ );
508
+ server.tool(
509
+ {
510
+ name: "gsc_find_high_impression_low_click_queries",
511
+ description: "Find queries with high Search Console impression volume but weak click capture.",
512
+ schema: searchConsoleHighImpressionLowClickQueriesSchema,
513
+ annotations: {
514
+ readOnlyHint: true,
515
+ destructiveHint: false,
516
+ openWorldHint: true
517
+ }
518
+ },
519
+ searchConsoleHighImpressionLowClickQueriesHandler
520
+ );
521
+ server.tool(
522
+ {
523
+ name: "gsc_find_low_ctr_opportunities",
524
+ description: "Find Search Console queries that rank reasonably well but underperform on CTR.",
525
+ schema: searchConsoleLowCtrOpportunitiesSchema,
526
+ annotations: {
527
+ readOnlyHint: true,
528
+ destructiveHint: false,
529
+ openWorldHint: true
530
+ }
531
+ },
532
+ searchConsoleLowCtrOpportunitiesHandler
533
+ );
534
+ server.tool(
535
+ {
536
+ name: "gsc_detect_visibility_declines",
537
+ description: "Detect Search Console pages that are losing visibility between two periods.",
538
+ schema: searchConsoleVisibilityDeclinesSchema,
539
+ annotations: {
540
+ readOnlyHint: true,
541
+ destructiveHint: false,
542
+ openWorldHint: true
543
+ }
544
+ },
545
+ searchConsoleVisibilityDeclinesHandler
546
+ );
547
+ server.tool(
548
+ {
549
+ name: "gsc_find_product_demand_low_capture_queries",
550
+ description: "Find product-intent queries with demand in Search Console but weak click capture.",
551
+ schema: searchConsoleProductDemandLowCaptureQueriesSchema,
552
+ annotations: {
553
+ readOnlyHint: true,
554
+ destructiveHint: false,
555
+ openWorldHint: true
556
+ }
557
+ },
558
+ searchConsoleProductDemandLowCaptureQueriesHandler
559
+ );
560
+ server.tool(
561
+ {
562
+ name: "gsc_find_rising_non_brand_queries",
563
+ description: "Find non-branded Search Console queries growing between two periods.",
564
+ schema: searchConsoleRisingNonBrandQueriesSchema,
565
+ annotations: {
566
+ readOnlyHint: true,
567
+ destructiveHint: false,
568
+ openWorldHint: true
569
+ }
570
+ },
571
+ searchConsoleRisingNonBrandQueriesHandler
572
+ );
573
+ server.tool(
574
+ {
575
+ name: "gsc_find_quick_win_opportunities",
576
+ description: "Prioritize Search Console quick wins across CTR improvements and ranking gains.",
577
+ schema: searchConsoleQuickWinOpportunitiesSchema,
578
+ annotations: {
579
+ readOnlyHint: true,
580
+ destructiveHint: false,
581
+ openWorldHint: true
582
+ }
583
+ },
584
+ searchConsoleQuickWinOpportunitiesHandler
585
+ );
586
+ server.tool(
587
+ {
588
+ name: "ga4_list_accessible_properties",
589
+ description: "List all Google Analytics 4 accounts and properties accessible with the configured OAuth credentials.",
590
+ schema: listAccessiblePropertiesSchema,
591
+ annotations: {
592
+ readOnlyHint: true,
593
+ destructiveHint: false,
594
+ openWorldHint: true
595
+ }
596
+ },
597
+ listAccessiblePropertiesHandler
598
+ );
599
+ server.tool(
600
+ {
601
+ name: "ga4_get_property_info",
602
+ description: "Get summary information and capabilities for one GA4 property, including ecommerce and attribution support.",
603
+ schema: propertyInfoSchema,
604
+ annotations: {
605
+ readOnlyHint: true,
606
+ destructiveHint: false,
607
+ openWorldHint: true
608
+ }
609
+ },
610
+ propertyInfoHandler
611
+ );
612
+ server.tool(
613
+ {
614
+ name: "ga4_get_channel_mix",
615
+ description: "Get traffic mix by default channel group with shares of sessions and users for a date range.",
616
+ schema: channelMixSchema,
617
+ annotations: {
618
+ readOnlyHint: true,
619
+ destructiveHint: false,
620
+ openWorldHint: true
621
+ }
622
+ },
623
+ channelMixHandler
624
+ );
625
+ server.tool(
626
+ {
627
+ name: "ga4_get_source_medium_breakdown",
628
+ description: "Get traffic breakdown by session source / medium with session and user share for a date range.",
629
+ schema: sourceMediumBreakdownSchema,
630
+ annotations: {
631
+ readOnlyHint: true,
632
+ destructiveHint: false,
633
+ openWorldHint: true
634
+ }
635
+ },
636
+ sourceMediumBreakdownHandler
637
+ );
638
+ server.tool(
639
+ {
640
+ name: "ga4_get_revenue_overview",
641
+ description: "Get GA4 ecommerce overview for a date range including transactions, revenue, purchasers, and rates.",
642
+ schema: revenueOverviewSchema,
643
+ annotations: {
644
+ readOnlyHint: true,
645
+ destructiveHint: false,
646
+ openWorldHint: true
647
+ }
648
+ },
649
+ revenueOverviewHandler
650
+ );
651
+ server.tool(
652
+ {
653
+ name: "ga4_get_revenue_trend",
654
+ description: "Get daily GA4 revenue and transactions trend for a date range.",
655
+ schema: revenueTrendSchema,
656
+ annotations: {
657
+ readOnlyHint: true,
658
+ destructiveHint: false,
659
+ openWorldHint: true
660
+ }
661
+ },
662
+ revenueTrendHandler
663
+ );
664
+ server.tool(
665
+ {
666
+ name: "ga4_get_revenue_by_channel",
667
+ description: "Get GA4 revenue and transactions by default channel group for a date range.",
668
+ schema: revenueByChannelSchema,
669
+ annotations: {
670
+ readOnlyHint: true,
671
+ destructiveHint: false,
672
+ openWorldHint: true
673
+ }
674
+ },
675
+ revenueByChannelHandler
676
+ );
677
+ server.tool(
678
+ {
679
+ name: "ga4_get_top_landing_pages",
680
+ description: "Get top landing pages by sessions and users for a date range.",
681
+ schema: topLandingPagesSchema,
682
+ annotations: {
683
+ readOnlyHint: true,
684
+ destructiveHint: false,
685
+ openWorldHint: true
686
+ }
687
+ },
688
+ topLandingPagesHandler
689
+ );
690
+ server.tool(
691
+ {
692
+ name: "ga4_get_engagement_overview",
693
+ description: "Get GA4 engagement metrics for a date range, including engagement rate, bounce rate, and session duration.",
694
+ schema: engagementOverviewSchema,
695
+ annotations: {
696
+ readOnlyHint: true,
697
+ destructiveHint: false,
698
+ openWorldHint: true
699
+ }
700
+ },
701
+ engagementOverviewHandler
702
+ );
703
+ server.tool(
704
+ {
705
+ name: "ga4_detect_attribution_gaps",
706
+ description: "Detect unattributed traffic, unassigned channels, and not-set source / medium values in GA4.",
707
+ schema: attributionGapsSchema,
708
+ annotations: {
709
+ readOnlyHint: true,
710
+ destructiveHint: false,
711
+ openWorldHint: true
712
+ }
713
+ },
714
+ attributionGapsHandler
715
+ );
716
+ server.tool(
717
+ {
718
+ name: "ga4_check_ecommerce_tracking_health",
719
+ description: "Evaluate whether GA4 ecommerce tracking appears complete by checking item views, carts, checkouts, purchases, and refunds.",
720
+ schema: ecommerceTrackingHealthSchema,
721
+ annotations: {
722
+ readOnlyHint: true,
723
+ destructiveHint: false,
724
+ openWorldHint: true
725
+ }
726
+ },
727
+ ecommerceTrackingHealthHandler
728
+ );
729
+ server.prompt(
730
+ {
731
+ name: "vtex-reporte-ventas",
732
+ description: "Genera un prompt de reporte de ventas VTEX usando una sola entrada temporal en lenguaje natural.",
733
+ schema: reporteVentasPromptSchema
734
+ },
735
+ reporteVentasPromptHandler
736
+ );
737
+ async function createStdioTransportFromMcpUseDependency() {
738
+ const requireFromHere = createRequire(import.meta.url);
739
+ const mcpUseServerEntry = requireFromHere.resolve("mcp-use/server");
740
+ const requireFromMcpUse = createRequire(mcpUseServerEntry);
741
+ const stdioModulePath = requireFromMcpUse.resolve("@modelcontextprotocol/sdk/server/stdio.js");
742
+ const stdioModule = await import(pathToFileURL(stdioModulePath).href);
743
+ return new stdioModule.StdioServerTransport();
744
+ }
745
+ async function startServer() {
746
+ const transport = (process.env.MCP_TRANSPORT ?? "http").trim().toLowerCase();
747
+ if (transport === "stdio") {
748
+ const stdioTransport = await createStdioTransportFromMcpUseDependency();
749
+ await server.nativeServer.connect(stdioTransport);
750
+ console.error("MCP server running on stdio transport");
751
+ return;
752
+ }
753
+ if (transport === "http") {
754
+ const port = process.env.PORT ? Number.parseInt(process.env.PORT, 10) : 3e3;
755
+ if (Number.isNaN(port)) {
756
+ throw new Error(`Invalid PORT value: ${process.env.PORT}`);
757
+ }
758
+ console.error(`MCP server running on http transport (port ${port})`);
759
+ await server.listen(port);
760
+ return;
761
+ }
762
+ throw new Error(`Invalid MCP_TRANSPORT "${process.env.MCP_TRANSPORT}". Use "http" or "stdio".`);
763
+ }
764
+ startServer().catch((error) => {
765
+ console.error("Failed to start MCP server", error);
766
+ process.exit(1);
767
+ });
768
+ //# sourceMappingURL=index.js.map