@posthog/mcp 0.22.0 → 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.
- package/dist/extensions/mcp-payloads.d.ts +2 -28
- package/dist/extensions/mcp-payloads.d.ts.map +1 -1
- package/dist/extensions/mcp-payloads.js +9 -314
- package/dist/extensions/mcp-payloads.mjs +18 -323
- package/dist/extensions/sanitization.js +12 -15
- package/dist/extensions/sanitization.mjs +12 -15
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +4 -4
- package/src/extensions/mcp-payloads.ts +15 -666
- package/src/extensions/sanitization.ts +9 -28
- package/src/version.ts +1 -1
|
@@ -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
|
-
|
|
88
|
-
|
|
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
|
+
export const version = "0.22.2"
|