Skip to content
PluginStats

@posthog/mcp weekly downloads statistics

By posthog (4 listings) · npm · MCP servers

PostHog SDK for Model Context Protocol (MCP) servers — tracks tool usage, intent, and identity

View on npm Fresh · Dec 6, 2026

@posthog/mcp has 862,767 recorded weekly downloads on npm, an increase of 19.2% over the past 30 days, ranking #311 of 3,247 tracked listings.

Weekly downloads
862,767
Official API · Dec 5, 2026
7-day growth
-0.7%
-6.1K weekly downloads
30-day growth
+19.2%
+139.1K weekly downloads
90-day growth
+412%
+694.3K weekly downloads
Rank
#311
▼ 16 in 7 days

About @posthog/mcp

PostHog MCP package

Please see the main PostHog docs.

SDK usage examples and code snippets live in the official documentation so they stay up to date.

Documentation

Versioning

From 1.0.0, @posthog/mcp follows semver for its API and for the events it sends. A minor or patch release doesn't rename or remove a $mcp_* event or property, change its type, or change which requests send an event, so saved insights keep working across upgrades. It may add events and properties, and redact more of a captured value. The rules come from the MCP analytics spec, section "Event schema stability".

Stateless & multi-pod servers

On stateless deployments the SDK mints the Mcp-Session-Id response header at initialize as a token carrying the session id and client name/version. Clients replay the header on every request, so any pod keeps $session_id and $mcp_client_name/$mcp_client_version stable with no server-side store.

The SDK publishes no standalone $identify event. The identify callback runs on every request, on any pod, and stamps distinct_id and $set onto each event it sends.

A custom event from analytics.capture() takes the session and identity of the request it was captured in, even when requests overlap on one instance. That needs AsyncLocalStorage, which Node, Bun, Deno, Vercel Edge and Cloudflare Workers with the nodejs_compat or nodejs_als flag provide. Without it the SDK cannot tell requests apart, so it sends custom events with a session of their own and no identity rather than another caller's, and logs one warning.

Streamable HTTP: set enableJsonResponse: true

The token is minted onto the Mcp-Session-Id response header from inside the initialize handler, so it only reaches the client when the transport builds the response after the handler runs — i.e. JSON mode. In SSE (streaming) mode StreamableHTTPServerTransport flushes the response headers before the handler runs, so the minted header never lands and behavior silently falls back to a session-per-request. This is a property of the transport, so it applies to every Streamable-HTTP host — set enableJsonResponse: true (and use a fresh transport per request):

// @modelcontextprotocol/sdk
new StreamableHTTPServerTransport({ sessionIdGenerator: undefined, enableJsonResponse: true })

// Cloudflare agents / createMcpHandler (SSE is the default)
createMcpHandler(server, { enableJsonResponse: true })

// @rekog/mcp-nest
McpModule.forRoot({ streamableHttp: { enableJsonResponse: true } })
If you must stream (SSE)

Set the header yourself at the HTTP layer with the exported encodeSessionId (read clientInfo from the initialize body) — the SDK decodes it either way:

import { MCP_SESSION_HEADER, encodeSessionId, newSessionId } from '@posthog/mcp'

// after parsing the POST body, before flushing headers:
if (body?.method === 'initialize' && !req.headers[MCP_SESSION_HEADER]) {
  res.setHeader(
    MCP_SESSION_HEADER,
    encodeSessionId({
      sessionId: newSessionId(),
      clientName: body.params?.clientInfo?.name,
      clientVersion: body.params?.clientInfo?.version,
    })
  )
}

Details: docs/ARCHITECTURE.md §4.

Flushing on per-request runtimes

Auto-captured events reach posthog.capture() asynchronously, after the handler's response is built. On a runtime that freezes or exits after each request (serverless and edge functions, Convex HTTP actions), await analytics.flush() before you return. It waits until every event the server has captured so far is handed to posthog-node, then flushes the posthog-node queue:

const analytics = instrument(server, posthog)

const response = await handleRequest(request)
await analytics.flush()
return response

On a runtime with background work, such as Cloudflare Workers or Vercel, pass it to waitUntil so the response doesn't wait: ctx.waitUntil(analytics.flush()).

An event is captured when its handler finishes. A JSON response is complete by then, but a streamed (SSE) one is returned before the handler has run, so there flush() has nothing to wait for yet. Return JSON (enableJsonResponse: true), or flush when the stream ends:

const response = await handleRequest(request)
if (!response.body) {
  await analytics.flush()
  return response
}
const { readable, writable } = new TransformStream()
const sent = response.body.pipeTo(writable).catch(() => undefined) // the client may disconnect
ctx.waitUntil(sent.then(() => analytics.flush()))
return new Response(readable, response)

It flushes the whole client, so events you capture on it yourself are sent too. It never rejects. When posthog.flush() does, that goes to the logger option. posthog-node 6.x.x reports failed deliveries through posthog.on('error', ...) instead. Which failed events are retried is up to posthog-node.

MCP TypeScript SDK v2

instrument() works on both SDK majors — @modelcontextprotocol/sdk v1 and @modelcontextprotocol/{core,server,client} v2 — and on both the high-level McpServer and the low-level Server. Shapes are detected at runtime, so neither major is a dependency here.

Sessions and client identity on a v2 server

Protocol revision is a property of each request, not of the server: a v2 server serves both 2025-11-25 and 2026-07-28 traffic, and the SDK is instrumented once for both.…

Description from the npm listing.

  • posthog
  • mcp
  • model-context-protocol
  • analytics
  • llm

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

@posthog/mcp weekly downloads on npm, last 90 days: 862,767 weekly downloads as of Dec 5, 2026, +412% over 90 days.@posthog/mcpWeekly downloads on npm · Last 90 days862,767downloads / week+412% over 90 days0200K400K600K800K1MSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
@posthog/mcp weekly downloads on npm, last 90 days: 862,767 weekly downloads as of Dec 5, 2026, +412% over 90 days.

7/30/90-day growth

@posthog/mcp weekly downloads growth on npm: -0.7% over 7 days, +19.2% over 30 days, +412% over 90 days.@posthog/mcpWeekly downloads growth on npm862,767downloads / week now7-day growth-6,143 weekly downloads-0.7%30-day growth+139,097 weekly downloads+19.2%90-day growth+694,305 weekly downloads+412%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
@posthog/mcp weekly downloads growth on npm: -0.7% over 7 days, +19.2% over 30 days, +412% over 90 days.

Ranking history

@posthog/mcp npm ranking history: currently #311 (by weekly downloads).@posthog/mcpnpm ranking · by weekly downloads · Last 90 days#311current rank#100#150#200#250#300#350#400Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 17, 2026 – Dec 6, 2026 · 45 observations · Updated Dec 5, 2026pluginstats.com
@posthog/mcp npm ranking history: currently #311 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 16, #11 (overall #311)
All npm: every listing in weekly downloads order

Listing placement

MCP servers468 listings · 24 pages · page 2, #5 (overall #25)
MCP servers: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (592)
Recent weekly downloads observations for @posthog/mcp
Date (UTC)Weekly downloadsChange vs. previous
862,767-72.9K
935,688+32.6K
903,096+29.2K
873,890+9.6K
864,247+5.6K
858,602-7.2K
865,815-3.1K
868,910+12.4K
856,512+2.7K
853,839+3.8K
850,062+13.5K
836,603+26.3K
810,307+30.2K
780,118—

Similar npm MCP servers plugins

All 20 @posthog/mcp alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/@posthog/mcp. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.