@posthog/mcp 0.22.1 → 0.22.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.
@@ -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.2";
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.2";
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.2";
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.2",
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.2"
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.0"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@modelcontextprotocol/sdk": ">=1.26.0",
@@ -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.2"