Packages

@posthog/mcp

1.6.1 · 21 Nov 2026MIT780.1k / weekRepositorynpmAtom feed

Your version

101 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.

  1. 1.x · latest line
  2. 1.7.0

    23 Nov 2026
    • Group tool calls into sessions by the client's own conversation id in _meta: ChatGPT's openai/session, Codex's sessionId, and VS Code's vscode.conversationId, each read only from the client its User-Agent or client name identifies. The client's id wins over a conversation handle and a transport session. ChatGPT gets no conversation_id argument and no handle, so its tool schemas and results stay unchanged. Every event from instrument() now records which source grouped it as $mcp_session_source. PostHogMCP.prepareToolList and prepareToolCall take the request's headers (and clientInfo), and captureToolCall takes requestMeta.
      (2026-11-23)

  3. 1.6.1

    21 Nov 2026
    • PostHogMCP adds the configured serverBuild to captureAi() and captureAiImmediate() events, as it already does for capture() and captureImmediate(). With serverBuild set, an event whose properties cannot be read is now dropped by the client, as without serverBuild, instead of throwing from any of the four methods.
      (2026-11-21)

  4. 1.6.0

    18 Nov 2026
    • 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 on extra.requestInfo.headers for identify and other callbacks.
      (2026-11-18)

  5. 1.5.0

    18 Nov 2026
    • Support Vercel's mcp-handler. Call instrument(server, posthog) inside the createMcpHandler callback, and wrap the exported route in the new withMcpSessionHeader to keep one $session_id and the client's name per conversation on the 2025-11-25 protocol. mcp-handler streams the initialize response, so the session token is minted at the fetch layer instead of inside the server.
      (2026-11-18)

  6. 1.4.0

    18 Nov 2026
    • 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 carry validation instead 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)

  7. 1.3.0

    17 Nov 2026
    • Add eventOptions to set posthog-node per-event options on MCP events, per call or from an instrument() callback. beforeSend sees and can change them, and an explicit process_person_profile wins over the anonymous default.
      (2026-11-17)

    • Genkit spans and @posthog/mcp events with no user distinct id set the process_person_profile: false event option on posthog-node 6.x.x, so a registered or context process_person_profile: true option 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)

    • Export the table of per-event options and the event properties posthog-node 5.x.x reads instead, so posthog-node, @posthog/ai and @posthog/mcp share one copy.
      (2026-11-17)

  8. 1.2.3

    16 Nov 2026
    • instrumentMutator(posthog)(server) now returns the server's own type instead of unknown, so no type argument or cast is needed. Explicit instrumentMutator<McpServer>(posthog) calls and typed serverMutator hooks keep working.
      (2026-11-16)

    • getMoreToolsResult() and sendFeedbackResult() are now typed so they can be returned from an MCP SDK tool handler (v1 and v2 CallToolResult) without a cast.
      (2026-11-16)

  9. 1.2.2

    13 Nov 2026
    • Fix stateless servers on @modelcontextprotocol/server 2.0 to 2.2 that reuse one transport for every client: the session token minted at initialize now rides only that client's initialize response. Before, it stayed on the transport, so every later client's initialize failed 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.

      The token is no longer left on transport.sessionId after the response. Host code that read it there should read the Mcp-Session-Id header the client replays instead. (2026-11-13)

  10. 1.2.1

    12 Nov 2026
    • mcp: Keep the thrown value on high-level McpServer tool calls, so $mcp_error_type and $mcp_error_status reflect what the tool threw. This covers MCP SDK v2, a thrown value that is not an Error, and servers built per request that share tool functions. For a thrown non-Error, $mcp_error_message and error grouping now describe the thrown value (for example 'UpstreamError' captured as exception with message: 'bad') instead of [object Object]. $mcp_error_type is now redacted like the message, including an errorType passed to captureToolCall. An error whose getters throw while it is captured is still recorded: a tool call falls back to the tool result, and other events record Unknown error instead of being dropped.
      (2026-11-12)

  11. 1.2.0

    12 Nov 2026
    • A failed tool call now sets $mcp_error_status to the HTTP status behind it, read from the thrown error or its cause chain (status_code, statusCode or status, on the error or its response, as a fetch Response, axios and got carry it). Failures from an upstream API now group by status in MCP Analytics instead of landing in "unknown".
      (2026-11-12)

    • Ignore non-string name/version values returned by the clientInfo option instead of recording them as the MCP client.
      (2026-11-12)

  12. 1.1.1

    11 Nov 2026
    • mcp: Keep additionalProperties: false on tool schemas when injecting context, llm_model and conversation_id. The injected keys are declared properties, so the schema stays valid and keeps the strictness the host advertised.
      (2026-11-11)

  13. 1.1.0

    10 Nov 2026
    • Add sessionId and clientInfo options so stateless per-request servers can supply the session id and client name for each request
      (2026-11-10)

  14. 1.0.1

    9 Nov 2026
    • Fix intent and payload capture bugs: a long digit run no longer drops $mcp_intent with a stack overflow (card redaction is otherwise unchanged), captured tool arguments are limited before they are sanitized and credential-named arguments are not walked, and $mcp_feedback_<name> object extras redact identifiers in keys and numbers. A parsed __proto__ argument is still dropped, as before.
      (2026-11-09)

  15. 1.0.0

    6 Nov 2026
  16. 0.26.x
  17. 0.26.0

    6 Nov 2026
    • Aligned with the MCP analytics spec: a call to a tool the server never registered now emits $mcp_unknown_tool instead of a failed $mcp_tool_call, llm_model is advertised as optional, the get_more_tools and send_feedback annotations now declare that they record data, and the injected context argument has a shorter description. A server whose own dispatcher bypasses the MCP SDK's tool registry (such as @rekog/mcp-nest) keeps recording calls to unknown names as failed tool calls, since the SDK cannot tell whether such a tool exists. On a low-level server, resolveOriginalTool returning undefined now marks a failing call as an unknown tool, so return a tool for every name your server serves. Strings cut to a property limit (such as 256 characters for names and 2,048 for intent and error text) now stop exactly at the limit, ... included, instead of 3 characters past it. PostHogMCP capture methods called without a sessionId now send a fresh $session_id per call, and anonymous calls use it as their distinct id instead of the shared "anonymous". This changes your published tool definitions; if your server is listed in the ChatGPT or Claude directories, those platforms may re-review the updated tools.
      (2026-11-06)

  18. 0.25.x
  19. 0.25.2

    6 Nov 2026
    • Parse Node stack frames for functions named async without a leading parenthesis in the filename.
      (2026-11-06)

  20. 0.25.1

    6 Nov 2026
    • Reworded the descriptions of the injected conversation_id and llm_model arguments and the get_more_tools and send_feedback virtual tools so they describe the field instead of instructing the model. This changes your published tool definitions; if your server is listed in the ChatGPT or Claude directories, those platforms may re-review the updated tools.
      (2026-11-05)

  21. 0.25.0

    28 Oct 2026
    • Add a sendToolsListEvent option. It is on by default. Set it to false to stop sending $mcp_tools_list.
      (2026-10-28)

  22. 0.24.x
  23. 0.24.0

    28 Oct 2026
    • Add a sendInitializeEvent option. It is on by default. Set it to false to stop sending $mcp_initialize.
      (2026-10-28)

  24. 0.23.x
  25. 0.23.0

    19 Oct 2026
    • Stop sending standalone $identify events, so insights, funnels, or cohorts built on MCP $identify stop receiving new data. The identify callback still sets distinct_id, $set and $groups on every event.
      (2026-10-19)

  26. 0.22.x
  27. 0.22.3

    9 Oct 2026
    • Set $mcp_interface to mcp on events from MCP servers.
      (2026-10-09)

  28. 0.22.2

    7 Oct 2026
    • Sanitize each tool response once instead of twice, and replace image, audio and binary blocks before the scan, so tool calls with large results cost less CPU. Redact PostHog tokens that URL field decoding exposes.
      (2026-10-07)

  29. 0.22.1

    6 Oct 2026
    • Capture WebMCP tool intent and model metadata by default.
      (2026-10-06)

  30. 0.22.0

    5 Oct 2026
    • Strip SDK-owned analytics arguments on fresh low-level server instances through resolveOriginalTool.
      (2026-10-05)

  31. 0.21.x
  32. 0.21.4

    2 Oct 2026
    • Make oversized events cheaper to truncate. The depth reduction now starts at the first depth that removes anything, so shallow payloads such as rows of data no longer normalize and measure the whole event again for each depth that changes nothing.
      (2026-10-02)

  33. 0.21.3

    2 Oct 2026
    • Sanitize only the part of a long string that the captured event can keep, so a tool call returning megabytes of HTML or text no longer blocks the event loop while it is scanned. A 10 MB HTML response now costs about 5 ms to capture instead of 2.7 s. The captured event does not change.
      (2026-10-02)

  34. 0.21.2

    30 Sep 2026
    • Stop copying the full tool list into $mcp_response on $mcp_tools_list events, so instrumented servers answer tools/list faster.
      (2026-09-30)

  35. 0.21.1

    30 Sep 2026
    • Add the configured server build to custom events captured through PostHogMCP.
      (2026-09-30)

  36. 0.21.0

    28 Sep 2026
    • Add optional MCP server build metadata
      (2026-09-28)

  37. 0.20.x
  38. 0.20.0

    28 Sep 2026
    • Record declared input aliases in automatic MCP instrumentation.
      (2026-09-28)

  39. 0.19.x
  40. 0.19.0

    28 Sep 2026
    • Record which declared parameter aliases a tool call relied on as $mcp_input_aliases_used, from a server-owned inputAliases map.
      (2026-09-28)

    • Record safe tool input field names for automatic and custom MCP servers. Unknown names are [redacted] by default; shouldRecordInputKey replaces that rule.
      (2026-09-28)

  41. 0.18.x
  42. 0.18.1

    25 Sep 2026
    • Keep MCP conversation sessions consistent across user messages.
      (2026-09-25)

  43. 0.18.0

    23 Sep 2026
    • Add conversation and session correlation helpers for custom MCP dispatchers.
      (2026-09-23)

  44. 0.17.x
  45. 0.17.0

    17 Sep 2026
    • Enable model capture and conversation correlation by default. Advertised tool schemas gain an llm_model argument (never enforced at dispatch) and eligible tool results gain a conversation handle; instrument(server, posthog, { captureModel: false, enableConversationId: false }) restores the previous shape. Fresh low-level instances now read both arguments under the ADR-0011 rule instead of staying silent.
      (2026-09-17)

  46. 0.16.x
  47. 0.16.4

    17 Sep 2026
    • Use conversation IDs for get_more_tools and send_feedback calls handled by fresh server instances.
      (2026-09-17)

  48. 0.16.3

    16 Sep 2026
    • Inject the get_more_tools tool only on the first tools/list page, so a paginated catalogue's concatenated listing carries it once instead of once per page. A real first-page tool with the same name still wins (warning logged); a real tool on a later page is shadowed, with a warning when a client fetches that page — rename the SDK's tool with the missingCapabilityToolName option if your catalogue uses the name.
      (2026-09-16)

  49. 0.16.2

    15 Sep 2026
    • Inject the send_feedback tool only on the first tools/list page (the request with no cursor), so a paginated catalogue's concatenated listing carries it once instead of once per page. A real first-page tool with the same name still wins: the SDK warns, skips injection, and forwards its calls. A real tool that only appears on a later page is not detected — the SDK logs a warning when a client fetches that page; rename the SDK's tool with collectFeedback: { toolName } if your catalogue uses the name.
      (2026-09-15)

  50. 0.16.1

    14 Sep 2026
    • Harden feedback validation, error handling, and tool-name collision routing.
      (2026-09-14)

  51. 0.16.0

    11 Sep 2026
    • Add the send_feedback virtual tool (new collectFeedback option): an honest, general agent-feedback channel with missing capabilities as the priority category. Every call emits a new $mcp_feedback event with $mcp_feedback_type and the other $mcp_feedback_* properties. Hosts can rename the tool, replace its description, declare extraProperties (captured as $mcp_feedback_<key>), and route reports to a real backend via onFeedback (instrument() path) or prepareToolCall().feedbackReport + captureFeedback() + sendFeedbackResult() (custom-dispatcher path). reportMissing / get_more_tools / $mcp_missing_capability are unchanged; new integrations should enable only collectFeedback.
      (2026-09-11)

  52. 0.15.x
  53. 0.15.0

    10 Sep 2026
    • Capture resource discovery and reads from instrumented MCP servers. URL credential redaction (userinfo, credential-named query and fragment parameters) now applies to every captured string, including existing $mcp_tool_call parameters, responses, and error messages, so URLs already flowing through tool-call data will show %5Bredacted%5D values after upgrading.
      (2026-09-10)

  54. 0.14.x
  55. 0.14.1

    9 Sep 2026
    • error-tracking: Collapse repeated frame cycles in parsed stack traces to reduce grouping differences caused by recursion depth, while preserving distinct throw locations
      (2026-09-09)

  56. 0.14.0

    8 Sep 2026
    • Capture model identity from recognized client metadata before falling back to the injected llm_model argument.
      (2026-09-08)

  57. 0.13.x
  58. 0.13.1

    7 Sep 2026
    • Reduce personal data in $mcp_intent, which is agent-narrated free text and could previously carry personal data a model read aloud.

      context: false and beforeSend remain the ways to drop the field entirely. (2026-09-07)

  59. 0.13.0

    3 Sep 2026
    • Add self-reported model capture to the PostHogMCP custom-dispatcher path. The preparation helpers preserve application-owned fields and work across stateless server replicas when given the original tool descriptor. Tool calls and missing-capability reports can record the model properties.
      (2026-09-03)

  60. 0.12.x
  61. 0.12.0

    27 Aug 2026
    • Add opt-in captureModel option: injects a required llm_model parameter into every tool — including the get_more_tools virtual tool — so the calling agent self-reports the model it runs as, captured as $mcp_llm_model with $mcp_llm_model_source = "self_reported". Stripping the argument before the handler runs and capturing the property both require confirmed SDK ownership of the parameter: a customer-declared llm_model is never stolen or captured, and a low-level Server that builds a fresh instance per request records nothing (see the README). An honest "unknown" from the agent is dropped rather than recorded.
      (2026-08-27)

  62. 0.11.x
  63. 0.11.7

    18 Aug 2026

    Reading the note…

  64. 0.11.6

    13 Aug 2026

    Reading the note…

  65. 0.11.5

    13 Aug 2026

    Reading the note…

  66. 0.11.4

    10 Aug 2026

    Reading the note…

  67. 0.11.3

    10 Aug 2026

    Reading the note…

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.