@firstdistro/mcp 1.1.0 → 1.1.2

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 (2) hide show
  1. package/dist/server.js +25 -12
  2. package/package.json +4 -8
package/dist/server.js CHANGED
@@ -459,6 +459,12 @@ function formatNetworkError(error) {
459
459
  }
460
460
  return "Unknown network error occurred.";
461
461
  }
462
+ function unwrapApiResponse(response) {
463
+ if (response && typeof response === "object" && "success" in response && "data" in response) {
464
+ return response.data;
465
+ }
466
+ return response;
467
+ }
462
468
  async function startServer() {
463
469
  let config = null;
464
470
  let configError = null;
@@ -505,8 +511,9 @@ function registerAuthenticatedTools(server, config) {
505
511
  isError: true
506
512
  };
507
513
  }
508
- const data = await response.json();
509
- const experiences = data.experiences || data;
514
+ const rawData = await response.json();
515
+ const data = unwrapApiResponse(rawData);
516
+ const experiences = data.experiences || [];
510
517
  if (!experiences || experiences.length === 0) {
511
518
  return {
512
519
  content: [
@@ -560,7 +567,8 @@ ${summary}`
560
567
  isError: true
561
568
  };
562
569
  }
563
- const data = await response.json();
570
+ const rawData = await response.json();
571
+ const data = unwrapApiResponse(rawData);
564
572
  if (data.eventsFlowing || data.hasEvents) {
565
573
  let topEventsText = "";
566
574
  if (data.topEvents && data.topEvents.length > 0) {
@@ -630,8 +638,9 @@ Unique users (24h): ${data.uniqueUsersLast24h ?? "N/A"}${topEventsText}`
630
638
  isError: true
631
639
  };
632
640
  }
633
- const data = await response.json();
634
- const health = data.health || data;
641
+ const rawData = await response.json();
642
+ const data = unwrapApiResponse(rawData);
643
+ const health = data.health || {};
635
644
  return {
636
645
  content: [
637
646
  {
@@ -684,7 +693,8 @@ Last Seen: ${data.account?.lastSeenAt || "Unknown"}`
684
693
  isError: true
685
694
  };
686
695
  }
687
- const data = await response.json();
696
+ const rawData = await response.json();
697
+ const data = unwrapApiResponse(rawData);
688
698
  const stats = data.stats || {};
689
699
  const exp = data.experience || {};
690
700
  let avgTimeDisplay = "N/A";
@@ -751,7 +761,8 @@ Avg Time to Complete: ${avgTimeDisplay}`
751
761
  isError: true
752
762
  };
753
763
  }
754
- const data = await response.json();
764
+ const rawData = await response.json();
765
+ const data = unwrapApiResponse(rawData);
755
766
  const customers = data.stuckCustomers || [];
756
767
  const exp = data.experience || {};
757
768
  if (customers.length === 0) {
@@ -824,7 +835,8 @@ ${customerList}${customers.length > 10 ? `
824
835
  isError: true
825
836
  };
826
837
  }
827
- const data = await response.json();
838
+ const rawData = await response.json();
839
+ const data = unwrapApiResponse(rawData);
828
840
  const accounts = data.accounts || [];
829
841
  const summary = data.summary || {};
830
842
  if (accounts.length === 0) {
@@ -889,8 +901,8 @@ ${accountList}${accounts.length > 15 ? `
889
901
  isError: true
890
902
  };
891
903
  }
892
- const data = await response.json();
893
- const result = data.data || data;
904
+ const rawData = await response.json();
905
+ const result = unwrapApiResponse(rawData);
894
906
  const snippets = result.snippets || {};
895
907
  return {
896
908
  content: [
@@ -958,8 +970,9 @@ After setup, use 'check_events_flowing' to verify events are being received.`
958
970
  isError: true
959
971
  };
960
972
  }
961
- const data = await response.json();
962
- const installationToken = data.data?.installationToken || data.installationToken;
973
+ const rawData = await response.json();
974
+ const data = unwrapApiResponse(rawData);
975
+ const installationToken = data.installationToken;
963
976
  if (!installationToken) {
964
977
  return {
965
978
  content: [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@firstdistro/mcp",
3
- "version": "1.1.0",
4
- "description": "MCP server for FirstDistro - query and manage customer health from AI assistants",
3
+ "version": "1.1.2",
4
+ "description": "MCP server that brings customer health scores, stuck users, and funnel analytics into Claude, Cursor, and other AI tools — catch churn risks early",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "firstdistro-mcp": "./bin/firstdistro-mcp.js"
@@ -33,7 +33,7 @@
33
33
  "@types/node": "^20.0.0",
34
34
  "tsup": "^8.0.0",
35
35
  "typescript": "^5.0.0",
36
- "vitest": "^2.0.0"
36
+ "vitest": "^4.0.18"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=18.0.0"
@@ -48,10 +48,6 @@
48
48
  "llm"
49
49
  ],
50
50
  "license": "MIT",
51
- "repository": {
52
- "type": "git",
53
- "url": "https://github.com/Wonderstand-AI/first-distro"
54
- },
55
- "homepage": "https://firstdistro.com/docs/mcp",
51
+ "homepage": "https://firstdistro.com/documentation/mcp/overview",
56
52
  "author": "FirstDistro <support@firstdistro.com>"
57
53
  }