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.0
to
0.11.1
+45
dist/extensions/detect.d.ts
/**
* Structural feature probes.
*
* Every question about the shape of a server object is answered here, by
* duck-typing the object in front of us — never by reading a package version or
* a protocol constant. Two reasons this is a rule and not a preference:
*
* - The two SDK majors expose the same capability under different names (v1's
* `.tool()` vs v2's `.registerTool()`), so "which SDK is installed" answers a
* different question than "can this object register a tool".
* - A single v2 server serves both protocol eras, request by request, so no
* module-level constant describes it. v2's exported `LATEST_PROTOCOL_VERSION`
* is `2025-11-25`.
*
* Nothing here imports `@modelcontextprotocol/*`; that boundary is pinned by
* `sdk-import-boundary.test.ts`.
*/
type UnknownRecord = Record<string, unknown>;
/** A high-level `McpServer` wrapper: it holds the low-level server on `.server`. */
export declare function hasNestedLowLevelServer(server: unknown): server is UnknownRecord & {
server: UnknownRecord;
};
/** No `.server` property, so the object is itself the low-level `Server`. */
export declare function isBareServerShape(server: unknown): boolean;
/** The high-level registry we read tool metadata from and wrap callbacks in. */
export declare function hasToolRegistry(server: unknown): boolean;
/**
* The object can register a tool.
*
* v1 offers both `tool()` and `registerTool()`; v2 dropped the deprecated
* `tool()` and keeps only `registerTool()`. Requiring `tool()` specifically is
* what made `instrument()` reject every v2 high-level server — and, because
* `instrument()` swallows compatibility errors, reject it silently.
*/
export declare function canRegisterTools(server: unknown): boolean;
/** Handler registration, which we patch to wrap late registrations. */
export declare function canSetRequestHandler(server: unknown): boolean;
/** The live handler map we read and write directly. A real `Map` on both majors. */
export declare function hasRequestHandlerMap(server: unknown): boolean;
/** `getClientVersion()` — still present on v2, and a link in B1's identity chain. */
export declare function hasClientVersionAccessor(server: unknown): boolean;
/** `_serverInfo`, which names the server on every event. */
export declare function hasServerInfo(server: unknown): boolean;
export {};
//# sourceMappingURL=detect.d.ts.map
{"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,uEAAuE;AACvE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAE7D;AAED,oFAAoF;AACpF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAG7D;AAED,qFAAqF;AACrF,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAEjE;AAED,4DAA4D;AAC5D,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAGtD"}
"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__, {
canRegisterTools: ()=>canRegisterTools,
canSetRequestHandler: ()=>canSetRequestHandler,
hasClientVersionAccessor: ()=>hasClientVersionAccessor,
hasNestedLowLevelServer: ()=>hasNestedLowLevelServer,
hasRequestHandlerMap: ()=>hasRequestHandlerMap,
hasServerInfo: ()=>hasServerInfo,
hasToolRegistry: ()=>hasToolRegistry,
isBareServerShape: ()=>isBareServerShape
});
function asRecord(value) {
return value && 'object' == typeof value ? value : void 0;
}
function hasMethod(value, key) {
return 'function' == typeof asRecord(value)?.[key];
}
function hasNestedLowLevelServer(server) {
const record = asRecord(server);
return !!record && 'server' in record && !!asRecord(record.server);
}
function isBareServerShape(server) {
const record = asRecord(server);
return !!record && !('server' in record);
}
function hasToolRegistry(server) {
return !!asRecord(asRecord(server)?._registeredTools);
}
function canRegisterTools(server) {
return hasMethod(server, 'registerTool') || hasMethod(server, 'tool');
}
function canSetRequestHandler(server) {
return hasMethod(server, 'setRequestHandler');
}
function hasRequestHandlerMap(server) {
const handlers = asRecord(server)?._requestHandlers;
return handlers instanceof Map && 'function' == typeof handlers.get;
}
function hasClientVersionAccessor(server) {
return hasMethod(server, 'getClientVersion');
}
function hasServerInfo(server) {
const info = asRecord(asRecord(server)?._serverInfo);
return !!info && 'name' in info;
}
exports.canRegisterTools = __webpack_exports__.canRegisterTools;
exports.canSetRequestHandler = __webpack_exports__.canSetRequestHandler;
exports.hasClientVersionAccessor = __webpack_exports__.hasClientVersionAccessor;
exports.hasNestedLowLevelServer = __webpack_exports__.hasNestedLowLevelServer;
exports.hasRequestHandlerMap = __webpack_exports__.hasRequestHandlerMap;
exports.hasServerInfo = __webpack_exports__.hasServerInfo;
exports.hasToolRegistry = __webpack_exports__.hasToolRegistry;
exports.isBareServerShape = __webpack_exports__.isBareServerShape;
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
"canRegisterTools",
"canSetRequestHandler",
"hasClientVersionAccessor",
"hasNestedLowLevelServer",
"hasRequestHandlerMap",
"hasServerInfo",
"hasToolRegistry",
"isBareServerShape"
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
Object.defineProperty(exports, '__esModule', {
value: true
});
function asRecord(value) {
return value && 'object' == typeof value ? value : void 0;
}
function hasMethod(value, key) {
return 'function' == typeof asRecord(value)?.[key];
}
function hasNestedLowLevelServer(server) {
const record = asRecord(server);
return !!record && 'server' in record && !!asRecord(record.server);
}
function isBareServerShape(server) {
const record = asRecord(server);
return !!record && !('server' in record);
}
function hasToolRegistry(server) {
return !!asRecord(asRecord(server)?._registeredTools);
}
function canRegisterTools(server) {
return hasMethod(server, 'registerTool') || hasMethod(server, 'tool');
}
function canSetRequestHandler(server) {
return hasMethod(server, 'setRequestHandler');
}
function hasRequestHandlerMap(server) {
const handlers = asRecord(server)?._requestHandlers;
return handlers instanceof Map && 'function' == typeof handlers.get;
}
function hasClientVersionAccessor(server) {
return hasMethod(server, 'getClientVersion');
}
function hasServerInfo(server) {
const info = asRecord(asRecord(server)?._serverInfo);
return !!info && 'name' in info;
}
export { canRegisterTools, canSetRequestHandler, hasClientVersionAccessor, hasNestedLowLevelServer, hasRequestHandlerMap, hasServerInfo, hasToolRegistry, isBareServerShape };
import type { RequestHeaderBag } from '../types';
/**
* Reads the HTTP request headers off the `extra` (v1) / `ctx` (v2) object the
* MCP SDK hands a request handler, and returns them as a plain object with
* lowercase keys. Returns `undefined` when the request did not come over HTTP —
* stdio and in-memory transports carry no headers at all.
*
* The two SDK majors put them in different places and in different shapes: v1
* attaches a plain object at `extra.requestInfo.headers`, while v2 attaches the
* WHATWG `Request` at `ctx.http.req`, whose `headers` is a `Headers` instance
* that only answers to `.get()`. A v1-shaped read returns `undefined` on v2,
* which is why this exists.
*
* Normalisation is **by shape, not by source**: a framework is free to hand us a
* plain object where the SDK hands `Headers`, so both fields are checked for
* both shapes. `Headers` is duck-typed on `.entries` rather than `instanceof` —
* workerd and other edge runtimes are a different realm and would fail the
* identity check on a perfectly good object.
*
* Exported from the package for host callbacks. `identify`, `intentFallback`,
* `eventProperties` and `beforeSend` receive the SDK's `extra` unchanged — we
* deliberately do not synthesise a v1 shape on v2, because a fabricated
* `requestInfo` is a convincing partial lie about a shape the SDK removed on
* purpose. So a host that reads headers reads them through this instead:
*
* ```ts
* import { getRequestHeaders } from '@posthog/mcp'
*
* identify: async (request, extra) => {
* const auth = getRequestHeaders(extra)?.['authorization']
* // ...
* }
* ```
*/
export declare function getRequestHeaders(extra: unknown): RequestHeaderBag | undefined;
//# sourceMappingURL=request-headers.d.ts.map
{"version":3,"file":"request-headers.d.ts","sourceRoot":"","sources":["../../src/extensions/request-headers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,GAAG,SAAS,CAY9E"}
"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__, {
getRequestHeaders: ()=>getRequestHeaders
});
function getRequestHeaders(extra) {
if (!extra || 'object' != typeof extra) return;
const record = extra;
const http = record.http;
const requestInfo = record.requestInfo;
const source = http?.req?.headers ?? requestInfo?.headers;
if (!source || 'object' != typeof source) return;
return toHeaderBag(source);
}
function toHeaderBag(source) {
try {
const entries = isHeadersLike(source) ? [
...source.entries()
] : Object.entries(source);
const bag = {};
for (const [key, value] of entries)if ('string' == typeof key && null != value) {
if ('string' == typeof value || Array.isArray(value)) bag[key.toLowerCase()] = value;
}
return bag;
} catch {
return;
}
}
function isHeadersLike(source) {
const candidate = source;
return 'function' == typeof candidate.entries && 'function' == typeof candidate.get;
}
exports.getRequestHeaders = __webpack_exports__.getRequestHeaders;
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
"getRequestHeaders"
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
Object.defineProperty(exports, '__esModule', {
value: true
});
function getRequestHeaders(extra) {
if (!extra || 'object' != typeof extra) return;
const record = extra;
const http = record.http;
const requestInfo = record.requestInfo;
const source = http?.req?.headers ?? requestInfo?.headers;
if (!source || 'object' != typeof source) return;
return toHeaderBag(source);
}
function toHeaderBag(source) {
try {
const entries = isHeadersLike(source) ? [
...source.entries()
] : Object.entries(source);
const bag = {};
for (const [key, value] of entries)if ('string' == typeof key && null != value) {
if ('string' == typeof value || Array.isArray(value)) bag[key.toLowerCase()] = value;
}
return bag;
} catch {
return;
}
}
function isHeadersLike(source) {
const candidate = source;
return 'function' == typeof candidate.entries && 'function' == typeof candidate.get;
}
export { getRequestHeaders };
/**
* Structural feature probes.
*
* Every question about the shape of a server object is answered here, by
* duck-typing the object in front of us — never by reading a package version or
* a protocol constant. Two reasons this is a rule and not a preference:
*
* - The two SDK majors expose the same capability under different names (v1's
* `.tool()` vs v2's `.registerTool()`), so "which SDK is installed" answers a
* different question than "can this object register a tool".
* - A single v2 server serves both protocol eras, request by request, so no
* module-level constant describes it. v2's exported `LATEST_PROTOCOL_VERSION`
* is `2025-11-25`.
*
* Nothing here imports `@modelcontextprotocol/*`; that boundary is pinned by
* `sdk-import-boundary.test.ts`.
*/
type UnknownRecord = Record<string, unknown>
function asRecord(value: unknown): UnknownRecord | undefined {
return value && typeof value === 'object' ? (value as UnknownRecord) : undefined
}
function hasMethod(value: unknown, key: string): boolean {
return typeof asRecord(value)?.[key] === 'function'
}
/** A high-level `McpServer` wrapper: it holds the low-level server on `.server`. */
export function hasNestedLowLevelServer(server: unknown): server is UnknownRecord & { server: UnknownRecord } {
const record = asRecord(server)
return !!record && 'server' in record && !!asRecord(record.server)
}
/** No `.server` property, so the object is itself the low-level `Server`. */
export function isBareServerShape(server: unknown): boolean {
const record = asRecord(server)
return !!record && !('server' in record)
}
/** The high-level registry we read tool metadata from and wrap callbacks in. */
export function hasToolRegistry(server: unknown): boolean {
return !!asRecord(asRecord(server)?._registeredTools)
}
/**
* The object can register a tool.
*
* v1 offers both `tool()` and `registerTool()`; v2 dropped the deprecated
* `tool()` and keeps only `registerTool()`. Requiring `tool()` specifically is
* what made `instrument()` reject every v2 high-level server — and, because
* `instrument()` swallows compatibility errors, reject it silently.
*/
export function canRegisterTools(server: unknown): boolean {
return hasMethod(server, 'registerTool') || hasMethod(server, 'tool')
}
/** Handler registration, which we patch to wrap late registrations. */
export function canSetRequestHandler(server: unknown): boolean {
return hasMethod(server, 'setRequestHandler')
}
/** The live handler map we read and write directly. A real `Map` on both majors. */
export function hasRequestHandlerMap(server: unknown): boolean {
const handlers = asRecord(server)?._requestHandlers
return handlers instanceof Map && typeof handlers.get === 'function'
}
/** `getClientVersion()` — still present on v2, and a link in B1's identity chain. */
export function hasClientVersionAccessor(server: unknown): boolean {
return hasMethod(server, 'getClientVersion')
}
/** `_serverInfo`, which names the server on every event. */
export function hasServerInfo(server: unknown): boolean {
const info = asRecord(asRecord(server)?._serverInfo)
return !!info && 'name' in info
}
import type { RequestHeaderBag } from '../types'
/**
* Reads the HTTP request headers off the `extra` (v1) / `ctx` (v2) object the
* MCP SDK hands a request handler, and returns them as a plain object with
* lowercase keys. Returns `undefined` when the request did not come over HTTP —
* stdio and in-memory transports carry no headers at all.
*
* The two SDK majors put them in different places and in different shapes: v1
* attaches a plain object at `extra.requestInfo.headers`, while v2 attaches the
* WHATWG `Request` at `ctx.http.req`, whose `headers` is a `Headers` instance
* that only answers to `.get()`. A v1-shaped read returns `undefined` on v2,
* which is why this exists.
*
* Normalisation is **by shape, not by source**: a framework is free to hand us a
* plain object where the SDK hands `Headers`, so both fields are checked for
* both shapes. `Headers` is duck-typed on `.entries` rather than `instanceof` —
* workerd and other edge runtimes are a different realm and would fail the
* identity check on a perfectly good object.
*
* Exported from the package for host callbacks. `identify`, `intentFallback`,
* `eventProperties` and `beforeSend` receive the SDK's `extra` unchanged — we
* deliberately do not synthesise a v1 shape on v2, because a fabricated
* `requestInfo` is a convincing partial lie about a shape the SDK removed on
* purpose. So a host that reads headers reads them through this instead:
*
* ```ts
* import { getRequestHeaders } from '@posthog/mcp'
*
* identify: async (request, extra) => {
* const auth = getRequestHeaders(extra)?.['authorization']
* // ...
* }
* ```
*/
export function getRequestHeaders(extra: unknown): RequestHeaderBag | undefined {
if (!extra || typeof extra !== 'object') {
return undefined
}
const record = extra as Record<string, unknown>
const http = record.http as { req?: { headers?: unknown } } | undefined
const requestInfo = record.requestInfo as { headers?: unknown } | undefined
const source = http?.req?.headers ?? requestInfo?.headers
if (!source || typeof source !== 'object') {
return undefined
}
return toHeaderBag(source)
}
/**
* Flattens either shape into a lowercase-keyed bag. Never throws: a header read
* failing must not take a tool call down with it.
*/
function toHeaderBag(source: object): RequestHeaderBag | undefined {
try {
const entries = isHeadersLike(source) ? [...source.entries()] : Object.entries(source)
const bag: RequestHeaderBag = {}
for (const [key, value] of entries) {
if (typeof key !== 'string' || value === undefined || value === null) {
continue
}
if (typeof value === 'string' || Array.isArray(value)) {
bag[key.toLowerCase()] = value as string | string[]
}
}
return bag
} catch {
return undefined
}
}
/** Duck-typed, never `instanceof` — an edge runtime's `Headers` is another realm's class. */
function isHeadersLike(source: object): source is { entries(): Iterable<[string, string]> } {
const candidate = source as { entries?: unknown; get?: unknown }
return typeof candidate.entries === 'function' && typeof candidate.get === 'function'
}
+1
-1

