@posthog/mcp
1.6.1 · 21 Nov 2026MIT780.1k / weekRepositorynpmAtom feed
Upgrading @posthog/mcp From 1.1.1 to 1.7.0
10 releases in betweenevery note read
Release by release
- New
Group tool calls into sessions by the client's own conversation id in
_meta: ChatGPT'sopenai/session, Codex'ssessionId, and VS Code'svscode.conversationId, each read only from the client itsUser-Agentor client name identifies. The client's id wins over a conversation handle and a transport session. ChatGPT gets noconversation_idargument and no handle, so its tool schemas and results stay unchanged. Every event frominstrument()now records which source grouped it as$mcp_session_source.PostHogMCP.prepareToolListandprepareToolCalltake the request'sheaders(andclientInfo), andcaptureToolCalltakesrequestMeta. (2026-11-23)
- New
- Fixed
PostHogMCPadds the configuredserverBuildtocaptureAi()andcaptureAiImmediate()events, as it already does forcapture()andcaptureImmediate(). WithserverBuildset, an event whose properties cannot be read is now dropped by the client, as withoutserverBuild, instead of throwing from any of the four methods. (2026-11-21)
- Fixed
- New
Support FastMCP with
instrumentFastMCP(fastmcp, posthog, options). FastMCP builds a server per session (per request when stateless) behind a private factory, so this hooks the module's session class and instruments each one before it connects. FastMCP's HTTP layer drops request headers, so the adapter puts them back onextra.requestInfo.headersforidentifyand other callbacks. (2026-11-18)
- New
- New
Support Vercel's
mcp-handler. Callinstrument(server, posthog)inside thecreateMcpHandlercallback, and wrap the exported route in the newwithMcpSessionHeaderto keep one$session_idand the client's name per conversation on the2025-11-25protocol. mcp-handler streams theinitializeresponse, so the session token is minted at the fetch layer instead of inside the server. (2026-11-18)
- New
- New
Classify client-caused failures as
$mcp_error_type: "validation". A tool call whose arguments failed the tool's input schema, a call to a disabled tool, a tool that rejected its arguments with JSON-RPC-32602, and a read of an unknown resource now carryvalidationinstead of the thrown error's type, so dashboards can tell an agent's mistake from a server bug. Output-schema failures and malformed tool results, which also use-32602, keep the thrown type. Every failure still sends its$exception, as before. (2026-11-18)
- New
- New
Add
eventOptionsto set posthog-node per-event options on MCP events, per call or from aninstrument()callback.beforeSendsees and can change them, and an explicitprocess_person_profilewins over the anonymous default. (2026-11-17) - Fixed
Genkit spans and
@posthog/mcpevents with no user distinct id set theprocess_person_profile: falseevent option on posthog-node 6.x.x, so a registered or contextprocess_person_profile: trueoption no longer creates a person for each trace or session. Genkit also counts an empty or whitespace-only distinct id as missing. (2026-11-17) - Fixed
Export the table of per-event options and the event properties posthog-node 5.x.x reads instead, so posthog-node,
@posthog/aiand@posthog/mcpshare one copy. (2026-11-17) - Fixed
Accepts posthog-node 6.x.x as a peer dependency. (2026-11-17)
- New
- Fixed
instrumentMutator(posthog)(server)now returns the server's own type instead ofunknown, so no type argument or cast is needed. ExplicitinstrumentMutator<McpServer>(posthog)calls and typedserverMutatorhooks keep working. (2026-11-16) - Fixed
getMoreToolsResult()andsendFeedbackResult()are now typed so they can be returned from an MCP SDK tool handler (v1 and v2CallToolResult) without a cast. (2026-11-16)
- Fixed
- Fixed
Fix stateless servers on
@modelcontextprotocol/server2.0 to 2.2 that reuse one transport for every client: the session token minted atinitializenow rides only that client'sinitializeresponse. Before, it stayed on the transport, so every later client'sinitializefailed with 400 "Server already initialized" and later responses handed the first client's token to other clients. Per-request and multi-pod stateless servers still get a stable session token.
- Fixed
3 internal lines (docs, tests, tooling) left out.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.