You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 44123ba
Browse filesBrowse the repository at this point in the historyBrowse files
feat!: keep the posthog-python identity when instrumenting MCP
MCP instrumentation relabeled the whole client, so the app's own events and flag requests reported posthog-python-mcp. Capture v1 takes $lib from the per-request PostHog-Sdk-Info header, which is now always posthog-python.
MCP instrumentation no longer relabels the client as `posthog-python-mcp`. `posthog.mcp.instrument()` and `PostHogMCP` used to change `$lib`, the `PostHog-Sdk-Info` header and the feature flag request `User-Agent` for every event the client sent, including the app's own events. All events now report `posthog-python`. Filter MCP traffic on the `$mcp_*` events and properties.
Copy file name to clipboardExpand all lines: docs/migration-7.x-to-8.0.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ You need to change code if your app does any of these:
18
18
- expects `super_properties` to override properties passed to a single call
19
19
- tests the AI integrations with a mock client and asserts on `capture`
20
20
- passes its own client object to the AI integrations
21
+
- sets `$lib` or `$lib_version`, or filters on `$lib = "posthog-python-mcp"`
21
22
22
23
## Endpoints
23
24
@@ -29,6 +30,18 @@ You need to change code if your app does any of these:
29
30
If you send events to a self-hosted PostHog, check that it serves both endpoints before you upgrade.
30
31
An endpoint that is not served drops every event sent to it.
31
32
33
+
## SDK identity
34
+
35
+
PostHog sets `$lib` and `$lib_version` on every event from the `PostHog-Sdk-Info` request header, which is always `posthog-python/<version>`.
36
+
The SDK removes `$lib` and `$lib_version` from the properties it sends.
37
+
A value you set in a call, in `super_properties` or in `before_send` does not reach PostHog.
38
+
39
+
MCP instrumentation no longer relabels the client.
40
+
In 7.x, `posthog.mcp.instrument()` and `PostHogMCP` set the client's identity to `posthog-python-mcp`.
41
+
With the default client, or any client the app also used, every event and feature flag request from the app then reported `posthog-python-mcp`, not only the MCP events.
42
+
In 8.0, MCP events report `posthog-python` like all other events.
43
+
To find MCP traffic, filter on the `$mcp_*` events and properties instead of `$lib`.
Install is just `pip install posthog`. `instrument()` needs the MCP SDK at runtime,
32
32
but anyone wrapping a server already has it.
33
33
34
-
MCP analytics events report `$lib: "posthog-python-mcp"` and the installed `posthog` package version in `$lib_version`.
35
-
Request headers use the same identity and package version, so SDK Health can compare MCP traffic with Python SDK releases.
36
-
Because `$lib` is a client-level identity, `instrument()` relabels every event sent by the client passed to it.
34
+
MCP analytics events report `$lib: "posthog-python"` and the installed `posthog` package version in `$lib_version`, like every other event the client sends.
35
+
PostHog sets both from the client's `PostHog-Sdk-Info` request header, so `instrument()` and `PostHogMCP` do not relabel the client.
36
+
Filter MCP traffic by its `$mcp_*` events and properties instead.
37
37
Use a client dedicated to MCP analytics if the application also captures unrelated events.
0 commit comments