@@ -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;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"}
{"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;AAWrE,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,CAEpG;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,CAiChH;AAyCD,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAanE"}

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

__webpack_require__.d(__webpack_exports__, {
getMCPCompatibleErrorMessage: ()=>getMCPCompatibleErrorMessage,
isLowLevelServer: ()=>isLowLevelServer,
isHighLevelServer: ()=>isHighLevelServer,
logCompatibilityWarning: ()=>logCompatibilityWarning,
isCompatibleServerType: ()=>isCompatibleServerType,
isHighLevelServer: ()=>isHighLevelServer,
isLowLevelServer: ()=>isLowLevelServer,
logCompatibilityWarning: ()=>logCompatibilityWarning
getMCPCompatibleErrorMessage: ()=>getMCPCompatibleErrorMessage
});
const external_detect_js_namespaceObject = require("./detect.js");
function logCompatibilityWarning(logger) {

@@ -38,6 +39,6 @@ logger('PostHog MCP analytics SDK Compatibility: This version only supports Model Context Protocol TypeScript SDK v1.11 and above. Please upgrade if using an older version.');

function isHighLevelServer(server) {
return !!server && 'object' == typeof server && 'server' in server && !!server.server && 'object' == typeof server.server;
return (0, external_detect_js_namespaceObject.hasNestedLowLevelServer)(server);
}
function isLowLevelServer(server) {
return !!server && 'object' == typeof server && !('server' in server);
return (0, external_detect_js_namespaceObject.isBareServerShape)(server);
}

@@ -50,9 +51,9 @@ function isCompatibleServerType(server, logger) {

if (isHighLevelServer(server)) {
if (!server._registeredTools || 'object' != typeof server._registeredTools) {
if (!(0, external_detect_js_namespaceObject.hasToolRegistry)(server)) {
logCompatibilityWarning(logger);
throw new Error('PostHog MCP analytics SDK compatibility error: High-level server must have _registeredTools object. This requires MCP SDK v1.11 or higher.');
}
if ('function' != typeof server.tool) {
if (!(0, external_detect_js_namespaceObject.canRegisterTools)(server)) {
logCompatibilityWarning(logger);
throw new Error('PostHog MCP analytics SDK compatibility error: High-level server must have tool() method. This requires MCP SDK v1.11 or higher.');
throw new Error('PostHog MCP analytics SDK compatibility error: High-level server must have a registerTool() or tool() method. This requires MCP SDK v1.11 or higher.');
}

@@ -71,20 +72,15 @@ const targetServer = server.server;

}
const serverRecord = server;
if ('function' != typeof serverRecord.setRequestHandler) {
if (!(0, external_detect_js_namespaceObject.canSetRequestHandler)(server)) {
logCompatibilityWarning(logger);
throw new Error('PostHog MCP analytics SDK compatibility error: Server must have a setRequestHandler method. This requires MCP SDK v1.11 or higher.');
}
if (!(serverRecord._requestHandlers && serverRecord._requestHandlers instanceof Map)) {
if (!(0, external_detect_js_namespaceObject.hasRequestHandlerMap)(server)) {
logCompatibilityWarning(logger);
throw new Error('PostHog MCP analytics SDK compatibility error: Server._requestHandlers is not accessible. This requires MCP SDK v1.11 or higher.');
}
if ('function' != typeof serverRecord._requestHandlers.get) {
if (!(0, external_detect_js_namespaceObject.hasClientVersionAccessor)(server)) {
logCompatibilityWarning(logger);
throw new Error('PostHog MCP analytics SDK compatibility error: Server._requestHandlers must be a Map with a get method. This requires MCP SDK v1.11 or higher.');
}
if ('function' != typeof serverRecord.getClientVersion) {
logCompatibilityWarning(logger);
throw new Error('PostHog MCP analytics SDK compatibility error: Server.getClientVersion must be a function. This requires MCP SDK v1.11 or higher.');
}
if (!serverRecord._serverInfo || 'object' != typeof serverRecord._serverInfo || !('name' in serverRecord._serverInfo)) {
if (!(0, external_detect_js_namespaceObject.hasServerInfo)(server)) {
logCompatibilityWarning(logger);

@@ -91,0 +87,0 @@ throw new Error('PostHog MCP analytics SDK compatibility error: Server._serverInfo is not accessible or missing name. This requires MCP SDK v1.11 or higher.');

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

import { canRegisterTools, canSetRequestHandler, hasClientVersionAccessor, hasNestedLowLevelServer, hasRequestHandlerMap, hasServerInfo, hasToolRegistry, isBareServerShape } from "./detect.mjs";
function logCompatibilityWarning(logger) {

@@ -5,6 +6,6 @@ logger('PostHog MCP analytics SDK Compatibility: This version only supports Model Context Protocol TypeScript SDK v1.11 and above. Please upgrade if using an older version.');

function isHighLevelServer(server) {
return !!server && 'object' == typeof server && 'server' in server && !!server.server && 'object' == typeof server.server;
return hasNestedLowLevelServer(server);
}
function isLowLevelServer(server) {
return !!server && 'object' == typeof server && !('server' in server);
return isBareServerShape(server);
}

@@ -17,9 +18,9 @@ function isCompatibleServerType(server, logger) {

if (isHighLevelServer(server)) {
if (!server._registeredTools || 'object' != typeof server._registeredTools) {
if (!hasToolRegistry(server)) {
logCompatibilityWarning(logger);
throw new Error('PostHog MCP analytics SDK compatibility error: High-level server must have _registeredTools object. This requires MCP SDK v1.11 or higher.');
}
if ('function' != typeof server.tool) {
if (!canRegisterTools(server)) {
logCompatibilityWarning(logger);
throw new Error('PostHog MCP analytics SDK compatibility error: High-level server must have tool() method. This requires MCP SDK v1.11 or higher.');
throw new Error('PostHog MCP analytics SDK compatibility error: High-level server must have a registerTool() or tool() method. This requires MCP SDK v1.11 or higher.');
}

@@ -38,20 +39,15 @@ const targetServer = server.server;

}
const serverRecord = server;
if ('function' != typeof serverRecord.setRequestHandler) {
if (!canSetRequestHandler(server)) {
logCompatibilityWarning(logger);
throw new Error('PostHog MCP analytics SDK compatibility error: Server must have a setRequestHandler method. This requires MCP SDK v1.11 or higher.');
}
if (!(serverRecord._requestHandlers && serverRecord._requestHandlers instanceof Map)) {
if (!hasRequestHandlerMap(server)) {
logCompatibilityWarning(logger);
throw new Error('PostHog MCP analytics SDK compatibility error: Server._requestHandlers is not accessible. This requires MCP SDK v1.11 or higher.');
}
if ('function' != typeof serverRecord._requestHandlers.get) {
if (!hasClientVersionAccessor(server)) {
logCompatibilityWarning(logger);
throw new Error('PostHog MCP analytics SDK compatibility error: Server._requestHandlers must be a Map with a get method. This requires MCP SDK v1.11 or higher.');
}
if ('function' != typeof serverRecord.getClientVersion) {
logCompatibilityWarning(logger);
throw new Error('PostHog MCP analytics SDK compatibility error: Server.getClientVersion must be a function. This requires MCP SDK v1.11 or higher.');
}
if (!serverRecord._serverInfo || 'object' != typeof serverRecord._serverInfo || !('name' in serverRecord._serverInfo)) {
if (!hasServerInfo(server)) {
logCompatibilityWarning(logger);

@@ -58,0 +54,0 @@ throw new Error('PostHog MCP analytics SDK compatibility error: Server._serverInfo is not accessible or missing name. This requires MCP SDK v1.11 or higher.');

@@ -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;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,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;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AO,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"}

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

const external_mcp_sdk_compat_js_namespaceObject = require("./mcp-sdk-compat.js");
const external_request_headers_js_namespaceObject = require("./request-headers.js");
const external_session_js_namespaceObject = require("./session.js");

@@ -330,4 +331,4 @@ const external_session_token_js_namespaceObject = require("./session-token.js");

try {
const headers = extra?.requestInfo?.headers;
if (!headers || 'object' != typeof headers) return;
const headers = (0, external_request_headers_js_namespaceObject.getRequestHeaders)(extra);
if (!headers) return;
if ((0, external_session_token_js_namespaceObject.readMcpSessionHeader)(headers)) return;

@@ -334,0 +335,0 @@ const transport = server.transport;

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

import { readRequestHandlerMethod } from "./mcp-sdk-compat.mjs";
import { getRequestHeaders } from "./request-headers.mjs";
import { getSessionId, getSessionInfo, newSessionId } from "./session.mjs";

@@ -294,4 +295,4 @@ import { encodeSessionId, readMcpSessionHeader, writeSessionIdToTransport } from "./session-token.mjs";

try {
const headers = extra?.requestInfo?.headers;
if (!headers || 'object' != typeof headers) return;
const headers = getRequestHeaders(extra);
if (!headers) return;
if (readMcpSessionHeader(headers)) return;

@@ -298,0 +299,0 @@ const transport = server.transport;

@@ -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;;;;;;;;;;;;;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"}
{"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;AAQjB,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"}

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

const external_internal_js_namespaceObject = require("./internal.js");
const external_request_headers_js_namespaceObject = require("./request-headers.js");
const external_session_token_js_namespaceObject = require("./session-token.js");

@@ -63,3 +64,3 @@ function newSessionId() {

function applyTokenClientIdentity(data, extra) {
const token = (0, external_session_token_js_namespaceObject.decodeSessionId)((0, external_session_token_js_namespaceObject.readMcpSessionHeader)(extra?.requestInfo?.headers));
const token = (0, external_session_token_js_namespaceObject.decodeSessionId)((0, external_session_token_js_namespaceObject.readMcpSessionHeader)((0, external_request_headers_js_namespaceObject.getRequestHeaders)(extra)));
if (!token) return;

@@ -66,0 +67,0 @@ data.sessionInfo.clientName = token.clientName;

@@ -5,2 +5,3 @@ import { version } from "../version.mjs";

import { getServerTrackingData, setServerTrackingData } from "./internal.mjs";
import { getRequestHeaders } from "./request-headers.mjs";
import { decodeSessionId, readMcpSessionHeader } from "./session-token.mjs";

@@ -31,3 +32,3 @@ function newSessionId() {

function applyTokenClientIdentity(data, extra) {
const token = decodeSessionId(readMcpSessionHeader(extra?.requestInfo?.headers));
const token = decodeSessionId(readMcpSessionHeader(getRequestHeaders(extra)));
if (!token) return;

@@ -34,0 +35,0 @@ data.sessionInfo.clientName = token.clientName;

@@ -40,5 +40,10 @@ import type { CompatibleRequestHandlerExtra, McpEvent } from '../types';

/**
* 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.
* Reads the transport identity headers off the request. Returns `undefined`
* when the request carries neither — including every stdio and in-memory
* request, which has no HTTP headers at all. Never throws.
*
* Sourced through `getRequestHeaders` rather than `extra.requestInfo.headers`
* directly: MCP SDK v2 puts the request at `extra.http.req` as a WHATWG
* `Request`, so a v1-shaped read finds nothing and this whole feature would be
* silently inert on exactly the servers being adopted now.
*/

@@ -45,0 +50,0 @@ export declare function readTransportIdentity(extra: CompatibleRequestHandlerExtra | undefined): TransportIdentity | undefined;

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

{"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"}
{"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;AAIvE;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;GASG;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"}

@@ -33,6 +33,7 @@ "use strict";

const external_headers_js_namespaceObject = require("./headers.js");
const external_request_headers_js_namespaceObject = require("./request-headers.js");
const CLIENT_USER_AGENT_HEADER = 'user-agent';
const VENDOR_CLIENT_HEADER = 'x-anthropic-client';
function readTransportIdentity(extra) {
const headers = extra?.requestInfo?.headers;
const headers = (0, external_request_headers_js_namespaceObject.getRequestHeaders)(extra);
if (!headers) return;

@@ -39,0 +40,0 @@ const result = {};

import { readHeaderValue } from "./headers.mjs";
import { getRequestHeaders } from "./request-headers.mjs";
const CLIENT_USER_AGENT_HEADER = 'user-agent';
const VENDOR_CLIENT_HEADER = 'x-anthropic-client';
function readTransportIdentity(extra) {
const headers = extra?.requestInfo?.headers;
const headers = getRequestHeaders(extra);
if (!headers) return;

@@ -7,0 +8,0 @@ const result = {};

@@ -53,2 +53,3 @@ import type { PostHog } from 'posthog-node';

export { POSTHOG_MCP_ANALYTICS_SOURCE, PostHogMCPAnalyticsEvent, PostHogMCPAnalyticsProperty, } from './extensions/constants';
export { getRequestHeaders } from './extensions/request-headers';
export { PostHogMCP, type PostHogMCPOptions } from './extensions/posthog-mcp';

@@ -58,5 +59,5 @@ export { getMoreToolsResult } from './extensions/tools';

export { PostHog, type PostHogOptions } from 'posthog-node';
export type { BeforeSendFn, CaptureEventData, InitializeCaptureData, McpAnalytics, McpCaptureCommon, MCPAnalyticsContextOptions, MCPAnalyticsIntentSource, MCPAnalyticsOptions, MissingCapabilityCaptureData, PreparedToolCall, PrepareToolListOptions, ToolCallCaptureData, ToolsListCaptureData, UserIdentity, } from './types';
export type { BeforeSendFn, CaptureEventData, InitializeCaptureData, McpAnalytics, McpCaptureCommon, MCPAnalyticsContextOptions, MCPAnalyticsIntentSource, MCPAnalyticsOptions, MissingCapabilityCaptureData, PreparedToolCall, PrepareToolListOptions, RequestHeaderBag, ToolCallCaptureData, ToolsListCaptureData, UserIdentity, } from './types';
export type IdentifyFunction = MCPAnalyticsOptions['identify'];
export { instrument, instrumentMutator };
//# sourceMappingURL=index.d.ts.map

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

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAQ3C,OAAO,EAAE,6BAA6B,EAAkB,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGlG,OAAO,KAAK,EAGV,YAAY,EAEZ,mBAAmB,EAGpB,MAAM,SAAS,CAAA;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,iBAAS,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,mBAAwB,GAAG,YAAY,CAiCtG;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAKjH;AAuFD,OAAO,EAAE,6BAA6B,EAAE,YAAY,EAAE,CAAA;AAItD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,KAAK,mBAAmB,GACzB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,2BA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A6B,EAAE,YAAY,EAAE,CAAA;AAItD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,KAAK,mBAAmB,GACzB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,wBAAwB,CAAA;AAG/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAI/C,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAA;AAC3D,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,EAChB,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,EACnB,4BAA4B,EAC5B,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,GACb,MAAM,SAAS,CAAA;AAChB,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,CAAA"}

@@ -27,16 +27,17 @@ "use strict";

__webpack_require__.d(__webpack_exports__, {
setLogger: ()=>logger_js_namespaceObject.setLogger,
PostHog: ()=>external_posthog_node_namespaceObject.PostHog,
PostHogMCP: ()=>posthog_mcp_js_namespaceObject.PostHogMCP,
POSTHOG_MCP_ANALYTICS_SOURCE: ()=>constants_js_namespaceObject.POSTHOG_MCP_ANALYTICS_SOURCE,
deriveSessionIdFromMCPSession: ()=>session_js_namespaceObject.deriveSessionIdFromMCPSession,
instrument: ()=>instrument,
decodeSessionId: ()=>session_token_js_namespaceObject.decodeSessionId,
MCP_SESSION_HEADER: ()=>session_token_js_namespaceObject.MCP_SESSION_HEADER,
PostHogMCPAnalyticsEvent: ()=>constants_js_namespaceObject.PostHogMCPAnalyticsEvent,
getRequestHeaders: ()=>request_headers_js_namespaceObject.getRequestHeaders,
PostHogMCPAnalyticsProperty: ()=>constants_js_namespaceObject.PostHogMCPAnalyticsProperty,
PostHogMCP: ()=>posthog_mcp_js_namespaceObject.PostHogMCP,
newSessionId: ()=>session_js_namespaceObject.newSessionId,
MCP_SESSION_HEADER: ()=>session_token_js_namespaceObject.MCP_SESSION_HEADER,
instrument: ()=>instrument,
instrumentMutator: ()=>instrumentMutator,
PostHogMCPAnalyticsEvent: ()=>constants_js_namespaceObject.PostHogMCPAnalyticsEvent,
setLogger: ()=>logger_js_namespaceObject.setLogger,
encodeSessionId: ()=>session_token_js_namespaceObject.encodeSessionId,
getMoreToolsResult: ()=>tools_js_namespaceObject.getMoreToolsResult,
PostHogMCPAnalyticsProperty: ()=>constants_js_namespaceObject.PostHogMCPAnalyticsProperty
getMoreToolsResult: ()=>tools_js_namespaceObject.getMoreToolsResult
});

@@ -55,2 +56,3 @@ const compatibility_js_namespaceObject = require("./extensions/compatibility.js");

const constants_js_namespaceObject = require("./extensions/constants.js");
const request_headers_js_namespaceObject = require("./extensions/request-headers.js");
const posthog_mcp_js_namespaceObject = require("./extensions/posthog-mcp.js");

@@ -155,2 +157,3 @@ const tools_js_namespaceObject = require("./extensions/tools.js");

exports.getMoreToolsResult = __webpack_exports__.getMoreToolsResult;
exports.getRequestHeaders = __webpack_exports__.getRequestHeaders;
exports.instrument = __webpack_exports__.instrument;

@@ -171,2 +174,3 @@ exports.instrumentMutator = __webpack_exports__.instrumentMutator;

"getMoreToolsResult",
"getRequestHeaders",
"instrument",

@@ -173,0 +177,0 @@ "instrumentMutator",

@@ -13,2 +13,3 @@ import { isCompatibleServerType, isHighLevelServer } from "./extensions/compatibility.mjs";

import { POSTHOG_MCP_ANALYTICS_SOURCE, PostHogMCPAnalyticsEvent, PostHogMCPAnalyticsProperty } from "./extensions/constants.mjs";
import { getRequestHeaders } from "./extensions/request-headers.mjs";
import { PostHogMCP } from "./extensions/posthog-mcp.mjs";

@@ -103,2 +104,2 @@ import { getMoreToolsResult } from "./extensions/tools.mjs";

}
export { MCP_SESSION_HEADER, POSTHOG_MCP_ANALYTICS_SOURCE, PostHog, PostHogMCP, PostHogMCPAnalyticsEvent, PostHogMCPAnalyticsProperty, decodeSessionId, deriveSessionIdFromMCPSession, encodeSessionId, getMoreToolsResult, instrument, instrumentMutator, newSessionId, setLogger };
export { MCP_SESSION_HEADER, POSTHOG_MCP_ANALYTICS_SOURCE, PostHog, PostHogMCP, PostHogMCPAnalyticsEvent, PostHogMCPAnalyticsProperty, decodeSessionId, deriveSessionIdFromMCPSession, encodeSessionId, getMoreToolsResult, getRequestHeaders, instrument, instrumentMutator, newSessionId, setLogger };

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

}
/**
* The HTTP request an MCP SDK v2 server attaches to the handler context, as a
* WHATWG `Request` — so `headers` answers to `.get()`, not to indexing.
*/
export interface CompatibleHttpRequestLike {
req?: {
headers?: unknown;
[key: string]: unknown;
};
[key: string]: unknown;
}
export interface CompatibleRequestHandlerExtra {

@@ -208,4 +219,12 @@ headers?: Record<string, string | string[]>;

requestInfo?: CompatibleRequestInfoLike;
/** Where MCP SDK v2 puts the same thing. Read both through `getRequestHeaders`. */
http?: CompatibleHttpRequestLike;
[key: string]: unknown;
}
/**
* HTTP headers normalised to lowercase keys, as `getRequestHeaders` returns
* them — a plain bag, so a host's existing `headers['authorization']` keeps
* working when only the source of the headers changes.
*/
export type RequestHeaderBag = Record<string, string | string[]>;
export interface ServerClientInfoLike {

@@ -212,0 +231,0 @@ name?: string;

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

{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAo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AAE,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.0";
export declare const version = "0.11.1";
//# sourceMappingURL=version.d.ts.map

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

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

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

"dependencies": {
"@posthog/core": "^1.46.9"
"@posthog/core": "^1.47.0"
},

@@ -34,0 +34,0 @@ "devDependencies": {

@@ -70,2 +70,41 @@ # PostHog MCP package

## MCP TypeScript SDK v2
`instrument()` works on both SDK majors — `@modelcontextprotocol/sdk` v1 and
`@modelcontextprotocol/{core,server,client}` v2 — and on both the high-level `McpServer` and the
low-level `Server`. Shapes are detected at runtime, so neither major is a dependency here.
### Reading request headers in a callback
If your `identify`, `intentFallback`, `eventProperties` or `beforeSend` reads HTTP headers, it has
to change. The two majors put the request in different places and in different shapes: v1 attaches
a plain object at `extra.requestInfo.headers`, v2 attaches the WHATWG `Request` at `extra.http.req`,
whose `headers` only answers to `.get()`. A v1-shaped read returns `undefined` on v2 — an
`identify()` written that way returns `null` and every event goes anonymous.
The SDK hands your callback whatever the MCP SDK handed it, unchanged; it does **not** fake a v1
shape on v2, because a partially synthesised `requestInfo` is a more convincing lie than an absent
one. Read headers through the exported helper instead, which handles both majors, lowercases keys,
and duck-types `Headers` so it also works on edge runtimes:
```ts
import { getRequestHeaders } from '@posthog/mcp'
identify: async (request, extra) => {
const auth = getRequestHeaders(extra)?.['authorization'] // v1 and v2
// ...
}
```
### If you switched to `instrument(server.server)`
Before v2 support landed, the compatibility gate rejected high-level v2 servers, and the usual
workaround was to instrument the underlying low-level server. `instrument(server)` now works, so
you can go back to the documented call.
Whether the workaround costs you anything depends on your stack: instrumenting the low-level server
skips the high-level tool registry, so tool descriptions and callback-level wrapping come only from
what is advertised over `tools/list`. If your framework never calls `registerTool()` — `@rekog/mcp-nest`
does not — the registry is empty and the two calls behave the same.
## Developing locally

@@ -72,0 +111,0 @@

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

import type { HighLevelMCPServerLike, MCPServerLike } from '../types'
import {
canRegisterTools,
canSetRequestHandler,
hasClientVersionAccessor,
hasNestedLowLevelServer,
hasRequestHandlerMap,
hasServerInfo,
hasToolRegistry,
isBareServerShape,
} from './detect'
import type { LoggerFn } from './logger'

@@ -32,9 +42,7 @@

export function isHighLevelServer(server: unknown): server is ServerRecord & { server: ServerRecord } {
return (
!!server && typeof server === 'object' && 'server' in server && !!server.server && typeof server.server === 'object'
)
return hasNestedLowLevelServer(server)
}
export function isLowLevelServer(server: unknown): server is ServerRecord {
return !!server && typeof server === 'object' && !('server' in server)
return isBareServerShape(server)
}

@@ -51,3 +59,3 @@

if (isHighLevelServer(server)) {
if (!server._registeredTools || typeof server._registeredTools !== 'object') {
if (!hasToolRegistry(server)) {
logCompatibilityWarning(logger)

@@ -58,6 +66,10 @@ throw new Error(

}
if (typeof server.tool !== 'function') {
// Either registration method is enough. v1 has both; v2 dropped the
// deprecated tool() and kept registerTool(). Demanding tool() rejected every
// v2 high-level server, and instrument() swallows the rejection — so the
// integration looked healthy and captured nothing.
if (!canRegisterTools(server)) {
logCompatibilityWarning(logger)
throw new Error(
'PostHog MCP analytics SDK compatibility error: High-level server must have tool() method. This requires MCP SDK v1.11 or higher.'
'PostHog MCP analytics SDK compatibility error: High-level server must have a registerTool() or tool() method. This requires MCP SDK v1.11 or higher.'
)

@@ -83,5 +95,3 @@ }

const serverRecord = server as ServerRecord
if (typeof serverRecord.setRequestHandler !== 'function') {
if (!canSetRequestHandler(server)) {
logCompatibilityWarning(logger)

@@ -93,3 +103,5 @@ throw new Error(

if (!(serverRecord._requestHandlers && serverRecord._requestHandlers instanceof Map)) {
// A real Map with a working get(), which is what the handler patch reads and
// writes. Both majors keep it.
if (!hasRequestHandlerMap(server)) {
logCompatibilityWarning(logger)

@@ -101,12 +113,5 @@ throw new Error(

if (typeof serverRecord._requestHandlers.get !== 'function') {
if (!hasClientVersionAccessor(server)) {
logCompatibilityWarning(logger)
throw new Error(
'PostHog MCP analytics SDK compatibility error: Server._requestHandlers must be a Map with a get method. This requires MCP SDK v1.11 or higher.'
)
}
if (typeof serverRecord.getClientVersion !== 'function') {
logCompatibilityWarning(logger)
throw new Error(
'PostHog MCP analytics SDK compatibility error: Server.getClientVersion must be a function. This requires MCP SDK v1.11 or higher.'

@@ -116,7 +121,3 @@ )

if (
!serverRecord._serverInfo ||
typeof serverRecord._serverInfo !== 'object' ||
!('name' in serverRecord._serverInfo)
) {
if (!hasServerInfo(server)) {
logCompatibilityWarning(logger)

@@ -123,0 +124,0 @@ throw new Error(

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

import { readRequestHandlerMethod } from './mcp-sdk-compat'
import { getRequestHeaders } from './request-headers'
import { getSessionId, getSessionInfo, newSessionId } from './session'

@@ -692,4 +693,4 @@ import { encodeSessionId, readMcpSessionHeader, writeSessionIdToTransport } from './session-token'

try {
const headers = extra?.requestInfo?.headers
if (!headers || typeof headers !== 'object') {
const headers = getRequestHeaders(extra)
if (!headers) {
return undefined // not an HTTP transport (stdio/in-memory) — nothing to mint into

@@ -696,0 +697,0 @@ }

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

import { getServerTrackingData, setServerTrackingData } from './internal'
import { getRequestHeaders } from './request-headers'
import { decodeSessionId, readMcpSessionHeader } from './session-token'

@@ -114,3 +115,3 @@ import type { SessionTokenPayload } from './session-token'

): SessionTokenPayload | undefined {
const token = decodeSessionId(readMcpSessionHeader(extra?.requestInfo?.headers))
const token = decodeSessionId(readMcpSessionHeader(getRequestHeaders(extra)))
if (!token) {

@@ -117,0 +118,0 @@ return undefined

import type { CompatibleRequestHandlerExtra, McpEvent } from '../types'
import { readHeaderValue } from './headers'
import { getRequestHeaders } from './request-headers'

@@ -46,8 +47,13 @@ /**

/**
* 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.
* Reads the transport identity headers off the request. Returns `undefined`
* when the request carries neither — including every stdio and in-memory
* request, which has no HTTP headers at all. Never throws.
*
* Sourced through `getRequestHeaders` rather than `extra.requestInfo.headers`
* directly: MCP SDK v2 puts the request at `extra.http.req` as a WHATWG
* `Request`, so a v1-shaped read finds nothing and this whole feature would be
* silently inert on exactly the servers being adopted now.
*/
export function readTransportIdentity(extra: CompatibleRequestHandlerExtra | undefined): TransportIdentity | undefined {
const headers = extra?.requestInfo?.headers
const headers = getRequestHeaders(extra)
if (!headers) {

@@ -54,0 +60,0 @@ return undefined

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

} from './extensions/constants'
// Host callbacks receive the SDK's `extra`/`ctx` unchanged, and the two SDK
// majors carry HTTP headers in different places and shapes. This reads either.
export { getRequestHeaders } from './extensions/request-headers'
export { PostHogMCP, type PostHogMCPOptions } from './extensions/posthog-mcp'

@@ -233,2 +236,3 @@ export { getMoreToolsResult } from './extensions/tools'

PrepareToolListOptions,
RequestHeaderBag,
ToolCallCaptureData,

@@ -235,0 +239,0 @@ ToolsListCaptureData,

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

/**
* The HTTP request an MCP SDK v2 server attaches to the handler context, as a
* WHATWG `Request` — so `headers` answers to `.get()`, not to indexing.
*/
export interface CompatibleHttpRequestLike {
req?: { headers?: unknown; [key: string]: unknown }
[key: string]: unknown
}
export interface CompatibleRequestHandlerExtra {

@@ -234,5 +243,14 @@ headers?: Record<string, string | string[]>

requestInfo?: CompatibleRequestInfoLike
/** Where MCP SDK v2 puts the same thing. Read both through `getRequestHeaders`. */
http?: CompatibleHttpRequestLike
[key: string]: unknown
}
/**
* HTTP headers normalised to lowercase keys, as `getRequestHeaders` returns
* them — a plain bag, so a host's existing `headers['authorization']` keeps
* working when only the source of the headers changes.
*/
export type RequestHeaderBag = Record<string, string | string[]>
export interface ServerClientInfoLike {

@@ -239,0 +257,0 @@ name?: string

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

export const version = '0.11.0'
export const version = '0.11.1'