@posthog/mcp 0.11.1 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extensions/client-identity.d.ts +70 -15
- package/dist/extensions/client-identity.d.ts.map +1 -1
- package/dist/extensions/client-identity.js +72 -17
- package/dist/extensions/client-identity.mjs +59 -13
- package/dist/extensions/detect.d.ts +6 -0
- package/dist/extensions/detect.d.ts.map +1 -1
- package/dist/extensions/detect.js +6 -0
- package/dist/extensions/detect.mjs +4 -1
- package/dist/extensions/instrument-highlevel.d.ts.map +1 -1
- package/dist/extensions/instrumentation.d.ts +4 -5
- package/dist/extensions/instrumentation.d.ts.map +1 -1
- package/dist/extensions/instrumentation.js +3 -3
- package/dist/extensions/instrumentation.mjs +4 -4
- package/dist/extensions/internal.js +1 -1
- package/dist/extensions/internal.mjs +2 -2
- package/dist/extensions/tools.d.ts +4 -4
- package/dist/extensions/tools.d.ts.map +1 -1
- package/dist/types.d.ts +58 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +11 -1
- package/src/extensions/client-identity.ts +146 -31
- package/src/extensions/detect.ts +9 -0
- package/src/extensions/instrument-highlevel.ts +4 -4
- package/src/extensions/instrumentation.ts +19 -13
- package/src/extensions/internal.ts +2 -2
- package/src/extensions/tools.ts +4 -4
- package/src/types.ts +60 -3
- package/src/version.ts +1 -1
package/src/types.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// Copyright (c) 2025 AgentCat, Inc. (formerly MCPcat)
|
|
4
4
|
// Licensed under the MIT License: https://github.com/agentcathq/agentcat-typescript-sdk/blob/main/LICENSE
|
|
5
5
|
|
|
6
|
-
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js'
|
|
7
6
|
import type { ErrorTracking } from '@posthog/core'
|
|
7
|
+
import type { AnalyticsInjectableJsonSchema } from './extensions/analytics-parameters'
|
|
8
8
|
import type { MCPAnalyticsEventType } from './extensions/event-types'
|
|
9
9
|
import type { IdentityCache } from './extensions/internal'
|
|
10
10
|
import type { PostHogCaptureEvent } from './extensions/posthog-events'
|
|
@@ -18,6 +18,54 @@ export type ErrorProperties = ErrorTracking.ErrorProperties
|
|
|
18
18
|
/** A single parsed stack frame. Re-exported from `@posthog/core`. */
|
|
19
19
|
export type StackFrame = ErrorTracking.StackFrame
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* The MCP wire shapes we touch, declared structurally rather than imported from
|
|
23
|
+
* `@modelcontextprotocol/sdk`.
|
|
24
|
+
*
|
|
25
|
+
* Both SDK majors are **optional** peers — a v2-only consumer has no v1 SDK
|
|
26
|
+
* installed — so a type import of it in shipped `.d.ts` output is a `TS2307`
|
|
27
|
+
* for anyone type-checking without `skipLibCheck`. These are deliberately loose
|
|
28
|
+
* (open-ended, everything optional): they describe what we *read* off an SDK
|
|
29
|
+
* result, and an SDK-typed value assigns to them cleanly. What we hand back to
|
|
30
|
+
* the SDK is typed precisely instead — see {@link CompatibleTextToolResult}.
|
|
31
|
+
*/
|
|
32
|
+
export interface CompatibleToolResultLike {
|
|
33
|
+
content?: unknown[]
|
|
34
|
+
structuredContent?: JsonRecord
|
|
35
|
+
isError?: boolean
|
|
36
|
+
_meta?: JsonRecord
|
|
37
|
+
[key: string]: unknown
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** One entry of a `tools/list` response, as we read it. */
|
|
41
|
+
export interface CompatibleToolDescriptorLike {
|
|
42
|
+
name: string
|
|
43
|
+
title?: string
|
|
44
|
+
description?: string
|
|
45
|
+
/** The advertised JSON Schema, as the analytics parameters are injected into it. */
|
|
46
|
+
inputSchema?: AnalyticsInjectableJsonSchema
|
|
47
|
+
outputSchema?: unknown
|
|
48
|
+
_meta?: JsonRecord
|
|
49
|
+
[key: string]: unknown
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** A `tools/list` response, as we read it. */
|
|
53
|
+
export interface CompatibleToolsListLike {
|
|
54
|
+
tools: CompatibleToolDescriptorLike[]
|
|
55
|
+
nextCursor?: string
|
|
56
|
+
[key: string]: unknown
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A text-only tool result *we* construct and a host may hand straight back to
|
|
61
|
+
* the SDK. Typed precisely, not loosely, so it stays assignable to the SDK's own
|
|
62
|
+
* `CallToolResult` — the direction that would silently break callers.
|
|
63
|
+
*/
|
|
64
|
+
export interface CompatibleTextToolResult {
|
|
65
|
+
content: { type: 'text'; text: string }[]
|
|
66
|
+
isError?: boolean
|
|
67
|
+
}
|
|
68
|
+
|
|
21
69
|
export interface MCPRequestParamsLike {
|
|
22
70
|
arguments?: JsonRecord
|
|
23
71
|
name?: string
|
|
@@ -128,8 +176,11 @@ export type MaybePromise<T> = T | Promise<T>
|
|
|
128
176
|
export type MCPAnalyticsIntentSource = 'context_parameter' | 'inferred'
|
|
129
177
|
|
|
130
178
|
export type ToolCallback =
|
|
131
|
-
| ((
|
|
132
|
-
|
|
179
|
+
| ((
|
|
180
|
+
args: unknown,
|
|
181
|
+
extra: CompatibleRequestHandlerExtra
|
|
182
|
+
) => CompatibleToolResultLike | Promise<CompatibleToolResultLike>)
|
|
183
|
+
| ((extra: CompatibleRequestHandlerExtra) => CompatibleToolResultLike | Promise<CompatibleToolResultLike>)
|
|
133
184
|
|
|
134
185
|
// RegisteredTool type that supports both MCP SDK 1.23- (callback) and 1.24+ (handler)
|
|
135
186
|
export type RegisteredTool = {
|
|
@@ -241,6 +292,12 @@ export interface CompatibleRequestHandlerExtra {
|
|
|
241
292
|
requestInfo?: CompatibleRequestInfoLike
|
|
242
293
|
/** Where MCP SDK v2 puts the same thing. Read both through `getRequestHeaders`. */
|
|
243
294
|
http?: CompatibleHttpRequestLike
|
|
295
|
+
/**
|
|
296
|
+
* MCP SDK v2's parsed request. It lifts the reserved `io.modelcontextprotocol/*`
|
|
297
|
+
* keys out of `params._meta` into `envelope`, so client identity is here rather
|
|
298
|
+
* than on the request by the time a handler runs.
|
|
299
|
+
*/
|
|
300
|
+
mcpReq?: { envelope?: Record<string, unknown>; [key: string]: unknown }
|
|
244
301
|
[key: string]: unknown
|
|
245
302
|
}
|
|
246
303
|
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.11.
|
|
1
|
+
export const version = '0.11.2'
|