@sentientui/mcp 0.8.2 → 0.9.0

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.
@@ -1401,8 +1401,113 @@ function registerIntegrationGuideTools(server) {
1401
1401
  );
1402
1402
  }
1403
1403
 
1404
+ // src/tools/agent-traffic.ts
1405
+ import { z as z13 } from "zod";
1406
+ var PLAN_GATE_GUIDANCE = {
1407
+ agent_analytics_requires_paid_plan: "Agent analytics requires a paid SentientUI plan (Starter or above). Upgrade at https://sentient-ui.com, then try again."
1408
+ };
1409
+ function registerAgentTrafficTools(server, client) {
1410
+ server.registerTool(
1411
+ "get_agent_traffic",
1412
+ {
1413
+ title: "Agent traffic",
1414
+ description: "Which AI agents and crawlers are reading this site: totals by type (passive crawlers, agentic browsers, agent API calls), engine breakdown, and the paths they fetch most. Agent traffic is tracked separately and never counted in conversion rate.",
1415
+ inputSchema: { projectId: projectIdSchema },
1416
+ outputSchema: {
1417
+ totals: z13.object({ crawler: z13.number(), api: z13.number(), browser: z13.number() }),
1418
+ engines: z13.array(
1419
+ z13.object({
1420
+ engine: z13.string(),
1421
+ count: z13.number(),
1422
+ sharePct: z13.number(),
1423
+ lastSeen: z13.string(),
1424
+ firstSeenInRange: z13.boolean().describe("First observed within the queried period")
1425
+ })
1426
+ ),
1427
+ topPaths: z13.array(z13.object({ path: z13.string(), count: z13.number(), engines: z13.number() }))
1428
+ },
1429
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false }
1430
+ },
1431
+ withApiErrorGuidance(async ({ projectId }) => {
1432
+ const id = encodeURIComponent(projectId);
1433
+ const s = await client.get(`/projects/${id}/agent-activity/summary`);
1434
+ const structuredContent = { totals: s.totals, engines: s.engines, topPaths: s.topPaths };
1435
+ const total = s.totals.crawler + s.totals.api + s.totals.browser;
1436
+ if (total === 0) {
1437
+ return {
1438
+ content: [{
1439
+ type: "text",
1440
+ text: "No agent traffic observed yet. Passive crawlers (GPTBot, ClaudeBot, \u2026) run no JavaScript \u2014 install sentientAgentMiddleware from @sentientui/react/next to capture them server-side."
1441
+ }],
1442
+ structuredContent
1443
+ };
1444
+ }
1445
+ const lines = [
1446
+ `Agent traffic: ${s.totals.crawler} crawler fetches, ${s.totals.api} agent API calls, ${s.totals.browser} agentic browser sessions.`,
1447
+ "",
1448
+ "Engines:",
1449
+ ...s.engines.map((e) => `- ${e.engine}: ${e.count} fetches (${e.sharePct}%)${e.firstSeenInRange ? " \u2014 NEW this period" : ""}`),
1450
+ "",
1451
+ "Most-fetched paths:",
1452
+ ...s.topPaths.map((p) => `- ${p.path}: ${p.count} fetches by ${p.engines} engine(s)`)
1453
+ ];
1454
+ return { content: [{ type: "text", text: lines.join("\n") }], structuredContent };
1455
+ }, PLAN_GATE_GUIDANCE)
1456
+ );
1457
+ server.registerTool(
1458
+ "get_agent_legibility",
1459
+ {
1460
+ title: "Agent legibility",
1461
+ description: "Whether the pages AI agents actually read are machine-legible: per-path checks for price, product name, positioning, and CTA in the server HTML, plus agent API blocks served without agent data. Each failure comes with a concrete fix.",
1462
+ inputSchema: { projectId: projectIdSchema },
1463
+ outputSchema: {
1464
+ paths: z13.array(
1465
+ z13.object({
1466
+ path: z13.string(),
1467
+ score: z13.number().describe("0\u2013100, 25 per passing check"),
1468
+ checks: z13.object({
1469
+ price: z13.boolean(),
1470
+ name: z13.boolean(),
1471
+ positioning: z13.boolean(),
1472
+ cta: z13.boolean(),
1473
+ notes: z13.array(z13.string())
1474
+ }),
1475
+ lastChecked: z13.string()
1476
+ })
1477
+ ),
1478
+ emptyBlocks: z13.array(z13.object({ block: z13.string(), variant: z13.string(), occurrences: z13.number() }))
1479
+ },
1480
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false }
1481
+ },
1482
+ withApiErrorGuidance(async ({ projectId }) => {
1483
+ const id = encodeURIComponent(projectId);
1484
+ const l = await client.get(`/projects/${id}/agent-activity/legibility`);
1485
+ const structuredContent = { paths: l.paths, emptyBlocks: l.emptyBlocks };
1486
+ if (l.paths.length === 0 && l.emptyBlocks.length === 0) {
1487
+ return {
1488
+ content: [{ type: "text", text: "No legibility results yet \u2014 they appear once AI crawlers start fetching pages (checked daily)." }],
1489
+ structuredContent
1490
+ };
1491
+ }
1492
+ const lines = [
1493
+ "Legibility of agent-read paths:",
1494
+ ...l.paths.map((p) => {
1495
+ const failed = ["price", "name", "positioning", "cta"].filter((k) => !p.checks[k]);
1496
+ return `- ${p.path}: ${p.score}/100${failed.length ? ` \u2014 missing: ${failed.join(", ")}` : " \u2014 fully legible"}`;
1497
+ }),
1498
+ ...l.paths.flatMap((p) => p.checks.notes.map((n) => ` fix (${p.path}): ${n}`))
1499
+ ];
1500
+ if (l.emptyBlocks.length > 0) {
1501
+ lines.push("", "Agent API blocks served without agent data (add agentDataByVariant):");
1502
+ lines.push(...l.emptyBlocks.map((b) => `- ${b.block} (variant ${b.variant}): ${b.occurrences} calls`));
1503
+ }
1504
+ return { content: [{ type: "text", text: lines.join("\n") }], structuredContent };
1505
+ }, PLAN_GATE_GUIDANCE)
1506
+ );
1507
+ }
1508
+
1404
1509
  // src/server.ts
