github PostHog/posthog-js @posthog/mcp@1.9.0

latest release: posthog-node@6.2.1
one hour ago

1.9.0

Minor Changes

  • #5942 a94641d Thanks @lucasheriques! - Tool calls from Claude, Cursor, and other openai-mcp/ clients now take their session from the client's own conversation id in params._meta, so their calls stay grouped with conversation correlation turned off:

    • com.anthropic/session from Claude (User-Agent Claude-User or claude-code/…, or client name Anthropic/ClaudeAI or claude-code).
    • gen_ai.conversation.id from Cursor (User-Agent Cursor/…, or client name Cursor or cursor-vscode).
    • openai/session from any openai-mcp/ User-Agent, not only ChatGPT's. A request with that User-Agent and client name codex-mcp-client now reads openai/session instead of sessionId.

    A call that carries one of these ids now gets no conversation_id block in its result, records $mcp_session_source as client_metadata with no $mcp_conversation_id, and leaves the id out of $mcp_parameters. Conversations in flight at upgrade start a new session. These clients still get a conversation handle on calls that carry no id. (2026-11-30)

  • #5895 6f0a733 Thanks @lucasheriques! - PostHogMCP's step path (prepareToolCall, prepareToolResult) now resolves sessions the way instrument() does, per the sdk-specs MCP analytics spec. Notable behavior change: a raw transport id passed to prepareToolCall now yields a hashed $session_id, so a session in flight at upgrade splits once, and calls stop matching captureInitialize and captureToolsList events that still send the raw id until you spread in resolveSession.

    • prepareToolCall's sessionId is a transport session: a PostHog session token gives the session inside it, and any other id is hashed into a ses_ id. Before, it was sent as given, so the same Mcp-Session-Id produced different $session_id values on the two paths.
    • New connectionKey option for one-client connections (stdio): the SDK keeps a session per key and rotates it on the first call 30 minutes or more after the previous one ended. Call prepareToolResult for failed calls too, since a call holds the session open until then.
    • New resolveSession({ sessionId, connectionKey }) gives captureInitialize, captureToolsList and other out-of-call captures the tool calls' session. Those methods still send a sessionId as given, so if you passed the raw transport id to them, spread resolveSession in instead to keep one session per connection.
    • A minted conversation handle that never reaches the agent no longer sets the session.
    • prepareToolCall and prepareToolResult return sessionSource, and capture methods accept it as $mcp_session_source. A capture without a sessionId records generated. (2026-11-30)

Patch Changes

  • #5894 e43bf37 Thanks @lucasheriques! - Session identity now follows the sdk-specs MCP analytics spec more closely:

    • A session from your sessionId option records $mcp_session_source as host (was transport).
    • On a one-client connection (stdio), the generated session rotates on the first tool call that arrives 30 minutes or more after the previous tool call ended. Listings and other requests no longer keep it alive or rotate it, and the most recent call, while it runs, holds it open. An earlier call that never settles does not.
    • While a call's session rests on a conversation handle minted for it, its custom events wait and go out with the call's final session and identity. Past 1,000 held events, the rest are now sent at once with the session the call has without its handle, instead of being dropped. (2026-11-30)
  • Updated dependencies [d65dde7]:

    • @posthog/core@1.69.3
    • posthog-node@6.2.1

Don't miss a new posthog-js release

NewReleases is sending notifications on new releases.