: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): stamp the vendor header as $mcp_vendor_client (#93200)
Georgis Andonis89191133ccfc
diff --git a/services/mcp/src/hono/analytics.ts b/services/mcp/src/hono/analytics.tsindex 6ea107cd6d19..46b03b55d454 100644--- a/services/mcp/src/hono/analytics.ts+++ b/services/mcp/src/hono/analytics.ts@@ -78,7 +78,7 @@ function buildBaseProperties(}: {}),mcp_runtime: 'hono',- mcp_vendor_client: clientIdentity.mcpVendorClient,+ $mcp_vendor_client: clientIdentity.mcpVendorClient,...buildMCPSessionAnalyticsProperties(state.sessionContext),}return { properties, groups }@@ -450,7 +450,7 @@ export function trackAuthFailure(props: RequestProperties, failure: McpAuthFailu$mcp_region: props.region,$mcp_auth_method: classifyAuthMethod(props.apiToken),mcp_runtime: 'hono',- mcp_vendor_client: props.mcpVendorClient,+ $mcp_vendor_client: props.mcpVendorClient,$mcp_auth_failure_reason: failure.reason,...(failure.status ? { $mcp_auth_status: failure.status } : {}),...(failure.missingScope ? { $mcp_missing_scope: failure.missingScope } : {}),diff --git a/services/mcp/src/hono/request-context.ts b/services/mcp/src/hono/request-context.tsindex 6400db881fe9..835373380057 100644--- a/services/mcp/src/hono/request-context.ts+++ b/services/mcp/src/hono/request-context.ts@@ -237,7 +237,7 @@ export class RequestContext {$mcp_mode: requestContext.mode,$mcp_region: requestContext.region,mcp_runtime: 'hono',- mcp_vendor_client: requestContext.mcpVendorClient,+ $mcp_vendor_client: requestContext.mcpVendorClient,...buildMCPSessionAnalyticsProperties(sessionContext),}}diff --git a/services/mcp/tests/hono/analytics.test.ts b/services/mcp/tests/hono/analytics.test.tsindex 44ab717ddc57..674a24cddba7 100644--- a/services/mcp/tests/hono/analytics.test.ts+++ b/services/mcp/tests/hono/analytics.test.ts@@ -105,7 +105,7 @@ describe('Hono MCP analytics contexts', () => {$mcp_mode: 'cli',$mcp_region: 'us',$mcp_auth_method: 'personal_api_key',- mcp_vendor_client: 'ClaudeAI',+ $mcp_vendor_client: 'ClaudeAI',mcp_session_client_name: 'claude-code',mcp_session_client_version: '1.0',mcp_session_protocol_version: '2025-03-26',@@ -166,7 +166,7 @@ describe('Hono MCP analytics contexts', () => {['$mcp_client_version', 'mcpClientVersion'],['$mcp_protocol_version', 'mcpProtocolVersion'],['$mcp_consumer', 'mcpConsumer'],- ['mcp_vendor_client', 'mcpVendorClient'],+ ['$mcp_vendor_client', 'mcpVendorClient'],] as const)('%s: live value wins when both live and session values are present',async (eventProp, contextField) => {@@ -185,7 +185,7 @@ describe('Hono MCP analytics contexts', () => {['$mcp_client_version', 'mcpClientVersion'],['$mcp_protocol_version', 'mcpProtocolVersion'],['$mcp_consumer', 'mcpConsumer'],- ['mcp_vendor_client', 'mcpVendorClient'],+ ['$mcp_vendor_client', 'mcpVendorClient'],] as const)('%s: falls back to the session-pinned value when the live request has none (the tools/call case)',async (eventProp, contextField) => {@@ -204,7 +204,7 @@ describe('Hono MCP analytics contexts', () => {['$mcp_client_version', 'mcpClientVersion'],['$mcp_protocol_version', 'mcpProtocolVersion'],['$mcp_consumer', 'mcpConsumer'],- ['mcp_vendor_client', 'mcpVendorClient'],+ ['$mcp_vendor_client', 'mcpVendorClient'],] as const)('%s: stays undefined (never an empty string) when both live and session values are absent',async (eventProp, contextField) => {@@ -226,7 +226,7 @@ describe('Hono MCP analytics contexts', () => {$mcp_client_version: '2.0',$mcp_protocol_version: '2025-03-26',$mcp_consumer: 'request-consumer',- mcp_vendor_client: 'ClaudeAI',+ $mcp_vendor_client: 'ClaudeAI',})})diff --git a/services/mcp/tests/hono/auth-instrumentation.test.ts b/services/mcp/tests/hono/auth-instrumentation.test.tsindex 6f4c67ab1d33..c968c652357d 100644--- a/services/mcp/tests/hono/auth-instrumentation.test.ts+++ b/services/mcp/tests/hono/auth-instrumentation.test.ts@@ -92,7 +92,7 @@ describe('MCP auth instrumentation', () => {$mcp_auth_status: 401,$mcp_auth_method: 'oauth',$mcp_client_name: 'claude-ai',- mcp_vendor_client: 'ClaudeAI',+ $mcp_vendor_client: 'ClaudeAI',})expect(call.properties.$mcp_missing_scope).toBeUndefined()})diff --git a/services/mcp/tests/hono/request-context.test.ts b/services/mcp/tests/hono/request-context.test.tsindex 924b52d1ee78..80fdebcc66f4 100644--- a/services/mcp/tests/hono/request-context.test.ts+++ b/services/mcp/tests/hono/request-context.test.ts@@ -326,7 +326,7 @@ describe('RequestContext', () => {$mcp_client_name: 'Claude Desktop',$mcp_client_version: '2.0',$mcp_consumer: 'request-consumer',- mcp_vendor_client: 'ClaudeAI',+ $mcp_vendor_client: 'ClaudeAI',mcp_session_client_name: 'claude-code',mcp_session_client_version: '1.0',mcp_session_consumer: 'session-consumer',