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 name | When it fires | Notable extras |
|---|---|---|
$mcp_tool_call | Every 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_list | Every tools/list response | $mcp_listed_tool_names |
$mcp_resources_list | Every resources/list and resources/templates/list request | $mcp_response (the listing as sent) |
$mcp_resource_read | Every resources/read request | $mcp_resource_name (the URI, with credentials redacted). The resource body is never captured. |
$mcp_initialize | Every 2025-11-25 handshake | $mcp_client_name, $mcp_client_version, $mcp_protocol_version |
$mcp_missing_capability | The agent calls the get_more_tools virtual tool | The agent's reasoning, as $mcp_intent. See missing capabilities. |
$exception | A tool call or resource request fails | See 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
| Property | Type | Description |
|---|---|---|
$session_id | string | The MCP session. See session resolution. |
$mcp_source | string | Always "posthog_mcp_analytics". Use it to filter MCP events in a project with other events. |
$mcp_tool_name | string | The tool name. Only on tool calls. |
$mcp_resource_name | string | The tool name, or on resource events the resource URI with credentials redacted. |
$mcp_tool_description | string | The tool's description at the time of the call. |
$mcp_tool_category | string | Your own grouping label for the tool, if you set one. |
$mcp_listed_tool_names | string[] | The tools in a tools/list response. Join on $session_id to find tools that were listed but never called. |
$mcp_duration_ms | number | How long the request took, in milliseconds. |
$mcp_is_error | boolean | True if the handler threw or returned isError: true. |
$mcp_error_type | string | Failure 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_message | string | The error message, truncated and redacted. Only on failures. |
$mcp_server_name | string | Your server's name. |
$mcp_server_version | string | Your server's version. |
$mcp_server_build | string | The build you passed as serverBuild, such as a Git commit SHA. |
$mcp_client_name | string | The client's name, as it reports itself. Can be missing on stateless 2025-11-25 servers. See MCP SDK v2. |
$mcp_client_version | string | The client's version, as it reports itself. |
$mcp_client_user_agent | string | The 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_client | string | The client's vendor header, such as X-Anthropic-Client. HTTP only. |
$mcp_protocol_version | string | The request's MCP revision, such as 2025-11-25. On 2026-07-28, each request declares its own revision. |
$mcp_intent | string | What 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_model | string | The calling model, if known. See model capture. |
$mcp_llm_model_source | "client_metadata" \| "self_reported" | Where the model came from. |
$mcp_parameters | object | The request arguments, redacted. See privacy. |
$mcp_response | object | The tool result or listing, redacted. Never a resource body. |
$mcp_input_keys | string[] | The argument names the agent sent. Names the input schema doesn't declare are recorded as [redacted]. Change this with shouldRecordInputKey. |
$mcp_input_aliases_used | string[] | Alternative argument names the agent used, when resolveInputAliases declares them. |
$mcp_conversation_id | string | The 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:
- The
conversation_idthe agent sent, when conversation IDs are on. - The session ID on a
2025-11-25request. - 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:
$mcp_vendor_client, the only way to tell apart Anthropic surfaces like Claude.ai and Cowork, which share a client name.$mcp_client_user_agent, which tells apart Claude Code's CLI, SDK, VS Code, and desktop interfaces.$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.
| Property | Description |
|---|---|
$exception_list | The exceptions, each with type, value (the message), mechanism, and a parsed stacktrace. An Error.cause chain adds entries. |
$exception_level | Always "error". |
The $exception also carries the call's session, tool, server, and client properties. Intent, model, and duration stay on the main event.
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_tooland$mcp_input_requiredinstead of$mcp_tool_callfor unknown tools and2026-07-28input-required rounds. Both carry$mcp_tool_name, and$mcp_input_requiredalso has$mcp_input_request_methods, the request methods without their contents. $mcp_unknown_tool,$mcp_input_required, and$mcp_missing_capabilitydon'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 stateless2025-11-25servers. - On stateless HTTP, a request with no conversation handle gets a new session ID.
$exceptionhas no stack trace.$setneeds an explicitDistinctID.- Doesn't send
$mcp_interface.
Rust
- Sends
$mcp_unknown_tooland$mcp_input_requiredinstead of$mcp_tool_callfor unknown tools and2026-07-28input-required rounds. - Only
$mcp_tool_callcarries$mcp_source. $exceptionhas no stack trace.$setis on every event, including$exception.
Ruby
- Sends a separate
$identifyevent when the identity changes, instead of putting it on every event. - The only SDK that sends
$mcp_prompts_listand$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:
POSTHOG_MCP_ANALYTICS_SOURCE holds "posthog_mcp_analytics", the value of $mcp_source.





