Skip to content

feat!: MCP no longer relabels the client SDK identity - #1034

Open
eli-r-ph wants to merge 2 commits into
v1-capture-migration-docsfrom
v1-sdk-identity
Open

eli-r-ph wants to merge 2 commits into
v1-capture-migration-docsfrom
v1-sdk-identity

Conversation

@eli-r-ph

@eli-r-ph eli-r-ph commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Stacked on #1030. Capture v1 sets $lib from a per-request header, so one client has one identity. In 7.x, MCP instrumentation relabeled the whole client as posthog-python-mcp, so every event and flag request from the app reported that name. In 8.0 the client always reports posthog-python.

Changes

  • MCP instrumentation no longer changes $lib, the PostHog-Sdk-Info header or the flag request User-Agent.
  • Removes _lib_identity.py, POSTHOG_MCP_LIB_NAME, Client._set_library_identity and the request code that only served them.
  • The MCP README and migration guide say to find MCP traffic with the $mcp_* events and properties.

Note

SDK Health and flag analytics will count MCP servers as posthog-python after 8.0.

💚 How did you test it?

  • A client passed to instrument() keeps $lib: posthog-python; bringing back the relabel fails the test.
  • A PostHogMCP client sends PostHog-Sdk-Info: posthog-python/<version>.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Written with Cursor (Claude) under the direction of the assignee.

🤖 Generated with Claude Code

@dustinbyrne dustinbyrne left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, glad to see we're retaining $lib and $lib_version as queryable properties. from my standpoint, that was my main concern.

worth a look from @PostHog/mcp-analytics given the $lib overwrite is part of their SDK specification: https://github.com/PostHog/sdk-specs/blob/f238b169dee7897dd55074061f600a2fa8bb4925/openspec/specs/mcp-analytics/spec.md#L529-L543

@eli-r-ph
eli-r-ph force-pushed the v1-capture-migration-docs branch from bd1bc05 to d0562f4 Compare October 8, 2026 22:54
@eli-r-ph
eli-r-ph force-pushed the v1-capture-migration-docs branch from d0562f4 to 171af6b Compare October 8, 2026 23:40

@lucasheriques lucasheriques left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense from mcp-analytics side, esp. if this is better for the property long term. we can add a new $mcp_* property indeed if needed, thanks for addressing and sorry for causing the issue in first place 😅

will update on the spec too

@eli-r-ph
eli-r-ph force-pushed the v1-sdk-identity branch 2 times, most recently from ec37610 to 5718a37 Compare October 10, 2026 03:19
@eli-r-ph
eli-r-ph force-pushed the v1-capture-migration-docs branch from bba9730 to bdf67ef Compare October 10, 2026 23:35
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.
@eli-r-ph
eli-r-ph force-pushed the v1-capture-migration-docs branch from bdf67ef to 893844b Compare October 11, 2026 20:17
@eli-r-ph eli-r-ph changed the title feat!: keep the posthog-python identity when instrumenting MCP feat!: MCP no longer relabels the client SDK identity Oct 13, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants