@sentientui/mcp 0.17.2 → 0.17.4

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.
@@ -348,8 +348,8 @@ function rangeInputSchema(defaultRange) {
348
348
  }
349
349
  function rangeQuery(args) {
350
350
  const p = new URLSearchParams();
351
- if (args.from) {
352
- p.set("from", args.from);
351
+ if (args.from || args.to) {
352
+ if (args.from) p.set("from", args.from);
353
353
  if (args.to) p.set("to", args.to);
354
354
  } else if (args.range) {
355
355
  p.set("range", args.range);
@@ -369,10 +369,27 @@ var windowOutputSchema = z.object({
369
369
  function windowLine(window) {
370
370
  if (!window) return "";
371
371
  if (window.start && window.end) {
372
- return `Window: ${window.start.slice(0, 10)} to ${window.end.slice(0, 10)} (${window.timezone}, exclusive end)`;
372
+ const from = localDate(window.start, window.timezone);
373
+ const lastIncluded = localDate(
374
+ new Date(new Date(window.end).getTime() - 1).toISOString(),
375
+ window.timezone
376
+ );
377
+ return `Window: ${from} through ${lastIncluded} inclusive (${window.timezone})`;
373
378
  }
374
379
  return `Window: all retained data (${window.retentionDays}-day retention)`;
375
380
  }
381
+ function localDate(iso, timeZone) {
382
+ try {
383
+ return new Intl.DateTimeFormat("en-CA", {
384
+ timeZone,
385
+ year: "numeric",
386
+ month: "2-digit",
387
+ day: "2-digit"
388
+ }).format(new Date(iso));
389
+ } catch (e) {
390
+ return iso.slice(0, 10);
391
+ }
392
+ }
376
393
  function apiErrorGuidance(err, extra) {
377
394
  if (extra && Object.prototype.hasOwnProperty.call(extra, err.message)) {
378
395
  return extra[err.message];
@@ -393,6 +410,12 @@ function apiErrorGuidance(err, extra) {
393
410
  if (err.message === "invalid_range") {
394
411
  return "Invalid time window. Use range '7d', '30d', '90d' or 'all', or from/to as YYYY-MM-DD dates.";
395
412
  }
413
+ if (err.message === "plan_required" || err.message === "plan_upgrade_required") {
414
+ return "This feature is not included on the project\u2019s current plan. Upgrade the SentientUI plan to turn it on \u2014 re-authenticating will not help.";
415
+ }
416
+ if (err.message === "agent_analytics_requires_paid_plan") {
417
+ return "Agent analytics is available on paid plans only. Upgrade the SentientUI plan to read agent traffic for this project.";
418
+ }
396
419
  if (err.status === 402) {
397
420
  return `This feature requires a higher plan (${err.message}). Upgrade your SentientUI plan, then try again.`;
398
421
  }
@@ -681,6 +704,8 @@ var EMPTY_REASON_TEXT = {
681
704
  // The stale/never-ran texts name the remedy: an agent that is not told about
682
705
  // refresh_insights has no way to know it can fix this itself.
683
706
  job_never_ran: "The analysis job has not run yet. Call refresh_insights to run it now.",
707
+ // No refresh_insights hint here: on a free plan that call just 403s.
708
+ plan_locked: "AI analysis requires a Starter plan or higher. The measured findings are complete; only the written analysis is plan-gated.",
684
709
  job_stale: "These numbers are out of date \u2014 the analysis job has not run recently. Call refresh_insights to regenerate them.",
685
710
  data_unavailable: "The project data could not be read just now \u2014 nothing is wrong with the setup. Retry shortly."
686
711
  };
@@ -1009,6 +1034,13 @@ function registerGoalTools(server, client) {
1009
1034
  // src/tools/funnels.ts
1010
1035
  import { z as z7 } from "zod";
1011
1036
  var funnelIdSchema = z7.string().describe('Funnel slug (from list_funnels), e.g. "checkout"');
1037
+ function stepChangeText(dropOffFromPrevious) {
1038
+ if (dropOffFromPrevious == null) return "";
1039
+ if (dropOffFromPrevious < 0) {
1040
+ return ` (${Math.round(-dropOffFromPrevious * 100)}% MORE than the previous step \u2014 some visitors reached it without the step before, or completed that step before this window)`;
1041
+ }
1042
+ return ` (${Math.round(dropOffFromPrevious * 100)}% drop-off from previous)`;
1043
+ }
1012
1044
  function registerFunnelTools(server, client) {
1013
1045
  server.registerTool(
1014
1046
  "list_funnels",
@@ -1118,7 +1150,7 @@ function registerFunnelTools(server, client) {
1118
1150
  const lines = [`${data.displayName} \u2014 last ${data.windowDays} days`];
1119
1151
  for (const s of data.steps) {
1120
1152
  lines.push(
1121
- `${s.stepIndex + 1}. ${s.displayName}: ${s.reached} reached` + (s.dropOffFromPrevious != null ? ` (${Math.round(s.dropOffFromPrevious * 100)}% drop-off from previous)` : "") + (s.neverFired ? " [never recorded \u2014 check the goal name]" : "")
1153
+ `${s.stepIndex + 1}. ${s.displayName}: ${s.reached} reached` + stepChangeText(s.dropOffFromPrevious) + (s.neverFired ? " [never recorded \u2014 check the goal name]" : "")
1122
1154
  );
1123
1155
  for (const v of s.variants) {
1124
1156
  lines.push(` ${v.componentId}/${v.variantId}: ${v.reached}/${v.assigned} assigned sessions reached this step`);
@@ -1895,7 +1927,7 @@ function registerAgentTrafficTools(server, client) {
1895
1927
  }
1896
1928
 
1897
1929
  // src/server.ts
1898
- var PKG_VERSION = true ? "0.17.2" : "0.0.0-dev";
1930
+ var PKG_VERSION = true ? "0.17.4" : "0.0.0-dev";
1899
1931
  function createMcpServer(client) {
1900
1932
  const server = new McpServer(
1901
1933
  {
package/dist/index.cjs CHANGED
@@ -91,8 +91,8 @@ function rangeInputSchema(defaultRange) {
91
91
  }
92
92
  function rangeQuery(args) {
93
93
  const p = new URLSearchParams();
94
- if (args.from) {
95
- p.set("from", args.from);
94
+ if (args.from || args.to) {
95
+ if (args.from) p.set("from", args.from);
96
96
  if (args.to) p.set("to", args.to);
97
97
  } else if (args.range) {
98
98
  p.set("range", args.range);
@@ -112,10 +112,27 @@ var windowOutputSchema = import_zod.z.object({
112
112
  function windowLine(window) {
113
113
  if (!window) return "";
114
114
  if (window.start && window.end) {
115
- return `Window: ${window.start.slice(0, 10)} to ${window.end.slice(0, 10)} (${window.timezone}, exclusive end)`;
115
+ const from = localDate(window.start, window.timezone);
116
+ const lastIncluded = localDate(
117
+ new Date(new Date(window.end).getTime() - 1).toISOString(),
118
+ window.timezone
119
+ );
120
+ return `Window: ${from} through ${lastIncluded} inclusive (${window.timezone})`;
116
121
  }
117
122
  return `Window: all retained data (${window.retentionDays}-day retention)`;
118
123
  }
124
+ function localDate(iso, timeZone) {
125
+ try {
126
+ return new Intl.DateTimeFormat("en-CA", {
127
+ timeZone,
128
+ year: "numeric",
129
+ month: "2-digit",
130
+ day: "2-digit"
131
+ }).format(new Date(iso));
132
+ } catch (e) {
133
+ return iso.slice(0, 10);
134
+ }
135
+ }
119
136
  function apiErrorGuidance(err, extra) {
120
137
  if (extra && Object.prototype.hasOwnProperty.call(extra, err.message)) {
121
138
  return extra[err.message];
@@ -136,6 +153,12 @@ function apiErrorGuidance(err, extra) {
136
153
  if (err.message === "invalid_range") {
137
154
  return "Invalid time window. Use range '7d', '30d', '90d' or 'all', or from/to as YYYY-MM-DD dates.";
138
155
  }
156
+ if (err.message === "plan_required" || err.message === "plan_upgrade_required") {
157
+ return "This feature is not included on the project\u2019s current plan. Upgrade the SentientUI plan to turn it on \u2014 re-authenticating will not help.";
158
+ }
159
+ if (err.message === "agent_analytics_requires_paid_plan") {
160
+ return "Agent analytics is available on paid plans only. Upgrade the SentientUI plan to read agent traffic for this project.";
161
+ }
139
162
  if (err.status === 402) {
140
163
  return `This feature requires a higher plan (${err.message}). Upgrade your SentientUI plan, then try again.`;
141
164
  }
@@ -687,6 +710,8 @@ var EMPTY_REASON_TEXT = {
687
710
  // The stale/never-ran texts name the remedy: an agent that is not told about
688
711
  // refresh_insights has no way to know it can fix this itself.
689
712
  job_never_ran: "The analysis job has not run yet. Call refresh_insights to run it now.",
713
+ // No refresh_insights hint here: on a free plan that call just 403s.
714
+ plan_locked: "AI analysis requires a Starter plan or higher. The measured findings are complete; only the written analysis is plan-gated.",
690
715
  job_stale: "These numbers are out of date \u2014 the analysis job has not run recently. Call refresh_insights to regenerate them.",
691
716
  data_unavailable: "The project data could not be read just now \u2014 nothing is wrong with the setup. Retry shortly."
692
717
  };
@@ -1015,6 +1040,13 @@ function registerGoalTools(server, client) {
1015
1040
  // src/tools/funnels.ts
1016
1041
  var import_zod7 = require("zod");
1017
1042
  var funnelIdSchema = import_zod7.z.string().describe('Funnel slug (from list_funnels), e.g. "checkout"');
1043
+ function stepChangeText(dropOffFromPrevious) {
1044
+ if (dropOffFromPrevious == null) return "";
1045
+ if (dropOffFromPrevious < 0) {
1046
+ return ` (${Math.round(-dropOffFromPrevious * 100)}% MORE than the previous step \u2014 some visitors reached it without the step before, or completed that step before this window)`;
1047
+ }
1048
+ return ` (${Math.round(dropOffFromPrevious * 100)}% drop-off from previous)`;
1049
+ }
1018
1050
  function registerFunnelTools(server, client) {
1019
1051
  server.registerTool(
1020
1052
  "list_funnels",
@@ -1124,7 +1156,7 @@ function registerFunnelTools(server, client) {
1124
1156
  const lines = [`${data.displayName} \u2014 last ${data.windowDays} days`];
1125
1157
  for (const s of data.steps) {
1126
1158
  lines.push(
1127
- `${s.stepIndex + 1}. ${s.displayName}: ${s.reached} reached` + (s.dropOffFromPrevious != null ? ` (${Math.round(s.dropOffFromPrevious * 100)}% drop-off from previous)` : "") + (s.neverFired ? " [never recorded \u2014 check the goal name]" : "")
1159
+ `${s.stepIndex + 1}. ${s.displayName}: ${s.reached} reached` + stepChangeText(s.dropOffFromPrevious) + (s.neverFired ? " [never recorded \u2014 check the goal name]" : "")
1128
1160
  );
1129
1161
  for (const v of s.variants) {
1130
1162
  lines.push(` ${v.componentId}/${v.variantId}: ${v.reached}/${v.assigned} assigned sessions reached this step`);
@@ -1901,7 +1933,7 @@ function registerAgentTrafficTools(server, client) {
1901
1933
  }
1902
1934
 
1903
1935
  // src/server.ts
1904
- var PKG_VERSION = true ? "0.17.2" : "0.0.0-dev";
1936
+ var PKG_VERSION = true ? "0.17.4" : "0.0.0-dev";
1905
1937
  function createMcpServer(client) {
1906
1938
  const server = new import_mcp.McpServer(
1907
1939
  {
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ApiClient,
4
4
  createMcpServer
5
- } from "./chunk-PHUP47GG.js";
5
+ } from "./chunk-CEZJQSKB.js";
6
6
 
7
7
  // src/index.ts
8
8
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
package/dist/lib.cjs CHANGED
@@ -115,8 +115,8 @@ function rangeInputSchema(defaultRange) {
115
115
  }
116
116
  function rangeQuery(args) {
117
117
  const p = new URLSearchParams();
118
- if (args.from) {
119
- p.set("from", args.from);
118
+ if (args.from || args.to) {
119
+ if (args.from) p.set("from", args.from);
120
120
  if (args.to) p.set("to", args.to);
121
121
  } else if (args.range) {
122
122
  p.set("range", args.range);
@@ -136,10 +136,27 @@ var windowOutputSchema = import_zod.z.object({
136
136
  function windowLine(window) {
137
137
  if (!window) return "";
138
138
  if (window.start && window.end) {
139
- return `Window: ${window.start.slice(0, 10)} to ${window.end.slice(0, 10)} (${window.timezone}, exclusive end)`;
139
+ const from = localDate(window.start, window.timezone);
140
+ const lastIncluded = localDate(
141
+ new Date(new Date(window.end).getTime() - 1).toISOString(),
142
+ window.timezone
143
+ );
144
+ return `Window: ${from} through ${lastIncluded} inclusive (${window.timezone})`;
140
145
  }
141
146
  return `Window: all retained data (${window.retentionDays}-day retention)`;
142
147
  }
148
+ function localDate(iso, timeZone) {
149
+ try {
150
+ return new Intl.DateTimeFormat("en-CA", {
151
+ timeZone,
152
+ year: "numeric",
153
+ month: "2-digit",
154
+ day: "2-digit"
155
+ }).format(new Date(iso));
156
+ } catch (e) {
157
+ return iso.slice(0, 10);
158
+ }
159
+ }
143
160
  function apiErrorGuidance(err, extra) {
144
161
  if (extra && Object.prototype.hasOwnProperty.call(extra, err.message)) {
145
162
  return extra[err.message];
@@ -160,6 +177,12 @@ function apiErrorGuidance(err, extra) {
160
177
  if (err.message === "invalid_range") {
161
178
  return "Invalid time window. Use range '7d', '30d', '90d' or 'all', or from/to as YYYY-MM-DD dates.";
162
179
  }
180
+ if (err.message === "plan_required" || err.message === "plan_upgrade_required") {
181
+ return "This feature is not included on the project\u2019s current plan. Upgrade the SentientUI plan to turn it on \u2014 re-authenticating will not help.";
182
+ }
183
+ if (err.message === "agent_analytics_requires_paid_plan") {
184
+ return "Agent analytics is available on paid plans only. Upgrade the SentientUI plan to read agent traffic for this project.";
185
+ }
163
186
  if (err.status === 402) {
164
187
  return `This feature requires a higher plan (${err.message}). Upgrade your SentientUI plan, then try again.`;
165
188
  }
@@ -711,6 +734,8 @@ var EMPTY_REASON_TEXT = {
711
734
  // The stale/never-ran texts name the remedy: an agent that is not told about
712
735
  // refresh_insights has no way to know it can fix this itself.
713
736
  job_never_ran: "The analysis job has not run yet. Call refresh_insights to run it now.",
737
+ // No refresh_insights hint here: on a free plan that call just 403s.
738
+ plan_locked: "AI analysis requires a Starter plan or higher. The measured findings are complete; only the written analysis is plan-gated.",
714
739
  job_stale: "These numbers are out of date \u2014 the analysis job has not run recently. Call refresh_insights to regenerate them.",
715
740
  data_unavailable: "The project data could not be read just now \u2014 nothing is wrong with the setup. Retry shortly."
716
741
  };
@@ -1039,6 +1064,13 @@ function registerGoalTools(server, client) {
1039
1064
  // src/tools/funnels.ts
1040
1065
  var import_zod7 = require("zod");
1041
1066
  var funnelIdSchema = import_zod7.z.string().describe('Funnel slug (from list_funnels), e.g. "checkout"');
1067
+ function stepChangeText(dropOffFromPrevious) {
1068
+ if (dropOffFromPrevious == null) return "";
1069
+ if (dropOffFromPrevious < 0) {
1070
+ return ` (${Math.round(-dropOffFromPrevious * 100)}% MORE than the previous step \u2014 some visitors reached it without the step before, or completed that step before this window)`;
1071
+ }
1072
+ return ` (${Math.round(dropOffFromPrevious * 100)}% drop-off from previous)`;
1073
+ }
1042
1074
  function registerFunnelTools(server, client) {
1043
1075
  server.registerTool(
1044
1076
  "list_funnels",
@@ -1148,7 +1180,7 @@ function registerFunnelTools(server, client) {
1148
1180
  const lines = [`${data.displayName} \u2014 last ${data.windowDays} days`];
1149
1181
  for (const s of data.steps) {
1150
1182
  lines.push(
1151
- `${s.stepIndex + 1}. ${s.displayName}: ${s.reached} reached` + (s.dropOffFromPrevious != null ? ` (${Math.round(s.dropOffFromPrevious * 100)}% drop-off from previous)` : "") + (s.neverFired ? " [never recorded \u2014 check the goal name]" : "")
1183
+ `${s.stepIndex + 1}. ${s.displayName}: ${s.reached} reached` + stepChangeText(s.dropOffFromPrevious) + (s.neverFired ? " [never recorded \u2014 check the goal name]" : "")
1152
1184
  );
1153
1185
  for (const v of s.variants) {
1154
1186
  lines.push(` ${v.componentId}/${v.variantId}: ${v.reached}/${v.assigned} assigned sessions reached this step`);
@@ -1925,7 +1957,7 @@ function registerAgentTrafficTools(server, client) {
1925
1957
  }
1926
1958
 
1927
1959
  // src/server.ts
1928
- var PKG_VERSION = true ? "0.17.2" : "0.0.0-dev";
1960
+ var PKG_VERSION = true ? "0.17.4" : "0.0.0-dev";
1929
1961
  function createMcpServer(client) {
1930
1962
  const server = new import_mcp.McpServer(
1931
1963
  {
package/dist/lib.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  ApiError,
5
5
  PUBLIC_UI_RESOURCE_URIS,
6
6
  createMcpServer
7
- } from "./chunk-PHUP47GG.js";
7
+ } from "./chunk-CEZJQSKB.js";
8
8
  export {
9
9
  ApiClient,
10
10
  ApiError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentientui/mcp",
3
- "version": "0.17.2",
3
+ "version": "0.17.4",
4
4
  "description": "MCP server for SentientUI — exposes project data and actions to AI agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://sentient-ui.com",