@posthog/mcp 0.22.1 → 0.22.3

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.
@@ -35,6 +35,7 @@ export declare const PostHogMCPAnalyticsProperty: {
35
35
  readonly FeedbackTaskCompleted: '$mcp_feedback_task_completed';
36
36
  readonly FeedbackTool: '$mcp_feedback_tool';
37
37
  readonly FeedbackType: '$mcp_feedback_type';
38
+ readonly Interface: '$mcp_interface';
38
39
  readonly IsError: '$mcp_is_error';
39
40
  readonly InputAliasesUsed: '$mcp_input_aliases_used';
40
41
  readonly InputKeys: '$mcp_input_keys';
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/extensions/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,6BAA6B,KAAK,CAAA;AAE/C,eAAO,MAAM,qCAAqC,onBAA4mB,CAAA;AAE9pB,eAAO,MAAM,mCAAmC,gRAAqQ,CAAA;AAErT,eAAO,MAAM,mCAAmC,qYAC+U,CAAA;AAE/X,eAAO,MAAM,4BAA4B,0BAA0B,CAAA;AAMnE,eAAO,MAAM,oBAAoB,qBAAqB,CAAA;AAItD,eAAO,MAAM,wBAAwB;aACnC,MAAM,EAAE,aAAa;aACrB,SAAS,EAAE,YAAY;aACvB,QAAQ,EAAE,eAAe;aACzB,QAAQ,EAAE,WAAW;aACrB,UAAU,EAAE,iBAAiB;aAC7B,iBAAiB,EAAE,yBAAyB;aAC5C,SAAS,EAAE,iBAAiB;aAC5B,WAAW,EAAE,mBAAmB;aAChC,YAAY,EAAE,oBAAoB;aAClC,aAAa,EAAE,qBAAqB;aACpC,QAAQ,EAAE,gBAAgB;aAC1B,SAAS,EAAE,iBAAiB;CACpB,CAAA;AAEV,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,OAAO,wBAAwB,CAAC,CAAA;AAE/G,eAAO,MAAM,2BAA2B;aACtC,UAAU,EAA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BAAwB;aACzC,QAAQ,EAAE,gBAAgB;aAC1B,cAAc,EAAE,uBAAuB;aACvC,UAAU,EAAE,iBAAiB;aAC7B,eAAe,EAAE,uBAAuB;aACxC,YAAY,EAAE,oBAAoB;aAClC,QAAQ,EAAE,eAAe;aACzB,WAAW,EAAE,mBAAmB;aAChC,UAAU,EAAE,kBAAkB;aAC9B,aAAa,EAAE,qBAAqB;aACpC,SAAS,EAAE,aAAa;aACxB,MAAM,EAAE,aAAa;aACrB,YAAY,EAAE,oBAAoB;aAClC,eAAe,EAAE,uBAAuB;aACxC,QAAQ,EAAE,gBAAgB;aAC1B,YAAY,EAAE,oBAAoB;CAC1B,CAAA;AAEV,MAAM,MAAM,2BAA2B,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,OAAO,2BAA2B,CAAC,CAAA"}
@@ -63,6 +63,7 @@ const PostHogMCPAnalyticsProperty = {
63
63
  FeedbackTaskCompleted: '$mcp_feedback_task_completed',
64
64
  FeedbackTool: '$mcp_feedback_tool',
65
65
  FeedbackType: '$mcp_feedback_type',
66
+ Interface: '$mcp_interface',
66
67
  IsError: '$mcp_is_error',
67
68
  InputAliasesUsed: '$mcp_input_aliases_used',
68
69
  InputKeys: '$mcp_input_keys',
@@ -34,6 +34,7 @@ const PostHogMCPAnalyticsProperty = {
34
34
  FeedbackTaskCompleted: '$mcp_feedback_task_completed',
35
35
  FeedbackTool: '$mcp_feedback_tool',
36
36
  FeedbackType: '$mcp_feedback_type',
37
+ Interface: '$mcp_interface',
37
38
  IsError: '$mcp_is_error',
38
39
  InputAliasesUsed: '$mcp_input_aliases_used',
39
40
  InputKeys: '$mcp_input_keys',
@@ -62,6 +62,7 @@ function buildCaptureEvent(event) {
62
62
  const distinctId = getDistinctId(event);
63
63
  const timestamp = getTimestamp(event);
64
64
  const properties = {
65
+ [external_constants_js_namespaceObject.PostHogMCPAnalyticsProperty.Interface]: 'mcp',
65
66
  [external_constants_js_namespaceObject.PostHogMCPAnalyticsProperty.Source]: external_constants_js_namespaceObject.POSTHOG_MCP_ANALYTICS_SOURCE
66
67
  };
67
68
  addSessionIdProperty(event, properties);
@@ -133,7 +134,9 @@ function addServerBuildProperty(event, properties) {
133
134
  function buildExceptionEvent(event) {
134
135
  const distinctId = getDistinctId(event);
135
136
  const timestamp = getTimestamp(event);
136
- const properties = {};
137
+ const properties = {
138
+ [external_constants_js_namespaceObject.PostHogMCPAnalyticsProperty.Interface]: 'mcp'
139
+ };
137
140
  addSessionIdProperty(event, properties);
138
141
  addConversationIdProperty(event, properties);
139
142
  addPersonProcessingProperty(event, properties);
@@ -30,6 +30,7 @@ function buildCaptureEvent(event) {
30
30
  const distinctId = getDistinctId(event);
31
31
  const timestamp = getTimestamp(event);
32
32
  const properties = {
33
+ [PostHogMCPAnalyticsProperty.Interface]: 'mcp',
33
34
  [PostHogMCPAnalyticsProperty.Source]: POSTHOG_MCP_ANALYTICS_SOURCE
34
35
  };
35
36
  addSessionIdProperty(event, properties);
@@ -101,7 +102,9 @@ function addServerBuildProperty(event, properties) {
101
102
  function buildExceptionEvent(event) {
102
103
  const distinctId = getDistinctId(event);
103
104
  const timestamp = getTimestamp(event);
104
- const properties = {};
105
+ const properties = {
106
+ [PostHogMCPAnalyticsProperty.Interface]: 'mcp'
107
+ };
105
108
  addSessionIdProperty(event, properties);
106
109
  addConversationIdProperty(event, properties);
107
110
  addPersonProcessingProperty(event, properties);
@@ -57,22 +57,21 @@ function sanitizeExceptionValues(error) {
57
57
  };
58
58
  }
59
59
  function sanitizeResponse(response) {
60
- if (null == response || 'object' != typeof response) return (0, external_mcp_payloads_js_namespaceObject.sanitizeCapturedValue)(response);
61
- const sanitized = (0, external_mcp_payloads_js_namespaceObject.sanitizeCapturedValue)(response);
62
- if (!isRecord(sanitized)) return sanitized;
63
- const result = {
64
- ...sanitized
65
- };
66
- const content = result.content;
67
- if (Array.isArray(content)) result.content = content.map(sanitizeContentBlock);
68
- if (null != result.structuredContent && 'object' == typeof result.structuredContent) result.structuredContent = (0, external_mcp_payloads_js_namespaceObject.sanitizeCapturedValue)(result.structuredContent);
69
- return result;
60
+ if (isRecord(response) && Array.isArray(response.content)) {
61
+ const result = (0, external_mcp_payloads_js_namespaceObject.sanitizeCapturedValue)({
62
+ ...response,
63
+ content: []
64
+ });
65
+ result.content = response.content.map(sanitizeContentBlock);
66
+ return result;
67
+ }
68
+ return (0, external_mcp_payloads_js_namespaceObject.sanitizeCapturedValue)(response);
70
69
  }
71
70
  function sanitizeContentBlock(block) {
72
- if (null == block || 'object' != typeof block) return block;
73
- if (!isRecord(block)) return block;
71
+ if (!isRecord(block)) return (0, external_mcp_payloads_js_namespaceObject.sanitizeCapturedValue)(block);
74
72
  switch(block.type){
75
73
  case 'text':
74
+ case 'resource_link':
76
75
  return (0, external_mcp_payloads_js_namespaceObject.sanitizeCapturedValue)(block);
77
76
  case 'image':
78
77
  return {
@@ -86,12 +85,10 @@ function sanitizeContentBlock(block) {
86
85
  };
87
86
  case 'resource':
88
87
  return sanitizeResourceBlock(block);
89
- case 'resource_link':
90
- return (0, external_mcp_payloads_js_namespaceObject.sanitizeCapturedValue)(block);
91
88
  default:
92
89
  return {
93
90
  type: 'text',
94
- text: `[unsupported content type "${block.type}" redacted - not supported by PostHog MCP analytics]`
91
+ text: `[unsupported content type "${(0, external_mcp_payloads_js_namespaceObject.sanitizeCapturedValue)(block.type)}" redacted - not supported by PostHog MCP analytics]`
95
92
  };
96
93
  }
97
94
  }
@@ -25,22 +25,21 @@ function sanitizeExceptionValues(error) {
25
25
  };
26
26
  }
27
27
  function sanitizeResponse(response) {
28
- if (null == response || 'object' != typeof response) return sanitizeCapturedValue(response);
29
- const sanitized = sanitizeCapturedValue(response);
30
- if (!isRecord(sanitized)) return sanitized;
31
- const result = {
32
- ...sanitized
33
- };
34
- const content = result.content;
35
- if (Array.isArray(content)) result.content = content.map(sanitizeContentBlock);
36
- if (null != result.structuredContent && 'object' == typeof result.structuredContent) result.structuredContent = sanitizeCapturedValue(result.structuredContent);
37
- return result;
28
+ if (isRecord(response) && Array.isArray(response.content)) {
29
+ const result = sanitizeCapturedValue({
30
+ ...response,
31
+ content: []
32
+ });
33
+ result.content = response.content.map(sanitizeContentBlock);
34
+ return result;
35
+ }
36
+ return sanitizeCapturedValue(response);
38
37
  }
39
38
  function sanitizeContentBlock(block) {
40
- if (null == block || 'object' != typeof block) return block;
41
- if (!isRecord(block)) return block;
39
+ if (!isRecord(block)) return sanitizeCapturedValue(block);
42
40
  switch(block.type){
43
41
  case 'text':
42
+ case 'resource_link':
44
43
  return sanitizeCapturedValue(block);
45
44
  case 'image':
46
45
  return {
@@ -54,12 +53,10 @@ function sanitizeContentBlock(block) {
54
53
  };
55
54
  case 'resource':
56
55
  return sanitizeResourceBlock(block);
57
- case 'resource_link':
58
- return sanitizeCapturedValue(block);
59
56
  default:
60
57
  return {
61
58
  type: 'text',
62
- text: `[unsupported content type "${block.type}" redacted - not supported by PostHog MCP analytics]`
59
+ text: `[unsupported content type "${sanitizeCapturedValue(block.type)}" redacted - not supported by PostHog MCP analytics]`
63
60
  };
64
61
  }
65
62
  }
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const version = "0.22.1";
1
+ export declare const version = "0.22.3";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -27,7 +27,7 @@ var __webpack_require__ = {};
27
27
  })();
28
28
  var __webpack_exports__ = {};
29
29
  __webpack_require__.r(__webpack_exports__);
30
- const version = "0.22.1";
30
+ const version = "0.22.3";
31
31
  __webpack_require__.d(__webpack_exports__, {}, {
32
32
  version: version
33
33
  });
package/dist/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- const version = "0.22.1";
1
+ const version = "0.22.3";
2
2
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/mcp",
3
- "version": "0.22.1",
3
+ "version": "0.22.3",
4
4
  "bugs": {
5
5
  "url": "https://github.com/PostHog/posthog-js/issues"
6
6
  },
@@ -28,7 +28,7 @@
28
28
  "module": "dist/index.mjs",
29
29
  "types": "dist/index.d.ts",
30
30
  "dependencies": {
31
- "@posthog/core": "^1.57.0"
31
+ "@posthog/core": "^1.57.3"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@babel/preset-env": "^7.27.1",
@@ -53,8 +53,8 @@
53
53
  "zod4": "npm:zod@^4.4.3",
54
54
  "@vitest/coverage-v8": "^1.6.1",
55
55
  "vitest": "^1.6.1",
56
- "posthog-node": "^5.55.0",
57
- "@posthog-tooling/tsconfig-base": "1.1.1"
56
+ "@posthog-tooling/tsconfig-base": "1.1.1",
57
+ "posthog-node": "^5.55.1"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@modelcontextprotocol/sdk": ">=1.26.0",
@@ -55,6 +55,7 @@ export const PostHogMCPAnalyticsProperty = {
55
55
  FeedbackTaskCompleted: '$mcp_feedback_task_completed',
56
56
  FeedbackTool: '$mcp_feedback_tool',
57
57
  FeedbackType: '$mcp_feedback_type',
58
+ Interface: '$mcp_interface',
58
59
  IsError: '$mcp_is_error',
59
60
  InputAliasesUsed: '$mcp_input_aliases_used',
60
61
  InputKeys: '$mcp_input_keys',
@@ -60,6 +60,7 @@ function buildCaptureEvent(event: Event): PostHogCaptureEvent {
60
60
  const timestamp = getTimestamp(event)
61
61
 
62
62
  const properties: Record<string, unknown> = {
63
+ [PostHogMCPAnalyticsProperty.Interface]: 'mcp',
63
64
  [PostHogMCPAnalyticsProperty.Source]: POSTHOG_MCP_ANALYTICS_SOURCE,
64
65
  }
65
66
  addSessionIdProperty(event, properties)
@@ -230,7 +231,9 @@ function buildExceptionEvent(event: Event): PostHogCaptureEvent {
230
231
  const distinctId = getDistinctId(event)
231
232
  const timestamp = getTimestamp(event)
232
233
 
233
- const properties: Record<string, unknown> = {}
234
+ const properties: Record<string, unknown> = {
235
+ [PostHogMCPAnalyticsProperty.Interface]: 'mcp',
236
+ }
234
237
  addSessionIdProperty(event, properties)
235
238
  addConversationIdProperty(event, properties)
236
239
  addPersonProcessingProperty(event, properties)
@@ -84,42 +84,26 @@ function sanitizeExceptionValues(error: ErrorProperties): ErrorProperties {
84
84
  * with informative redaction messages.
85
85
  */
86
86
  function sanitizeResponse(response: unknown): unknown {
87
- if (response == null || typeof response !== 'object') {
88
- return sanitizeCapturedValue(response)
87
+ // Sanitize each kept block on its own, so the pass never scans the data of replaced blocks.
88
+ if (isRecord(response) && Array.isArray(response.content)) {
89
+ const result = sanitizeCapturedValue({ ...response, content: [] }) as SanitizedRecord
90
+ result.content = response.content.map(sanitizeContentBlock)
91
+ return result
89
92
  }
90
-
91
- const sanitized = sanitizeCapturedValue(response)
92
- if (!isRecord(sanitized)) {
93
- return sanitized
94
- }
95
-
96
- const result: SanitizedRecord = { ...sanitized }
97
- const content = result.content
98
- if (Array.isArray(content)) {
99
- result.content = content.map(sanitizeContentBlock)
100
- }
101
-
102
- if (result.structuredContent != null && typeof result.structuredContent === 'object') {
103
- result.structuredContent = sanitizeCapturedValue(result.structuredContent)
104
- }
105
-
106
- return result
93
+ return sanitizeCapturedValue(response)
107
94
  }
108
95
 
109
96
  /**
110
97
  * Sanitizes a single content block based on its type discriminator.
111
98
  */
112
99
  function sanitizeContentBlock(block: unknown): unknown {
113
- if (block == null || typeof block !== 'object') {
114
- return block
115
- }
116
-
117
100
  if (!isRecord(block)) {
118
- return block
101
+ return sanitizeCapturedValue(block)
119
102
  }
120
103
 
121
104
  switch (block.type) {
122
105
  case 'text':
106
+ case 'resource_link':
123
107
  return sanitizeCapturedValue(block)
124
108
 
125
109
  case 'image':
@@ -137,13 +121,10 @@ function sanitizeContentBlock(block: unknown): unknown {
137
121
  case 'resource':
138
122
  return sanitizeResourceBlock(block)
139
123
 
140
- case 'resource_link':
141
- return sanitizeCapturedValue(block)
142
-
143
124
  default:
144
125
  return {
145
126
  type: 'text',
146
- text: `[unsupported content type "${block.type}" redacted - not supported by PostHog MCP analytics]`,
127
+ text: `[unsupported content type "${sanitizeCapturedValue(block.type)}" redacted - not supported by PostHog MCP analytics]`,
147
128
  }
148
129
  }
149
130
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "0.22.1"
1
+ export const version = "0.22.3"