Sign In

@posthog/mcp

Package Overview
Dependencies
Maintainers
22
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@posthog/mcp - npm Package Compare versions

Comparing version
0.10.9
to
0.11.0
+33
dist/extensions/headers.d.ts
/**
* The single place this package reads an HTTP request header.
*
* The MCP SDK hands us `IsomorphicHeaders` — a plain
* `Record<string, string | string[] | undefined>`, not a `Headers` instance — so
* values come out by bracket access rather than `.get()`. MCP SDK v2 plans to
* pass a real `Headers` object instead; funnelling every read through here keeps
* that migration a one-function change instead of a hunt for bracket lookups.
*/
/**
* Reads one header value out of an `IsomorphicHeaders` bag. `name` must be
* lower-cased: the HTTP transports build the bag with
* `Object.fromEntries(req.headers.entries())` and the Fetch spec lower-cases
* header names. A hand-rolled transport can still hand us mixed-case keys, so a
* case-insensitive scan backs up the direct lookup.
*
* Repeated headers arrive as an array — we take the first entry, since every
* header we read is single-valued by definition. Returns `undefined` for a
* missing, non-string, or blank value, and never throws: a malformed header from
* an untrusted client must not break the request it rode in on.
*/
export declare function readHeaderValue(headers: unknown, name: string): string | undefined;
/**
* Coerces one raw header value into a clean string, or `undefined`.
*
* Exported so the custom-dispatcher path can apply the same rules to values a host
* read off the request itself. Without it the two integration paths emit different
* properties for the *same* request: a whitespace-only header would survive as a junk
* value, and a repeated header would reach the wire as an array, because the
* downstream length cap passes non-strings through untouched.
*/
export declare function normalizeHeaderString(value: unknown): string | undefined;
//# sourceMappingURL=headers.d.ts.map
{"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../src/extensions/headers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAWlF;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAOxE"}
"use strict";
var __webpack_require__ = {};
(()=>{
__webpack_require__.d = (exports1, definition)=>{
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
enumerable: true,
get: definition[key]
});
};
})();
(()=>{
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
__webpack_require__.r = (exports1)=>{
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
value: 'Module'
});
Object.defineProperty(exports1, '__esModule', {
value: true
});
};
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
normalizeHeaderString: ()=>normalizeHeaderString,
readHeaderValue: ()=>readHeaderValue
});
function readHeaderValue(headers, name) {
if (!headers || 'object' != typeof headers) return;
const record = headers;
let value = record[name];
if (void 0 === value) {
const key = Object.keys(record).find((k)=>k.toLowerCase() === name);
value = void 0 === key ? void 0 : record[key];
}
return normalizeHeaderString(value);
}
function normalizeHeaderString(value) {
const first = Array.isArray(value) ? value[0] : value;
if ('string' != typeof first) return;
const trimmed = first.trim();
return trimmed.length > 0 ? trimmed : void 0;
}
exports.normalizeHeaderString = __webpack_exports__.normalizeHeaderString;
exports.readHeaderValue = __webpack_exports__.readHeaderValue;
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
"normalizeHeaderString",
"readHeaderValue"
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
Object.defineProperty(exports, '__esModule', {
value: true
});
function readHeaderValue(headers, name) {
if (!headers || 'object' != typeof headers) return;
const record = headers;
let value = record[name];
if (void 0 === value) {
const key = Object.keys(record).find((k)=>k.toLowerCase() === name);
value = void 0 === key ? void 0 : record[key];
}
return normalizeHeaderString(value);
}
function normalizeHeaderString(value) {
const first = Array.isArray(value) ? value[0] : value;
if ('string' != typeof first) return;
const trimmed = first.trim();
return trimmed.length > 0 ? trimmed : void 0;
}
export { normalizeHeaderString, readHeaderValue };
import type { CompatibleRequestHandlerExtra, McpEvent } from '../types';
/**
* Transport-level client identity: the two request headers that say *which
* product* is calling, where `clientInfo` only says which client library is.
*
* MCP's own identity fields are too coarse to attribute usage to a surface. A
* vendor ships many products on one client: Anthropic reports
* `clientInfo.name = "claude-code"` from the CLI, the Agent SDK, the VS Code
* extension, the desktop app and more, so `$mcp_client_name` collapses all of
* them into one bucket. The distinguishing detail exists only in the User-Agent
* parenthetical — `claude-code/2.1.0 (cli)` vs `claude-code/2.1.0 (sdk-ts)` vs
* `claude-code/2.1.0 (claude-vscode)` — alongside vendor-specific headers like
* `x-anthropic-client`. Capturing them is the only way a server owner can tell
* their surfaces apart.
*
* We capture the raw strings and classify nothing. No vendor table, no product
* labels: friendly names are resolved at query time server-side, so labels can
* improve (and new surfaces can appear) without waiting on an SDK release, and
* there is exactly one resolver rather than one per installed SDK version.
*
* This is deliberately separate from `client-identity.ts`. That module reads the
* request body's `_meta` and therefore works on every transport, including stdio
* and in-memory. Headers exist only on HTTP transports, so everything here is a
* silent no-op elsewhere and those events stay byte-identical to before.
*/
/** Header carrying the client's product/surface, e.g. `claude-code/2.1.0 (cli)`. */
export declare const CLIENT_USER_AGENT_HEADER = "user-agent";
/**
* Vendor-specific client header. Anthropic's clients send it alongside the
* User-Agent; it is captured verbatim as a second, independent signal rather
* than merged into one, so a query-time resolver can prefer whichever the
* vendor keeps stable.
*/
export declare const VENDOR_CLIENT_HEADER = "x-anthropic-client";
export interface TransportIdentity {
clientUserAgent?: string;
vendorClient?: string;
}
/**
* Reads the transport identity headers off `extra.requestInfo.headers`. Returns
* `undefined` when the request carries neither — including every stdio and
* in-memory request, which has no `requestInfo` at all. Never throws.
*/
export declare function readTransportIdentity(extra: CompatibleRequestHandlerExtra | undefined): TransportIdentity | undefined;
/**
* Stamps the transport identity onto the event being built for *this* request,
* so it carries `$mcp_client_user_agent` and `$mcp_vendor_client`.
*
* Headers are per-request, so this writes to the event — a per-request object —
* and never to the server-wide `sessionInfo`. One instrumented server can
* multiplex concurrent requests from different clients, and caching a header
* into shared state would attribute one client's surface to another's event.
* `client-identity.ts` and `capture.ts` guard the same hazard.
*
* Values are capped downstream by `truncateEvent`, which runs on every capture
* path, so a hostile 1MB header cannot inflate an event.
*/
export declare function stampTransportIdentity(event: McpEvent, extra: CompatibleRequestHandlerExtra | undefined): void;
//# sourceMappingURL=transport-identity.d.ts.map
{"version":3,"file":"transport-identity.d.ts","sourceRoot":"","sources":["../../src/extensions/transport-identity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGvE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,oFAAoF;AACpF,eAAO,MAAM,wBAAwB,eAAe,CAAA;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,uBAAuB,CAAA;AAExD,MAAM,WAAW,iBAAiB;IAChC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,6BAA6B,GAAG,SAAS,GAAG,iBAAiB,GAAG,SAAS,CAkBrH;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,6BAA6B,GAAG,SAAS,GAAG,IAAI,CAW9G"}
"use strict";
var __webpack_require__ = {};
(()=>{
__webpack_require__.d = (exports1, definition)=>{
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
enumerable: true,
get: definition[key]
});
};
})();
(()=>{
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
__webpack_require__.r = (exports1)=>{
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
value: 'Module'
});
Object.defineProperty(exports1, '__esModule', {
value: true
});
};
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
VENDOR_CLIENT_HEADER: ()=>VENDOR_CLIENT_HEADER,
stampTransportIdentity: ()=>stampTransportIdentity,
CLIENT_USER_AGENT_HEADER: ()=>CLIENT_USER_AGENT_HEADER,
readTransportIdentity: ()=>readTransportIdentity
});
const external_headers_js_namespaceObject = require("./headers.js");
const CLIENT_USER_AGENT_HEADER = 'user-agent';
const VENDOR_CLIENT_HEADER = 'x-anthropic-client';
function readTransportIdentity(extra) {
const headers = extra?.requestInfo?.headers;
if (!headers) return;
const result = {};
const clientUserAgent = (0, external_headers_js_namespaceObject.readHeaderValue)(headers, CLIENT_USER_AGENT_HEADER);
if (clientUserAgent) result.clientUserAgent = clientUserAgent;
const vendorClient = (0, external_headers_js_namespaceObject.readHeaderValue)(headers, VENDOR_CLIENT_HEADER);
if (vendorClient) result.vendorClient = vendorClient;
return result.clientUserAgent || result.vendorClient ? result : void 0;
}
function stampTransportIdentity(event, extra) {
const identity = readTransportIdentity(extra);
if (!identity) return;
if (identity.clientUserAgent) event.clientUserAgent = identity.clientUserAgent;
if (identity.vendorClient) event.vendorClient = identity.vendorClient;
}
exports.CLIENT_USER_AGENT_HEADER = __webpack_exports__.CLIENT_USER_AGENT_HEADER;
exports.VENDOR_CLIENT_HEADER = __webpack_exports__.VENDOR_CLIENT_HEADER;
exports.readTransportIdentity = __webpack_exports__.readTransportIdentity;
exports.stampTransportIdentity = __webpack_exports__.stampTransportIdentity;
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
"CLIENT_USER_AGENT_HEADER",
"VENDOR_CLIENT_HEADER",
"readTransportIdentity",
"stampTransportIdentity"
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
Object.defineProperty(exports, '__esModule', {
value: true
});
import { readHeaderValue } from "./headers.mjs";
const CLIENT_USER_AGENT_HEADER = 'user-agent';
const VENDOR_CLIENT_HEADER = 'x-anthropic-client';
function readTransportIdentity(extra) {
const headers = extra?.requestInfo?.headers;
if (!headers) return;
const result = {};
const clientUserAgent = readHeaderValue(headers, CLIENT_USER_AGENT_HEADER);
if (clientUserAgent) result.clientUserAgent = clientUserAgent;
const vendorClient = readHeaderValue(headers, VENDOR_CLIENT_HEADER);
if (vendorClient) result.vendorClient = vendorClient;
return result.clientUserAgent || result.vendorClient ? result : void 0;
}
function stampTransportIdentity(event, extra) {
const identity = readTransportIdentity(extra);
if (!identity) return;
if (identity.clientUserAgent) event.clientUserAgent = identity.clientUserAgent;
if (identity.vendorClient) event.vendorClient = identity.vendorClient;
}
export { CLIENT_USER_AGENT_HEADER, VENDOR_CLIENT_HEADER, readTransportIdentity, stampTransportIdentity };
/**
* The single place this package reads an HTTP request header.
*
* The MCP SDK hands us `IsomorphicHeaders` — a plain
* `Record<string, string | string[] | undefined>`, not a `Headers` instance — so
* values come out by bracket access rather than `.get()`. MCP SDK v2 plans to
* pass a real `Headers` object instead; funnelling every read through here keeps
* that migration a one-function change instead of a hunt for bracket lookups.
*/
/**
* Reads one header value out of an `IsomorphicHeaders` bag. `name` must be
* lower-cased: the HTTP transports build the bag with
* `Object.fromEntries(req.headers.entries())` and the Fetch spec lower-cases
* header names. A hand-rolled transport can still hand us mixed-case keys, so a
* case-insensitive scan backs up the direct lookup.
*
* Repeated headers arrive as an array — we take the first entry, since every
* header we read is single-valued by definition. Returns `undefined` for a
* missing, non-string, or blank value, and never throws: a malformed header from
* an untrusted client must not break the request it rode in on.
*/
export function readHeaderValue(headers: unknown, name: string): string | undefined {
if (!headers || typeof headers !== 'object') {
return undefined
}
const record = headers as Record<string, unknown>
let value = record[name]
if (value === undefined) {
const key = Object.keys(record).find((k) => k.toLowerCase() === name)
value = key === undefined ? undefined : record[key]
}
return normalizeHeaderString(value)
}
/**
* Coerces one raw header value into a clean string, or `undefined`.
*
* Exported so the custom-dispatcher path can apply the same rules to values a host
* read off the request itself. Without it the two integration paths emit different
* properties for the *same* request: a whitespace-only header would survive as a junk
* value, and a repeated header would reach the wire as an array, because the
* downstream length cap passes non-strings through untouched.
*/
export function normalizeHeaderString(value: unknown): string | undefined {
const first = Array.isArray(value) ? value[0] : value
if (typeof first !== 'string') {
return undefined
}
const trimmed = first.trim()
return trimmed.length > 0 ? trimmed : undefined
}
import type { CompatibleRequestHandlerExtra, McpEvent } from '../types'
import { readHeaderValue } from './headers'
/**
* Transport-level client identity: the two request headers that say *which
* product* is calling, where `clientInfo` only says which client library is.
*
* MCP's own identity fields are too coarse to attribute usage to a surface. A
* vendor ships many products on one client: Anthropic reports
* `clientInfo.name = "claude-code"` from the CLI, the Agent SDK, the VS Code
* extension, the desktop app and more, so `$mcp_client_name` collapses all of
* them into one bucket. The distinguishing detail exists only in the User-Agent
* parenthetical — `claude-code/2.1.0 (cli)` vs `claude-code/2.1.0 (sdk-ts)` vs
* `claude-code/2.1.0 (claude-vscode)` — alongside vendor-specific headers like
* `x-anthropic-client`. Capturing them is the only way a server owner can tell
* their surfaces apart.
*
* We capture the raw strings and classify nothing. No vendor table, no product
* labels: friendly names are resolved at query time server-side, so labels can
* improve (and new surfaces can appear) without waiting on an SDK release, and
* there is exactly one resolver rather than one per installed SDK version.
*
* This is deliberately separate from `client-identity.ts`. That module reads the
* request body's `_meta` and therefore works on every transport, including stdio
* and in-memory. Headers exist only on HTTP transports, so everything here is a
* silent no-op elsewhere and those events stay byte-identical to before.
*/
/** Header carrying the client's product/surface, e.g. `claude-code/2.1.0 (cli)`. */
export const CLIENT_USER_AGENT_HEADER = 'user-agent'
/**
* Vendor-specific client header. Anthropic's clients send it alongside the
* User-Agent; it is captured verbatim as a second, independent signal rather
* than merged into one, so a query-time resolver can prefer whichever the
* vendor keeps stable.
*/
export const VENDOR_CLIENT_HEADER = 'x-anthropic-client'
export interface TransportIdentity {
clientUserAgent?: string
vendorClient?: string
}
/**
* Reads the transport identity headers off `extra.requestInfo.headers`. Returns
* `undefined` when the request carries neither — including every stdio and
* in-memory request, which has no `requestInfo` at all. Never throws.
*/
export function readTransportIdentity(extra: CompatibleRequestHandlerExtra | undefined): TransportIdentity | undefined {
const headers = extra?.requestInfo?.headers
if (!headers) {
return undefined
}
const result: TransportIdentity = {}
const clientUserAgent = readHeaderValue(headers, CLIENT_USER_AGENT_HEADER)
if (clientUserAgent) {
result.clientUserAgent = clientUserAgent
}
const vendorClient = readHeaderValue(headers, VENDOR_CLIENT_HEADER)
if (vendorClient) {
result.vendorClient = vendorClient
}
return result.clientUserAgent || result.vendorClient ? result : undefined
}
/**
* Stamps the transport identity onto the event being built for *this* request,
* so it carries `$mcp_client_user_agent` and `$mcp_vendor_client`.
*
* Headers are per-request, so this writes to the event — a per-request object —
* and never to the server-wide `sessionInfo`. One instrumented server can
* multiplex concurrent requests from different clients, and caching a header
* into shared state would attribute one client's surface to another's event.
* `client-identity.ts` and `capture.ts` guard the same hazard.
*
* Values are capped downstream by `truncateEvent`, which runs on every capture
* path, so a hostile 1MB header cannot inflate an event.
*/
export function stampTransportIdentity(event: McpEvent, extra: CompatibleRequestHandlerExtra | undefined): void {
const identity = readTransportIdentity(extra)
if (!identity) {
return
}
if (identity.clientUserAgent) {
event.clientUserAgent = identity.clientUserAgent
}
if (identity.vendorClient) {
event.vendorClient = identity.vendorClient
}
}
+1
-1

