@posthog/mcp@0.11.1
0.11.1
Patch Changes
-
#4462
2fc1211Thanks @gesh! - Instrument high-levelMcpServerinstances from MCP TypeScript SDK v2, and read request headers from either SDK major.The compatibility gate required
typeof server.tool === 'function'. SDK v2 dropped the deprecatedtool()in favour ofregisterTool(), so every v2 high-level server failed the check — and sinceinstrument()catches compatibility failures and returns a working-looking handle, it failed silently: no throw, no warning at the call site, and no$mcp_*events at all. The gate now accepts either registration method, and every shape question it asks is answered by a structural probe in the newdetect.tsrather than by a version or protocol constant.Opening the gate is also what first sends v2-shaped request context to header reads, so both halves ship together. The SDK's own reads go through a new
getRequestHeaders(extra), which takes headers from v2'sctx.http.req(a WHATWGRequest, whose headers only answer to.get()) as well as v1'sextra.requestInfo.headers, and returns a plain lowercase-keyed object either way. It is duck-typed on.entriesrather thaninstanceof Headers, so aHeadersfrom another realm — workerd and other edge runtimes — is read correctly.getRequestHeadersis exported, becauseidentify,intentFallback,eventPropertiesandbeforeSendstill receive the SDK'sextraunchanged — we deliberately do not synthesise a v1requestInfoon v2, as a partially faked shape is worse than an absent one. Hosts reading headers in a callback migrate in one line:import { getRequestHeaders } from '@posthog/mcp' identify: async (request, extra) => { const auth = getRequestHeaders(extra)?.['authorization'] // ... } ``` (2026-08-10)