: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
chore(mcp): default notion clients to single-exec mode (#60246)
Georgiy Tarasov0ad757ee0f93
diff --git a/services/mcp/src/lib/client-detection.ts b/services/mcp/src/lib/client-detection.tsindex a60a798bb4dd..eff97f7e1963 100644--- a/services/mcp/src/lib/client-detection.ts+++ b/services/mcp/src/lib/client-detection.ts@@ -59,6 +59,10 @@ export const CODING_AGENT_CLIENT_NAME_FRAGMENTS = ['aider','copilot','gemini-cli',+ // Notion AI ships its own `notion-mcp-client` (not a coding agent per se,+ // but an LLM-driven consumer that benefits from the same single-exec mode+ // and formatted-text rendering as coding agents).+ 'notion',] as const// Value sent in `x-posthog-mcp-consumer` by PostHog Code (the Tasks sandbox@@ -67,14 +71,16 @@ export const CODING_AGENT_CLIENT_NAME_FRAGMENTS = [// emission in single-exec mode. Slack-launched runs send `"slack"` instead.export const POSTHOG_CODE_CONSUMER = 'posthog-code'-// OAuth application names (from token introspection) for vibe-coding platforms-// that should default to single-exec mode. These match against the OAuth+// OAuth application names (from token introspection) for upstream tools that+// should default to single-exec mode. These match against the OAuth// `client_name` (the registered OAuth app name in PostHog), not the MCP-// `clientInfo.name` self-report — those platforms typically connect through a+// `clientInfo.name` self-report — many of these platforms connect through a// generic MCP client wrapper, so the OAuth name is what reliably identifies// the upstream tool. Substring match is case-insensitive and separator-agnostic// so "Lovable", "Lovable.dev", "Replit", and "Replit Agent" all resolve.-export const VIBE_CODING_OAUTH_CLIENT_NAME_FRAGMENTS = ['lovable', 'replit'] as const+// Notion is included here because a sizeable share of sessions only carry the+// OAuth name without the `notion-mcp-client` self-report.+export const VIBE_CODING_OAUTH_CLIENT_NAME_FRAGMENTS = ['lovable', 'replit', 'notion'] as constexport type ClientCapabilities = {// MCP `initialize` response includes an `instructions` field that mostdiff --git a/services/mcp/tests/unit/client-detection.test.ts b/services/mcp/tests/unit/client-detection.test.tsindex a5a98cc85893..a8b9c5d19bfa 100644--- a/services/mcp/tests/unit/client-detection.test.ts+++ b/services/mcp/tests/unit/client-detection.test.ts@@ -25,6 +25,7 @@ describe('isCodingAgentClient', () => {['zed'],['aider'],['copilot'],+ ['notion'],])('returns true for %s', (clientName) => {expect(isCodingAgentClient(clientName)).toBe(true)})@@ -42,6 +43,8 @@ describe('isCodingAgentClient', () => {['GitHub Copilot Chat'],['zed-editor'],['Codex CLI'],+ ['notion-mcp-client'],+ ['Notion'],])('returns true for variant %s (case-insensitive substring match)', (clientName) => {expect(isCodingAgentClient(clientName)).toBe(true)})@@ -123,6 +126,8 @@ describe('isVibeCodingClient', () => {['replit'],['Replit Agent'],['replit-ai'],+ ['Notion'],+ ['notion'],])('returns true for OAuth client name %s', (oauthClientName) => {expect(isVibeCodingClient(oauthClientName)).toBe(true)})@@ -165,6 +170,7 @@ describe('MCPClientProfile', () => {['aider'],['github.copilot'],['GitHub Copilot Chat'],+ ['notion-mcp-client'],])('returns true for %s', (clientName) => {expect(new MCPClientProfile({ clientName }).isCodingAgent()).toBe(true)})@@ -222,7 +228,7 @@ describe('MCPClientProfile', () => {})describe('isVibeCodingClient()', () => {- it.each([['Lovable'], ['lovable.dev'], ['Replit'], ['Replit Agent']])(+ it.each([['Lovable'], ['lovable.dev'], ['Replit'], ['Replit Agent'], ['Notion']])('returns true for OAuth client name %s',(oauthClientName) => {expect(new MCPClientProfile({ oauthClientName }).isVibeCodingClient()).toBe(true)