@@ -1,1 +0,1 @@

{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../src/extensions/capture.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAGpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGxC;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,QAAQ,EACpB,MAAM,EAAE,QAAQ,EAChB,kBAAkB,CAAC,EAAE,WAAW,GAC/B,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAoE3B"}
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../src/extensions/capture.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAGpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGxC;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,QAAQ,EACpB,MAAM,EAAE,QAAQ,EAChB,kBAAkB,CAAC,EAAE,WAAW,GAC/B,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CA0E3B"}

@@ -53,2 +53,4 @@ "use strict";

clientVersion: eventInput.clientVersion ?? sessionInfo.clientVersion,
clientUserAgent: eventInput.clientUserAgent,
vendorClient: eventInput.vendorClient,
identifyActorGivenId: sessionInfo.identifyActorGivenId,

@@ -55,0 +57,0 @@ identifyActorData: sessionInfo.identifyActorData,

@@ -25,2 +25,4 @@ import { MCPAnalyticsEventType } from "./event-types.mjs";

clientVersion: eventInput.clientVersion ?? sessionInfo.clientVersion,
clientUserAgent: eventInput.clientUserAgent,
vendorClient: eventInput.vendorClient,
identifyActorGivenId: sessionInfo.identifyActorGivenId,

@@ -27,0 +29,0 @@ identifyActorData: sessionInfo.identifyActorData,

@@ -1,1 +0,1 @@

{"version":3,"file":"compatibility.d.ts","sourceRoot":"","sources":["../../src/extensions/compatibility.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAE3C;;;;;;;;;;;GAWG;AAGH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAI9D;AAGD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,YAAY,GAAG;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,CAIpG;AAGD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,YAAY,CAExE;AAGD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAG,aAAa,GAAG,sBAAsB,CAgChH;AAsDD,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAanE"}
{"version":3,"file":"compatibility.d.ts","sourceRoot":"","sources":["../../src/extensions/compatibility.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAE3C;;;;;;;;;;;GAWG;AAEH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAI9D;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,YAAY,GAAG;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,CAIpG;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,YAAY,CAExE;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAG,aAAa,GAAG,sBAAsB,CA6BhH;AAoDD,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAanE"}

@@ -22,2 +22,3 @@ export declare const INACTIVITY_TIMEOUT_IN_MINUTES = 30;

readonly ClientName: "$mcp_client_name";
readonly ClientUserAgent: "$mcp_client_user_agent";
readonly ClientVersion: "$mcp_client_version";

@@ -43,4 +44,5 @@ readonly ConversationId: "$mcp_conversation_id";

readonly ToolName: "$mcp_tool_name";
readonly VendorClient: "$mcp_vendor_client";
};
export type PostHogMCPAnalyticsProperty = (typeof PostHogMCPAnalyticsProperty)[keyof typeof PostHogMCPAnalyticsProperty];
//# sourceMappingURL=constants.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/extensions/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,6BAA6B,KAAK,CAAA;AAE/C,eAAO,MAAM,qCAAqC,2hBAAyhB,CAAA;AAE3kB,eAAO,MAAM,mCAAmC,4LACsI,CAAA;AAEtL,eAAO,MAAM,4BAA4B,0BAA0B,CAAA;AAMnE,eAAO,MAAM,oBAAoB,qBAAqB,CAAA;AAItD,eAAO,MAAM,wBAAwB;;;;;;;;;;;;CAY3B,CAAA;AAEV,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,OAAO,wBAAwB,CAAC,CAAA;AAE/G,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;CAsB9B,CAAA;AAEV,MAAM,MAAM,2BAA2B,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,OAAO,2BAA2B,CAAC,CAAA"}
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/extensions/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,6BAA6B,KAAK,CAAA;AAE/C,eAAO,MAAM,qCAAqC,2hBAAyhB,CAAA;AAE3kB,eAAO,MAAM,mCAAmC,4LACsI,CAAA;AAEtL,eAAO,MAAM,4BAA4B,0BAA0B,CAAA;AAMnE,eAAO,MAAM,oBAAoB,qBAAqB,CAAA;AAItD,eAAO,MAAM,wBAAwB;;;;;;;;;;;;CAY3B,CAAA;AAEV,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,OAAO,wBAAwB,CAAC,CAAA;AAE/G,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;CAwB9B,CAAA;AAEV,MAAM,MAAM,2BAA2B,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,OAAO,2BAA2B,CAAC,CAAA"}

@@ -55,2 +55,3 @@ "use strict";

ClientName: '$mcp_client_name',
ClientUserAgent: '$mcp_client_user_agent',
ClientVersion: '$mcp_client_version',

@@ -75,3 +76,4 @@ ConversationId: '$mcp_conversation_id',

ToolDescription: "$mcp_tool_description",
ToolName: '$mcp_tool_name'
ToolName: '$mcp_tool_name',
VendorClient: '$mcp_vendor_client'
};

@@ -78,0 +80,0 @@ exports.DEFAULT_CONTEXT_PARAMETER_DESCRIPTION = __webpack_exports__.DEFAULT_CONTEXT_PARAMETER_DESCRIPTION;

@@ -21,2 +21,3 @@ const INACTIVITY_TIMEOUT_IN_MINUTES = 30;

ClientName: '$mcp_client_name',
ClientUserAgent: '$mcp_client_user_agent',
ClientVersion: '$mcp_client_version',

@@ -41,4 +42,5 @@ ConversationId: '$mcp_conversation_id',

ToolDescription: "$mcp_tool_description",
ToolName: '$mcp_tool_name'
ToolName: '$mcp_tool_name',
VendorClient: '$mcp_vendor_client'
};
export { DEFAULT_CONTEXT_PARAMETER_DESCRIPTION, DEFAULT_CONVERSATION_ID_DESCRIPTION, INACTIVITY_TIMEOUT_IN_MINUTES, POSTHOG_MCP_ANALYTICS_SOURCE, POSTHOG_MCP_LIB_NAME, PostHogMCPAnalyticsEvent, PostHogMCPAnalyticsProperty };

