feat: mcp apps for posthog's mcp#2459
Conversation
|
k11kirky
left a comment
There was a problem hiding this comment.
another nit:
HOST_INFO in useAppBridge.ts:65 is still { name: "Twig", ... }, even though this PR renamed the client identity to posthog-code in both service.ts:171 and createConnection.
| ); | ||
|
|
||
| useEffect(() => { | ||
| log.info("render state", { |
There was a problem hiding this comment.
should probably remove this
- Rename MCP host identity from "Twig" to "posthog-code" in useAppBridge, matching the client identity already used in the main service. - Remove the debug "render state" useEffect from McpToolBlock. - Fix the getUiResourceByUri test to expect a rejection: a missing server config rethrows (transient boot-race), it does not resolve to null. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ac8493a to
e71c2b7
Compare
Problem
We'd like to render MCP apps for PostHog's MCP. However, the CLI MCP mode is not compliant with the MCP spec, so we needed to alter the MCP apps renderer.
Changes
Standard MCP Apps bind a tool to its UI app upfront via registration metadata. PostHog instead exposes all UI apps through one generic
exectool and puts theui://resource URI on each tool-call response. This branch adds that per-call resolution path:POSTHOG_EXEC_TOOL_KEYconstants +resolveResultResourceUri()(reads the URI from a result's_meta, modern key with legacy fallback) +getUiResourceByUriInputschema.getUiResourceByUri()(+ sharedfetchUiResourceByUri/doFetchUiResourcewith caching); special-casesposthog/execduring discovery; treats"No server config"boot-race failures as transient.getUiResourceByUriprocedure.McpAppHost/McpToolBlockresolve the URI fromtoolCall.rawOutput(persisted → survives restarts), fetch by URI, dedup result delivery pertoolCallId, and re-fetch ononDiscoveryComplete.x-posthog-mcp-consumer: posthog-codeheader.How did you test this?
Tests added across all three layers (
service.test.ts,mcp-apps.test.ts,auth-adapter.test.ts).Automatic notifications