: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
fix(mcp): stop offering render-ui to the claude desktop code tab (#127158)
Sam Pennington098f947d0e69
diff --git a/services/mcp/src/lib/client-detection.ts b/services/mcp/src/lib/client-detection.tsindex 049c9eb4a3a3..0a4a2d0685ab 100644--- a/services/mcp/src/lib/client-detection.ts+++ b/services/mcp/src/lib/client-detection.ts@@ -215,6 +215,11 @@ export const ANTHROPIC_UI_HOST_USER_AGENT_FRAGMENTS = ANTHROPIC_USER_AGENT_FRAGM// render UI.export const OPENAI_RENDER_UI_CLIENT_NAMES = ['openai-mcp'] as const+// Claude desktop's Code tab sends `claude-code/<version> (claude-desktop, ...)`.+// The terminal CLI sends the same product token without `claude-desktop`.+export const CLAUDE_CODE_USER_AGENT_PRODUCTS = ['claude-code'] as const+export const CLAUDE_DESKTOP_USER_AGENT_FRAGMENTS = ['claude-desktop'] as const+export type ClientCapabilities = {// MCP `initialize` response includes an `instructions` field that most// clients inject into the model's system prompt. Codex discards it, so@@ -331,9 +336,20 @@ export class MCPClientProfile {}isRenderUiHost(): boolean {- // A client that declares the MCP Apps extension states its own support, so the- // declaration wins over name detection in both directions. Clients that omit the- // extension fall back to the hosts known to render `render-ui`.+ // The Code tab in Claude desktop declares the MCP Apps extension, but its host+ // rejects every app `callServerTool` with JSON-RPC -32603. The `render-ui` app+ // then cannot load its data and shows only an error state.+ // ponytail: this blocks every desktop Code build, including a future fixed one.+ // Remove the check when a desktop Code build forwards app tool calls.+ if (+ matchesProductName(this.userAgent, CLAUDE_CODE_USER_AGENT_PRODUCTS) &&+ matchesAnyFragment(this.userAgent, CLAUDE_DESKTOP_USER_AGENT_FRAGMENTS)+ ) {+ return false+ }+ // Any other client that declares the MCP Apps extension states its own support,+ // so the declaration wins over name detection in both directions. Clients that+ // omit the extension fall back to the hosts known to render `render-ui`.if (this.uiSupported !== undefined) {return this.uiSupported}diff --git a/services/mcp/tests/unit/client-detection.test.ts b/services/mcp/tests/unit/client-detection.test.tsindex 89866e644e88..889352d16a43 100644--- a/services/mcp/tests/unit/client-detection.test.ts+++ b/services/mcp/tests/unit/client-detection.test.ts@@ -400,6 +400,8 @@ describe('MCPClientProfile', () => {// Claude Code's pooled initialize body also says `Anthropic/ClaudeAI`.{ clientName: 'Anthropic/ClaudeAI' },{ clientName: 'Anthropic/ClaudeAI', vendorClient: 'ClaudeCode' },+ // Claude desktop's Code tab declares MCP Apps support but cannot load app data.+ { userAgent: 'claude-code/2.1.309 (claude-desktop, agent-sdk/0.3.309)', uiSupported: true },])('returns false for %j', (input) => {expect(new MCPClientProfile(input).isRenderUiHost()).toBe(false)})