@sentientui/mcp 0.17.3 → 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
  }
@@ -1011,6 +1034,13 @@ function registerGoalTools(server, client) {
1011
1034
  // src/tools/funnels.ts
1012
1035
  import { z as z7 } from "zod";
1013
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
+ }
1014
1044
  function registerFunnelTools(server, client) {
1015
1045
  server.registerTool(
1016
1046
  "list_funnels",
@@ -1120,7 +1150,7 @@ function registerFunnelTools(server, client) {
1120
1150
  const lines = [`${data.displayName} \u2014 last ${data.windowDays} days`];
1121
1151
  for (const s of data.steps) {
1122
1152
  lines.push(
1123
- `${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]" : "")
1124
1154
  );
1125
1155
  for (const v of s.variants) {
1126
1156
  lines.push(` ${v.componentId}/${v.variantId}: ${v.reached}/${v.assigned} assigned sessions reached this step`);
@@ -1897,7 +1927,7 @@ function registerAgentTrafficTools(server, client) {
1897
1927
  }
1898
1928
 
1899
1929
  // src/server.ts
1900
- var PKG_VERSION = true ? "0.17.3" : "0.0.0-dev";
1930
+ var PKG_VERSION = true ? "0.17.4" : "0.0.0-dev";
1901
1931
  function createMcpServer(client) {
1902
1932
  const server = new McpServer(
1903
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
  }
@@ -1017,6 +1040,13 @@ function registerGoalTools(server, client) {
1017
1040
  // src/tools/funnels.ts
1018
1041
  var import_zod7 = require("zod");
1019
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
+ }
1020
1050
  function registerFunnelTools(server, client) {
1021
1051
  server.registerTool(
1022
1052
  "list_funnels",
@@ -1126,7 +1156,7 @@ function registerFunnelTools(server, client) {
1126
1156
  const lines = [`${data.displayName} \u2014 last ${data.windowDays} days`];
1127
1157
  for (const s of data.steps) {
1128
1158
  lines.push(
1129
- `${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]" : "")
1130
1160
  );
1131
1161
  for (const v of s.variants) {
1132
1162
  lines.push(` ${v.componentId}/${v.variantId}: ${v.reached}/${v.assigned} assigned sessions reached this step`);
@@ -1903,7 +1933,7 @@ function registerAgentTrafficTools(server, client) {
1903
1933
  }
1904
1934
 
1905
1935
  // src/server.ts
1906
- var PKG_VERSION = true ? "0.17.3" : "0.0.0-dev";
1936
+ var PKG_VERSION = true ? "0.17.4" : "0.0.0-dev";
1907
1937
  function createMcpServer(client) {
1908
1938
  const server = new import_mcp.McpServer(
1909
1939
  {
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ApiClient,
4
4
  createMcpServer
5
- } from "./chunk-PUMG7EQ2.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
  }
@@ -1041,6 +1064,13 @@ function registerGoalTools(server, client) {
1041
1064
  // src/tools/funnels.ts
1042
1065
  var import_zod7 = require("zod");
1043
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
+ }
1044
1074
  function registerFunnelTools(server, client) {
1045
1075
  server.registerTool(
1046
1076
  "list_funnels",
@@ -1150,7 +1180,7 @@ function registerFunnelTools(server, client) {
1150
1180
  const lines = [`${data.displayName} \u2014 last ${data.windowDays} days`];
1151
1181
  for (const s of data.steps) {
1152
1182
  lines.push(
1153
- `${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]" : "")
1154
1184
  );
1155
1185
  for (const v of s.variants) {
1156
1186
  lines.push(` ${v.componentId}/${v.variantId}: ${v.reached}/${v.assigned} assigned sessions reached this step`);
@@ -1927,7 +1957,7 @@ function registerAgentTrafficTools(server, client) {
1927
1957
  }
1928
1958
 
1929
1959
  // src/server.ts
1930
- var PKG_VERSION = true ? "0.17.3" : "0.0.0-dev";
1960
+ var PKG_VERSION = true ? "0.17.4" : "0.0.0-dev";
1931
1961
  function createMcpServer(client) {
1932
1962
  const server = new import_mcp.McpServer(
1933
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-PUMG7EQ2.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.3",
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",