@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
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import type { McpEvent, MCPRequestLike } from '../types';
|
|
1
|
+
import type { CompatibleRequestHandlerExtra, McpEvent, MCPRequestLike, MCPServerLike } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
* Client identity
|
|
3
|
+
* Client identity — who is calling, and which spec revision they speak.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* of
|
|
5
|
+
* Where it lives depends on the revision the *request* declares, so this is a
|
|
6
|
+
* fallback chain and never a branch: one server serves both eras, request by
|
|
7
|
+
* request.
|
|
8
|
+
*
|
|
9
|
+
* 1. `ctx.mcpReq.envelope` — MCP SDK v2 lifts the reserved
|
|
10
|
+
* `io.modelcontextprotocol/*` keys out of `_meta` before dispatch, so by
|
|
11
|
+
* the time a handler runs they are here and `params._meta` is empty.
|
|
12
|
+
* 2. `request.params._meta` — where 2026-07-28 puts them on the wire, and
|
|
13
|
+
* where they still are on any server that does not lift them.
|
|
14
|
+
* 3. the server's own accessors — `getClientVersion()` from a legacy
|
|
15
|
+
* `initialize` handshake, `getNegotiatedProtocolVersion()` on v2.
|
|
16
|
+
*
|
|
17
|
+
* The 2026-07-28 revision removed the `initialize` handshake and the
|
|
18
|
+
* `Mcp-Session-Id` header (SEP-2575 / SEP-2567), so client name/version and the
|
|
19
|
+
* protocol version no longer arrive once per connection — they travel with
|
|
20
|
+
* every request. The key strings are mirrored here rather than imported,
|
|
21
|
+
* because no `@modelcontextprotocol/*` package is a dependency of this one.
|
|
11
22
|
*/
|
|
12
23
|
export declare const META_CLIENT_INFO_KEY = "io.modelcontextprotocol/clientInfo";
|
|
13
24
|
export declare const META_PROTOCOL_VERSION_KEY = "io.modelcontextprotocol/protocolVersion";
|
|
@@ -16,6 +27,18 @@ export interface MetaClientInfo {
|
|
|
16
27
|
clientVersion?: string;
|
|
17
28
|
protocolVersion?: string;
|
|
18
29
|
}
|
|
30
|
+
/** Everything a request can be asked about who is calling. */
|
|
31
|
+
export interface ClientIdentitySources {
|
|
32
|
+
request: MCPRequestLike;
|
|
33
|
+
extra?: CompatibleRequestHandlerExtra;
|
|
34
|
+
/**
|
|
35
|
+
* Typed `unknown` on purpose: every accessor on it is reached through a
|
|
36
|
+
* structural probe, never a declared type, because the two SDK majors expose
|
|
37
|
+
* different ones. Call sites pass a real `MCPServerLike`; the shape checks
|
|
38
|
+
* here are what decide whether it can answer.
|
|
39
|
+
*/
|
|
40
|
+
server?: unknown;
|
|
41
|
+
}
|
|
19
42
|
/**
|
|
20
43
|
* Reads the client name/version and protocol version a modern client puts in
|
|
21
44
|
* `params._meta`. Returns `undefined` when the request carries none (e.g. a
|
|
@@ -23,17 +46,49 @@ export interface MetaClientInfo {
|
|
|
23
46
|
*/
|
|
24
47
|
export declare function readMetaClientInfo(request: MCPRequestLike): MetaClientInfo | undefined;
|
|
25
48
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
49
|
+
* Reads the same keys from MCP SDK v2's request envelope. v2 strips the reserved
|
|
50
|
+
* `io.modelcontextprotocol/*` keys from `_meta` while parsing, so on exactly the
|
|
51
|
+
* traffic this matters for, `readMetaClientInfo` finds nothing and this finds
|
|
52
|
+
* everything.
|
|
53
|
+
*/
|
|
54
|
+
export declare function readEnvelopeClientInfo(extra: CompatibleRequestHandlerExtra | undefined): MetaClientInfo | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Asks the server itself. `getClientVersion()` answers on any server that
|
|
57
|
+
* handled an `initialize` (and v2 hosts such as `createMcpHandler` backfill it
|
|
58
|
+
* from the envelope); `getNegotiatedProtocolVersion()` exists on v2 only, which
|
|
59
|
+
* is why it is a link in the chain rather than a branch. Never throws — a
|
|
60
|
+
* server that dislikes being asked must not fail the tool call.
|
|
61
|
+
*/
|
|
62
|
+
export declare function readServerClientIdentity(server: unknown): MetaClientInfo | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Resolves client identity through the whole chain, field by field: the first
|
|
65
|
+
* source that answers a field wins, and a source that answers nothing simply
|
|
66
|
+
* does not participate. Field-by-field rather than source-by-source because a
|
|
67
|
+
* request may carry its protocol version in the envelope while the client's
|
|
68
|
+
* name is only known to the server from a handshake.
|
|
69
|
+
*
|
|
70
|
+
* The first three links are **per request**, so they cannot describe anyone but
|
|
71
|
+
* the caller. Only the last — the server's own accessors — is connection-scoped,
|
|
72
|
+
* and on a server that multiplexes several clients through one connection it
|
|
73
|
+
* answers for whichever client completed the handshake. That is the best answer
|
|
74
|
+
* available on that connection, and it is the same scope `capture.ts` has always
|
|
75
|
+
* fallen back to (`eventInput.clientName ?? sessionInfo.clientName`), so the
|
|
76
|
+
* chain neither introduces that sharing nor widens it. Ordering it last is what
|
|
77
|
+
* keeps it a fallback: any request that identifies itself wins outright.
|
|
78
|
+
*/
|
|
79
|
+
export declare function resolveClientIdentity({ request, extra, server }: ClientIdentitySources): MetaClientInfo | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Stamps whatever the chain resolved onto the event being built for *this*
|
|
82
|
+
* request, so it carries `$mcp_client_name`, `$mcp_client_version` and
|
|
83
|
+
* `$mcp_protocol_version` even when there was no `initialize` to learn them
|
|
84
|
+
* from (the modern stateless case).
|
|
30
85
|
*
|
|
31
86
|
* Writing to the event — a per-request object — rather than the server-wide
|
|
32
87
|
* `sessionInfo` keeps identity correct when one instrumented server multiplexes
|
|
33
88
|
* concurrent requests from different clients (which the stateless spec allows):
|
|
34
89
|
* a sibling request can't clobber this event's attribution between now and when
|
|
35
|
-
* it's captured. Only fields
|
|
36
|
-
*
|
|
90
|
+
* it's captured. Only fields actually resolved are set, so a request that
|
|
91
|
+
* carries nothing leaves the event's existing values untouched.
|
|
37
92
|
*/
|
|
38
|
-
export declare function
|
|
93
|
+
export declare function stampClientIdentity(event: McpEvent, request: MCPRequestLike, extra?: CompatibleRequestHandlerExtra, server?: MCPServerLike): void;
|
|
39
94
|
//# sourceMappingURL=client-identity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
{"version":3,"file":"client-identity.d.ts","sourceRoot":"","sources":["../../src/extensions/client-identity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,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pack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
28
|
-
META_PROTOCOL_VERSION_KEY: ()=>META_PROTOCOL_VERSION_KEY,
|
|
27
|
+
resolveClientIdentity: ()=>resolveClientIdentity,
|
|
29
28
|
readMetaClientInfo: ()=>readMetaClientInfo,
|
|
30
|
-
|
|
29
|
+
readServerClientIdentity: ()=>readServerClientIdentity,
|
|
30
|
+
readEnvelopeClientInfo: ()=>readEnvelopeClientInfo,
|
|
31
|
+
META_PROTOCOL_VERSION_KEY: ()=>META_PROTOCOL_VERSION_KEY,
|
|
32
|
+
stampClientIdentity: ()=>stampClientIdentity,
|
|
33
|
+
META_CLIENT_INFO_KEY: ()=>META_CLIENT_INFO_KEY
|
|
31
34
|
});
|
|
35
|
+
const external_detect_js_namespaceObject = require("./detect.js");
|
|
32
36
|
const META_CLIENT_INFO_KEY = 'io.modelcontextprotocol/clientInfo';
|
|
33
37
|
const META_PROTOCOL_VERSION_KEY = 'io.modelcontextprotocol/protocolVersion';
|
|
38
|
+
function nonEmptyString(value) {
|
|
39
|
+
return 'string' == typeof value && value.length > 0 ? value : void 0;
|
|
40
|
+
}
|
|
41
|
+
function readClientInfoValue(value) {
|
|
42
|
+
if (!value || 'object' != typeof value) return;
|
|
43
|
+
const { name, version } = value;
|
|
44
|
+
const result = {};
|
|
45
|
+
const clientName = nonEmptyString(name);
|
|
46
|
+
const clientVersion = nonEmptyString(version);
|
|
47
|
+
if (clientName) result.clientName = clientName;
|
|
48
|
+
if (clientVersion) result.clientVersion = clientVersion;
|
|
49
|
+
return result.clientName || result.clientVersion ? result : void 0;
|
|
50
|
+
}
|
|
51
|
+
function readReservedKeys(bag) {
|
|
52
|
+
if (!bag || 'object' != typeof bag) return;
|
|
53
|
+
const record = bag;
|
|
54
|
+
const result = {
|
|
55
|
+
...readClientInfoValue(record[META_CLIENT_INFO_KEY])
|
|
56
|
+
};
|
|
57
|
+
const protocolVersion = nonEmptyString(record[META_PROTOCOL_VERSION_KEY]);
|
|
58
|
+
if (protocolVersion) result.protocolVersion = protocolVersion;
|
|
59
|
+
return result.clientName || result.clientVersion || result.protocolVersion ? result : void 0;
|
|
60
|
+
}
|
|
34
61
|
function readMetaClientInfo(request) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
62
|
+
return readReservedKeys(request.params?._meta);
|
|
63
|
+
}
|
|
64
|
+
function readEnvelopeClientInfo(extra) {
|
|
65
|
+
return readReservedKeys(extra?.mcpReq?.envelope);
|
|
66
|
+
}
|
|
67
|
+
function readServerClientIdentity(server) {
|
|
68
|
+
if (!server) return;
|
|
69
|
+
const result = {};
|
|
70
|
+
try {
|
|
71
|
+
if ((0, external_detect_js_namespaceObject.hasClientVersionAccessor)(server)) Object.assign(result, readClientInfoValue(server.getClientVersion()));
|
|
72
|
+
if ((0, external_detect_js_namespaceObject.hasNegotiatedProtocolVersionAccessor)(server)) {
|
|
73
|
+
const negotiated = server.getNegotiatedProtocolVersion();
|
|
74
|
+
const protocolVersion = nonEmptyString(negotiated);
|
|
75
|
+
if (protocolVersion) result.protocolVersion = protocolVersion;
|
|
76
|
+
}
|
|
77
|
+
} catch {}
|
|
78
|
+
return result.clientName || result.clientVersion || result.protocolVersion ? result : void 0;
|
|
79
|
+
}
|
|
80
|
+
function resolveClientIdentity({ request, extra, server }) {
|
|
81
|
+
const chain = [
|
|
82
|
+
readEnvelopeClientInfo(extra),
|
|
83
|
+
readMetaClientInfo(request),
|
|
84
|
+
readServerClientIdentity(server)
|
|
85
|
+
];
|
|
38
86
|
const result = {};
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if ('string' == typeof version && version.length > 0) result.clientVersion = version;
|
|
87
|
+
for (const source of chain)if (source) {
|
|
88
|
+
result.clientName ??= source.clientName;
|
|
89
|
+
result.clientVersion ??= source.clientVersion;
|
|
90
|
+
result.protocolVersion ??= source.protocolVersion;
|
|
44
91
|
}
|
|
45
|
-
const protocolVersion = record[META_PROTOCOL_VERSION_KEY];
|
|
46
|
-
if ('string' == typeof protocolVersion && protocolVersion.length > 0) result.protocolVersion = protocolVersion;
|
|
47
92
|
return result.clientName || result.clientVersion || result.protocolVersion ? result : void 0;
|
|
48
93
|
}
|
|
49
|
-
function
|
|
50
|
-
const info =
|
|
94
|
+
function stampClientIdentity(event, request, extra, server) {
|
|
95
|
+
const info = resolveClientIdentity({
|
|
96
|
+
request,
|
|
97
|
+
extra,
|
|
98
|
+
server
|
|
99
|
+
});
|
|
51
100
|
if (!info) return;
|
|
52
101
|
if (info.clientName) event.clientName = info.clientName;
|
|
53
102
|
if (info.clientVersion) event.clientVersion = info.clientVersion;
|
|
@@ -55,13 +104,19 @@ function stampMetaClientInfo(event, request) {
|
|
|
55
104
|
}
|
|
56
105
|
exports.META_CLIENT_INFO_KEY = __webpack_exports__.META_CLIENT_INFO_KEY;
|
|
57
106
|
exports.META_PROTOCOL_VERSION_KEY = __webpack_exports__.META_PROTOCOL_VERSION_KEY;
|
|
107
|
+
exports.readEnvelopeClientInfo = __webpack_exports__.readEnvelopeClientInfo;
|
|
58
108
|
exports.readMetaClientInfo = __webpack_exports__.readMetaClientInfo;
|
|
59
|
-
exports.
|
|
109
|
+
exports.readServerClientIdentity = __webpack_exports__.readServerClientIdentity;
|
|
110
|
+
exports.resolveClientIdentity = __webpack_exports__.resolveClientIdentity;
|
|
111
|
+
exports.stampClientIdentity = __webpack_exports__.stampClientIdentity;
|
|
60
112
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
61
113
|
"META_CLIENT_INFO_KEY",
|
|
62
114
|
"META_PROTOCOL_VERSION_KEY",
|
|
115
|
+
"readEnvelopeClientInfo",
|
|
63
116
|
"readMetaClientInfo",
|
|
64
|
-
"
|
|
117
|
+
"readServerClientIdentity",
|
|
118
|
+
"resolveClientIdentity",
|
|
119
|
+
"stampClientIdentity"
|
|
65
120
|
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
66
121
|
Object.defineProperty(exports, '__esModule', {
|
|
67
122
|
value: true
|
|
@@ -1,25 +1,71 @@
|
|
|
1
|
+
import { hasClientVersionAccessor, hasNegotiatedProtocolVersionAccessor } from "./detect.mjs";
|
|
1
2
|
const META_CLIENT_INFO_KEY = 'io.modelcontextprotocol/clientInfo';
|
|
2
3
|
const META_PROTOCOL_VERSION_KEY = 'io.modelcontextprotocol/protocolVersion';
|
|
4
|
+
function nonEmptyString(value) {
|
|
5
|
+
return 'string' == typeof value && value.length > 0 ? value : void 0;
|
|
6
|
+
}
|
|
7
|
+
function readClientInfoValue(value) {
|
|
8
|
+
if (!value || 'object' != typeof value) return;
|
|
9
|
+
const { name, version } = value;
|
|
10
|
+
const result = {};
|
|
11
|
+
const clientName = nonEmptyString(name);
|
|
12
|
+
const clientVersion = nonEmptyString(version);
|
|
13
|
+
if (clientName) result.clientName = clientName;
|
|
14
|
+
if (clientVersion) result.clientVersion = clientVersion;
|
|
15
|
+
return result.clientName || result.clientVersion ? result : void 0;
|
|
16
|
+
}
|
|
17
|
+
function readReservedKeys(bag) {
|
|
18
|
+
if (!bag || 'object' != typeof bag) return;
|
|
19
|
+
const record = bag;
|
|
20
|
+
const result = {
|
|
21
|
+
...readClientInfoValue(record[META_CLIENT_INFO_KEY])
|
|
22
|
+
};
|
|
23
|
+
const protocolVersion = nonEmptyString(record[META_PROTOCOL_VERSION_KEY]);
|
|
24
|
+
if (protocolVersion) result.protocolVersion = protocolVersion;
|
|
25
|
+
return result.clientName || result.clientVersion || result.protocolVersion ? result : void 0;
|
|
26
|
+
}
|
|
3
27
|
function readMetaClientInfo(request) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
28
|
+
return readReservedKeys(request.params?._meta);
|
|
29
|
+
}
|
|
30
|
+
function readEnvelopeClientInfo(extra) {
|
|
31
|
+
return readReservedKeys(extra?.mcpReq?.envelope);
|
|
32
|
+
}
|
|
33
|
+
function readServerClientIdentity(server) {
|
|
34
|
+
if (!server) return;
|
|
35
|
+
const result = {};
|
|
36
|
+
try {
|
|
37
|
+
if (hasClientVersionAccessor(server)) Object.assign(result, readClientInfoValue(server.getClientVersion()));
|
|
38
|
+
if (hasNegotiatedProtocolVersionAccessor(server)) {
|
|
39
|
+
const negotiated = server.getNegotiatedProtocolVersion();
|
|
40
|
+
const protocolVersion = nonEmptyString(negotiated);
|
|
41
|
+
if (protocolVersion) result.protocolVersion = protocolVersion;
|
|
42
|
+
}
|
|
43
|
+
} catch {}
|
|
44
|
+
return result.clientName || result.clientVersion || result.protocolVersion ? result : void 0;
|
|
45
|
+
}
|
|
46
|
+
function resolveClientIdentity({ request, extra, server }) {
|
|
47
|
+
const chain = [
|
|
48
|
+
readEnvelopeClientInfo(extra),
|
|
49
|
+
readMetaClientInfo(request),
|
|
50
|
+
readServerClientIdentity(server)
|
|
51
|
+
];
|
|
7
52
|
const result = {};
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if ('string' == typeof version && version.length > 0) result.clientVersion = version;
|
|
53
|
+
for (const source of chain)if (source) {
|
|
54
|
+
result.clientName ??= source.clientName;
|
|
55
|
+
result.clientVersion ??= source.clientVersion;
|
|
56
|
+
result.protocolVersion ??= source.protocolVersion;
|
|
13
57
|
}
|
|
14
|
-
const protocolVersion = record[META_PROTOCOL_VERSION_KEY];
|
|
15
|
-
if ('string' == typeof protocolVersion && protocolVersion.length > 0) result.protocolVersion = protocolVersion;
|
|
16
58
|
return result.clientName || result.clientVersion || result.protocolVersion ? result : void 0;
|
|
17
59
|
}
|
|
18
|
-
function
|
|
19
|
-
const info =
|
|
60
|
+
function stampClientIdentity(event, request, extra, server) {
|
|
61
|
+
const info = resolveClientIdentity({
|
|
62
|
+
request,
|
|
63
|
+
extra,
|
|
64
|
+
server
|
|
65
|
+
});
|
|
20
66
|
if (!info) return;
|
|
21
67
|
if (info.clientName) event.clientName = info.clientName;
|
|
22
68
|
if (info.clientVersion) event.clientVersion = info.clientVersion;
|
|
23
69
|
if (info.protocolVersion) event.protocolVersion = info.protocolVersion;
|
|
24
70
|
}
|
|
25
|
-
export { META_CLIENT_INFO_KEY, META_PROTOCOL_VERSION_KEY, readMetaClientInfo,
|
|
71
|
+
export { META_CLIENT_INFO_KEY, META_PROTOCOL_VERSION_KEY, readEnvelopeClientInfo, readMetaClientInfo, readServerClientIdentity, resolveClientIdentity, stampClientIdentity };
|
|
@@ -39,6 +39,12 @@ export declare function canSetRequestHandler(server: unknown): boolean;
|
|
|
39
39
|
export declare function hasRequestHandlerMap(server: unknown): boolean;
|
|
40
40
|
/** `getClientVersion()` — still present on v2, and a link in B1's identity chain. */
|
|
41
41
|
export declare function hasClientVersionAccessor(server: unknown): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* `getNegotiatedProtocolVersion()` — v2 only, and the last link in the protocol
|
|
44
|
+
* version chain. A v1 server does not have it, which is why the chain probes for
|
|
45
|
+
* it instead of branching on which SDK is installed.
|
|
46
|
+
*/
|
|
47
|
+
export declare function hasNegotiatedProtocolVersionAccessor(server: unknown): boolean;
|
|
42
48
|
/** `_serverInfo`, which names the server on every event. */
|
|
43
49
|
export declare function hasServerInfo(server: unknown): boolean;
|
|
44
50
|
export {};
|
|
@@ -1 +1 @@
|
|
|
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,OA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CAAoC,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAE7E;AAED,4DAA4D;AAC5D,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAGtD"}
|
|
@@ -27,6 +27,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27
27
|
canRegisterTools: ()=>canRegisterTools,
|
|
28
28
|
canSetRequestHandler: ()=>canSetRequestHandler,
|
|
29
29
|
hasClientVersionAccessor: ()=>hasClientVersionAccessor,
|
|
30
|
+
hasNegotiatedProtocolVersionAccessor: ()=>hasNegotiatedProtocolVersionAccessor,
|
|
30
31
|
hasNestedLowLevelServer: ()=>hasNestedLowLevelServer,
|
|
31
32
|
hasRequestHandlerMap: ()=>hasRequestHandlerMap,
|
|
32
33
|
hasServerInfo: ()=>hasServerInfo,
|
|
@@ -63,6 +64,9 @@ function hasRequestHandlerMap(server) {
|
|
|
63
64
|
function hasClientVersionAccessor(server) {
|
|
64
65
|
return hasMethod(server, 'getClientVersion');
|
|
65
66
|
}
|
|
67
|
+
function hasNegotiatedProtocolVersionAccessor(server) {
|
|
68
|
+
return hasMethod(server, 'getNegotiatedProtocolVersion');
|
|
69
|
+
}
|
|
66
70
|
function hasServerInfo(server) {
|
|
67
71
|
const info = asRecord(asRecord(server)?._serverInfo);
|
|
68
72
|
return !!info && 'name' in info;
|
|
@@ -70,6 +74,7 @@ function hasServerInfo(server) {
|
|
|
70
74
|
exports.canRegisterTools = __webpack_exports__.canRegisterTools;
|
|
71
75
|
exports.canSetRequestHandler = __webpack_exports__.canSetRequestHandler;
|
|
72
76
|
exports.hasClientVersionAccessor = __webpack_exports__.hasClientVersionAccessor;
|
|
77
|
+
exports.hasNegotiatedProtocolVersionAccessor = __webpack_exports__.hasNegotiatedProtocolVersionAccessor;
|
|
73
78
|
exports.hasNestedLowLevelServer = __webpack_exports__.hasNestedLowLevelServer;
|
|
74
79
|
exports.hasRequestHandlerMap = __webpack_exports__.hasRequestHandlerMap;
|
|
75
80
|
exports.hasServerInfo = __webpack_exports__.hasServerInfo;
|
|
@@ -79,6 +84,7 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
|
79
84
|
"canRegisterTools",
|
|
80
85
|
"canSetRequestHandler",
|
|
81
86
|
"hasClientVersionAccessor",
|
|
87
|
+
"hasNegotiatedProtocolVersionAccessor",
|
|
82
88
|
"hasNestedLowLevelServer",
|
|
83
89
|
"hasRequestHandlerMap",
|
|
84
90
|
"hasServerInfo",
|
|
@@ -28,8 +28,11 @@ function hasRequestHandlerMap(server) {
|
|
|
28
28
|
function hasClientVersionAccessor(server) {
|
|
29
29
|
return hasMethod(server, 'getClientVersion');
|
|
30
30
|
}
|
|
31
|
+
function hasNegotiatedProtocolVersionAccessor(server) {
|
|
32
|
+
return hasMethod(server, 'getNegotiatedProtocolVersion');
|
|
33
|
+
}
|
|
31
34
|
function hasServerInfo(server) {
|
|
32
35
|
const info = asRecord(asRecord(server)?._serverInfo);
|
|
33
36
|
return !!info && 'name' in info;
|
|
34
37
|
}
|
|
35
|
-
export { canRegisterTools, canSetRequestHandler, hasClientVersionAccessor, hasNestedLowLevelServer, hasRequestHandlerMap, hasServerInfo, hasToolRegistry, isBareServerShape };
|
|
38
|
+
export { canRegisterTools, canSetRequestHandler, hasClientVersionAccessor, hasNegotiatedProtocolVersionAccessor, hasNestedLowLevelServer, hasRequestHandlerMap, hasServerInfo, hasToolRegistry, isBareServerShape };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument-highlevel.d.ts","sourceRoot":"","sources":["../../src/extensions/instrument-highlevel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"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,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { AnalyticsParameterOwnership, CompatibleRequestHandlerExtra, MCPAnalyticsData, MCPRequestLike, MCPServerLike } from '../types';
|
|
1
|
+
import type { AnalyticsParameterOwnership, CompatibleRequestHandlerExtra, CompatibleToolsListLike, MCPAnalyticsData, MCPRequestLike, MCPServerLike } from '../types';
|
|
3
2
|
import { MCPAnalyticsEventType } from './event-types';
|
|
4
3
|
import type { LoggerFn } from './logger';
|
|
5
4
|
/**
|
|
@@ -97,16 +96,16 @@ export declare function isToolAdvertised(server: MCPServerLike, toolName: string
|
|
|
97
96
|
* parameter, conversation id, `get_more_tools`) into the returned list.
|
|
98
97
|
*/
|
|
99
98
|
export declare function handleListToolsRequest(server: MCPServerLike, originalListToolsHandler: MCPRequestHandler, request: MCPRequestLike, extra: CompatibleRequestHandlerExtra | undefined, logger: LoggerFn): Promise<{
|
|
100
|
-
tools:
|
|
99
|
+
tools: CompatibleToolsListLike['tools'];
|
|
101
100
|
}>;
|
|
102
|
-
export declare function cacheToolDescriptions(cache: Map<string, string>, tools:
|
|
101
|
+
export declare function cacheToolDescriptions(cache: Map<string, string>, tools: CompatibleToolsListLike['tools'] | undefined): void;
|
|
103
102
|
/**
|
|
104
103
|
* Category declared on a tool's `_meta` block (the MCP spec allows arbitrary
|
|
105
104
|
* `_meta` keys). Declaring `_meta: { category: "Logs" }` on a tool definition
|
|
106
105
|
* is all a server needs for every call to carry `$mcp_tool_category`.
|
|
107
106
|
*/
|
|
108
107
|
export declare function readToolMetaCategory(meta: unknown): string | undefined;
|
|
109
|
-
export declare function cacheToolCategories(cache: Map<string, string>, tools:
|
|
108
|
+
export declare function cacheToolCategories(cache: Map<string, string>, tools: CompatibleToolsListLike['tools'] | undefined): void;
|
|
110
109
|
/**
|
|
111
110
|
* Captures the connection handshake (and resolves identity) on `initialize`
|
|
112
111
|
* before the original handler runs.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../src/extensions/instrumentation.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../src/extensions/instrumentation.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,2BAA2B,EAC3B,6BAA6B,EAC7B,uBAAuB,EACvB,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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GtE;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"}
|
|
@@ -110,7 +110,7 @@ async function prepareToolCallEvent(server, data, request, downstreamRequest, ex
|
|
|
110
110
|
toolCategory: toolName ? data.toolCategories.get(toolName) : void 0,
|
|
111
111
|
toolDescription: toolName ? data.toolDescriptions.get(toolName) : void 0
|
|
112
112
|
};
|
|
113
|
-
(0, external_client_identity_js_namespaceObject.
|
|
113
|
+
(0, external_client_identity_js_namespaceObject.stampClientIdentity)(event, request, extra, server);
|
|
114
114
|
(0, external_transport_identity_js_namespaceObject.stampTransportIdentity)(event, extra);
|
|
115
115
|
await (0, external_tracing_helpers_js_namespaceObject.applyResolvedMetadata)(event, data, request, extra);
|
|
116
116
|
(0, external_intent_js_namespaceObject.setEventIntent)(event, await (0, external_intent_js_namespaceObject.resolveToolCallIntent)(data, request, ownership.context, extra));
|
|
@@ -230,7 +230,7 @@ async function handleListToolsRequest(server, originalListToolsHandler, request,
|
|
|
230
230
|
eventType: external_event_types_js_namespaceObject.MCPAnalyticsEventType.mcpToolsList,
|
|
231
231
|
timestamp: startTime
|
|
232
232
|
};
|
|
233
|
-
(0, external_client_identity_js_namespaceObject.
|
|
233
|
+
(0, external_client_identity_js_namespaceObject.stampClientIdentity)(event, request, extra, server);
|
|
234
234
|
(0, external_transport_identity_js_namespaceObject.stampTransportIdentity)(event, extra);
|
|
235
235
|
if (data) await (0, external_tracing_helpers_js_namespaceObject.applyResolvedMetadata)(event, data, request, extra);
|
|
236
236
|
const tools = await getTracedToolsList(server, originalListToolsHandler, request, extra, event, logger, requestAttribution);
|
|
@@ -403,7 +403,7 @@ async function handleInitializeRequest(server, originalInitializeHandler, reques
|
|
|
403
403
|
parameters: (0, external_mcp_payloads_js_namespaceObject.buildCapturedMcpParameters)(request),
|
|
404
404
|
timestamp: new Date()
|
|
405
405
|
};
|
|
406
|
-
(0, external_client_identity_js_namespaceObject.
|
|
406
|
+
(0, external_client_identity_js_namespaceObject.stampClientIdentity)(event, request, extra, server);
|
|
407
407
|
(0, external_transport_identity_js_namespaceObject.stampTransportIdentity)(event, extra);
|
|
408
408
|
await (0, external_tracing_helpers_js_namespaceObject.applyResolvedMetadata)(event, data, request, extra);
|
|
409
409
|
const result = await originalInitializeHandler(request, extra);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getAnalyticsParameterOwnership, stripOwnedAnalyticsArguments } from "./analytics-parameters.mjs";
|
|
2
2
|
import { addContextParameterToTools, getContextDescription, isContextEnabled } from "./context-parameters.mjs";
|
|
3
3
|
import { addConversationIdToTools, canInjectConversationIdPromptBack, injectConversationIdPromptBack, resolveConversationId } from "./conversation-id.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { stampClientIdentity } from "./client-identity.mjs";
|
|
5
5
|
import { stampTransportIdentity } from "./transport-identity.mjs";
|
|
6
6
|
import { addInstructionsToOutputSchemas, mirrorInstructionsIntoStructuredContent } from "./output-instructions.mjs";
|
|
7
7
|
import { captureEvent } from "./capture.mjs";
|
|
@@ -74,7 +74,7 @@ async function prepareToolCallEvent(server, data, request, downstreamRequest, ex
|
|
|
74
74
|
toolCategory: toolName ? data.toolCategories.get(toolName) : void 0,
|
|
75
75
|
toolDescription: toolName ? data.toolDescriptions.get(toolName) : void 0
|
|
76
76
|
};
|
|
77
|
-
|
|
77
|
+
stampClientIdentity(event, request, extra, server);
|
|
78
78
|
stampTransportIdentity(event, extra);
|
|
79
79
|
await applyResolvedMetadata(event, data, request, extra);
|
|
80
80
|
setEventIntent(event, await resolveToolCallIntent(data, request, ownership.context, extra));
|
|
@@ -194,7 +194,7 @@ async function handleListToolsRequest(server, originalListToolsHandler, request,
|
|
|
194
194
|
eventType: MCPAnalyticsEventType.mcpToolsList,
|
|
195
195
|
timestamp: startTime
|
|
196
196
|
};
|
|
197
|
-
|
|
197
|
+
stampClientIdentity(event, request, extra, server);
|
|
198
198
|
stampTransportIdentity(event, extra);
|
|
199
199
|
if (data) await applyResolvedMetadata(event, data, request, extra);
|
|
200
200
|
const tools = await getTracedToolsList(server, originalListToolsHandler, request, extra, event, logger, requestAttribution);
|
|
@@ -367,7 +367,7 @@ async function handleInitializeRequest(server, originalInitializeHandler, reques
|
|
|
367
367
|
parameters: buildCapturedMcpParameters(request),
|
|
368
368
|
timestamp: new Date()
|
|
369
369
|
};
|
|
370
|
-
|
|
370
|
+
stampClientIdentity(event, request, extra, server);
|
|
371
371
|
stampTransportIdentity(event, extra);
|
|
372
372
|
await applyResolvedMetadata(event, data, request, extra);
|
|
373
373
|
const result = await originalInitializeHandler(request, extra);
|
|
@@ -110,7 +110,7 @@ async function handleIdentify(server, data, sessionId, request, requestAttributi
|
|
|
110
110
|
},
|
|
111
111
|
timestamp: new Date()
|
|
112
112
|
};
|
|
113
|
-
(0, external_client_identity_js_namespaceObject.
|
|
113
|
+
(0, external_client_identity_js_namespaceObject.stampClientIdentity)(identifyEvent, request, extra, server);
|
|
114
114
|
(0, external_transport_identity_js_namespaceObject.stampTransportIdentity)(identifyEvent, extra);
|
|
115
115
|
try {
|
|
116
116
|
const identityResult = 'function' == typeof data.options.identify ? await data.options.identify(request, extra) : data.options.identify;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MCPAnalyticsEventType } from "./event-types.mjs";
|
|
2
2
|
import { captureEvent } from "./capture.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { stampClientIdentity } from "./client-identity.mjs";
|
|
4
4
|
import { stampTransportIdentity } from "./transport-identity.mjs";
|
|
5
5
|
class IdentityCache {
|
|
6
6
|
constructor(maxSize = 1000){
|
|
@@ -75,7 +75,7 @@ async function handleIdentify(server, data, sessionId, request, requestAttributi
|
|
|
75
75
|
},
|
|
76
76
|
timestamp: new Date()
|
|
77
77
|
};
|
|
78
|
-
|
|
78
|
+
stampClientIdentity(identifyEvent, request, extra, server);
|
|
79
79
|
stampTransportIdentity(identifyEvent, extra);
|
|
80
80
|
try {
|
|
81
81
|
const identityResult = 'function' == typeof data.options.identify ? await data.options.identify(request, extra) : data.options.identify;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CompatibleTextToolResult, CompatibleToolsListLike } from '../types';
|
|
2
2
|
import { type LoggerFn } from './logger';
|
|
3
3
|
export declare const GET_MORE_TOOLS_NAME: "get_more_tools";
|
|
4
4
|
/**
|
|
@@ -9,7 +9,7 @@ export declare const GET_MORE_TOOLS_NAME: "get_more_tools";
|
|
|
9
9
|
export declare function resolveMissingCapabilityToolName(options?: {
|
|
10
10
|
missingCapabilityToolName?: string;
|
|
11
11
|
}): string;
|
|
12
|
-
type ReportMissingToolDescriptor =
|
|
12
|
+
type ReportMissingToolDescriptor = CompatibleToolsListLike['tools'][number];
|
|
13
13
|
export declare function getReportMissingToolDescriptor(name?: string): ReportMissingToolDescriptor;
|
|
14
14
|
/**
|
|
15
15
|
* The canned acknowledgement returned to the agent after it calls
|
|
@@ -17,9 +17,9 @@ export declare function getReportMissingToolDescriptor(name?: string): ReportMis
|
|
|
17
17
|
* report was recorded (custom dispatcher path); the `instrument()` path returns
|
|
18
18
|
* it automatically.
|
|
19
19
|
*/
|
|
20
|
-
export declare function getMoreToolsResult():
|
|
20
|
+
export declare function getMoreToolsResult(): CompatibleTextToolResult;
|
|
21
21
|
export declare function handleReportMissing(args: {
|
|
22
22
|
context: string;
|
|
23
|
-
}, logger?: LoggerFn):
|
|
23
|
+
}, logger?: LoggerFn): CompatibleTextToolResult;
|
|
24
24
|
export {};
|
|
25
25
|
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/extensions/tools.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,
|
|
1
|
+
{"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"}
|