Event and property reference

This page lists the events and properties the MCP Analytics SDKs send. Use it to write queries, or to send the events yourself. Every property is prefixed with $mcp_, so it never collides with other PostHog events. Some SDKs send a subset. See differences between SDKs.

Events

Event nameWhen it firesNotable extras
$mcp_tool_callEvery tools/call request$mcp_tool_name, $mcp_parameters, $mcp_response, $mcp_duration_ms, $mcp_is_error, and on errors $mcp_error_type and $mcp_error_message
$mcp_tools_listEvery tools/list response$mcp_listed_tool_names
$mcp_resources_listEvery resources/list and resources/templates/list request$mcp_response (the listing as sent)
$mcp_resource_readEvery resources/read request$mcp_resource_name (the URI, with credentials redacted). The resource body is never captured.
$mcp_initializeEvery 2025-11-25 handshake$mcp_client_name, $mcp_client_version, $mcp_protocol_version
$mcp_missing_capabilityThe agent calls the get_more_tools virtual toolThe agent's reasoning, as $mcp_intent. See missing capabilities.
$exceptionA tool call or resource request failsSee exception properties
(your event name)You call analytics.capture({ event, properties })Your properties. See custom events.

You can turn off $mcp_tools_list, $mcp_initialize, and $exception in the configuration on your language's installation page.

Core properties

PropertyTypeDescription
$session_idstringThe MCP session. See session resolution.
$mcp_sourcestringAlways "posthog_mcp_analytics". Use it to filter MCP events in a project with other events.
$mcp_tool_namestringThe tool name. Only on tool calls.
$mcp_resource_namestringThe tool name, or on resource events the resource URI with credentials redacted.
$mcp_tool_descriptionstringThe tool's description at the time of the call.
$mcp_tool_categorystringYour own grouping label for the tool, if you set one.
$mcp_listed_tool_namesstring[]The tools in a tools/list response. Join on $session_id to find tools that were listed but never called.
$mcp_duration_msnumberHow long the request took, in milliseconds.
$mcp_is_errorbooleanTrue if the handler threw or returned isError: true.
$mcp_error_typestringFailure category, present only when $mcp_is_error is true. Defaults to the thrown error type. In TypeScript, from @posthog/mcp 1.4.0, failures the client caused, such as invalid arguments or an unknown resource, get validation. To set your own label, use a custom dispatcher: errorType (TypeScript), error_type (Python, Ruby), or ToolCall.ErrorType (Go).
$mcp_error_messagestringThe error message, truncated and redacted. Only on failures.
$mcp_server_namestringYour server's name.
$mcp_server_versionstringYour server's version.
$mcp_server_buildstringThe build you passed as serverBuild, such as a Git commit SHA.
$mcp_client_namestringThe client's name, as it reports itself. Can be missing on stateless 2025-11-25 servers. See MCP SDK v2.
$mcp_client_versionstringThe client's version, as it reports itself.
$mcp_client_user_agentstringThe client's User-Agent header. It tells apart clients that share a name, such as Claude Code CLI and Agent SDK. HTTP only.
$mcp_vendor_clientstringThe client's vendor header, such as X-Anthropic-Client. HTTP only.
$mcp_protocol_versionstringThe request's MCP revision, such as 2025-11-25. On 2026-07-28, each request declares its own revision.
$mcp_intentstringWhat the agent was trying to do. See agent intent.
$mcp_intent_source"context_parameter" \| "inferred"Whether the agent sent the intent or your intentFallback produced it.
$mcp_llm_modelstringThe calling model, if known. See model capture.
$mcp_llm_model_source"client_metadata" \| "self_reported"Where the model came from.
$mcp_parametersobjectThe request arguments, redacted. See privacy.
$mcp_responseobjectThe tool result or listing, redacted. Never a resource body.
$mcp_input_keysstring[]The argument names the agent sent. Names the input schema doesn't declare are recorded as [redacted]. Change this with shouldRecordInputKey.
$mcp_input_aliases_usedstring[]Alternative argument names the agent used, when resolveInputAliases declares them.
$mcp_conversation_idstringThe conversation handle. See conversation IDs.
$mcp_interface"mcp" \| "webmcp""webmcp" for WebMCP tools in the browser, otherwise "mcp".

Session resolution

