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, unless the tool returns an input_required result$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.
$mcp_input_requiredA tool returns an input_required result, asking the client for more input$mcp_input_requests, $mcp_input_request_methods. See multi round-trip requests in tool calls.
$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. On tool calls and $mcp_input_required.
$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".

Multi round-trip requests in tool calls

A tool can ask for more input before it finishes, such as asking the user to confirm a payment. On earlier protocol revisions, the server sends the client a request during the call. On revision 2026-07-28, the tool returns a result that asks for the input instead. The spec calls this pattern multi round-trip requests (MRTR):

  1. The tool returns an input_required result instead of its final result. Its inputRequests say what it needs, usually an elicitation: a message or form the client shows the user.
  2. The client collects the input, then retries the original request with the inputResponses. It also sends back any requestState the tool returned. The retry is a new request, with its own ID.
  3. The tool runs again with the input. It returns its final result, or another input_required result.

The SDK sends $mcp_input_required for each input_required result, and $mcp_tool_call for the retry that completes the call. So a tool that asks for input still counts as one tool call. Both events carry $mcp_parameters, the tool's arguments.

prompts/get and resources/read can return an input_required result too, but the SDKs don't record those yet.

PropertyTypeOnDescription
$mcp_input_requestsobject$mcp_input_requiredThe result's inputRequests, under their keys. An elicitation/create request keeps its params, such as mode, message, and requestedSchema. Any other input request, such as sampling/createMessage or roots/list, keeps only its method.
$mcp_input_request_methodsstring[]$mcp_input_requiredThe method of each input request, such as ["elicitation/create"].
$mcp_input_responsesobjectThe retry's $mcp_tool_call, or its $mcp_input_required if the tool asks for more inputThe action of each elicitation response: accept, decline, or cancel. Never its content, which holds what the user entered. A response without one of these actions, such as a roots/list response, is {}.

For example, a send_invoice tool asks the user to confirm with a form mode elicitation, and the user accepts. The first request sends $mcp_input_required. The SDK redacts the email address in the message:

JSON
{
"$mcp_tool_name": "send_invoice",
"$mcp_input_request_methods": ["elicitation/create"],
"$mcp_input_requests": {
"confirm": {
"method": "elicitation/create",
"params": {
"mode": "form",
"message": "Send the invoice to [redacted]?",
"requestedSchema": { "type": "object", "properties": { "note": { "type": "string" } } }
}
}
}
}

The retry sends $mcp_tool_call. It keeps the user's action, but not the note they typed:

JSON
{
"$mcp_tool_name": "send_invoice",
"$mcp_input_responses": { "confirm": { "action": "accept" } }
}

A result with only a requestState records {} and []. Privacy lists everything the SDK leaves out.

Clients on earlier protocol revisions can't receive an input_required result. Some MCP SDKs, such as the TypeScript SDK with its legacy shim, ask the client for the input within the same call. That call is one $mcp_tool_call. When the MCP SDK can't do that, the call is a failed $mcp_tool_call with $mcp_error_type: "input_required".

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

  • $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

  • Only $mcp_tool_call carries $mcp_source.
  • $exception has no stack trace.
  • $set is on every event, including $exception.

Ruby

  • $set is on every event, including $exception.
  • 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?