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.11.1
to
0.11.2
+70
-15
dist/extensions/client-identity.d.ts

@@ -1,11 +0,22 @@

import type { McpEvent, MCPRequestLike } from '../types';
import type { CompatibleRequestHandlerExtra, McpEvent, MCPRequestLike, MCPServerLike } from '../types';
/**
* Client identity under the MCP 2026-07-28 (stateless) revision.
* Client identity — who is calling, and which spec revision they speak.
*
* That revision removes the `initialize` handshake and the `Mcp-Session-Id`
* header (SEP-2575 / SEP-2567). Client name/version and the protocol version no
* longer arrive once at `initialize` — they travel in every request's
* `params._meta` under these reverse-DNS keys. We mirror the literal key strings
* here rather than depend on the (still beta) v2 SDK, which is not a dependency
* of this package.
* Where it lives depends on the revision the *request* declares, so this is a
* fallback chain and never a branch: one server serves both eras, request by
* request.
*
* 1. `ctx.mcpReq.envelope` — MCP SDK v2 lifts the reserved
* `io.modelcontextprotocol/*` keys out of `_meta` before dispatch, so by
* the time a handler runs they are here and `params._meta` is empty.
* 2. `request.params._meta` — where 2026-07-28 puts them on the wire, and
* where they still are on any server that does not lift them.
* 3. the server's own accessors — `getClientVersion()` from a legacy
* `initialize` handshake, `getNegotiatedProtocolVersion()` on v2.
*
* The 2026-07-28 revision removed the `initialize` handshake and the
* `Mcp-Session-Id` header (SEP-2575 / SEP-2567), so client name/version and the
* protocol version no longer arrive once per connection — they travel with
* every request. The key strings are mirrored here rather than imported,
* because no `@modelcontextprotocol/*` package is a dependency of this one.
*/

@@ -19,2 +30,14 @@ export declare const META_CLIENT_INFO_KEY = "io.modelcontextprotocol/clientInfo";

}
/** Everything a request can be asked about who is calling. */
export interface ClientIdentitySources {
request: MCPRequestLike;
extra?: CompatibleRequestHandlerExtra;
/**
* Typed `unknown` on purpose: every accessor on it is reached through a
* structural probe, never a declared type, because the two SDK majors expose
* different ones. Call sites pass a real `MCPServerLike`; the shape checks
* here are what decide whether it can answer.
*/
server?: unknown;
}
/**

@@ -27,7 +50,39 @@ * Reads the client name/version and protocol version a modern client puts in

/**
* Stamps any client identity found in `params._meta` directly onto the event
* being built for *this* request, so it carries `$mcp_client_name`,
* `$mcp_client_version`, and `$mcp_protocol_version` even when there was no
* `initialize` to learn them from (the modern stateless case).
* Reads the same keys from MCP SDK v2's request envelope. v2 strips the reserved
* `io.modelcontextprotocol/*` keys from `_meta` while parsing, so on exactly the
* traffic this matters for, `readMetaClientInfo` finds nothing and this finds
* everything.
*/
export declare function readEnvelopeClientInfo(extra: CompatibleRequestHandlerExtra | undefined): MetaClientInfo | undefined;
/**
* Asks the server itself. `getClientVersion()` answers on any server that
* handled an `initialize` (and v2 hosts such as `createMcpHandler` backfill it
* from the envelope); `getNegotiatedProtocolVersion()` exists on v2 only, which
* is why it is a link in the chain rather than a branch. Never throws — a
* server that dislikes being asked must not fail the tool call.
*/
export declare function readServerClientIdentity(server: unknown): MetaClientInfo | undefined;
/**
* Resolves client identity through the whole chain, field by field: the first
* source that answers a field wins, and a source that answers nothing simply
* does not participate. Field-by-field rather than source-by-source because a
* request may carry its protocol version in the envelope while the client's
* name is only known to the server from a handshake.
*
* The first three links are **per request**, so they cannot describe anyone but
* the caller. Only the last — the server's own accessors — is connection-scoped,
* and on a server that multiplexes several clients through one connection it
* answers for whichever client completed the handshake. That is the best answer
* available on that connection, and it is the same scope `capture.ts` has always
* fallen back to (`eventInput.clientName ?? sessionInfo.clientName`), so the
* chain neither introduces that sharing nor widens it. Ordering it last is what
* keeps it a fallback: any request that identifies itself wins outright.
*/
export declare function resolveClientIdentity({ request, extra, server }: ClientIdentitySources): MetaClientInfo | undefined;
/**
* Stamps whatever the chain resolved onto the event being built for *this*
* request, so it carries `$mcp_client_name`, `$mcp_client_version` and
* `$mcp_protocol_version` even when there was no `initialize` to learn them
* from (the modern stateless case).
*
* Writing to the event — a per-request object — rather than the server-wide

@@ -37,6 +92,6 @@ * `sessionInfo` keeps identity correct when one instrumented server multiplexes

* a sibling request can't clobber this event's attribution between now and when
* it's captured. Only fields the request actually carries are set, so a request
* without `_meta` leaves the event's existing values untouched.
* it's captured. Only fields actually resolved are set, so a request that
* carries nothing leaves the event's existing values untouched.
*/
export declare function stampMetaClientInfo(event: McpEvent, request: MCPRequestLike): void;
export declare function stampClientIdentity(event: McpEvent, request: MCPRequestLike, extra?: CompatibleRequestHandlerExtra, server?: MCPServerLike): void;
//# sourceMappingURL=client-identity.d.ts.map
+1
-1

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

