: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): detect opencode client for CLI mode (#63529)
Georgiy Tarasov9f5ebe0d0cc1
diff --git a/services/mcp/src/lib/client-detection.ts b/services/mcp/src/lib/client-detection.tsindex 11ae2c80e4be..c7b467b5df08 100644--- a/services/mcp/src/lib/client-detection.ts+++ b/services/mcp/src/lib/client-detection.ts@@ -77,6 +77,11 @@ export const CODING_AGENT_CLIENT_NAME_FRAGMENTS = [// but an LLM-driven consumer that benefits from the same single-exec mode// and formatted-text rendering as coding agents).'notion',+ // OpenCode is a terminal coding agent (and the engine behind clients like+ // OpenWork). It connects through OpenCode's MCP client, which self-reports+ // `clientInfo.name` as `opencode`. It renders text, not MCP Apps UI, so it+ // wants single-exec mode like the other coding agents.+ 'opencode',] as const// Known `x-anthropic-client` (`vendorClient`) header values. Anthropic poolsdiff --git a/services/mcp/tests/unit/client-detection.test.ts b/services/mcp/tests/unit/client-detection.test.tsindex 325bb69e86c1..19da6c38e014 100644--- a/services/mcp/tests/unit/client-detection.test.ts+++ b/services/mcp/tests/unit/client-detection.test.ts@@ -32,6 +32,7 @@ describe('isCliModeEnabledClient', () => {['devin'],['librechat'],['notion'],+ ['opencode'],])('returns true for %s', (clientName) => {expect(isCliModeEnabledClient(clientName)).toBe(true)})@@ -55,6 +56,8 @@ describe('isCliModeEnabledClient', () => {['notion-mcp-client'],['Notion'],['Devin'],+ ['OpenCode'],+ ['opencode/1.2.3'],])('returns true for variant %s (case-insensitive substring match)', (clientName) => {expect(isCliModeEnabledClient(clientName)).toBe(true)})