@posthog/mcp 0.4.3 → 0.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"sink.d.ts","sourceRoot":"","sources":["../../src/extensions/sink.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAG3C,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAE7D,OAAO,EAAE,KAAK,mBAAmB,EAA6B,MAAM,kBAAkB,CAAA;AAKtF,yEAAyE;AACzE,MAAM,WAAW,iBAAiB;IAChC,0BAA0B,EAAE,OAAO,CAAA;IACnC,kFAAkF;IAClF,UAAU,CAAC,EAAE,YAAY,CAAA;CAC1B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,mBAAmB,EAAE,CAAA;CAAE,GAAG,IAAI,CAAC,CA2BnE;AA4BD;;;;;;;;GAQG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,OAAO;IAE7C;;;;OAIG;IACG,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CA0B1E"}
1
+ {"version":3,"file":"sink.d.ts","sourceRoot":"","sources":["../../src/extensions/sink.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAG3C,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAE7D,OAAO,EAAE,KAAK,mBAAmB,EAA6B,MAAM,kBAAkB,CAAA;AAKtF,yEAAyE;AACzE,MAAM,WAAW,iBAAiB;IAChC,0BAA0B,EAAE,OAAO,CAAA;IACnC,kFAAkF;IAClF,UAAU,CAAC,EAAE,YAAY,CAAA;CAC1B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,mBAAmB,EAAE,CAAA;CAAE,GAAG,IAAI,CAAC,CA2BnE;AA4BD;;;;;;;;GAQG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,OAAO;IAE7C;;;;OAIG;IACG,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAmC1E"}
@@ -78,13 +78,19 @@ class McpEventSink {
78
78
  if (!result) return;
79
79
  const { event: fullEvent, captures } = result;
80
80
  try {
81
- for (const captureEvent of captures)this.posthog.capture({
82
- distinctId: captureEvent.distinct_id,
83
- event: captureEvent.event,
84
- properties: captureEvent.properties,
85
- timestamp: new Date(captureEvent.timestamp),
86
- uuid: (0, core_namespaceObject.uuidv7)()
87
- });
81
+ for (const captureEvent of captures){
82
+ const groups = captureEvent.properties.$groups;
83
+ this.posthog.capture({
84
+ distinctId: captureEvent.distinct_id,
85
+ event: captureEvent.event,
86
+ properties: captureEvent.properties,
87
+ ...groups ? {
88
+ groups
89
+ } : {},
90
+ timestamp: new Date(captureEvent.timestamp),
91
+ uuid: (0, core_namespaceObject.uuidv7)()
92
+ });
93
+ }
88
94
  (0, external_logger_js_namespaceObject.log)(`Captured PostHog event ${fullEvent.id} | ${fullEvent.eventType} | ${fullEvent.duration} ms | ${fullEvent.identifyActorGivenId || 'anonymous'}`);
89
95
  } catch (err) {
90
96
  (0, external_logger_js_namespaceObject.log)(`Failed to capture PostHog event ${fullEvent.id}: ${err}`);
@@ -49,13 +49,19 @@ class McpEventSink {
49
49
  if (!result) return;
50
50
  const { event: fullEvent, captures } = result;
51
51
  try {
52
- for (const captureEvent of captures)this.posthog.capture({
53
- distinctId: captureEvent.distinct_id,
54
- event: captureEvent.event,
55
- properties: captureEvent.properties,
56
- timestamp: new Date(captureEvent.timestamp),
57
- uuid: uuidv7()
58
- });
52
+ for (const captureEvent of captures){
53
+ const groups = captureEvent.properties.$groups;
54
+ this.posthog.capture({
55
+ distinctId: captureEvent.distinct_id,
56
+ event: captureEvent.event,
57
+ properties: captureEvent.properties,
58
+ ...groups ? {
59
+ groups
60
+ } : {},
61
+ timestamp: new Date(captureEvent.timestamp),
62
+ uuid: uuidv7()
63
+ });
64
+ }
59
65
  log(`Captured PostHog event ${fullEvent.id} | ${fullEvent.eventType} | ${fullEvent.duration} ms | ${fullEvent.identifyActorGivenId || 'anonymous'}`);
60
66
  } catch (err) {
61
67
  log(`Failed to capture PostHog event ${fullEvent.id}: ${err}`);
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const version = "0.4.3";
1
+ export declare const version = "0.4.4";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -26,7 +26,7 @@ __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  version: ()=>version
28
28
  });
29
- const version = '0.4.3';
29
+ const version = '0.4.4';
30
30
  exports.version = __webpack_exports__.version;
31
31
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
32
32
  "version"
package/dist/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- const version = '0.4.3';
1
+ const version = '0.4.4';
2
2
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/mcp",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "bugs": {
5
5
  "url": "https://github.com/PostHog/posthog-js/issues"
6
6
  },
@@ -39,7 +39,7 @@
39
39
  "@types/node": "^20.0.0",
40
40
  "jest": "29.7.0",
41
41
  "zod": "^3.25.0",
42
- "posthog-node": "^5.38.5",
42
+ "posthog-node": "^5.38.6",
43
43
  "@posthog-tooling/tsconfig-base": "1.1.1"
44
44
  },
45
45
  "peerDependencies": {
@@ -114,10 +114,19 @@ export class McpEventSink {
114
114
  const { event: fullEvent, captures } = result
115
115
  try {
116
116
  for (const captureEvent of captures) {
117
+ // `$groups` is written into `properties` by `buildPostHogCaptureEvents`,
118
+ // but posthog-node's `prepareEventMessage` overwrites the outgoing
119
+ // `$groups` property with the top-level `groups` field
120
+ // (`$groups: eventMessage.groups || groups`). Without passing `groups`
121
+ // here the group association would be silently dropped. See
122
+ // https://github.com/PostHog/posthog-js/issues/3888.
123
+ const groups = captureEvent.properties.$groups as Record<string, string> | undefined
124
+
117
125
  this.posthog.capture({
118
126
  distinctId: captureEvent.distinct_id,
119
127
  event: captureEvent.event,
120
128
  properties: captureEvent.properties,
129
+ ...(groups ? { groups } : {}),
121
130
  timestamp: new Date(captureEvent.timestamp),
122
131
  uuid: uuidv7(),
123
132
  })
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '0.4.3'
1
+ export const version = '0.4.4'