@@ -1,1 +0,1 @@

{"version":3,"file":"context-parameters.d.ts","sourceRoot":"","sources":["../../src/extensions/context-parameters.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAGL,KAAK,6BAA6B,EACnC,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAA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AM,GAAG,SAAS,CAEjG;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,SAAS,qBAAqB,EAC3E,IAAI,EAAE,KAAK,EACX,0BAA0B,CAAC,EAAE,MAAM,EACnC,MAAM,GAAE,QAAc,GACrB,KAAK,CAqDP;AAED,wBAAgB,0BAA0B,CAAC,KAAK,SAAS,qBAAqB,EAC5E,KAAK,EAAE,KAAK,EAAE,EACd,0BAA0B,CAAC,EAAE,MAAM,EACnC,MAAM,GAAE,QAAc,GACrB,KAAK,EAAE,CAET"}

@@ -34,16 +34,5 @@ import { type AnalyticsInjectableJsonSchema } from './analytics-parameters';

* invent are not random (`conv-1`, `1`, `session`), so trusting them verbatim
* would silently merge unrelated conversations, potentially across users.
*
* A compliant agent echoes the uuidv7 we minted and is unaffected. Anything else
* is treated exactly as if the handle were absent: mint, and prompt back. Shape
* would silently merge unrelated conversations, potentially across users. Shape
* rather than a registry of issued ids, because a per-request server has no
* memory of what it minted.
*
* This narrows the problem, it does not prove provenance: a caller supplying a
* well-formed uuidv7 is trusted, so two that pick the *same* one still merge. That
* residue is far smaller than the case it replaces — an agent ignoring the
* parameter description reaches for `conv-1` or `1`, not a conforming uuidv7 — and
* closing it needs a signed handle, i.e. a secret shared by every pod. Worth doing
* if this ever anchors something security-bearing; `$session_id` is an analytics
* grouping key, so it does not today.
* memory of what it minted. Residual risk and why it's accepted: ADR-0004.
*/

@@ -50,0 +39,0 @@ export declare function resolveConversationId(enabled: boolean, args: unknown): ConversationIdResolution;

@@ -1,1 +0,1 @@

{"version":3,"file":"conversation-id.d.ts","sourceRoot":"","sources":["../../src/extensions/conversation-id.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,6BAA6B,EACnC,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAA;AAE7C,eAAO,MAAM,0BAA0B,oBAAoB,CAAA;AAE3D,MAAM,WAAW,4BAA4B;IAC3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,CAAC,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAS/F"}

@@ -1,1 +0,1 @@

{"version":3,"file":"instrument-highlevel.d.ts","sourceRoot":"","sources":["../../src/extensions/instrument-highlevel.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAEV,sBAAsB,EAIvB,MAAM,UAAU,CAAA;AASjB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAgQxC,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,CA2BhG"}
{"version":3,"file":"instrument-highlevel.d.ts","sourceRoot":"","sources":["../../src/extensions/instrument-highlevel.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAEV,sBAAsB,EAIvB,MAAM,UAAU,CAAA;AASjB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAgQxC,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,CA0BhG"}

@@ -1,1 +0,1 @@

{"version":3,"file":"instrument-lowlevel.d.ts","sourceRoot":"","sources":["../../src/extensions/instrument-lowlevel.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAiD,aAAa,EAAE,MAAM,UAAU,CAAA;AAG5F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAmBxC;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,CA0BtF"}
{"version":3,"file":"instrument-lowlevel.d.ts","sourceRoot":"","sources":["../../src/extensions/instrument-lowlevel.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAiD,aAAa,EAAE,MAAM,UAAU,CAAA;AAG5F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAmBxC;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,CAyBtF"}

@@ -80,2 +80,9 @@ import type { ListToolsResult } from '@modelcontextprotocol/sdk/types.js';

export declare function registerFallbackRequestHandler(server: MCPServerLike, handlerName: string, fallbackHandler: MCPRequestHandler, patch: HandlerPatch): void;
/**
* Applies the `patches` (keyed by method, e.g. `initialize`, `tools/list`) to the
* handlers already registered, and patches `setRequestHandler` so matching
* handlers registered later are patched too. The latter is what makes adapters
* that register handlers post-construction work — e.g. `@rekog/mcp-nest` hands a
* bare server to instrument() and only then registers its handlers.
*/
export declare function patchRequestHandlers(server: MCPServerLike, patches: Record<string, HandlerPatch>): void;

@@ -82,0 +89,0 @@ /**

@@ -1,1 +0,1 @@

{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../src/extensions/instrumentation.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AACzE,OAAO,KAAK,EACV,2BAA2B,EAC3B,6BAA6B,EAC7B,gBAAgB,EAChB,cAAc,EACd,aAAa,EAId,MAAM,UAAU,CAAA;AAajB,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAIrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAQxC;;;;;;GAMG;AAEH,KAAK,iBAAiB,GAAG,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,6BAA6B,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAE7G,2EAA2E;AAC3E,KAAK,YAAY,GAAG,CAAC,iBAAiB,EAAE,cAAc,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAE3E,UAAU,mBAAmB;IAC3B,MAAM,EAAE,aAAa,CAAA;IACrB,IAAI,EAAE,gBAAgB,CAAA;IACtB,OAAO,EAAE,cAAc,CAAA;IACvB,KAAK,CAAC,EAAE,6BAA6B,CA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AAQ,GACf,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAoB9B;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,aAAa,EACrB,wBAAwB,EAAE,iBAAiB,EAC3C,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,6BAA6B,GAAG,SAAS,EAChD,MAAM,EAAE,QAAQ,GACf,OAAO,CAAC;IAAE,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC,CAsD9C;AAqFD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,CASnH;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAGtE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,CAUjH;AA+GD;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,aAAa,EACrB,yBAAyB,EAAE,iBAAiB,EAC5C,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,6BAA6B,GAAG,SAAS,EAChD,MAAM,EAAE,QAAQ,GACf,OAAO,CAAC,OAAO,CAAC,CA4DlB"}

@@ -41,2 +41,3 @@ "use strict";

const external_client_identity_js_namespaceObject = require("./client-identity.js");
const external_transport_identity_js_namespaceObject = require("./transport-identity.js");
const external_output_instructions_js_namespaceObject = require("./output-instructions.js");

@@ -113,2 +114,3 @@ const external_capture_js_namespaceObject = require("./capture.js");

(0, external_client_identity_js_namespaceObject.stampMetaClientInfo)(event, request);
(0, external_transport_identity_js_namespaceObject.stampTransportIdentity)(event, extra);
await (0, external_tracing_helpers_js_namespaceObject.applyResolvedMetadata)(event, data, request, extra);

@@ -233,2 +235,3 @@ (0, external_intent_js_namespaceObject.setEventIntent)(event, await (0, external_intent_js_namespaceObject.resolveToolCallIntent)(data, request, ownership.context, extra));

(0, external_client_identity_js_namespaceObject.stampMetaClientInfo)(event, request);
(0, external_transport_identity_js_namespaceObject.stampTransportIdentity)(event, extra);
if (data) await (0, external_tracing_helpers_js_namespaceObject.applyResolvedMetadata)(event, data, request, extra);

@@ -406,2 +409,3 @@ const tools = await getTracedToolsList(server, originalListToolsHandler, request, extra, event, logger, requestAttribution);

(0, external_client_identity_js_namespaceObject.stampMetaClientInfo)(event, request);
(0, external_transport_identity_js_namespaceObject.stampTransportIdentity)(event, extra);
await (0, external_tracing_helpers_js_namespaceObject.applyResolvedMetadata)(event, data, request, extra);

@@ -408,0 +412,0 @@ const result = await originalInitializeHandler(request, extra);

@@ -5,2 +5,3 @@ import { getAnalyticsParameterOwnership, stripOwnedAnalyticsArguments } from "./analytics-parameters.mjs";

import { stampMetaClientInfo } from "./client-identity.mjs";
import { stampTransportIdentity } from "./transport-identity.mjs";
import { addInstructionsToOutputSchemas, mirrorInstructionsIntoStructuredContent } from "./output-instructions.mjs";

@@ -77,2 +78,3 @@ import { captureEvent } from "./capture.mjs";

stampMetaClientInfo(event, request);
stampTransportIdentity(event, extra);
await applyResolvedMetadata(event, data, request, extra);

@@ -197,2 +199,3 @@ setEventIntent(event, await resolveToolCallIntent(data, request, ownership.context, extra));

stampMetaClientInfo(event, request);
stampTransportIdentity(event, extra);
if (data) await applyResolvedMetadata(event, data, request, extra);

@@ -370,2 +373,3 @@ const tools = await getTracedToolsList(server, originalListToolsHandler, request, extra, event, logger, requestAttribution);

stampMetaClientInfo(event, request);
stampTransportIdentity(event, extra);
await applyResolvedMetadata(event, data, request, extra);

@@ -372,0 +376,0 @@ const result = await originalInitializeHandler(request, extra);

@@ -1,1 +0,1 @@

{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/extensions/internal.ts"],"names":[],"m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EACvB,kBAAkB,EAAE,WAAW,EAC/B,KAAK,CAAC,EAAE,6BAA6B;AACrC;;;;;GAKG;AACH,uBAAuB,UAAQ,GAC9B,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAuDnC;AAED,wBAAgB,YAAY,CAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,GAAG,SAAS,GAAG,WAAW,CAOtG;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,cAAc,EACvB,KAAK,CAAC,EAAE,6BAA6B,GACpC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAUzC"}

@@ -39,2 +39,3 @@ "use strict";

const external_client_identity_js_namespaceObject = require("./client-identity.js");
const external_transport_identity_js_namespaceObject = require("./transport-identity.js");
class IdentityCache {

@@ -114,2 +115,3 @@ constructor(maxSize = 1000){

(0, external_client_identity_js_namespaceObject.stampMetaClientInfo)(identifyEvent, request);
(0, external_transport_identity_js_namespaceObject.stampTransportIdentity)(identifyEvent, extra);
try {

@@ -116,0 +118,0 @@ const identityResult = 'function' == typeof data.options.identify ? await data.options.identify(request, extra) : data.options.identify;

import { MCPAnalyticsEventType } from "./event-types.mjs";
import { captureEvent } from "./capture.mjs";
import { stampMetaClientInfo } from "./client-identity.mjs";
import { stampTransportIdentity } from "./transport-identity.mjs";
class IdentityCache {

@@ -78,2 +79,3 @@ constructor(maxSize = 1000){

stampMetaClientInfo(identifyEvent, request);
stampTransportIdentity(identifyEvent, extra);
try {

@@ -80,0 +82,0 @@ const identityResult = 'function' == typeof data.options.identify ? await data.options.identify(request, extra) : data.options.identify;

import type { LoggerFn } from './logger';
/**
* The `conversation_id` session handle reaches the agent as a text block appended to the
* tool result. That block is invisible to any client that reads
* `structuredContent` instead of `content` — which is what clients do whenever a
* tool declares an `outputSchema`. Measured against Claude Code, correlation for
* such tools drops to zero.
* Mirrors the `conversation_id` session handle into `structuredContent`, in two
* halves that must stay in that order:
*
* The fix is to mirror the session handle into `structuredContent` as well, which this
* module does in two halves that must stay in that order:
*
* 1. declare `_mcp_instructions` on the tool's advertised `outputSchema`
* 2. write it into the result's `structuredContent`
*
* Needed because clients that read `structuredContent` — which they do whenever
* a tool declares an `outputSchema` — never see the `content` text block that
* carries the handle (ADR-0004).
*
* The declaration is what makes the write safe. The MCP client ajv-validates

@@ -16,0 +14,0 @@ * `structuredContent` against the schema from `tools/list`, and

@@ -1,1 +0,1 @@

{"version":3,"file":"output-instructions.d.ts","sourceRoot":"","sources":["../../src/extensions/output-instructions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAIxC;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,sBAAsB,CAAA;AAQvD,MAAM,WAAW,gCAAgC;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAgC3E;AAwCD;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,SAAS,gCAAgC,EAC1F,IAAI,EAAE,KAAK,EACX,MAAM,GAAE,QAAc,GACrB,KAAK,CA8CP;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,SAAS,gCAAgC,EAC3F,KAAK,EAAE,KAAK,EAAE,EACd,MAAM,GAAE,QAAc,GACrB,KAAK,EAAE,CAET;AAED,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;CACrB;AAID,uFAAuF;AACvF,wBAAgB,6BAA6B,CAAC,cAAc,EAAE,MAAM,GAAG,wBAAwB,CAE9F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uCAAuC,CAAC,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAkBxG"}
{"version":3,"file":"output-instructions.d.ts","sourceRoot":"","sources":["../../src/extensions/output-instructions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAIxC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,oBAAoB,sBAAsB,CAAA;AAQvD,MAAM,WAAW,gCAAgC;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAgC3E;AAwCD;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,SAAS,gCAAgC,EAC1F,IAAI,EAAE,KAAK,EACX,MAAM,GAAE,QAAc,GACrB,KAAK,CA8CP;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,SAAS,gCAAgC,EAC3F,KAAK,EAAE,KAAK,EAAE,EACd,MAAM,GAAE,QAAc,GACrB,KAAK,EAAE,CAET;AAED,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;CACrB;AAID,uFAAuF;AACvF,wBAAgB,6BAA6B,CAAC,cAAc,EAAE,MAAM,GAAG,wBAAwB,CAE9F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uCAAuC,CAAC,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAkBxG"}

@@ -101,2 +101,4 @@ "use strict";

if (event.clientVersion) properties[external_constants_js_namespaceObject.PostHogMCPAnalyticsProperty.ClientVersion] = event.clientVersion;
if (event.clientUserAgent) properties[external_constants_js_namespaceObject.PostHogMCPAnalyticsProperty.ClientUserAgent] = event.clientUserAgent;
if (event.vendorClient) properties[external_constants_js_namespaceObject.PostHogMCPAnalyticsProperty.VendorClient] = event.vendorClient;
if (event.protocolVersion) properties[external_constants_js_namespaceObject.PostHogMCPAnalyticsProperty.ProtocolVersion] = event.protocolVersion;

@@ -140,2 +142,4 @@ if (event.userIntent) properties[external_constants_js_namespaceObject.PostHogMCPAnalyticsProperty.Intent] = event.userIntent;

if (event.clientVersion) properties[external_constants_js_namespaceObject.PostHogMCPAnalyticsProperty.ClientVersion] = event.clientVersion;
if (event.clientUserAgent) properties[external_constants_js_namespaceObject.PostHogMCPAnalyticsProperty.ClientUserAgent] = event.clientUserAgent;
if (event.vendorClient) properties[external_constants_js_namespaceObject.PostHogMCPAnalyticsProperty.VendorClient] = event.vendorClient;
if (event.protocolVersion) properties[external_constants_js_namespaceObject.PostHogMCPAnalyticsProperty.ProtocolVersion] = event.protocolVersion;

@@ -142,0 +146,0 @@ addCustomEventProperties(event, properties);

@@ -73,2 +73,4 @@ import { POSTHOG_MCP_ANALYTICS_SOURCE, PostHogMCPAnalyticsEvent, PostHogMCPAnalyticsProperty } from "./constants.mjs";

if (event.clientVersion) properties[PostHogMCPAnalyticsProperty.ClientVersion] = event.clientVersion;
if (event.clientUserAgent) properties[PostHogMCPAnalyticsProperty.ClientUserAgent] = event.clientUserAgent;
if (event.vendorClient) properties[PostHogMCPAnalyticsProperty.VendorClient] = event.vendorClient;
if (event.protocolVersion) properties[PostHogMCPAnalyticsProperty.ProtocolVersion] = event.protocolVersion;

@@ -112,2 +114,4 @@ if (event.userIntent) properties[PostHogMCPAnalyticsProperty.Intent] = event.userIntent;

if (event.clientVersion) properties[PostHogMCPAnalyticsProperty.ClientVersion] = event.clientVersion;
if (event.clientUserAgent) properties[PostHogMCPAnalyticsProperty.ClientUserAgent] = event.clientUserAgent;
if (event.vendorClient) properties[PostHogMCPAnalyticsProperty.VendorClient] = event.vendorClient;
if (event.protocolVersion) properties[PostHogMCPAnalyticsProperty.ProtocolVersion] = event.protocolVersion;

@@ -114,0 +118,0 @@ addCustomEventProperties(event, properties);

@@ -1,1 +0,1 @@

{"version":3,"file":"posthog-mcp.d.ts","sourceRoot":"","sources":["../../src/extensions/posthog-mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAA;AAE3D,OAAO,KAAK,EACV,qBAAqB,EAIrB,4BAA4B,EAC5B,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,UAAU,CAAA;AACjB,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,sBAAsB,CAAA;AAQ7B;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD;;;;;OAKG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAA;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBAAa,UAAW,SAAQ,OAAO;;gBAWzB,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB;IAO3D,8FAA8F;IAC9F,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI;IAiBhD,iEAAiE;IACjE,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI;IAUpD;;;;;OAKG;IACH,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI;IAclD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,eAAe,CAAC,KAAK,SAAS,qBAAqB,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,OAAO,GAAE,sBAA2B,GAAG,KAAK,EAAE;IAYnH;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB;IAW/E;;;;OAIG;IAC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"}

@@ -33,2 +33,3 @@ "use strict";

const external_exceptions_js_namespaceObject = require("./exceptions.js");
const external_headers_js_namespaceObject = require("./headers.js");
const external_lib_identity_js_namespaceObject = require("./lib-identity.js");

@@ -119,2 +120,4 @@ const external_logger_js_namespaceObject = require("./logger.js");

protocolVersion: common.protocolVersion,
clientUserAgent: (0, external_headers_js_namespaceObject.normalizeHeaderString)(common.clientUserAgent),
vendorClient: (0, external_headers_js_namespaceObject.normalizeHeaderString)(common.vendorClient),
timestamp: common.timestamp ?? new Date(),

@@ -121,0 +124,0 @@ properties: common.properties,

@@ -5,2 +5,3 @@ import { PostHog } from "posthog-node";

import { captureException } from "./exceptions.mjs";
import { normalizeHeaderString } from "./headers.mjs";
import { applyMcpLibIdentity } from "./lib-identity.mjs";

@@ -91,2 +92,4 @@ import { log } from "./logger.mjs";

protocolVersion: common.protocolVersion,
clientUserAgent: normalizeHeaderString(common.clientUserAgent),
vendorClient: normalizeHeaderString(common.vendorClient),
timestamp: common.timestamp ?? new Date(),

@@ -93,0 +96,0 @@ properties: common.properties,

@@ -1,1 +0,1 @@

{"version":3,"file":"session-token.d.ts","sourceRoot":"","sources":["../../src/extensions/session-token.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,kBAAkB,mBAAmB,CAAA;AAElD,oCAAoC;AACpC,MAAM,WAAW,mBAAmB;IAClC,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAA;IACjB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kDAAkD;IAClD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAWD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAepE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,GAAG,IAAI,CAiC1E;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAgBzE;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAsBpF"}
{"version":3,"file":"session-token.d.ts","sourceRoot":"","sources":["../../src/extensions/session-token.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,eAAO,MAAM,kBAAkB,mBAAmB,CAAA;AAElD,oCAAoC;AACpC,MAAM,WAAW,mBAAmB;IAClC,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAA;IACjB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kDAAkD;IAClD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAWD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAepE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,GAAG,IAAI,CAiC1E;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEzE;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAsBpF"}

@@ -27,8 +27,9 @@ "use strict";

__webpack_require__.d(__webpack_exports__, {
decodeSessionId: ()=>decodeSessionId,
writeSessionIdToTransport: ()=>writeSessionIdToTransport,
MCP_SESSION_HEADER: ()=>MCP_SESSION_HEADER,
decodeSessionId: ()=>decodeSessionId,
encodeSessionId: ()=>encodeSessionId,
readMcpSessionHeader: ()=>readMcpSessionHeader,
writeSessionIdToTransport: ()=>writeSessionIdToTransport
readMcpSessionHeader: ()=>readMcpSessionHeader
});
const external_headers_js_namespaceObject = require("./headers.js");
const MCP_SESSION_HEADER = 'mcp-session-id';

@@ -70,13 +71,3 @@ const MAX_TOKEN_LENGTH = 4096;

function readMcpSessionHeader(headers) {
if (!headers || 'object' != typeof headers) return;
const record = headers;
let value = record[MCP_SESSION_HEADER];
if (void 0 === value) {
const key = Object.keys(record).find((k)=>k.toLowerCase() === MCP_SESSION_HEADER);
value = void 0 === key ? void 0 : record[key];
}
const first = Array.isArray(value) ? value[0] : value;
if ('string' != typeof first) return;
const trimmed = first.trim();
return trimmed.length > 0 ? trimmed : void 0;
return (0, external_headers_js_namespaceObject.readHeaderValue)(headers, MCP_SESSION_HEADER);
}

@@ -83,0 +74,0 @@ function writeSessionIdToTransport(transport, token) {

@@ -0,1 +1,2 @@

import { readHeaderValue } from "./headers.mjs";
const MCP_SESSION_HEADER = 'mcp-session-id';

@@ -37,13 +38,3 @@ const MAX_TOKEN_LENGTH = 4096;

function readMcpSessionHeader(headers) {
if (!headers || 'object' != typeof headers) return;
const record = headers;
let value = record[MCP_SESSION_HEADER];
if (void 0 === value) {
const key = Object.keys(record).find((k)=>k.toLowerCase() === MCP_SESSION_HEADER);
value = void 0 === key ? void 0 : record[key];
}
const first = Array.isArray(value) ? value[0] : value;
if ('string' != typeof first) return;
const trimmed = first.trim();
return trimmed.length > 0 ? trimmed : void 0;
return readHeaderValue(headers, MCP_SESSION_HEADER);
}

@@ -50,0 +41,0 @@ function writeSessionIdToTransport(transport, token) {

@@ -9,5 +9,6 @@ import type { CompatibleRequestHandlerExtra, MCPAnalyticsData, MCPServerLike, SessionInfo } from '../types';

/**
* Derives the SDK session id from the agent's conversation handle. Deterministic
* and unsalted on purpose: two pods that never met must agree on the session, and
* the 2026-07-28 revision leaves them no shared state to agree through.
* Derives the SDK session id from the agent's conversation handle (ADR-0004).
* Deterministic and unsalted on purpose: two pods that never met must agree on
* the session, and the 2026-07-28 revision leaves them no shared state to agree
* through.
*

@@ -14,0 +15,0 @@ * Hashed rather than used verbatim so an MCP session can never collide with a

@@ -1,1 +0,1 @@

{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/extensions/session.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,6BAA6B,EAC7B,gBAAgB,EAChB,aAAa,EAEb,WAAW,EACZ,MAAM,UAAU,CAAA;AAOjB,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,+BAA+B,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,aAAa,EACrB,KAAK,CAAC,EAAE,6BAA6B,EACrC,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM,CA0CR;AA4ED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,gBAAgB,GAAG,SAAS,EAClC,SAAS,CAAC,EAAE,MAAM,GACjB,WAAW,CAmCb"}
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/extensions/session.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,6BAA6B,EAC7B,gBAAgB,EAChB,aAAa,EAEb,WAAW,EACZ,MAAM,UAAU,CAAA;AAOjB,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,+BAA+B,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,aAAa,EACrB,KAAK,CAAC,EAAE,6BAA6B,EACrC,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM,CAgCR;AAuED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,gBAAgB,GAAG,SAAS,EAClC,SAAS,CAAC,EAAE,MAAM,GACjB,WAAW,CAmCb"}

@@ -27,5 +27,4 @@ import type { PostHog } from 'posthog-node';

/**
* Wraps a user-supplied `posthog-node` client. Runs every MCP event through the
* sanitize → truncate pipeline, fans it out into the `$mcp_*` / `$exception`
* events, applies `beforeSend`, and hands each to `posthog.capture()`.
* Wraps a user-supplied `posthog-node` client: runs every MCP event through
* {@link processMcpEvent} and hands each surviving payload to `posthog.capture()`.
*

@@ -41,5 +40,4 @@ * The SDK does not own the client lifecycle — the host application constructs

/**
* Push an MCP event through the pipeline (sanitize → truncate → fan out →
* beforeSend → capture). Errors at any stage are logged and the event is
* dropped, never re-thrown into tool code.
* Errors at any stage are logged and the event is dropped, never re-thrown
* into tool code.
*/

@@ -46,0 +44,0 @@ capture(event: McpEvent, options: McpCaptureOptions): Promise<void>;

@@ -1,1 +0,1 @@

{"version":3,"file":"sink.d.ts","sourceRoot":"","sources":["../../src/extensions/sink.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAG3C,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,EAAE,KAAK,mBAAmB,EAA6B,MAAM,kBAAkB,CAAA;AAKtF,yEAAyE;AACzE,MAAM,WAAW,iBAAiB;IAChC,0BAA0B,EAAE,OAAO,CAAA;IACnC,kFAAkF;IAClF,UAAU,CAAC,EAAE,YAAY,CAAA;CAC1B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,iBAAiB,EAC1B,MAAM,GAAE,QAAc,GACrB,O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AM,GAAE,QAAc;IAGzC;;;OAGG;IACG,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAmC1E"}

@@ -1,1 +0,1 @@

{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/extensions/tools.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAC9F,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAA;AAE7C,eAAO,MAAM,mBAAmB,EAAG,gBAAyB,CAAA;AAE5D;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,CAAC,EAAE;IAAE,yBAAyB,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEzG;AAED,KAAK,2BAA2B,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAEnE,wBAAgB,8BAA8B,CAAC,IAAI,GAAE,MAA4B,GAAG,2BAA2B,CA6B9G;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,CASnD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM,GAAE,QAAc,GAAG,cAAc,CAGrG"}
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/extensions/tools.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAC9F,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAA;AAE7C,eAAO,MAAM,mBAAmB,EAAG,gBAAyB,CAAA;AAE5D;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,CAAC,EAAE;IAAE,yBAAyB,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEzG;AAED,KAAK,2BAA2B,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAEnE,wBAAgB,8BAA8B,CAAC,IAAI,GAAE,MAA4B,GAAG,2BAA2B,CA0B9G;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,CASnD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM,GAAE,QAAc,GAAG,cAAc,CAGrG"}

@@ -1,1 +0,1 @@

{"version":3,"file":"truncation.d.ts","sourceRoot":"","sources":["../../src/extensions/truncation.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAmB,KAAK,EAAc,QAAQ,EAAE,MAAM,UAAU,CAAA;AAG5E,eAAO,MAAM,SAAS,KAAK,CAAA;AAC3B,eAAO,MAAM,WAAW,MAAM,CAAA;AAC9B,eAAO,MAAM,iBAAiB,QAAS,CAAA;AACvC,eAAO,MAAM,eAAe,SAAU,CAAA;AAgBtC;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,OAAO,EACd,KAAK,GAAE,MAAkB,EACzB,UAAU,GAAE,MAAoB,EAChC,eAAe,GAAE,MAA0B,GAC1C,OAAO,CAGT;AAkXD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,KAAK,GAAG,QAAQ,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAoCrE"}
{"version":3,"file":"truncation.d.ts","sourceRoot":"","sources":["../../src/extensions/truncation.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAmB,KAAK,EAAc,QAAQ,EAAE,MAAM,UAAU,CAAA;AAG5E,eAAO,MAAM,SAAS,KAAK,CAAA;AAC3B,eAAO,MAAM,WAAW,MAAM,CAAA;AAC9B,eAAO,MAAM,iBAAiB,QAAS,CAAA;AACvC,eAAO,MAAM,eAAe,SAAU,CAAA;AAgBtC;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,OAAO,EACd,KAAK,GAAE,MAAkB,EACzB,UAAU,GAAE,MAAoB,EAChC,eAAe,GAAE,MAA0B,GAC1C,OAAO,CAGT;AAkXD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,KAAK,GAAG,QAAQ,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAwCrE"}

@@ -253,2 +253,4 @@ "use strict";

result.clientVersion = truncateString(result.clientVersion, MAX_METADATA_LENGTH);
result.clientUserAgent = truncateString(result.clientUserAgent, MAX_METADATA_LENGTH);
result.vendorClient = truncateString(result.vendorClient, MAX_METADATA_LENGTH);
result.errorType = truncateString(result.errorType, MAX_METADATA_LENGTH);

@@ -255,0 +257,0 @@ if (null != result.error && 'object' == typeof result.error) result.error = truncateExceptionList(result.error);

@@ -220,2 +220,4 @@ const MAX_DEPTH = 10;

result.clientVersion = truncateString(result.clientVersion, MAX_METADATA_LENGTH);
result.clientUserAgent = truncateString(result.clientUserAgent, MAX_METADATA_LENGTH);
result.vendorClient = truncateString(result.vendorClient, MAX_METADATA_LENGTH);
result.errorType = truncateString(result.errorType, MAX_METADATA_LENGTH);

@@ -222,0 +224,0 @@ if (null != result.error && 'object' == typeof result.error) result.error = truncateExceptionList(result.error);

@@ -131,2 +131,11 @@ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';

clientName?: string;
/**
* Raw `user-agent` request header → `$mcp_client_user_agent`. HTTP transports
* only. The only place a client's *surface* is distinguishable: one vendor
* ships many products under a single `clientName` (Anthropic's CLI, Agent SDK
* and VS Code extension all report `claude-code`), and only the User-Agent
* parenthetical tells them apart. Captured verbatim — surfaces are resolved to
* friendly labels at query time, never in this SDK.
*/
clientUserAgent?: string;
clientVersion?: string;

@@ -180,2 +189,8 @@ conversationId?: string;

userIntentSource?: MCPAnalyticsIntentSource;
/**
* Raw vendor client header (`x-anthropic-client`) → `$mcp_vendor_client`. HTTP
* transports only. A second, independent surface signal alongside
* {@link Event.clientUserAgent}; captured verbatim, never classified.
*/
vendorClient?: string;
}

@@ -315,2 +330,20 @@ /** A partially-built MCP event as it flows through the SDK before capture. */

protocolVersion?: string;
/**
* Raw `user-agent` request header → `$mcp_client_user_agent`. The
* `instrument()` path reads this off the transport automatically; a custom
* dispatcher has no `extra`, so pass `req.headers['user-agent']` yourself.
*
* Worth wiring up: it is the only signal that separates a vendor's surfaces
* (Anthropic's CLI, Agent SDK and VS Code extension all report
* `clientName: "claude-code"`, and only the User-Agent parenthetical —
* `(cli)` / `(sdk-ts)` / `(claude-vscode)` — tells them apart). Send it raw;
* PostHog resolves friendly product labels at query time.
*/
clientUserAgent?: string;
/**
* Raw vendor client header → `$mcp_vendor_client`. Anthropic's clients send
* `x-anthropic-client`; pass it as a second, independent surface signal
* alongside {@link McpCaptureCommon.clientUserAgent}. Sent verbatim.
*/
vendorClient?: string;
/** Person properties → `$set` (e.g. `{ name, email, plan }`). */

@@ -317,0 +350,0 @@ setProperties?: JsonRecord;

@@ -1,1 +0,1 @@

{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEnD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEhD,+FAA+F;AAC/F,MAAM,MAAM,eAAe,GAAG,aAAa,CAA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aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,4EAA4E;IAC5E,YAAY,CAAC,EAAE,wBAAwB,CAAA;IACvC,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,6DAA6D;IAC7D,mBAAmB,EAAE,OAAO,CAAA;CAC7B;AAED,gGAAgG;AAChG,MAAM,WAAW,4BAA6B,SAAQ,gBAAgB;IACpE;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB"}

@@ -1,2 +0,2 @@

export declare const version = "0.10.9";
export declare const version = "0.11.0";
//# sourceMappingURL=version.d.ts.map

@@ -29,3 +29,3 @@ "use strict";

});
const version = '0.10.9';
const version = '0.11.0';
exports.version = __webpack_exports__.version;

@@ -32,0 +32,0 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [

@@ -1,2 +0,2 @@

const version = '0.10.9';
const version = '0.11.0';
export { version };
{
"name": "@posthog/mcp",
"version": "0.10.9",
"version": "0.11.0",
"bugs": {

@@ -5,0 +5,0 @@ "url": "https://github.com/PostHog/posthog-js/issues"

@@ -63,2 +63,8 @@ // Portions of this file are derived from agentcathq/agentcat-typescript-sdk

clientVersion: eventInput.clientVersion ?? sessionInfo.clientVersion,
// Read from this request's headers only — there is deliberately no
// sessionInfo fallback to coalesce with. Headers ride every HTTP request, so
// a remembered value would just be a chance to attribute a sibling request's
// client surface to this event.
clientUserAgent: eventInput.clientUserAgent,
vendorClient: eventInput.vendorClient,
identifyActorGivenId: sessionInfo.identifyActorGivenId,

@@ -65,0 +71,0 @@ identifyActorData: sessionInfo.identifyActorData,

@@ -24,3 +24,2 @@ // Portions of this file are derived from agentcathq/agentcat-typescript-sdk

// Function to log compatibility information
export function logCompatibilityWarning(logger: LoggerFn): void {

@@ -32,3 +31,2 @@ logger(

// Check if server has high-level structure (wrapper with .server property)
export function isHighLevelServer(server: unknown): server is ServerRecord & { server: ServerRecord } {

@@ -40,3 +38,2 @@ return (

// Check if server has low-level structure (no .server property)
export function isLowLevelServer(server: unknown): server is ServerRecord {

@@ -46,3 +43,2 @@ return !!server && typeof server === 'object' && !('server' in server)

// Type guard function that validates server compatibility and returns typed server
export function isCompatibleServerType(server: unknown, logger: LoggerFn): MCPServerLike | HighLevelMCPServerLike {

@@ -57,3 +53,2 @@ if (!server || typeof server !== 'object') {

if (isHighLevelServer(server)) {
// Validate high-level server requirements
if (!server._registeredTools || typeof server._registeredTools !== 'object') {

@@ -72,3 +67,2 @@ logCompatibilityWarning(logger)

// Validate the underlying low-level server
const targetServer = server.server

@@ -79,3 +73,2 @@ validateLowLevelServer(targetServer, logger)

}
// Direct low-level server validation
validateLowLevelServer(server, logger)

@@ -85,3 +78,2 @@ return server as MCPServerLike

// Helper function to validate low-level server requirements
function validateLowLevelServer(server: unknown, logger: LoggerFn): void {

@@ -111,3 +103,2 @@ if (!server || typeof server !== 'object') {

// Validate that _requestHandlers contains functions with compatible signatures
if (typeof serverRecord._requestHandlers.get !== 'function') {

@@ -114,0 +105,0 @@ logCompatibilityWarning(logger)

@@ -41,2 +41,3 @@ // Portions of this file are derived from agentcathq/agentcat-typescript-sdk

ClientName: '$mcp_client_name',
ClientUserAgent: '$mcp_client_user_agent',
ClientVersion: '$mcp_client_version',

@@ -62,4 +63,5 @@ ConversationId: '$mcp_conversation_id',

ToolName: '$mcp_tool_name',
VendorClient: '$mcp_vendor_client',
} as const
export type PostHogMCPAnalyticsProperty = (typeof PostHogMCPAnalyticsProperty)[keyof typeof PostHogMCPAnalyticsProperty]

@@ -44,3 +44,2 @@ // Portions of this file are derived from agentcathq/agentcat-typescript-sdk

): TTool {
// Create a shallow copy of the tool to avoid modifying the original
const modifiedTool = { ...tool }

@@ -59,6 +58,2 @@ const toolName = tool.name || 'unknown'

// Note: If additionalProperties is false, we'll need to remove that constraint
// when adding context, otherwise the schema would be invalid. We handle this
// after the deep copy below.
if (!modifiedTool.inputSchema) {

@@ -74,3 +69,3 @@ modifiedTool.inputSchema = {

// Deep copy the inputSchema to avoid mutations
// Deep copy: the server may reuse or freeze the schema object it handed us.
modifiedTool.inputSchema = JSON.parse(JSON.stringify(modifiedTool.inputSchema)) as AnalyticsInjectableJsonSchema

@@ -80,3 +75,2 @@

// Ensure properties object exists
if (!inputSchema.properties) {

@@ -86,4 +80,4 @@ inputSchema.properties = {}

// Handle additionalProperties: false - must remove this constraint since we're adding context
// The MCP SDK adds this constraint when converting Zod schemas to JSON Schema
// The MCP SDK emits `additionalProperties: false` when converting Zod schemas;
// left in place it would make the injected `context` key invalid.
if (inputSchema.additionalProperties === false) {

@@ -93,3 +87,2 @@ inputSchema.additionalProperties = undefined

// Add context property
inputSchema.properties.context = {

@@ -100,3 +93,2 @@ type: 'string',

// Add context to required array
if (Array.isArray(inputSchema.required)) {

@@ -103,0 +95,0 @@ if (!inputSchema.required.includes('context')) {

@@ -105,16 +105,5 @@ // Portions of this file are derived from agentcathq/agentcat-typescript-sdk

* invent are not random (`conv-1`, `1`, `session`), so trusting them verbatim
* would silently merge unrelated conversations, potentially across users.
*
* A compliant agent echoes the uuidv7 we minted and is unaffected. Anything else
* is treated exactly as if the handle were absent: mint, and prompt back. Shape
* would silently merge unrelated conversations, potentially across users. Shape
* rather than a registry of issued ids, because a per-request server has no
* memory of what it minted.
*
* This narrows the problem, it does not prove provenance: a caller supplying a
* well-formed uuidv7 is trusted, so two that pick the *same* one still merge. That
* residue is far smaller than the case it replaces — an agent ignoring the
* parameter description reaches for `conv-1` or `1`, not a conforming uuidv7 — and
* closing it needs a signed handle, i.e. a secret shared by every pod. Worth doing
* if this ever anchors something security-bearing; `$session_id` is an analytics
* grouping key, so it does not today.
* memory of what it minted. Residual risk and why it's accepted: ADR-0004.
*/

@@ -127,6 +116,5 @@ export function resolveConversationId(enabled: boolean, args: unknown): ConversationIdResolution {

if (supplied && MINTED_CONVERSATION_ID.test(supplied)) {
// Lowercased because the shape test is case-insensitive but the hash behind
// `$session_id` is not. Some hosts normalise uuids to uppercase, and an
// uppercased echo of our own handle would otherwise clear the gate and then
// land in a different session than the call that minted it.
// Lowercased: the shape test is case-insensitive but the hash behind
// `$session_id` is not, so an uppercased echo (some hosts normalise uuids)
// would land in a different session than the call that minted it.
return { minted: false, conversationId: supplied.toLowerCase() }

@@ -133,0 +121,0 @@ }

@@ -283,3 +283,2 @@ // Portions of this file are derived from agentcathq/agentcat-typescript-sdk

// Patch already existing handlers, and patch setRequestHandler to capture dynamically created handlers.
const handlers: Record<string, HandlerPatch> = {

@@ -286,0 +285,0 @@ initialize: (trackedServer, originalHandler, request, extra) =>

@@ -35,3 +35,2 @@ // Portions of this file are derived from agentcathq/agentcat-typescript-sdk

try {
// Patch already existing handlers, and patch setRequestHandler to capture dynamically created handlers.
const hadCallToolHandler = server._requestHandlers.has('tools/call')

@@ -38,0 +37,0 @@ const traceToolCall: HandlerPatch = (server, originalHandler, request, extra) =>

@@ -27,2 +27,3 @@ // Portions of this file are derived from agentcathq/agentcat-typescript-sdk

import { stampMetaClientInfo } from './client-identity'
import { stampTransportIdentity } from './transport-identity'
import { addInstructionsToOutputSchemas, mirrorInstructionsIntoStructuredContent } from './output-instructions'

@@ -161,18 +162,9 @@ import { captureEvent } from './capture'

conversationId: data.options.enableConversationId === true && ownership?.conversationId === true,
// Deliberately read off `listed`, never the override. This asks whether
// `tools/list` actually declared `_mcp_instructions`, and only the advertised
// JSON Schema can answer it — an override is built from the live registry,
// which on the high-level path holds Zod.
//
// The cache is per-instance, so this is not merely "before the first
// `tools/list`": an instance that never serves a listing never writes the
// mirror at all. That is the per-request server pattern — `tools/list` lands
// on one instance, `tools/call` on a cold one — where the handle falls back
// to the `content` block and a structuredContent-only client misses it.
//
// Failing closed is deliberate. Writing a key the advertised schema did not
// declare fails the *entire* tool result under `additionalProperties: false`,
// so guessing costs the caller their result, while not guessing costs us one
// delivery channel. The fix is a process-scoped ownership cache, so a listing
// served by any instance answers for the rest — not a per-call guess.
// Deliberately read off `listed`, never the override: only the advertised
// JSON Schema can say whether `tools/list` declared `_mcp_instructions` (an
// override is built from the live registry, which holds Zod on the
// high-level path). An instance that never served a listing has no answer
// and fails closed — writing an undeclared key fails the customer's entire
// tool result under `additionalProperties: false`. See ADR-0004 for the
// per-request-instance gap this leaves and the planned fix.
outputInstructions: data.options.enableConversationId === true && listed?.outputInstructions === true,

@@ -242,2 +234,5 @@ }

stampMetaClientInfo(event, request)
// Which *surface* of the client made this call lives only in the request
// headers (HTTP transports); `clientInfo` can't tell a vendor's products apart.
stampTransportIdentity(event, extra)

@@ -256,15 +251,10 @@ await applyResolvedMetadata(event, data, request, extra)

/**
* Delivers the conversation session handle back to the agent, over both channels a tool
* result has:
* Delivers the conversation session handle back to the agent over both channels
* a tool result has: mirrored into `structuredContent` on every response (for
* tools whose output schema declares the key), and as a `content` text block on
* the minting response only. Why two channels and why those cadences: ADR-0004.
*
* - `structuredContent`, on *every* response for a tool whose output schema we
* declared the key on. Clients that read structured results never see the text
* block, and re-sending it each time lets an agent that dropped the session handle read
* it back.
* - `content`, as a text block, only on the response that minted the session handle.
* Repeating it every call would put a `[SERVER]:` line in front of the user on
* every single tool result.
*
* If neither channel could carry a session handle we minted, the agent never received it,
* so clear it off the event rather than showing analytics an id nobody has.
* If neither channel could carry a session handle we minted, the agent never
* received it, so clear it off the event rather than showing analytics an id
* nobody has.
*/

@@ -371,9 +361,3 @@ function applyConversationInstructions(

/**
* Applies the `patches` (keyed by method, e.g. `initialize`, `tools/list`) to the
* handlers already registered, and patches `setRequestHandler` so matching
* handlers registered later are patched too. The latter is what makes adapters
* that register handlers post-construction work — e.g. `@rekog/mcp-nest` hands a
* bare server to instrument() and only then registers its handlers.
*/
/** Pre-patch handlers, kept so `isToolAdvertised` can query the raw listing. */
const originalRequestHandlers = new WeakMap<MCPServerLike, Map<string, MCPRequestHandler>>()

@@ -425,4 +409,10 @@

/**
* Applies the `patches` (keyed by method, e.g. `initialize`, `tools/list`) to the
* handlers already registered, and patches `setRequestHandler` so matching
* handlers registered later are patched too. The latter is what makes adapters
* that register handlers post-construction work — e.g. `@rekog/mcp-nest` hands a
* bare server to instrument() and only then registers its handlers.
*/
export function patchRequestHandlers(server: MCPServerLike, patches: Record<string, HandlerPatch>): void {
// Monkey patch existing handlers.
for (const [handlerName, patch] of Object.entries(patches)) {

@@ -528,2 +518,3 @@ const originalHandler = server._requestHandlers.get(handlerName)

stampMetaClientInfo(event, request)
stampTransportIdentity(event, extra)

@@ -693,3 +684,3 @@ if (data) {

* the header on every request, so any pod recovers them with no server-side
* store (decoded in `getSessionId`).
* store (decoded in `getSessionId`). See ADR-0003.
*

@@ -841,2 +832,3 @@ * The header only reaches the wire when response headers are built after the

stampMetaClientInfo(event, request)
stampTransportIdentity(event, extra)

@@ -843,0 +835,0 @@ await applyResolvedMetadata(event, data, request, extra)

@@ -18,2 +18,3 @@ // Portions of this file are derived from agentcathq/agentcat-typescript-sdk

import { stampMetaClientInfo } from './client-identity'
import { stampTransportIdentity } from './transport-identity'

@@ -157,2 +158,3 @@ /**

stampMetaClientInfo(identifyEvent, request)
stampTransportIdentity(identifyEvent, extra)

@@ -171,7 +173,6 @@ try {

// $identify. Every event still carries distinct_id/$set regardless, so
// person properties are never lost. Known gap: if identity is null at
// `initialize` but resolves later on a token session, that first $identify
// is suppressed too, so any pre-identify (anonymous) events aren't aliased
// onto the user. Inherent to statelessness (no pod knows a sibling already
// announced); revisit with the stateless-by-default rework.
// person properties are never lost. Known accepted gap (ADR-0003): an
// identity resolving only after `initialize` on a token session gets no
// standalone $identify, so its pre-identify events aren't aliased onto
// the user.
const changed = previousIdentity !== undefined && !areIdentitiesEqual(previousIdentity, mergedIdentity)

@@ -178,0 +179,0 @@ const firstSeen = previousIdentity === undefined

@@ -6,14 +6,12 @@ import type { LoggerFn } from './logger'

/**
* The `conversation_id` session handle reaches the agent as a text block appended to the
* tool result. That block is invisible to any client that reads
* `structuredContent` instead of `content` — which is what clients do whenever a
* tool declares an `outputSchema`. Measured against Claude Code, correlation for
* such tools drops to zero.
* Mirrors the `conversation_id` session handle into `structuredContent`, in two
* halves that must stay in that order:
*
* The fix is to mirror the session handle into `structuredContent` as well, which this
* module does in two halves that must stay in that order:
*
* 1. declare `_mcp_instructions` on the tool's advertised `outputSchema`
* 2. write it into the result's `structuredContent`
*
* Needed because clients that read `structuredContent` — which they do whenever
* a tool declares an `outputSchema` — never see the `content` text block that
* carries the handle (ADR-0004).
*
* The declaration is what makes the write safe. The MCP client ajv-validates

@@ -20,0 +18,0 @@ * `structuredContent` against the schema from `tools/list`, and

@@ -154,2 +154,10 @@ // Portions of this file are derived from agentcathq/agentcat-typescript-sdk

}
// HTTP transports only, and only for the request that carried the header —
// stdio and in-memory servers simply never set these.
if (event.clientUserAgent) {
properties[PostHogMCPAnalyticsProperty.ClientUserAgent] = event.clientUserAgent
}
if (event.vendorClient) {
properties[PostHogMCPAnalyticsProperty.VendorClient] = event.vendorClient
}
// Present on every event once negotiated at `initialize` (carried via

@@ -246,2 +254,8 @@ // sessionInfo / the session token). Absent only before the handshake.

}
if (event.clientUserAgent) {
properties[PostHogMCPAnalyticsProperty.ClientUserAgent] = event.clientUserAgent
}
if (event.vendorClient) {
properties[PostHogMCPAnalyticsProperty.VendorClient] = event.vendorClient
}
if (event.protocolVersion) {

@@ -248,0 +262,0 @@ properties[PostHogMCPAnalyticsProperty.ProtocolVersion] = event.protocolVersion

@@ -22,2 +22,3 @@ import { PostHog, type PostHogOptions } from 'posthog-node'

import { captureException } from './exceptions'
import { normalizeHeaderString } from './headers'
import { applyMcpLibIdentity } from './lib-identity'

@@ -76,6 +77,2 @@ import { log } from './logger'

export class PostHogMCP extends PostHog {
// Reuses the shared sink so MCP events flow through the identical
// sanitize/truncate/fan-out pipeline as the `instrument()` path; the sink
// publishes via `this` (the inherited `capture()`), so the client's own
// `beforeSend` and batching apply.
readonly #sink = new McpEventSink(this)

@@ -90,3 +87,2 @@

this.#missingCapabilityToolName = options.missingCapabilityToolName ?? GET_MORE_TOOLS_NAME
// Report `$lib: 'posthog-node-mcp'` instead of the inherited `posthog-node`.
applyMcpLibIdentity(this)

@@ -250,2 +246,8 @@ }

protocolVersion: common.protocolVersion,
// There is no `extra` on this path, so the host reads the request headers and
// passes them per capture — the SDK has no transport to read them from. Normalized
// with the same rules `instrument()` applies, so one request yields one set of
// properties whichever path captured it.
clientUserAgent: normalizeHeaderString(common.clientUserAgent),
vendorClient: normalizeHeaderString(common.vendorClient),
timestamp: common.timestamp ?? new Date(),

@@ -252,0 +254,0 @@ properties: common.properties,

@@ -13,2 +13,4 @@ /**

import { readHeaderValue } from './headers'
export const MCP_SESSION_HEADER = 'mcp-session-id'

@@ -109,17 +111,3 @@

export function readMcpSessionHeader(headers: unknown): string | undefined {
if (!headers || typeof headers !== 'object') {
return undefined
}
const record = headers as Record<string, unknown>
let value = record[MCP_SESSION_HEADER]
if (value === undefined) {
const key = Object.keys(record).find((k) => k.toLowerCase() === MCP_SESSION_HEADER)
value = key === undefined ? undefined : record[key]
}
const first = Array.isArray(value) ? value[0] : value
if (typeof first !== 'string') {
return undefined
}
const trimmed = first.trim()
return trimmed.length > 0 ? trimmed : undefined
return readHeaderValue(headers, MCP_SESSION_HEADER)
}

@@ -126,0 +114,0 @@

@@ -33,5 +33,6 @@ // Portions of this file are derived from agentcathq/agentcat-typescript-sdk

/**
* Derives the SDK session id from the agent's conversation handle. Deterministic
* and unsalted on purpose: two pods that never met must agree on the session, and
* the 2026-07-28 revision leaves them no shared state to agree through.
* Derives the SDK session id from the agent's conversation handle (ADR-0004).
* Deterministic and unsalted on purpose: two pods that never met must agree on
* the session, and the 2026-07-28 revision leaves them no shared state to agree
* through.
*

@@ -73,22 +74,12 @@ * Hashed rather than used verbatim so an MCP session can never collide with a

// 1. The agent's conversation handle. It outranks both steps below because it
// is the only id that survives reconnects, restarts, and the per-request
// server instances the 2026-07-28 revision introduces. Hashed rather than used
// verbatim so it can never collide with Session Replay ids.
//
// This returns instead of falling through to the shared-state writes at the
// end: the handle belongs to this one request, and persisting it would leak
// one chat's session onto a concurrent chat's `tools/list`.
//
// `lastActivity` therefore does not advance either, so a conversation that
// always echoes lets the in-memory fallback age past the inactivity timeout —
// and a later call carrying no handle rotates it. That is the honest reading:
// the fallback session really has been idle for that whole time.
// 1. The agent's conversation handle — the only id that survives reconnects,
// restarts, and the per-request server instances of the 2026-07-28 revision
// (ADR-0004). Returns before the shared-state writes at the end: the handle
// belongs to this one request, and persisting it (or advancing lastActivity)
// would leak one chat's session onto a concurrent chat's `tools/list`.
if (conversationId) {
// The handle decides the *session*, but the request may still carry our token,
// and on a stateless instance that never processed `initialize` its payload is
// the only place client identity exists. Restore that before returning: the
// early return is about not persisting a session, not about ignoring what the
// request told us about the client. Without this, tool calls and `$identify`
// go out unattributed on exactly the deployments this branch exists for.
// The session comes from the handle, but on an instance that never processed
// `initialize` the request's token is still the only source of client
// identity — without this, tool calls and `$identify` go out unattributed
// on exactly the deployments this branch exists for.
applyTokenClientIdentity(data, extra)

@@ -115,10 +106,6 @@ return deriveSessionIdFromConversation(conversationId)

* mint time, and hands the decoded token back so the caller can also take the
* session id from it.
*
* Split out from step 2 because the two halves of the token have different
* scopes. The session id it carries is per-chat, so a conversation-anchored
* request must not adopt it. The client identity is per-connection — the same
* client for every request on it — so a conversation-anchored request should,
* and on a stateless instance that never saw `initialize` this is the only
* source of it.
* session id from it. Split from step 2 because the token's two halves have
* different scopes: its session id is per-chat (a conversation-anchored request
* must not adopt it), its client identity is per-connection (every request on
* the connection should).
*/

@@ -145,5 +132,4 @@ function applyTokenClientIdentity(

*
* Both are 2025-11-25 mechanisms. The 2026-07-28 revision removed that header
* outright — servers MUST NOT mint or echo it — so this entire step becomes
* legacy-only once era detection lands.
* Both are 2025-11-25 mechanisms; the 2026-07-28 revision removed the header
* outright, so this step is legacy-only once era detection lands (ADR-0003).
*/

@@ -210,4 +196,4 @@ function readSessionIdFromRequest(data: MCPAnalyticsData, extra?: CompatibleRequestHandlerExtra): string | undefined {

const sessionInfo: SessionInfo = {
ipAddress: undefined, // grab from django
sdkLanguage: 'TypeScript', // hardcoded for now
ipAddress: undefined,
sdkLanguage: 'TypeScript',
sdkVersion: version,

@@ -214,0 +200,0 @@ serverName: server._serverInfo?.name,

@@ -95,5 +95,4 @@ // Portions of this file are derived from agentcathq/agentcat-typescript-sdk

/**
* Wraps a user-supplied `posthog-node` client. Runs every MCP event through the
* sanitize → truncate pipeline, fans it out into the `$mcp_*` / `$exception`
* events, applies `beforeSend`, and hands each to `posthog.capture()`.
* Wraps a user-supplied `posthog-node` client: runs every MCP event through
* {@link processMcpEvent} and hands each surviving payload to `posthog.capture()`.
*

@@ -111,5 +110,4 @@ * The SDK does not own the client lifecycle — the host application constructs

/**
* Push an MCP event through the pipeline (sanitize → truncate → fan out →
* beforeSend → capture). Errors at any stage are logged and the event is
* dropped, never re-thrown into tool code.
* Errors at any stage are logged and the event is dropped, never re-thrown
* into tool code.
*/

@@ -116,0 +114,0 @@ async capture(event: McpEvent, options: McpCaptureOptions): Promise<void> {

@@ -39,11 +39,8 @@ // Portions of this file are derived from agentcathq/agentcat-typescript-sdk

title: 'Get More Tools',
// Doesn't mutate state on the MCP server
readOnlyHint: true,
// Interacts with external entities because we store this in analytics
// Interacts with an external entity: the report lands in analytics.
openWorldHint: true,
// A tool like `get_more_tools` would usually NOT be idempontent, but since we are
// only using this to keep track of missing tools/feedback/analytics, it is actually idempontent.
// It's also preferable to track it as idempontent to make agents more prone to call it proactively.
// Only records the gap, so repeat calls are harmless — and advertising it
// as idempotent makes agents more willing to call it proactively.
idempotentHint: true,
// Never deletes any data from the MCP server
destructiveHint: false,

@@ -50,0 +47,0 @@ },

@@ -433,2 +433,6 @@ // Portions of this file are derived from agentcathq/agentcat-typescript-sdk

result.clientVersion = truncateString(result.clientVersion, MAX_METADATA_LENGTH)
// Client-supplied HTTP headers, so unlike the fields above they are attacker-
// controlled in length. Any real User-Agent fits well inside the metadata cap.
result.clientUserAgent = truncateString(result.clientUserAgent, MAX_METADATA_LENGTH)
result.vendorClient = truncateString(result.vendorClient, MAX_METADATA_LENGTH)
result.errorType = truncateString(result.errorType, MAX_METADATA_LENGTH)

@@ -435,0 +439,0 @@

@@ -154,2 +154,11 @@ // Portions of this file are derived from agentcathq/agentcat-typescript-sdk

clientName?: string
/**
* Raw `user-agent` request header → `$mcp_client_user_agent`. HTTP transports
* only. The only place a client's *surface* is distinguishable: one vendor
* ships many products under a single `clientName` (Anthropic's CLI, Agent SDK
* and VS Code extension all report `claude-code`), and only the User-Agent
* parenthetical tells them apart. Captured verbatim — surfaces are resolved to
* friendly labels at query time, never in this SDK.
*/
clientUserAgent?: string
clientVersion?: string

@@ -203,2 +212,8 @@ conversationId?: string

userIntentSource?: MCPAnalyticsIntentSource
/**
* Raw vendor client header (`x-anthropic-client`) → `$mcp_vendor_client`. HTTP
* transports only. A second, independent surface signal alongside
* {@link Event.clientUserAgent}; captured verbatim, never classified.
*/
vendorClient?: string
}

@@ -349,2 +364,20 @@

protocolVersion?: string
/**
* Raw `user-agent` request header → `$mcp_client_user_agent`. The
* `instrument()` path reads this off the transport automatically; a custom
* dispatcher has no `extra`, so pass `req.headers['user-agent']` yourself.
*
* Worth wiring up: it is the only signal that separates a vendor's surfaces
* (Anthropic's CLI, Agent SDK and VS Code extension all report
* `clientName: "claude-code"`, and only the User-Agent parenthetical —
* `(cli)` / `(sdk-ts)` / `(claude-vscode)` — tells them apart). Send it raw;
* PostHog resolves friendly product labels at query time.
*/
clientUserAgent?: string
/**
* Raw vendor client header → `$mcp_vendor_client`. Anthropic's clients send
* `x-anthropic-client`; pass it as a second, independent surface signal
* alongside {@link McpCaptureCommon.clientUserAgent}. Sent verbatim.
*/
vendorClient?: string
/** Person properties → `$set` (e.g. `{ name, email, plan }`). */

@@ -351,0 +384,0 @@ setProperties?: JsonRecord

@@ -1,1 +0,1 @@

export const version = '0.10.9'
export const version = '0.11.0'