@posthog/mcp 0.0.6 → 0.0.8
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/README.md +1 -0
- package/dist/index.cjs +19 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +19 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -98,6 +98,7 @@ declare const PostHogMCPAnalyticsProperty: {
|
|
|
98
98
|
readonly IsError: "$mcp_is_error";
|
|
99
99
|
readonly Intent: "$mcp_intent";
|
|
100
100
|
readonly IntentSource: "$mcp_intent_source";
|
|
101
|
+
readonly ListedToolNames: "$mcp_listed_tool_names";
|
|
101
102
|
readonly Parameters: "$mcp_parameters";
|
|
102
103
|
readonly ResourceName: "$mcp_resource_name";
|
|
103
104
|
readonly Response: "$mcp_response";
|
package/dist/index.d.mts
CHANGED
|
@@ -97,6 +97,7 @@ declare const PostHogMCPAnalyticsProperty: {
|
|
|
97
97
|
readonly IsError: "$mcp_is_error";
|
|
98
98
|
readonly Intent: "$mcp_intent";
|
|
99
99
|
readonly IntentSource: "$mcp_intent_source";
|
|
100
|
+
readonly ListedToolNames: "$mcp_listed_tool_names";
|
|
100
101
|
readonly Parameters: "$mcp_parameters";
|
|
101
102
|
readonly ResourceName: "$mcp_resource_name";
|
|
102
103
|
readonly Response: "$mcp_response";
|
package/dist/index.mjs
CHANGED
|
@@ -381,6 +381,7 @@ const PostHogMCPAnalyticsProperty = {
|
|
|
381
381
|
IsError: "$mcp_is_error",
|
|
382
382
|
Intent: "$mcp_intent",
|
|
383
383
|
IntentSource: "$mcp_intent_source",
|
|
384
|
+
ListedToolNames: "$mcp_listed_tool_names",
|
|
384
385
|
Parameters: "$mcp_parameters",
|
|
385
386
|
ResourceName: "$mcp_resource_name",
|
|
386
387
|
Response: "$mcp_response",
|
|
@@ -458,6 +459,7 @@ function addCommonEventProperties(event, properties) {
|
|
|
458
459
|
if (event.eventType === MCPAnalyticsEventType.mcpToolsCall) properties[PostHogMCPAnalyticsProperty.ToolName] = event.resourceName;
|
|
459
460
|
}
|
|
460
461
|
if (event.toolDescription && event.eventType === MCPAnalyticsEventType.mcpToolsCall) properties[PostHogMCPAnalyticsProperty.ToolDescription] = event.toolDescription;
|
|
462
|
+
if (event.listedToolNames && event.listedToolNames.length > 0 && event.eventType === MCPAnalyticsEventType.mcpToolsList) properties[PostHogMCPAnalyticsProperty.ListedToolNames] = event.listedToolNames;
|
|
461
463
|
if (event.duration !== void 0) properties[PostHogMCPAnalyticsProperty.DurationMs] = event.duration;
|
|
462
464
|
if (event.serverName) properties[PostHogMCPAnalyticsProperty.ServerName] = event.serverName;
|
|
463
465
|
if (event.serverVersion) properties[PostHogMCPAnalyticsProperty.ServerVersion] = event.serverVersion;
|
|
@@ -556,6 +558,7 @@ const PROTECTED_FIELDS = new Set([
|
|
|
556
558
|
"identifyData",
|
|
557
559
|
"resourceName",
|
|
558
560
|
"toolDescription",
|
|
561
|
+
"listedToolNames",
|
|
559
562
|
"eventType",
|
|
560
563
|
"actorId",
|
|
561
564
|
"tags",
|
|
@@ -733,7 +736,7 @@ function sanitizeParameters(obj) {
|
|
|
733
736
|
}
|
|
734
737
|
//#endregion
|
|
735
738
|
//#region package.json
|
|
736
|
-
var version = "0.0.
|
|
739
|
+
var version = "0.0.8";
|
|
737
740
|
//#endregion
|
|
738
741
|
//#region src/modules/session.ts
|
|
739
742
|
function newSessionId() {
|
|
@@ -1194,6 +1197,7 @@ function publishEvent(server, eventInput) {
|
|
|
1194
1197
|
identifyActorData: sessionInfo.identifyActorData,
|
|
1195
1198
|
resourceName: eventInput.resourceName,
|
|
1196
1199
|
toolDescription: eventInput.toolDescription,
|
|
1200
|
+
listedToolNames: eventInput.listedToolNames,
|
|
1197
1201
|
parameters: eventInput.parameters,
|
|
1198
1202
|
response: eventInput.response,
|
|
1199
1203
|
userIntent: eventInput.userIntent,
|
|
@@ -1868,6 +1872,12 @@ function getReportMissingToolDescriptor() {
|
|
|
1868
1872
|
description: "A description of your goal and what kind of tool would help accomplish it."
|
|
1869
1873
|
} },
|
|
1870
1874
|
required: ["context"]
|
|
1875
|
+
},
|
|
1876
|
+
annotations: {
|
|
1877
|
+
readOnlyHint: true,
|
|
1878
|
+
idempotentHint: false,
|
|
1879
|
+
openWorldHint: false,
|
|
1880
|
+
destructiveHint: false
|
|
1871
1881
|
}
|
|
1872
1882
|
};
|
|
1873
1883
|
}
|
|
@@ -1923,9 +1933,8 @@ function setupMCPAnalyticsTools(server) {
|
|
|
1923
1933
|
return { tools };
|
|
1924
1934
|
}
|
|
1925
1935
|
if (isContextEnabled(data.options.context)) tools = addContextParameterToTools(tools, getContextDescription(data.options.context));
|
|
1926
|
-
if (data.options.reportMissing)
|
|
1927
|
-
|
|
1928
|
-
}
|
|
1936
|
+
if (data.options.reportMissing) if (tools.some((tool) => tool?.name === "get_more_tools")) writeToLog("Warning: report_missing tool already present in tools list. Skipping addition. This is likely due to the server already including a report_missing tool. If you want to rely on the PostHog MCP Analytics report_missing tool, you should disable the server's report_missing tool.");
|
|
1937
|
+
else tools.push(getReportMissingToolDescriptor());
|
|
1929
1938
|
event.response = { tools };
|
|
1930
1939
|
event.isError = false;
|
|
1931
1940
|
event.duration = event.timestamp && Date.now() - event.timestamp.getTime() || 0;
|
|
@@ -2128,11 +2137,17 @@ async function handleListToolsRequest(server, originalListToolsHandler, request,
|
|
|
2128
2137
|
return { tools };
|
|
2129
2138
|
}
|
|
2130
2139
|
event.response = { tools };
|
|
2140
|
+
event.listedToolNames = collectListedToolNames(tools);
|
|
2131
2141
|
event.isError = false;
|
|
2132
2142
|
event.duration = getEventDuration(event);
|
|
2133
2143
|
publishEvent(server, event);
|
|
2134
2144
|
return { tools };
|
|
2135
2145
|
}
|
|
2146
|
+
function collectListedToolNames(tools) {
|
|
2147
|
+
if (!tools || tools.length === 0) return;
|
|
2148
|
+
const names = tools.map((tool) => tool?.name).filter((name) => typeof name === "string");
|
|
2149
|
+
return names.length > 0 ? names : void 0;
|
|
2150
|
+
}
|
|
2136
2151
|
async function getTracedToolsList(server, originalListToolsHandler, request, extra, event) {
|
|
2137
2152
|
try {
|
|
2138
2153
|
const data = getServerTrackingData(server);
|