{"version":3,"file":"client-identity.d.ts","sourceRoot":"","sources":["../../src/extensions/client-identity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAExD;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,uCAAuC,CAAA;AACxE,eAAO,MAAM,yBAAyB,4CAA4C,CAAA;AAElF,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,GAAG,SAAS,CAyBtF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAclF"}
{"version":3,"file":"client-identity.d.ts","sourceRoot":"","sources":["../../src/extensions/client-identity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAGtG;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,oBAAoB,uCAAuC,CAAA;AACxE,eAAO,MAAM,yBAAyB,4CAA4C,CAAA;AAElF,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,8DAA8D;AAC9D,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,cAAc,CAAA;IACvB,KAAK,CAAC,EAAE,6BAA6B,CAAA;IACrC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAuCD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,GAAG,SAAS,CAEtF;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,6BAA6B,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,CAEnH;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAsBpF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,qBAAqB,GAAG,cAAc,GAAG,SAAS,CAYnH;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,cAAc,EACvB,KAAK,CAAC,EAAE,6BAA6B,EACrC,MAAM,CAAC,EAAE,aAAa,GACrB,IAAI,CAcN"}

@@ -27,26 +27,75 @@ "use strict";

__webpack_require__.d(__webpack_exports__, {
META_CLIENT_INFO_KEY: ()=>META_CLIENT_INFO_KEY,
resolveClientIdentity: ()=>resolveClientIdentity,
readMetaClientInfo: ()=>readMetaClientInfo,
readServerClientIdentity: ()=>readServerClientIdentity,
readEnvelopeClientInfo: ()=>readEnvelopeClientInfo,
META_PROTOCOL_VERSION_KEY: ()=>META_PROTOCOL_VERSION_KEY,
readMetaClientInfo: ()=>readMetaClientInfo,
stampMetaClientInfo: ()=>stampMetaClientInfo
stampClientIdentity: ()=>stampClientIdentity,
META_CLIENT_INFO_KEY: ()=>META_CLIENT_INFO_KEY
});
const external_detect_js_namespaceObject = require("./detect.js");
const META_CLIENT_INFO_KEY = 'io.modelcontextprotocol/clientInfo';
const META_PROTOCOL_VERSION_KEY = 'io.modelcontextprotocol/protocolVersion';
function nonEmptyString(value) {
return 'string' == typeof value && value.length > 0 ? value : void 0;
}
function readClientInfoValue(value) {
if (!value || 'object' != typeof value) return;
const { name, version } = value;
const result = {};
const clientName = nonEmptyString(name);
const clientVersion = nonEmptyString(version);
if (clientName) result.clientName = clientName;
if (clientVersion) result.clientVersion = clientVersion;
return result.clientName || result.clientVersion ? result : void 0;
}
function readReservedKeys(bag) {
if (!bag || 'object' != typeof bag) return;
const record = bag;
const result = {
...readClientInfoValue(record[META_CLIENT_INFO_KEY])
};
const protocolVersion = nonEmptyString(record[META_PROTOCOL_VERSION_KEY]);
if (protocolVersion) result.protocolVersion = protocolVersion;
return result.clientName || result.clientVersion || result.protocolVersion ? result : void 0;
}
function readMetaClientInfo(request) {
const meta = request.params?._meta;
if (!meta || 'object' != typeof meta) return;
const record = meta;
return readReservedKeys(request.params?._meta);
}
function readEnvelopeClientInfo(extra) {
return readReservedKeys(extra?.mcpReq?.envelope);
}
function readServerClientIdentity(server) {
if (!server) return;
const result = {};
const clientInfo = record[META_CLIENT_INFO_KEY];
if (clientInfo && 'object' == typeof clientInfo) {
const { name, version } = clientInfo;
if ('string' == typeof name && name.length > 0) result.clientName = name;
if ('string' == typeof version && version.length > 0) result.clientVersion = version;
try {
if ((0, external_detect_js_namespaceObject.hasClientVersionAccessor)(server)) Object.assign(result, readClientInfoValue(server.getClientVersion()));
if ((0, external_detect_js_namespaceObject.hasNegotiatedProtocolVersionAccessor)(server)) {
const negotiated = server.getNegotiatedProtocolVersion();
const protocolVersion = nonEmptyString(negotiated);
if (protocolVersion) result.protocolVersion = protocolVersion;
}
} catch {}
return result.clientName || result.clientVersion || result.protocolVersion ? result : void 0;
}
function resolveClientIdentity({ request, extra, server }) {
const chain = [
readEnvelopeClientInfo(extra),
readMetaClientInfo(request),
readServerClientIdentity(server)
];
const result = {};
for (const source of chain)if (source) {
result.clientName ??= source.clientName;
result.clientVersion ??= source.clientVersion;
result.protocolVersion ??= source.protocolVersion;
}
const protocolVersion = record[META_PROTOCOL_VERSION_KEY];
if ('string' == typeof protocolVersion && protocolVersion.length > 0) result.protocolVersion = protocolVersion;
return result.clientName || result.clientVersion || result.protocolVersion ? result : void 0;
}
function stampMetaClientInfo(event, request) {
const info = readMetaClientInfo(request);
function stampClientIdentity(event, request, extra, server) {
const info = resolveClientIdentity({
request,
extra,
server
});
if (!info) return;

@@ -59,9 +108,15 @@ if (info.clientName) event.clientName = info.clientName;

exports.META_PROTOCOL_VERSION_KEY = __webpack_exports__.META_PROTOCOL_VERSION_KEY;
exports.readEnvelopeClientInfo = __webpack_exports__.readEnvelopeClientInfo;
exports.readMetaClientInfo = __webpack_exports__.readMetaClientInfo;
exports.stampMetaClientInfo = __webpack_exports__.stampMetaClientInfo;
exports.readServerClientIdentity = __webpack_exports__.readServerClientIdentity;
exports.resolveClientIdentity = __webpack_exports__.resolveClientIdentity;
exports.stampClientIdentity = __webpack_exports__.stampClientIdentity;
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
"META_CLIENT_INFO_KEY",
"META_PROTOCOL_VERSION_KEY",
"readEnvelopeClientInfo",
"readMetaClientInfo",
"stampMetaClientInfo"
"readServerClientIdentity",
"resolveClientIdentity",
"stampClientIdentity"
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];

@@ -68,0 +123,0 @@ Object.defineProperty(exports, '__esModule', {

@@ -0,20 +1,66 @@

import { hasClientVersionAccessor, hasNegotiatedProtocolVersionAccessor } from "./detect.mjs";
const META_CLIENT_INFO_KEY = 'io.modelcontextprotocol/clientInfo';
const META_PROTOCOL_VERSION_KEY = 'io.modelcontextprotocol/protocolVersion';
function nonEmptyString(value) {
return 'string' == typeof value && value.length > 0 ? value : void 0;
}
function readClientInfoValue(value) {
if (!value || 'object' != typeof value) return;
const { name, version } = value;
const result = {};
const clientName = nonEmptyString(name);
const clientVersion = nonEmptyString(version);
if (clientName) result.clientName = clientName;
if (clientVersion) result.clientVersion = clientVersion;
return result.clientName || result.clientVersion ? result : void 0;
}
function readReservedKeys(bag) {
if (!bag || 'object' != typeof bag) return;
const record = bag;
const result = {
...readClientInfoValue(record[META_CLIENT_INFO_KEY])
};
const protocolVersion = nonEmptyString(record[META_PROTOCOL_VERSION_KEY]);
if (protocolVersion) result.protocolVersion = protocolVersion;
return result.clientName || result.clientVersion || result.protocolVersion ? result : void 0;
}
function readMetaClientInfo(request) {
const meta = request.params?._meta;
if (!meta || 'object' != typeof meta) return;
const record = meta;
return readReservedKeys(request.params?._meta);
}
function readEnvelopeClientInfo(extra) {
return readReservedKeys(extra?.mcpReq?.envelope);
}
function readServerClientIdentity(server) {
if (!server) return;
const result = {};
const clientInfo = record[META_CLIENT_INFO_KEY];
if (clientInfo && 'object' == typeof clientInfo) {
const { name, version } = clientInfo;
if ('string' == typeof name && name.length > 0) result.clientName = name;
if ('string' == typeof version && version.length > 0) result.clientVersion = version;
try {
if (hasClientVersionAccessor(server)) Object.assign(result, readClientInfoValue(server.getClientVersion()));
if (hasNegotiatedProtocolVersionAccessor(server)) {
const negotiated = server.getNegotiatedProtocolVersion();
const protocolVersion = nonEmptyString(negotiated);
if (protocolVersion) result.protocolVersion = protocolVersion;
}
} catch {}
return result.clientName || result.clientVersion || result.protocolVersion ? result : void 0;
}
function resolveClientIdentity({ request, extra, server }) {
const chain = [
readEnvelopeClientInfo(extra),
readMetaClientInfo(request),
readServerClientIdentity(server)
];
const result = {};
for (const source of chain)if (source) {
result.clientName ??= source.clientName;
result.clientVersion ??= source.clientVersion;
result.protocolVersion ??= source.protocolVersion;
}
const protocolVersion = record[META_PROTOCOL_VERSION_KEY];
if ('string' == typeof protocolVersion && protocolVersion.length > 0) result.protocolVersion = protocolVersion;
return result.clientName || result.clientVersion || result.protocolVersion ? result : void 0;
}
function stampMetaClientInfo(event, request) {
const info = readMetaClientInfo(request);
function stampClientIdentity(event, request, extra, server) {
const info = resolveClientIdentity({
request,
extra,
server
});
if (!info) return;

@@ -25,2 +71,2 @@ if (info.clientName) event.clientName = info.clientName;

}
export { META_CLIENT_INFO_KEY, META_PROTOCOL_VERSION_KEY, readMetaClientInfo, stampMetaClientInfo };
export { META_CLIENT_INFO_KEY, META_PROTOCOL_VERSION_KEY, readEnvelopeClientInfo, readMetaClientInfo, readServerClientIdentity, resolveClientIdentity, stampClientIdentity };

@@ -42,2 +42,8 @@ /**

export declare function hasClientVersionAccessor(server: unknown): boolean;
/**
* `getNegotiatedProtocolVersion()` — v2 only, and the last link in the protocol
* version chain. A v1 server does not have it, which is why the chain probes for
* it instead of branching on which SDK is installed.
*/
export declare function hasNegotiatedProtocolVersionAccessor(server: unknown): boolean;
/** `_serverInfo`, which names the server on every event. */

@@ -44,0 +50,0 @@ export declare function hasServerInfo(server: unknown): boolean;

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

{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../src/extensions/detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAU5C,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,aAAa,GAAG;IAAE,MAAM,EAAE,aAAa,CAAA;CAAE,CAG5G;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAG1D;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAExD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAEzD;AAED,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GAAG,OAAO,CAGtD"}

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

hasClientVersionAccessor: ()=>hasClientVersionAccessor,
hasNegotiatedProtocolVersionAccessor: ()=>hasNegotiatedProtocolVersionAccessor,
hasNestedLowLevelServer: ()=>hasNestedLowLevelServer,

@@ -67,2 +68,5 @@ hasRequestHandlerMap: ()=>hasRequestHandlerMap,

}
function hasNegotiatedProtocolVersionAccessor(server) {
return hasMethod(server, 'getNegotiatedProtocolVersion');
}
function hasServerInfo(server) {

@@ -75,2 +79,3 @@ const info = asRecord(asRecord(server)?._serverInfo);

exports.hasClientVersionAccessor = __webpack_exports__.hasClientVersionAccessor;
exports.hasNegotiatedProtocolVersionAccessor = __webpack_exports__.hasNegotiatedProtocolVersionAccessor;
exports.hasNestedLowLevelServer = __webpack_exports__.hasNestedLowLevelServer;

@@ -85,2 +90,3 @@ exports.hasRequestHandlerMap = __webpack_exports__.hasRequestHandlerMap;

"hasClientVersionAccessor",
"hasNegotiatedProtocolVersionAccessor",
"hasNestedLowLevelServer",

@@ -87,0 +93,0 @@ "hasRequestHandlerMap",

@@ -31,2 +31,5 @@ function asRecord(value) {

}
function hasNegotiatedProtocolVersionAccessor(server) {
return hasMethod(server, 'getNegotiatedProtocolVersion');
}
function hasServerInfo(server) {

@@ -36,2 +39,2 @@ const info = asRecord(asRecord(server)?._serverInfo);

}
export { canRegisterTools, canSetRequestHandler, hasClientVersionAccessor, hasNestedLowLevelServer, hasRequestHandlerMap, hasServerInfo, hasToolRegistry, isBareServerShape };
export { canRegisterTools, canSetRequestHandler, hasClientVersionAccessor, hasNegotiatedProtocolVersionAccessor, hasNestedLowLevelServer, hasRequestHandlerMap, hasServerInfo, hasToolRegistry, isBareServerShape };

@@ -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,CA0BhG"}
{"version":3,"file":"instrument-highlevel.d.ts","sourceRoot":"","sources":["../../src/extensions/instrument-highlevel.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAGV,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,3 +0,2 @@

import type { ListToolsResult } from '@modelcontextprotocol/sdk/types.js';
import type { AnalyticsParameterOwnership, CompatibleRequestHandlerExtra, MCPAnalyticsData, MCPRequestLike, MCPServerLike } from '../types';
import type { AnalyticsParameterOwnership, CompatibleRequestHandlerExtra, CompatibleToolsListLike, MCPAnalyticsData, MCPRequestLike, MCPServerLike } from '../types';
import { MCPAnalyticsEventType } from './event-types';

@@ -100,5 +99,5 @@ import type { LoggerFn } from './logger';

export declare function handleListToolsRequest(server: MCPServerLike, originalListToolsHandler: MCPRequestHandler, request: MCPRequestLike, extra: CompatibleRequestHandlerExtra | undefined, logger: LoggerFn): Promise<{
tools: ListToolsResult['tools'];
tools: CompatibleToolsListLike['tools'];
}>;
export declare function cacheToolDescriptions(cache: Map<string, string>, tools: ListToolsResult['tools'] | undefined): void;
export declare function cacheToolDescriptions(cache: Map<string, string>, tools: CompatibleToolsListLike['tools'] | undefined): void;
/**

@@ -110,3 +109,3 @@ * Category declared on a tool's `_meta` block (the MCP spec allows arbitrary

export declare function readToolMetaCategory(meta: unknown): string | undefined;
export declare function cacheToolCategories(cache: Map<string, string>, tools: ListToolsResult['tools'] | undefined): void;
export declare function cacheToolCategories(cache: Map<string, string>, tools: CompatibleToolsListLike['tools'] | undefined): void;
/**

@@ -113,0 +112,0 @@ * Captures the connection handshake (and resolves identity) on `initialize`

@@ -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;AAcjB,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAIrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AASxC;;;;;;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,CAAA;IACrC,OAAO,EAAE,YAAY,CAAA;IACrB,2FAA2F;IAC3F,kBAAkB,CAAC,EAAE,2BAA2B,CAAA;IAChD;;;;OAIG;IACH,SAAS,CAAC,EAAE,qBAAqB,CAAA;IACjC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAA;CAClC;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,CAmDnF;AA0MD;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,C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,CAAC,GAAG,SAAS,GAClD,IAAI,CASN;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAGtE;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1B,KAAK,EAAE,uBAAuB,CAAC,OAAO,CAAC,GAAG,SAAS,GAClD,IAAI,CAUN;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"}

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

};
(0, external_client_identity_js_namespaceObject.stampMetaClientInfo)(event, request);
(0, external_client_identity_js_namespaceObject.stampClientIdentity)(event, request, extra, server);
(0, external_transport_identity_js_namespaceObject.stampTransportIdentity)(event, extra);

@@ -234,3 +234,3 @@ await (0, external_tracing_helpers_js_namespaceObject.applyResolvedMetadata)(event, data, request, extra);

};
(0, external_client_identity_js_namespaceObject.stampMetaClientInfo)(event, request);
(0, external_client_identity_js_namespaceObject.stampClientIdentity)(event, request, extra, server);
(0, external_transport_identity_js_namespaceObject.stampTransportIdentity)(event, extra);

@@ -408,3 +408,3 @@ if (data) await (0, external_tracing_helpers_js_namespaceObject.applyResolvedMetadata)(event, data, request, extra);

};
(0, external_client_identity_js_namespaceObject.stampMetaClientInfo)(event, request);
(0, external_client_identity_js_namespaceObject.stampClientIdentity)(event, request, extra, server);
(0, external_transport_identity_js_namespaceObject.stampTransportIdentity)(event, extra);

@@ -411,0 +411,0 @@ await (0, external_tracing_helpers_js_namespaceObject.applyResolvedMetadata)(event, data, request, extra);

import { getAnalyticsParameterOwnership, stripOwnedAnalyticsArguments } from "./analytics-parameters.mjs";
import { addContextParameterToTools, getContextDescription, isContextEnabled } from "./context-parameters.mjs";
import { addConversationIdToTools, canInjectConversationIdPromptBack, injectConversationIdPromptBack, resolveConversationId } from "./conversation-id.mjs";
import { stampMetaClientInfo } from "./client-identity.mjs";
import { stampClientIdentity } from "./client-identity.mjs";
import { stampTransportIdentity } from "./transport-identity.mjs";

@@ -77,3 +77,3 @@ import { addInstructionsToOutputSchemas, mirrorInstructionsIntoStructuredContent } from "./output-instructions.mjs";

};
stampMetaClientInfo(event, request);
stampClientIdentity(event, request, extra, server);
stampTransportIdentity(event, extra);

@@ -198,3 +198,3 @@ await applyResolvedMetadata(event, data, request, extra);

};
stampMetaClientInfo(event, request);
stampClientIdentity(event, request, extra, server);
stampTransportIdentity(event, extra);

@@ -372,3 +372,3 @@ if (data) await applyResolvedMetadata(event, data, request, extra);

};
stampMetaClientInfo(event, request);
stampClientIdentity(event, request, extra, server);
stampTransportIdentity(event, extra);

@@ -375,0 +375,0 @@ await applyResolvedMetadata(event, data, request, extra);

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

};
(0, external_client_identity_js_namespaceObject.stampMetaClientInfo)(identifyEvent, request);
(0, external_client_identity_js_namespaceObject.stampClientIdentity)(identifyEvent, request, extra, server);
(0, external_transport_identity_js_namespaceObject.stampTransportIdentity)(identifyEvent, extra);

@@ -116,0 +116,0 @@ try {

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

@@ -78,3 +78,3 @@ class IdentityCache {

};
stampMetaClientInfo(identifyEvent, request);
stampClientIdentity(identifyEvent, request, extra, server);
stampTransportIdentity(identifyEvent, extra);

@@ -81,0 +81,0 @@ try {

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

import { type CallToolResult, type ListToolsResult } from '@modelcontextprotocol/sdk/types.js';
import type { CompatibleTextToolResult, CompatibleToolsListLike } from '../types';
import { type LoggerFn } from './logger';

@@ -12,3 +12,3 @@ export declare const GET_MORE_TOOLS_NAME: "get_more_tools";

}): string;
type ReportMissingToolDescriptor = ListToolsResult['tools'][number];
type ReportMissingToolDescriptor = CompatibleToolsListLike['tools'][number];
export declare function getReportMissingToolDescriptor(name?: string): ReportMissingToolDescriptor;

@@ -21,7 +21,7 @@ /**

*/
export declare function getMoreToolsResult(): CallToolResult;
export declare function getMoreToolsResult(): CompatibleTextToolResult;
export declare function handleReportMissing(args: {
context: string;
}, logger?: LoggerFn): CallToolResult;
}, logger?: LoggerFn): CompatibleTextToolResult;
export {};
//# sourceMappingURL=tools.d.ts.map

@@ -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,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"}
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/extensions/tools.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AACjF,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,uBAAuB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3E,wBAAgB,8BAA8B,CAAC,IAAI,GAAE,MAA4B,GAAG,2BAA2B,CA0B9G;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,wBAAwB,CAS7D;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM,GAAE,QAAc,GAAG,wBAAwB,CAG/G"}

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

import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
import type { ErrorTracking } from '@posthog/core';
import type { AnalyticsInjectableJsonSchema } from './extensions/analytics-parameters';
import type { MCPAnalyticsEventType } from './extensions/event-types';

@@ -13,2 +13,49 @@ import type { IdentityCache } from './extensions/internal';

export type StackFrame = ErrorTracking.StackFrame;
/**
* The MCP wire shapes we touch, declared structurally rather than imported from
* `@modelcontextprotocol/sdk`.
*
* Both SDK majors are **optional** peers — a v2-only consumer has no v1 SDK
* installed — so a type import of it in shipped `.d.ts` output is a `TS2307`
* for anyone type-checking without `skipLibCheck`. These are deliberately loose
* (open-ended, everything optional): they describe what we *read* off an SDK
* result, and an SDK-typed value assigns to them cleanly. What we hand back to
* the SDK is typed precisely instead — see {@link CompatibleTextToolResult}.
*/
export interface CompatibleToolResultLike {
content?: unknown[];
structuredContent?: JsonRecord;
isError?: boolean;
_meta?: JsonRecord;
[key: string]: unknown;
}
/** One entry of a `tools/list` response, as we read it. */
export interface CompatibleToolDescriptorLike {
name: string;
title?: string;
description?: string;
/** The advertised JSON Schema, as the analytics parameters are injected into it. */
inputSchema?: AnalyticsInjectableJsonSchema;
outputSchema?: unknown;
_meta?: JsonRecord;
[key: string]: unknown;
}
/** A `tools/list` response, as we read it. */
export interface CompatibleToolsListLike {
tools: CompatibleToolDescriptorLike[];
nextCursor?: string;
[key: string]: unknown;
}
/**
* A text-only tool result *we* construct and a host may hand straight back to
* the SDK. Typed precisely, not loosely, so it stays assignable to the SDK's own
* `CallToolResult` — the direction that would silently break callers.
*/
export interface CompatibleTextToolResult {
content: {
type: 'text';
text: string;
}[];
isError?: boolean;
}
export interface MCPRequestParamsLike {

@@ -108,3 +155,3 @@ arguments?: JsonRecord;

export type MCPAnalyticsIntentSource = 'context_parameter' | 'inferred';
export type ToolCallback = ((args: unknown, extra: CompatibleRequestHandlerExtra) => CallToolResult | Promise<CallToolResult>) | ((extra: CompatibleRequestHandlerExtra) => CallToolResult | Promise<CallToolResult>);
export type ToolCallback = ((args: unknown, extra: CompatibleRequestHandlerExtra) => CompatibleToolResultLike | Promise<CompatibleToolResultLike>) | ((extra: CompatibleRequestHandlerExtra) => CompatibleToolResultLike | Promise<CompatibleToolResultLike>);
export type RegisteredTool = {

@@ -222,2 +269,11 @@ description?: string;

http?: CompatibleHttpRequestLike;
/**
* MCP SDK v2's parsed request. It lifts the reserved `io.modelcontextprotocol/*`
* keys out of `params._meta` into `envelope`, so client identity is here rather
* than on the request by the time a handler runs.
*/
mcpReq?: {
envelope?: Record<string, unknown>;
[key: string]: unknown;
};
[key: string]: unknown;

@@ -224,0 +280,0 @@ }

@@ -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,K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ACH,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.11.1";
export declare const version = "0.11.2";
//# sourceMappingURL=version.d.ts.map

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

});
const version = '0.11.1';
const version = '0.11.2';
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.11.1';
const version = '0.11.2';
export { version };
{
"name": "@posthog/mcp",
"version": "0.11.1",
"version": "0.11.2",
"bugs": {

@@ -37,2 +37,3 @@ "url": "https://github.com/PostHog/posthog-js/issues"

"@modelcontextprotocol/sdk": "~1.29.0",
"@modelcontextprotocol/server": "~2.0.0",
"@rslib/core": "0.10.6",

@@ -48,4 +49,13 @@ "@types/jest": "^29.5.14",

"@modelcontextprotocol/sdk": ">=1.26.0",
"@modelcontextprotocol/server": ">=2.0.0",
"posthog-node": "^5.0.0"
},
"peerDependenciesMeta": {
"@modelcontextprotocol/sdk": {
"optional": true
},
"@modelcontextprotocol/server": {
"optional": true
}
},
"keywords": [

@@ -52,0 +62,0 @@ "posthog",

@@ -1,12 +0,24 @@

import type { McpEvent, MCPRequestLike } from '../types'
import type { CompatibleRequestHandlerExtra, McpEvent, MCPRequestLike, MCPServerLike } from '../types'
import { hasClientVersionAccessor, hasNegotiatedProtocolVersionAccessor } from './detect'
/**
* Client identity under the MCP 2026-07-28 (stateless) revision.
* Client identity — who is calling, and which spec revision they speak.
*
* That revision removes the `initialize` handshake and the `Mcp-Session-Id`
* header (SEP-2575 / SEP-2567). Client name/version and the protocol version no
* longer arrive once at `initialize` — they travel in every request's
* `params._meta` under these reverse-DNS keys. We mirror the literal key strings
* here rather than depend on the (still beta) v2 SDK, which is not a dependency
* of this package.
* Where it lives depends on the revision the *request* declares, so this is a
* fallback chain and never a branch: one server serves both eras, request by
* request.
*
* 1. `ctx.mcpReq.envelope` — MCP SDK v2 lifts the reserved
* `io.modelcontextprotocol/*` keys out of `_meta` before dispatch, so by
* the time a handler runs they are here and `params._meta` is empty.
* 2. `request.params._meta` — where 2026-07-28 puts them on the wire, and
* where they still are on any server that does not lift them.
* 3. the server's own accessors — `getClientVersion()` from a legacy
* `initialize` handshake, `getNegotiatedProtocolVersion()` on v2.
*
* The 2026-07-28 revision removed the `initialize` handshake and the
* `Mcp-Session-Id` header (SEP-2575 / SEP-2567), so client name/version and the
* protocol version no longer arrive once per connection — they travel with
* every request. The key strings are mirrored here rather than imported,
* because no `@modelcontextprotocol/*` package is a dependency of this one.
*/

@@ -22,2 +34,52 @@ export const META_CLIENT_INFO_KEY = 'io.modelcontextprotocol/clientInfo'

/** Everything a request can be asked about who is calling. */
export interface ClientIdentitySources {
request: MCPRequestLike
extra?: CompatibleRequestHandlerExtra
/**
* Typed `unknown` on purpose: every accessor on it is reached through a
* structural probe, never a declared type, because the two SDK majors expose
* different ones. Call sites pass a real `MCPServerLike`; the shape checks
* here are what decide whether it can answer.
*/
server?: unknown
}
type UnknownRecord = Record<string, unknown>
function nonEmptyString(value: unknown): string | undefined {
return typeof value === 'string' && value.length > 0 ? value : undefined
}
/** Pulls `{ name, version }` out of a reserved-key value, whatever carried it. */
function readClientInfoValue(value: unknown): MetaClientInfo | undefined {
if (!value || typeof value !== 'object') {
return undefined
}
const { name, version } = value as UnknownRecord
const result: MetaClientInfo = {}
const clientName = nonEmptyString(name)
const clientVersion = nonEmptyString(version)
if (clientName) {
result.clientName = clientName
}
if (clientVersion) {
result.clientVersion = clientVersion
}
return result.clientName || result.clientVersion ? result : undefined
}
function readReservedKeys(bag: unknown): MetaClientInfo | undefined {
if (!bag || typeof bag !== 'object') {
return undefined
}
const record = bag as UnknownRecord
const result: MetaClientInfo = { ...readClientInfoValue(record[META_CLIENT_INFO_KEY]) }
const protocolVersion = nonEmptyString(record[META_PROTOCOL_VERSION_KEY])
if (protocolVersion) {
result.protocolVersion = protocolVersion
}
return result.clientName || result.clientVersion || result.protocolVersion ? result : undefined
}
/**

@@ -29,25 +91,73 @@ * Reads the client name/version and protocol version a modern client puts in

export function readMetaClientInfo(request: MCPRequestLike): MetaClientInfo | undefined {
const meta = request.params?._meta
if (!meta || typeof meta !== 'object') {
return readReservedKeys(request.params?._meta)
}
/**
* Reads the same keys from MCP SDK v2's request envelope. v2 strips the reserved
* `io.modelcontextprotocol/*` keys from `_meta` while parsing, so on exactly the
* traffic this matters for, `readMetaClientInfo` finds nothing and this finds
* everything.
*/
export function readEnvelopeClientInfo(extra: CompatibleRequestHandlerExtra | undefined): MetaClientInfo | undefined {
return readReservedKeys((extra as { mcpReq?: { envelope?: unknown } } | undefined)?.mcpReq?.envelope)
}
/**
* Asks the server itself. `getClientVersion()` answers on any server that
* handled an `initialize` (and v2 hosts such as `createMcpHandler` backfill it
* from the envelope); `getNegotiatedProtocolVersion()` exists on v2 only, which
* is why it is a link in the chain rather than a branch. Never throws — a
* server that dislikes being asked must not fail the tool call.
*/
export function readServerClientIdentity(server: unknown): MetaClientInfo | undefined {
if (!server) {
return undefined
}
const record = meta as Record<string, unknown>
const result: MetaClientInfo = {}
const clientInfo = record[META_CLIENT_INFO_KEY]
if (clientInfo && typeof clientInfo === 'object') {
const { name, version } = clientInfo as Record<string, unknown>
if (typeof name === 'string' && name.length > 0) {
result.clientName = name
try {
if (hasClientVersionAccessor(server)) {
Object.assign(result, readClientInfoValue((server as MCPServerLike).getClientVersion()))
}
if (typeof version === 'string' && version.length > 0) {
result.clientVersion = version
if (hasNegotiatedProtocolVersionAccessor(server)) {
const negotiated = (
server as unknown as { getNegotiatedProtocolVersion(): unknown }
).getNegotiatedProtocolVersion()
const protocolVersion = nonEmptyString(negotiated)
if (protocolVersion) {
result.protocolVersion = protocolVersion
}
}
} catch {
// fall through to whatever was read before the accessor objected
}
return result.clientName || result.clientVersion || result.protocolVersion ? result : undefined
}
const protocolVersion = record[META_PROTOCOL_VERSION_KEY]
if (typeof protocolVersion === 'string' && protocolVersion.length > 0) {
result.protocolVersion = protocolVersion
/**
* Resolves client identity through the whole chain, field by field: the first
* source that answers a field wins, and a source that answers nothing simply
* does not participate. Field-by-field rather than source-by-source because a
* request may carry its protocol version in the envelope while the client's
* name is only known to the server from a handshake.
*
* The first three links are **per request**, so they cannot describe anyone but
* the caller. Only the last — the server's own accessors — is connection-scoped,
* and on a server that multiplexes several clients through one connection it
* answers for whichever client completed the handshake. That is the best answer
* available on that connection, and it is the same scope `capture.ts` has always
* fallen back to (`eventInput.clientName ?? sessionInfo.clientName`), so the
* chain neither introduces that sharing nor widens it. Ordering it last is what
* keeps it a fallback: any request that identifies itself wins outright.
*/
export function resolveClientIdentity({ request, extra, server }: ClientIdentitySources): MetaClientInfo | undefined {
const chain = [readEnvelopeClientInfo(extra), readMetaClientInfo(request), readServerClientIdentity(server)]
const result: MetaClientInfo = {}
for (const source of chain) {
if (!source) {
continue
}
result.clientName ??= source.clientName
result.clientVersion ??= source.clientVersion
result.protocolVersion ??= source.protocolVersion
}
return result.clientName || result.clientVersion || result.protocolVersion ? result : undefined

@@ -57,6 +167,6 @@ }

/**
* Stamps any client identity found in `params._meta` directly onto the event
* being built for *this* request, so it carries `$mcp_client_name`,
* `$mcp_client_version`, and `$mcp_protocol_version` even when there was no
* `initialize` to learn them from (the modern stateless case).
* Stamps whatever the chain resolved onto the event being built for *this*
* request, so it carries `$mcp_client_name`, `$mcp_client_version` and
* `$mcp_protocol_version` even when there was no `initialize` to learn them
* from (the modern stateless case).
*

@@ -67,7 +177,12 @@ * Writing to the event — a per-request object — rather than the server-wide

* a sibling request can't clobber this event's attribution between now and when
* it's captured. Only fields the request actually carries are set, so a request
* without `_meta` leaves the event's existing values untouched.
* it's captured. Only fields actually resolved are set, so a request that
* carries nothing leaves the event's existing values untouched.
*/
export function stampMetaClientInfo(event: McpEvent, request: MCPRequestLike): void {
const info = readMetaClientInfo(request)
export function stampClientIdentity(
event: McpEvent,
request: MCPRequestLike,
extra?: CompatibleRequestHandlerExtra,
server?: MCPServerLike
): void {
const info = resolveClientIdentity({ request, extra, server })
if (!info) {

@@ -74,0 +189,0 @@ return

@@ -74,2 +74,11 @@ /**

/**
* `getNegotiatedProtocolVersion()` — v2 only, and the last link in the protocol
* version chain. A v1 server does not have it, which is why the chain probes for
* it instead of branching on which SDK is installed.
*/
export function hasNegotiatedProtocolVersionAccessor(server: unknown): boolean {
return hasMethod(server, 'getNegotiatedProtocolVersion')
}
/** `_serverInfo`, which names the server on every event. */

@@ -76,0 +85,0 @@ export function hasServerInfo(server: unknown): boolean {

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

import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'
import type {
CompatibleRequestHandlerExtra,
CompatibleToolResultLike,
HighLevelMCPServerLike,

@@ -177,3 +177,3 @@ MCPServerLike,

const wrappedCallback = async (...params: unknown[]): Promise<CallToolResult> => {
const wrappedCallback = async (...params: unknown[]): Promise<CompatibleToolResultLike> => {
let args: unknown

@@ -197,3 +197,3 @@ let extra: CompatibleRequestHandlerExtra

if (cleanedArgs === undefined) {
const handler = originalCallback as (extra: CompatibleRequestHandlerExtra) => Promise<CallToolResult>
const handler = originalCallback as (extra: CompatibleRequestHandlerExtra) => Promise<CompatibleToolResultLike>
return await handler(extra)

@@ -204,3 +204,3 @@ }

extra: CompatibleRequestHandlerExtra
) => Promise<CallToolResult>
) => Promise<CompatibleToolResultLike>
return await handler(cleanedArgs, extra)

@@ -207,0 +207,0 @@ } catch (error) {

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

import type { ListToolsResult } from '@modelcontextprotocol/sdk/types.js'
import type {
AnalyticsParameterOwnership,
CompatibleRequestHandlerExtra,
CompatibleToolsListLike,
MCPAnalyticsData,

@@ -27,3 +27,3 @@ MCPRequestLike,

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

@@ -234,3 +234,3 @@ import { addInstructionsToOutputSchemas, mirrorInstructionsIntoStructuredContent } from './output-instructions'

// event now so concurrent requests can't cross-attribute it.
stampMetaClientInfo(event, request)
stampClientIdentity(event, request, extra, server)
// Which *surface* of the client made this call lives only in the request

@@ -477,3 +477,3 @@ // headers (HTTP transports); `clientInfo` can't tell a vendor's products apart.

try {
const response = (await listHandler({ method: 'tools/list', params: {} }, extra)) as ListToolsResult
const response = (await listHandler({ method: 'tools/list', params: {} }, extra)) as CompatibleToolsListLike
if (!response || !Array.isArray(response.tools)) {

@@ -503,3 +503,3 @@ return undefined

logger: LoggerFn
): Promise<{ tools: ListToolsResult['tools'] }> {
): Promise<{ tools: CompatibleToolsListLike['tools'] }> {
const data = getServerTrackingData(server)

@@ -517,3 +517,3 @@ const startTime = new Date()

}
stampMetaClientInfo(event, request)
stampClientIdentity(event, request, extra, server)
stampTransportIdentity(event, extra)

@@ -563,3 +563,3 @@

cache: Map<string, AnalyticsParameterOwnership>,
tools: ListToolsResult['tools']
tools: CompatibleToolsListLike['tools']
): void {

@@ -574,3 +574,3 @@ // Merge pages and concurrent enumerations; repeated tool names overwrite stale schemas.

function collectListedToolNames(tools: ListToolsResult['tools'] | undefined): string[] | undefined {
function collectListedToolNames(tools: CompatibleToolsListLike['tools'] | undefined): string[] | undefined {
if (!tools || tools.length === 0) {

@@ -591,6 +591,6 @@ return

requestAttribution: SessionInfo
): Promise<ListToolsResult['tools']> {
): Promise<CompatibleToolsListLike['tools']> {
try {
const data = getServerTrackingData(server)
const originalResponse = (await originalListToolsHandler(request, extra)) as ListToolsResult
const originalResponse = (await originalListToolsHandler(request, extra)) as CompatibleToolsListLike
// Injection must not mutate arrays reused or frozen by the server.

@@ -647,3 +647,6 @@ let tools = [...(originalResponse.tools || [])]

export function cacheToolDescriptions(cache: Map<string, string>, tools: ListToolsResult['tools'] | undefined): void {
export function cacheToolDescriptions(
cache: Map<string, string>,
tools: CompatibleToolsListLike['tools'] | undefined
): void {
if (!tools) {

@@ -669,3 +672,6 @@ return

export function cacheToolCategories(cache: Map<string, string>, tools: ListToolsResult['tools'] | undefined): void {
export function cacheToolCategories(
cache: Map<string, string>,
tools: CompatibleToolsListLike['tools'] | undefined
): void {
if (!tools) {

@@ -835,3 +841,3 @@ return

// info if a client also sends it in `_meta`.
stampMetaClientInfo(event, request)
stampClientIdentity(event, request, extra, server)
stampTransportIdentity(event, extra)

@@ -838,0 +844,0 @@

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

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

@@ -157,3 +157,3 @@

}
stampMetaClientInfo(identifyEvent, request)
stampClientIdentity(identifyEvent, request, extra, server)
stampTransportIdentity(identifyEvent, extra)

@@ -160,0 +160,0 @@

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

import { type CallToolResult, type ListToolsResult } from '@modelcontextprotocol/sdk/types.js'
import type { CompatibleTextToolResult, CompatibleToolsListLike } from '../types'
import { log, type LoggerFn } from './logger'

@@ -21,3 +21,3 @@

type ReportMissingToolDescriptor = ListToolsResult['tools'][number]
type ReportMissingToolDescriptor = CompatibleToolsListLike['tools'][number]

@@ -58,3 +58,3 @@ export function getReportMissingToolDescriptor(name: string = GET_MORE_TOOLS_NAME): ReportMissingToolDescriptor {

*/
export function getMoreToolsResult(): CallToolResult {
export function getMoreToolsResult(): CompatibleTextToolResult {
return {

@@ -70,5 +70,5 @@ content: [

export function handleReportMissing(args: { context: string }, logger: LoggerFn = log): CallToolResult {
export function handleReportMissing(args: { context: string }, logger: LoggerFn = log): CompatibleTextToolResult {
logger(`Missing tool reported: ${JSON.stringify(args)}`)
return getMoreToolsResult()
}

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

import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'
import type { ErrorTracking } from '@posthog/core'
import type { AnalyticsInjectableJsonSchema } from './extensions/analytics-parameters'
import type { MCPAnalyticsEventType } from './extensions/event-types'

@@ -22,2 +22,50 @@ import type { IdentityCache } from './extensions/internal'

/**
* The MCP wire shapes we touch, declared structurally rather than imported from
* `@modelcontextprotocol/sdk`.
*
* Both SDK majors are **optional** peers — a v2-only consumer has no v1 SDK
* installed — so a type import of it in shipped `.d.ts` output is a `TS2307`
* for anyone type-checking without `skipLibCheck`. These are deliberately loose
* (open-ended, everything optional): they describe what we *read* off an SDK
* result, and an SDK-typed value assigns to them cleanly. What we hand back to
* the SDK is typed precisely instead — see {@link CompatibleTextToolResult}.
*/
export interface CompatibleToolResultLike {
content?: unknown[]
structuredContent?: JsonRecord
isError?: boolean
_meta?: JsonRecord
[key: string]: unknown
}
/** One entry of a `tools/list` response, as we read it. */
export interface CompatibleToolDescriptorLike {
name: string
title?: string
description?: string
/** The advertised JSON Schema, as the analytics parameters are injected into it. */
inputSchema?: AnalyticsInjectableJsonSchema
outputSchema?: unknown
_meta?: JsonRecord
[key: string]: unknown
}
/** A `tools/list` response, as we read it. */
export interface CompatibleToolsListLike {
tools: CompatibleToolDescriptorLike[]
nextCursor?: string
[key: string]: unknown
}
/**
* A text-only tool result *we* construct and a host may hand straight back to
* the SDK. Typed precisely, not loosely, so it stays assignable to the SDK's own
* `CallToolResult` — the direction that would silently break callers.
*/
export interface CompatibleTextToolResult {
content: { type: 'text'; text: string }[]
isError?: boolean
}
export interface MCPRequestParamsLike {

@@ -133,4 +181,7 @@ arguments?: JsonRecord

export type ToolCallback =
| ((args: unknown, extra: CompatibleRequestHandlerExtra) => CallToolResult | Promise<CallToolResult>)
| ((extra: CompatibleRequestHandlerExtra) => CallToolResult | Promise<CallToolResult>)
| ((
args: unknown,
extra: CompatibleRequestHandlerExtra
) => CompatibleToolResultLike | Promise<CompatibleToolResultLike>)
| ((extra: CompatibleRequestHandlerExtra) => CompatibleToolResultLike | Promise<CompatibleToolResultLike>)

@@ -247,2 +298,8 @@ // RegisteredTool type that supports both MCP SDK 1.23- (callback) and 1.24+ (handler)

http?: CompatibleHttpRequestLike
/**
* MCP SDK v2's parsed request. It lifts the reserved `io.modelcontextprotocol/*`
* keys out of `params._meta` into `envelope`, so client identity is here rather
* than on the request by the time a handler runs.
*/
mcpReq?: { envelope?: Record<string, unknown>; [key: string]: unknown }
[key: string]: unknown

@@ -249,0 +306,0 @@ }

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

export const version = '0.11.1'
export const version = '0.11.2'