The SDK uses the first of these it finds:

  1. The conversation_id the agent sent, when conversation IDs are on.
  2. The session ID on a 2025-11-25 request.
  3. The server instance's session ID, which rotates after 30 minutes of inactivity.

2026-07-28 has no protocol sessions, so only 1 and 3 apply. Every pod derives the same session ID from the same conversation handle, so sessions survive reconnects, restarts, and load balancing.

How the harness label is resolved

A harness is the client label on the dashboard, such as "Claude Code", "Cursor", or "ChatGPT". PostHog derives it at query time, so labels improve without an SDK upgrade. It checks these properties in order:

  1. $mcp_vendor_client, the only way to tell apart Anthropic surfaces like Claude.ai and Cowork, which share a client name.
  2. $mcp_client_user_agent, which tells apart Claude Code's CLI, SDK, VS Code, and desktop interfaces.
  3. $mcp_client_name.

Claude.ai web, desktop, and mobile all show as "Claude.ai", because their requests look the same. An unrecognized client shows as "Other". If most calls show as "Other", check that these properties have values. Stdio servers have no headers, so only the client name is available. Custom dispatchers must pass the headers themselves, as in the Python example.

Model capture

MCP has no standard field for the calling model. The SDK reads it from known client metadata, such as Codex's turn metadata. Otherwise it adds an llm_model argument to tool schemas and records what the agent says. Missing, blank, and unknown values are dropped.

Both sources are unverified client input. Use them to compare tool quality by model, not for billing or security. To turn model capture off, see your language's installation page.

Exception properties

A failed tool call or resource request also sends an $exception event. It uses the same format as every other PostHog SDK, so it shows up in error tracking.

PropertyDescription
$exception_listThe exceptions, each with type, value (the message), mechanism, and a parsed stacktrace. An Error.cause chain adds entries.
$exception_levelAlways "error".

The $exception also carries the call's session, tool, server, and client properties. Intent, model, and duration stay on the main event.

Symbolicating minified MCP servers

Upload source maps with the PostHog CLI to symbolicate stack frames from bundled or minified servers.

Person properties and groups

When identify() returns a user, the properties you return are sent as $set on every event except $exception. For example, return properties: { name, email } to set the person's name and email. PostHog doesn't keep $set on the stored event, so query these as person properties.

If identify() returns groups, the SDK sends them as $groups on every event. See identifying users.

Sessions with no identity are sent with person processing off, so anonymous sessions don't create person profiles.

Differences between SDKs

What each SDK captures lists which events each SDK sends. The TypeScript and Python SDKs send every property above. The other SDKs differ in these ways:

Go

  • Sends $mcp_unknown_tool and $mcp_input_required instead of $mcp_tool_call for unknown tools and 2026-07-28 input-required rounds. Both carry $mcp_tool_name, and $mcp_input_required also has $mcp_input_request_methods, the request methods without their contents.
  • $mcp_unknown_tool, $mcp_input_required, and $mcp_missing_capability don't carry $mcp_source.
  • Error types are package-qualified, such as fs.PathError.
  • Reads the client name only from initialize, so it's missing on stateless 2025-11-25 servers.
  • On stateless HTTP, a request with no conversation handle gets a new session ID.
  • $exception has no stack trace.
  • $set needs an explicit DistinctID.
  • Doesn't send $mcp_interface.

Rust

  • Sends $mcp_unknown_tool and $mcp_input_required instead of $mcp_tool_call for unknown tools and 2026-07-28 input-required rounds.
  • Only $mcp_tool_call carries $mcp_source.
  • $exception has no stack trace.
  • $set is on every event, including $exception.

Ruby

  • Sends a separate $identify event when the identity changes, instead of putting it on every event.
  • The only SDK that sends $mcp_prompts_list and $mcp_prompt_get.
  • Doesn't send $mcp_interface.

Constants exported from the package

The TypeScript package exports the event and property names, so your queries stay typesafe:

TypeScript
import { PostHogMCPAnalyticsEvent, PostHogMCPAnalyticsProperty } from "@posthog/mcp";
const event = PostHogMCPAnalyticsEvent.ToolCall; // "$mcp_tool_call"
const key = PostHogMCPAnalyticsProperty.ToolName; // "$mcp_tool_name"

POSTHOG_MCP_ANALYTICS_SOURCE holds "posthog_mcp_analytics", the value of $mcp_source.

Still have questions?

Was this page useful?