:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(mcp-analytics): show $mcp_interface for webmcp tool calls (#121187)
Georgis Andonisaf252ec4de98
diff --git a/.agents/skills/debugging-mcp-analytics/references/event-vocabulary.md b/.agents/skills/debugging-mcp-analytics/references/event-vocabulary.mdindex ddaf55736743..1127e1f8159e 100644--- a/.agents/skills/debugging-mcp-analytics/references/event-vocabulary.md+++ b/.agents/skills/debugging-mcp-analytics/references/event-vocabulary.md@@ -56,6 +56,7 @@ On `$mcp_tool_call` unless noted. These are the properties any instrumented serv| `$mcp_resource_name` | On resource events. || `$session_id` | The standard PostHog session id, materialized. The usual grouping key. || `$mcp_source` | Always `posthog_mcp_analytics`. The reliable way to isolate MCP events from everything else on the `events` table. |+| `$mcp_interface` | `mcp` from an MCP server on `@posthog/mcp` (TS 0.22.3+), `webmcp` from a tool a web page registered through WebMCP and posthog-js captured in the browser. WebMCP events carry no transport, client, or harness properties, and `$mcp_server_name` is the page hostname. Absent on older events, so treat a missing value as `mcp`. |## Server-stamped propertiesdiff --git a/frontend/src/scenes/activity/explore/MCPEventView.tsx b/frontend/src/scenes/activity/explore/MCPEventView.tsxindex 5cb0893f22ae..ebc68a51fc7b 100644--- a/frontend/src/scenes/activity/explore/MCPEventView.tsx+++ b/frontend/src/scenes/activity/explore/MCPEventView.tsx@@ -82,6 +82,7 @@ const MCP_PROPERTY_ORDER: readonly string[] = ['$mcp_conversation_id','$mcp_mode','$mcp_source',+ '$mcp_interface','$mcp_transport',// Client'$mcp_client_name',@@ -231,12 +232,14 @@ export function MCPEventView({ properties }: MCPEventViewProps): JSX.Element {const llmModel = mcpProps['$mcp_llm_model']const llmModelSource = mcpProps['$mcp_llm_model_source']const serverName = mcpProps['$mcp_server_name']+ const mcpInterface = mcpProps['$mcp_interface']const intent = mcpProps['$mcp_intent']const intentSource = mcpProps['$mcp_intent_source']const hasSummaryStat =hasErrorStatus ||Boolean(displayName && displayKind) ||(durationMs !== undefined && durationMs !== null) ||+ Boolean(mcpInterface) ||Boolean(clientName) ||Boolean(llmModel) ||Boolean(serverName) ||@@ -301,6 +304,7 @@ export function MCPEventView({ properties }: MCPEventViewProps): JSX.Element {{durationMs !== undefined && durationMs !== null ? (<Stat label="Duration">{String(durationMs)} ms</Stat>) : null}+ {mcpInterface ? <Stat label="Interface">{String(mcpInterface)}</Stat> : null}{clientName ? <Stat label="Client">{String(clientName)}</Stat> : null}{llmModel ? (<Stat label={llmModelSource ? `Model (${String(llmModelSource).replace(/_/g, ' ')})` : 'Model'}>diff --git a/frontend/src/taxonomy/core-filter-definitions-by-group.json b/frontend/src/taxonomy/core-filter-definitions-by-group.jsonindex e0f0b1dc6cb4..87574279d56c 100644--- a/frontend/src/taxonomy/core-filter-definitions-by-group.json+++ b/frontend/src/taxonomy/core-filter-definitions-by-group.json@@ -1687,8 +1687,8 @@"label": "MCP intent source"},"$mcp_interface": {- "description": "The interface that produced the event. Set by the @posthog/mcp analytics SDK on every capture and exception event it sends.",- "examples": ["mcp"],+ "description": "How the agent reached the tool. 'mcp' means an MCP server instrumented with the @posthog/mcp SDK. 'webmcp' means a tool a web page registered through WebMCP, captured by posthog-js in the browser. WebMCP events carry no transport or client properties, and their $mcp_server_name is the page's hostname. Older events omit this property.",+ "examples": ["mcp", "webmcp"],"label": "MCP interface"},"$mcp_is_error": {@@ -3725,8 +3725,8 @@"label": "MCP intent source"},"$mcp_interface": {- "description": "The interface that produced the event. Set by the @posthog/mcp analytics SDK on every capture and exception event it sends.",- "examples": ["mcp"],+ "description": "How the agent reached the tool. 'mcp' means an MCP server instrumented with the @posthog/mcp SDK. 'webmcp' means a tool a web page registered through WebMCP, captured by posthog-js in the browser. WebMCP events carry no transport or client properties, and their $mcp_server_name is the page's hostname. Older events omit this property.",+ "examples": ["mcp", "webmcp"],"label": "MCP interface"},"$mcp_is_error": {@@ -5870,8 +5870,8 @@"label": "MCP intent source"},"$mcp_interface": {- "description": "The interface that produced the event. Set by the @posthog/mcp analytics SDK on every capture and exception event it sends.",- "examples": ["mcp"],+ "description": "How the agent reached the tool. 'mcp' means an MCP server instrumented with the @posthog/mcp SDK. 'webmcp' means a tool a web page registered through WebMCP, captured by posthog-js in the browser. WebMCP events carry no transport or client properties, and their $mcp_server_name is the page's hostname. Older events omit this property.",+ "examples": ["mcp", "webmcp"],"label": "MCP interface"},"$mcp_is_error": {diff --git a/posthog/taxonomy/taxonomy.py b/posthog/taxonomy/taxonomy.pyindex a37bfab2f945..7e1582bde502 100644--- a/posthog/taxonomy/taxonomy.py+++ b/posthog/taxonomy/taxonomy.py@@ -3098,8 +3098,8 @@ CORE_FILTER_DEFINITIONS_BY_GROUP: dict[str, dict[str, CoreFilterDefinition]] = {},"$mcp_interface": {"label": "MCP interface",- "description": "The interface that produced the event. Set by the @posthog/mcp analytics SDK on every capture and exception event it sends.",- "examples": ["mcp"],+ "description": "How the agent reached the tool. 'mcp' means an MCP server instrumented with the @posthog/mcp SDK. 'webmcp' means a tool a web page registered through WebMCP, captured by posthog-js in the browser. WebMCP events carry no transport or client properties, and their $mcp_server_name is the page's hostname. Older events omit this property.",+ "examples": ["mcp", "webmcp"],},"$mcp_consumer": {"label": "MCP consumer",