1405
- var PKG_VERSION = true ? "0.8.2" : "0.0.0-dev";
1510
+ var PKG_VERSION = true ? "0.9.0" : "0.0.0-dev";
1406
1511
  function createMcpServer(client) {
1407
1512
  const server = new McpServer(
1408
1513
  {
@@ -1435,6 +1540,7 @@ function createMcpServer(client) {
1435
1540
  registerTestBriefTools(server, client);
1436
1541
  registerVariantWriteTools(server, client);
1437
1542
  registerIntegrationGuideTools(server);
1543
+ registerAgentTrafficTools(server, client);
1438
1544
  return server;
1439
1545
  }
1440
1546
 
package/dist/index.cjs CHANGED
@@ -1405,8 +1405,113 @@ function registerIntegrationGuideTools(server) {
1405
1405
  );
1406
1406
  }
1407
1407
 
1408
+ // src/tools/agent-traffic.ts
1409
+ var import_zod13 = require("zod");
1410
+ var PLAN_GATE_GUIDANCE = {
1411
+ agent_analytics_requires_paid_plan: "Agent analytics requires a paid SentientUI plan (Starter or above). Upgrade at https://sentient-ui.com, then try again."
1412
+ };
1413
+ function registerAgentTrafficTools(server, client) {
1414
+ server.registerTool(
1415
+ "get_agent_traffic",
1416
+ {
1417
+ title: "Agent traffic",
1418
+ description: "Which AI agents and crawlers are reading this site: totals by type (passive crawlers, agentic browsers, agent API calls), engine breakdown, and the paths they fetch most. Agent traffic is tracked separately and never counted in conversion rate.",
1419
+ inputSchema: { projectId: projectIdSchema },
1420
+ outputSchema: {
1421
+ totals: import_zod13.z.object({ crawler: import_zod13.z.number(), api: import_zod13.z.number(), browser: import_zod13.z.number() }),
1422
+ engines: import_zod13.z.array(
1423
+ import_zod13.z.object({
1424
+ engine: import_zod13.z.string(),
1425
+ count: import_zod13.z.number(),
1426
+ sharePct: import_zod13.z.number(),
1427
+ lastSeen: import_zod13.z.string(),
1428
+ firstSeenInRange: import_zod13.z.boolean().describe("First observed within the queried period")
1429
+ })
1430
+ ),
1431
+ topPaths: import_zod13.z.array(import_zod13.z.object({ path: import_zod13.z.string(), count: import_zod13.z.number(), engines: import_zod13.z.number() }))
1432
+ },
1433
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false }
1434
+ },
1435
+ withApiErrorGuidance(async ({ projectId }) => {
1436
+ const id = encodeURIComponent(projectId);
1437
+ const s = await client.get(`/projects/${id}/agent-activity/summary`);
1438
+ const structuredContent = { totals: s.totals, engines: s.engines, topPaths: s.topPaths };
1439
+ const total = s.totals.crawler + s.totals.api + s.totals.browser;
1440
+ if (total === 0) {
1441
+ return {
1442
+ content: [{
1443
+ type: "text",
1444
+ text: "No agent traffic observed yet. Passive crawlers (GPTBot, ClaudeBot, \u2026) run no JavaScript \u2014 install sentientAgentMiddleware from @sentientui/react/next to capture them server-side."
1445
+ }],
1446
+ structuredContent
1447
+ };
1448
+ }
1449
+ const lines = [
1450
+ `Agent traffic: ${s.totals.crawler} crawler fetches, ${s.totals.api} agent API calls, ${s.totals.browser} agentic browser sessions.`,
1451
+ "",
1452
+ "Engines:",
1453
+ ...s.engines.map((e) => `- ${e.engine}: ${e.count} fetches (${e.sharePct}%)${e.firstSeenInRange ? " \u2014 NEW this period" : ""}`),
1454
+ "",
1455
+ "Most-fetched paths:",
1456
+ ...s.topPaths.map((p) => `- ${p.path}: ${p.count} fetches by ${p.engines} engine(s)`)
1457
+ ];
1458
+ return { content: [{ type: "text", text: lines.join("\n") }], structuredContent };
1459
+ }, PLAN_GATE_GUIDANCE)
1460
+ );
1461
+ server.registerTool(
1462
+ "get_agent_legibility",
1463
+ {
1464
+ title: "Agent legibility",
1465
+ description: "Whether the pages AI agents actually read are machine-legible: per-path checks for price, product name, positioning, and CTA in the server HTML, plus agent API blocks served without agent data. Each failure comes with a concrete fix.",
1466
+ inputSchema: { projectId: projectIdSchema },
1467
+ outputSchema: {
1468
+ paths: import_zod13.z.array(
1469
+ import_zod13.z.object({
1470
+ path: import_zod13.z.string(),
1471
+ score: import_zod13.z.number().describe("0\u2013100, 25 per passing check"),
1472
+ checks: import_zod13.z.object({
1473
+ price: import_zod13.z.boolean(),
1474
+ name: import_zod13.z.boolean(),
1475
+ positioning: import_zod13.z.boolean(),
1476
+ cta: import_zod13.z.boolean(),
1477
+ notes: import_zod13.z.array(import_zod13.z.string())
1478
+ }),
1479
+ lastChecked: import_zod13.z.string()
1480
+ })
1481
+ ),
1482
+ emptyBlocks: import_zod13.z.array(import_zod13.z.object({ block: import_zod13.z.string(), variant: import_zod13.z.string(), occurrences: import_zod13.z.number() }))
1483
+ },
1484
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false }
1485
+ },
1486
+ withApiErrorGuidance(async ({ projectId }) => {
1487
+ const id = encodeURIComponent(projectId);
1488
+ const l = await client.get(`/projects/${id}/agent-activity/legibility`);
1489
+ const structuredContent = { paths: l.paths, emptyBlocks: l.emptyBlocks };
1490
+ if (l.paths.length === 0 && l.emptyBlocks.length === 0) {
1491
+ return {
1492
+ content: [{ type: "text", text: "No legibility results yet \u2014 they appear once AI crawlers start fetching pages (checked daily)." }],
1493
+ structuredContent
1494
+ };
1495
+ }
1496
+ const lines = [
1497
+ "Legibility of agent-read paths:",
1498
+ ...l.paths.map((p) => {
1499
+ const failed = ["price", "name", "positioning", "cta"].filter((k) => !p.checks[k]);
1500
+ return `- ${p.path}: ${p.score}/100${failed.length ? ` \u2014 missing: ${failed.join(", ")}` : " \u2014 fully legible"}`;
1501
+ }),
1502
+ ...l.paths.flatMap((p) => p.checks.notes.map((n) => ` fix (${p.path}): ${n}`))
1503
+ ];
1504
+ if (l.emptyBlocks.length > 0) {
1505
+ lines.push("", "Agent API blocks served without agent data (add agentDataByVariant):");
1506
+ lines.push(...l.emptyBlocks.map((b) => `- ${b.block} (variant ${b.variant}): ${b.occurrences} calls`));
1507
+ }
1508
+ return { content: [{ type: "text", text: lines.join("\n") }], structuredContent };
1509
+ }, PLAN_GATE_GUIDANCE)
1510
+ );
1511
+ }
1512
+
1408
1513
  // src/server.ts
1409
- var PKG_VERSION = true ? "0.8.2" : "0.0.0-dev";
1514
+ var PKG_VERSION = true ? "0.9.0" : "0.0.0-dev";
1410
1515
  function createMcpServer(client) {
1411
1516
  const server = new import_mcp.McpServer(
1412
1517
  {
@@ -1439,6 +1544,7 @@ function createMcpServer(client) {
1439
1544
  registerTestBriefTools(server, client);
1440
1545
  registerVariantWriteTools(server, client);
1441
1546
  registerIntegrationGuideTools(server);
1547
+ registerAgentTrafficTools(server, client);
1442
1548
  return server;
1443
1549
  }
1444
1550
 
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  ApiClient,
4
4
  createMcpServer
5
- } from "./chunk-GLL5CMBY.js";
5
+ } from "./chunk-QESH43WV.js";
6
6
 
7
7
  // src/index.ts
8
8
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
package/dist/lib.cjs CHANGED
@@ -1430,8 +1430,113 @@ function registerIntegrationGuideTools(server) {
1430
1430
  );
1431
1431
  }
1432
1432
 
1433
+ // src/tools/agent-traffic.ts
1434
+ var import_zod13 = require("zod");
1435
+ var PLAN_GATE_GUIDANCE = {
1436
+ agent_analytics_requires_paid_plan: "Agent analytics requires a paid SentientUI plan (Starter or above). Upgrade at https://sentient-ui.com, then try again."
1437
+ };
1438
+ function registerAgentTrafficTools(server, client) {
1439
+ server.registerTool(
1440
+ "get_agent_traffic",
1441
+ {
1442
+ title: "Agent traffic",
1443
+ description: "Which AI agents and crawlers are reading this site: totals by type (passive crawlers, agentic browsers, agent API calls), engine breakdown, and the paths they fetch most. Agent traffic is tracked separately and never counted in conversion rate.",
1444
+ inputSchema: { projectId: projectIdSchema },
1445
+ outputSchema: {
1446
+ totals: import_zod13.z.object({ crawler: import_zod13.z.number(), api: import_zod13.z.number(), browser: import_zod13.z.number() }),
1447
+ engines: import_zod13.z.array(
1448
+ import_zod13.z.object({
1449
+ engine: import_zod13.z.string(),
1450
+ count: import_zod13.z.number(),
1451
+ sharePct: import_zod13.z.number(),
1452
+ lastSeen: import_zod13.z.string(),
1453
+ firstSeenInRange: import_zod13.z.boolean().describe("First observed within the queried period")
1454
+ })
1455
+ ),
1456
+ topPaths: import_zod13.z.array(import_zod13.z.object({ path: import_zod13.z.string(), count: import_zod13.z.number(), engines: import_zod13.z.number() }))
1457
+ },
1458
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false }
1459
+ },
1460
+ withApiErrorGuidance(async ({ projectId }) => {
1461
+ const id = encodeURIComponent(projectId);
1462
+ const s = await client.get(`/projects/${id}/agent-activity/summary`);
1463
+ const structuredContent = { totals: s.totals, engines: s.engines, topPaths: s.topPaths };
1464
+ const total = s.totals.crawler + s.totals.api + s.totals.browser;
1465
+ if (total === 0) {
1466
+ return {
1467
+ content: [{
1468
+ type: "text",
1469
+ text: "No agent traffic observed yet. Passive crawlers (GPTBot, ClaudeBot, \u2026) run no JavaScript \u2014 install sentientAgentMiddleware from @sentientui/react/next to capture them server-side."
1470
+ }],
1471
+ structuredContent
1472
+ };
1473
+ }
1474
+ const lines = [
1475
+ `Agent traffic: ${s.totals.crawler} crawler fetches, ${s.totals.api} agent API calls, ${s.totals.browser} agentic browser sessions.`,
1476
+ "",
1477
+ "Engines:",
1478
+ ...s.engines.map((e) => `- ${e.engine}: ${e.count} fetches (${e.sharePct}%)${e.firstSeenInRange ? " \u2014 NEW this period" : ""}`),
1479
+ "",
1480
+ "Most-fetched paths:",
1481
+ ...s.topPaths.map((p) => `- ${p.path}: ${p.count} fetches by ${p.engines} engine(s)`)
1482
+ ];
1483
+ return { content: [{ type: "text", text: lines.join("\n") }], structuredContent };
1484
+ }, PLAN_GATE_GUIDANCE)
1485
+ );
1486
+ server.registerTool(
1487
+ "get_agent_legibility",
1488
+ {
1489
+ title: "Agent legibility",
1490
+ description: "Whether the pages AI agents actually read are machine-legible: per-path checks for price, product name, positioning, and CTA in the server HTML, plus agent API blocks served without agent data. Each failure comes with a concrete fix.",
1491
+ inputSchema: { projectId: projectIdSchema },
1492
+ outputSchema: {
1493
+ paths: import_zod13.z.array(
1494
+ import_zod13.z.object({
1495
+ path: import_zod13.z.string(),
1496
+ score: import_zod13.z.number().describe("0\u2013100, 25 per passing check"),
1497
+ checks: import_zod13.z.object({
1498
+ price: import_zod13.z.boolean(),
1499
+ name: import_zod13.z.boolean(),
1500
+ positioning: import_zod13.z.boolean(),
1501
+ cta: import_zod13.z.boolean(),
1502
+ notes: import_zod13.z.array(import_zod13.z.string())
1503
+ }),
1504
+ lastChecked: import_zod13.z.string()
1505
+ })
1506
+ ),
1507
+ emptyBlocks: import_zod13.z.array(import_zod13.z.object({ block: import_zod13.z.string(), variant: import_zod13.z.string(), occurrences: import_zod13.z.number() }))
1508
+ },
1509
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false }
1510
+ },
1511
+ withApiErrorGuidance(async ({ projectId }) => {
1512
+ const id = encodeURIComponent(projectId);
1513
+ const l = await client.get(`/projects/${id}/agent-activity/legibility`);
1514
+ const structuredContent = { paths: l.paths, emptyBlocks: l.emptyBlocks };
1515
+ if (l.paths.length === 0 && l.emptyBlocks.length === 0) {
1516
+ return {
1517
+ content: [{ type: "text", text: "No legibility results yet \u2014 they appear once AI crawlers start fetching pages (checked daily)." }],
1518
+ structuredContent
1519
+ };
1520
+ }
1521
+ const lines = [
1522
+ "Legibility of agent-read paths:",
1523
+ ...l.paths.map((p) => {
1524
+ const failed = ["price", "name", "positioning", "cta"].filter((k) => !p.checks[k]);
1525
+ return `- ${p.path}: ${p.score}/100${failed.length ? ` \u2014 missing: ${failed.join(", ")}` : " \u2014 fully legible"}`;
1526
+ }),
1527
+ ...l.paths.flatMap((p) => p.checks.notes.map((n) => ` fix (${p.path}): ${n}`))
1528
+ ];
1529
+ if (l.emptyBlocks.length > 0) {
1530
+ lines.push("", "Agent API blocks served without agent data (add agentDataByVariant):");
1531
+ lines.push(...l.emptyBlocks.map((b) => `- ${b.block} (variant ${b.variant}): ${b.occurrences} calls`));
1532
+ }
1533
+ return { content: [{ type: "text", text: lines.join("\n") }], structuredContent };
1534
+ }, PLAN_GATE_GUIDANCE)
1535
+ );
1536
+ }
1537
+
1433
1538
  // src/server.ts
1434
- var PKG_VERSION = true ? "0.8.2" : "0.0.0-dev";
1539
+ var PKG_VERSION = true ? "0.9.0" : "0.0.0-dev";
1435
1540
  function createMcpServer(client) {
1436
1541
  const server = new import_mcp.McpServer(
1437
1542
  {
@@ -1464,6 +1569,7 @@ function createMcpServer(client) {
1464
1569
  registerTestBriefTools(server, client);
1465
1570
  registerVariantWriteTools(server, client);
1466
1571
  registerIntegrationGuideTools(server);
1572
+ registerAgentTrafficTools(server, client);
1467
1573
  return server;
1468
1574
  }
1469
1575
  // Annotate the CommonJS export names for ESM import in node:
package/dist/lib.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  ApiClient,
4
4
  ApiError,
5
5
  createMcpServer
6
- } from "./chunk-GLL5CMBY.js";
6
+ } from "./chunk-QESH43WV.js";
7
7
  export {
8
8
  ApiClient,
9
9
  ApiError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentientui/mcp",
3
- "version": "0.8.2",
3
+ "version": "0.9.0",
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",