agentfootprint 9.80.0 → 9.82.0
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/AGENTS.md +20 -0
- package/CHANGELOG.md +167 -0
- package/CLAUDE.md +3 -1
- package/dist/core/runbook/verdicts.js +30 -6
- package/dist/core/runbook/verdicts.js.map +1 -1
- package/dist/esm/core/runbook/types.d.ts +8 -0
- package/dist/esm/core/runbook/verdicts.d.ts +18 -5
- package/dist/esm/core/runbook/verdicts.js +30 -6
- package/dist/esm/core/runbook/verdicts.js.map +1 -1
- package/dist/esm/lib/mcp/connectionRefusals.d.ts +30 -0
- package/dist/esm/lib/mcp/connectionRefusals.js +110 -0
- package/dist/esm/lib/mcp/connectionRefusals.js.map +1 -0
- package/dist/esm/lib/mcp/index.d.ts +3 -2
- package/dist/esm/lib/mcp/index.js +4 -0
- package/dist/esm/lib/mcp/index.js.map +1 -1
- package/dist/esm/lib/mcp/mcpClient.d.ts +18 -5
- package/dist/esm/lib/mcp/mcpClient.js +102 -38
- package/dist/esm/lib/mcp/mcpClient.js.map +1 -1
- package/dist/esm/lib/mcp/mcpServe.js +45 -13
- package/dist/esm/lib/mcp/mcpServe.js.map +1 -1
- package/dist/esm/lib/mcp/sdkLoadFailure.d.ts +60 -0
- package/dist/esm/lib/mcp/sdkLoadFailure.js +74 -0
- package/dist/esm/lib/mcp/sdkLoadFailure.js.map +1 -0
- package/dist/esm/lib/mcp/throttleRetry.d.ts +20 -1
- package/dist/esm/lib/mcp/throttleRetry.js +20 -1
- package/dist/esm/lib/mcp/throttleRetry.js.map +1 -1
- package/dist/esm/lib/mcp/transportUrl.d.ts +30 -0
- package/dist/esm/lib/mcp/transportUrl.js +71 -0
- package/dist/esm/lib/mcp/transportUrl.js.map +1 -0
- package/dist/esm/lib/mcp/types.d.ts +143 -13
- package/dist/esm/tool-providers/index.d.ts +2 -2
- package/dist/esm/tool-providers/index.js +6 -1
- package/dist/esm/tool-providers/index.js.map +1 -1
- package/dist/lib/mcp/connectionRefusals.js +114 -0
- package/dist/lib/mcp/connectionRefusals.js.map +1 -0
- package/dist/lib/mcp/index.js +6 -1
- package/dist/lib/mcp/index.js.map +1 -1
- package/dist/lib/mcp/mcpClient.js +102 -38
- package/dist/lib/mcp/mcpClient.js.map +1 -1
- package/dist/lib/mcp/mcpServe.js +45 -13
- package/dist/lib/mcp/mcpServe.js.map +1 -1
- package/dist/lib/mcp/sdkLoadFailure.js +78 -0
- package/dist/lib/mcp/sdkLoadFailure.js.map +1 -0
- package/dist/lib/mcp/throttleRetry.js +20 -1
- package/dist/lib/mcp/throttleRetry.js.map +1 -1
- package/dist/lib/mcp/transportUrl.js +75 -0
- package/dist/lib/mcp/transportUrl.js.map +1 -0
- package/dist/tool-providers/index.js +6 -1
- package/dist/tool-providers/index.js.map +1 -1
- package/dist/types/core/runbook/types.d.ts +8 -0
- package/dist/types/core/runbook/types.d.ts.map +1 -1
- package/dist/types/core/runbook/verdicts.d.ts +18 -5
- package/dist/types/core/runbook/verdicts.d.ts.map +1 -1
- package/dist/types/lib/mcp/connectionRefusals.d.ts +31 -0
- package/dist/types/lib/mcp/connectionRefusals.d.ts.map +1 -0
- package/dist/types/lib/mcp/index.d.ts +3 -2
- package/dist/types/lib/mcp/index.d.ts.map +1 -1
- package/dist/types/lib/mcp/mcpClient.d.ts +18 -5
- package/dist/types/lib/mcp/mcpClient.d.ts.map +1 -1
- package/dist/types/lib/mcp/mcpServe.d.ts.map +1 -1
- package/dist/types/lib/mcp/sdkLoadFailure.d.ts +61 -0
- package/dist/types/lib/mcp/sdkLoadFailure.d.ts.map +1 -0
- package/dist/types/lib/mcp/throttleRetry.d.ts +20 -1
- package/dist/types/lib/mcp/throttleRetry.d.ts.map +1 -1
- package/dist/types/lib/mcp/transportUrl.d.ts +31 -0
- package/dist/types/lib/mcp/transportUrl.d.ts.map +1 -0
- package/dist/types/lib/mcp/types.d.ts +143 -13
- package/dist/types/lib/mcp/types.d.ts.map +1 -1
- package/dist/types/tool-providers/index.d.ts +2 -2
- package/dist/types/tool-providers/index.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* transportUrl — read `transport.url` the way the runtime it is running in
|
|
4
|
+
* would read it.
|
|
5
|
+
*
|
|
6
|
+
* ── Why ──────────────────────────────────────────────────────────────────────
|
|
7
|
+
* `new URL('/py/mcp')` throws `TypeError: Invalid URL`. In Node that is the
|
|
8
|
+
* right answer: there is no document, so there is no base, and a path on its
|
|
9
|
+
* own names nothing. In a browser it is the wrong answer twice over — the page
|
|
10
|
+
* HAS a base, and `/py/mcp` is the single most ordinary way to name a sidecar
|
|
11
|
+
* behind the same origin (which is also how you avoid a CORS preflight
|
|
12
|
+
* entirely). Before this, a browser consumer's first attempt died on a
|
|
13
|
+
* `TypeError` from deep inside the transport constructor, with nothing in the
|
|
14
|
+
* message naming the URL or the fix.
|
|
15
|
+
*
|
|
16
|
+
* ── The rule ─────────────────────────────────────────────────────────────────
|
|
17
|
+
* An ABSOLUTE url takes the identical first branch it always took, so every
|
|
18
|
+
* existing caller is byte-identical. A relative one resolves against
|
|
19
|
+
* `globalThis.location.href` when there is one. With neither, the refusal says
|
|
20
|
+
* which of the two worlds it is in, because "Invalid URL" does not.
|
|
21
|
+
*
|
|
22
|
+
* Pattern: pure function. Role: Layer-3 tool transport.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.transportUrl = void 0;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve a transport URL, honouring a document base when the runtime has one.
|
|
28
|
+
*
|
|
29
|
+
* @param raw the `url` from an `http` or `gateway` transport descriptor
|
|
30
|
+
* @param caller the function to name in the refusal, e.g. `'mcpClient'`
|
|
31
|
+
* @throws when `raw` is neither absolute nor resolvable against a base
|
|
32
|
+
*/
|
|
33
|
+
function transportUrl(raw, caller) {
|
|
34
|
+
try {
|
|
35
|
+
return new URL(raw);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// Not absolute. A browser can still resolve it; Node cannot.
|
|
39
|
+
}
|
|
40
|
+
const base = documentBase();
|
|
41
|
+
if (base !== undefined) {
|
|
42
|
+
try {
|
|
43
|
+
return new URL(raw, base);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
// A base existed and still did not help — fall through to the refusal,
|
|
47
|
+
// which names both halves rather than blaming the url alone.
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
throw new Error(`${caller}: transport.url ${JSON.stringify(raw)} is not an absolute URL, and ` +
|
|
51
|
+
`${base === undefined
|
|
52
|
+
? 'this runtime has no document base to resolve it against (Node, a worker, a test)'
|
|
53
|
+
: `it does not resolve against the document base ${JSON.stringify(base)}`}. ` +
|
|
54
|
+
'Pass an absolute URL (for example `http://127.0.0.1:5230/mcp`); a path like ' +
|
|
55
|
+
'`/mcp` only resolves in a browser, against the page it was loaded from.');
|
|
56
|
+
}
|
|
57
|
+
exports.transportUrl = transportUrl;
|
|
58
|
+
/**
|
|
59
|
+
* The page's own URL, when there is a page.
|
|
60
|
+
*
|
|
61
|
+
* Read through `globalThis` and guarded, because every access here is on a
|
|
62
|
+
* host object this library does not own: `location` is absent in Node, present
|
|
63
|
+
* but href-less in some worker and test doubles, and a getter that throws in a
|
|
64
|
+
* sandboxed frame.
|
|
65
|
+
*/
|
|
66
|
+
function documentBase() {
|
|
67
|
+
try {
|
|
68
|
+
const href = globalThis.location?.href;
|
|
69
|
+
return typeof href === 'string' && href.length > 0 ? href : undefined;
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=transportUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transportUrl.js","sourceRoot":"","sources":["../../../src/lib/mcp/transportUrl.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAEH;;;;;;GAMG;AACH,SAAgB,YAAY,CAAC,GAAW,EAAE,MAAc;IACtD,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,6DAA6D;IAC/D,CAAC;IACD,MAAM,IAAI,GAAG,YAAY,EAAE,CAAC;IAC5B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,IAAI,CAAC;YACH,OAAO,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,uEAAuE;YACvE,6DAA6D;QAC/D,CAAC;IACH,CAAC;IACD,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,mBAAmB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,+BAA+B;QAC5E,GACE,IAAI,KAAK,SAAS;YAChB,CAAC,CAAC,kFAAkF;YACpF,CAAC,CAAC,iDAAiD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAC3E,IAAI;QACJ,8EAA8E;QAC9E,yEAAyE,CAC5E,CAAC;AACJ,CAAC;AAzBD,oCAyBC;AAED;;;;;;;GAOG;AACH,SAAS,YAAY;IACnB,IAAI,CAAC;QACH,MAAM,IAAI,GAAI,UAAgD,CAAC,QAAQ,EAAE,IAAI,CAAC;QAC9E,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IACxE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
* symbols, one door. Import from the door.
|
|
50
50
|
*/
|
|
51
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
|
-
exports.AGENTCORE_SIGV4_SERVICE = exports.AGENTCORE_POLICY_SESSION_HEADER = exports.AGENTCORE_GATEWAY_SEARCH_TOOL = exports.hasGatewaySearch = exports.gatewaySearchTool = exports.agentCoreGatewayUrl = exports.agentCoreGatewayTransport = exports.MCP_TOOL_EXTRAS_KEY = exports.GatewayAuthorizationRequiredError = exports.gatewayTransport = exports.mockMcpClient = exports.mcpServe = exports.mcpClient = exports.SKILL_SCOPED_TOOLS_ID_PREFIX = exports.skillScopedToolsTarget = exports.skillScopedTools = exports.gatedTools = exports.staticTools = void 0;
|
|
52
|
+
exports.AGENTCORE_SIGV4_SERVICE = exports.AGENTCORE_POLICY_SESSION_HEADER = exports.AGENTCORE_GATEWAY_SEARCH_TOOL = exports.hasGatewaySearch = exports.gatewaySearchTool = exports.agentCoreGatewayUrl = exports.agentCoreGatewayTransport = exports.retryingFetch = exports.MCP_TOOL_EXTRAS_KEY = exports.GatewayAuthorizationRequiredError = exports.gatewayTransport = exports.mockMcpClient = exports.mcpServe = exports.mcpClient = exports.SKILL_SCOPED_TOOLS_ID_PREFIX = exports.skillScopedToolsTarget = exports.skillScopedTools = exports.gatedTools = exports.staticTools = void 0;
|
|
53
53
|
var staticTools_js_1 = require("./staticTools.js");
|
|
54
54
|
Object.defineProperty(exports, "staticTools", { enumerable: true, get: function () { return staticTools_js_1.staticTools; } });
|
|
55
55
|
var gatedTools_js_1 = require("./gatedTools.js");
|
|
@@ -73,6 +73,11 @@ Object.defineProperty(exports, "GatewayAuthorizationRequiredError", { enumerable
|
|
|
73
73
|
// directions (9.71.0). Public so a server this library did not write can
|
|
74
74
|
// speak it, and so a client can read a bag it received.
|
|
75
75
|
Object.defineProperty(exports, "MCP_TOOL_EXTRAS_KEY", { enumerable: true, get: function () { return index_js_1.MCP_TOOL_EXTRAS_KEY; } });
|
|
76
|
+
// The 429 retry `mcpClient({ transport })` applies for you (9.81.0). Public
|
|
77
|
+
// so `mcpClient({ connection })` — the arm a browser takes, where the library
|
|
78
|
+
// builds no transport — can wrap its own `fetch` with the same code rather
|
|
79
|
+
// than quietly doing without it.
|
|
80
|
+
Object.defineProperty(exports, "retryingFetch", { enumerable: true, get: function () { return index_js_1.retryingFetch; } });
|
|
76
81
|
// Reaching an AWS Bedrock AgentCore Gateway (9.66.0). A configuration of
|
|
77
82
|
// `gatewayTransport` plus the four facts that are AgentCore's alone — kept in
|
|
78
83
|
// the vendor's own file so the transport above stays able to say, truthfully,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tool-providers/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;;;AAEH,mDAA+C;AAAtC,6GAAA,WAAW,OAAA;AACpB,iDAA6C;AAApC,2GAAA,UAAU,OAAA;AACnB,6DAM+B;AAL7B,uHAAA,gBAAgB,OAAA;AAChB,kFAAkF;AAClF,kFAAkF;AAClF,6HAAA,sBAAsB,OAAA;AACtB,mIAAA,4BAA4B,OAAA;AAI9B,uEAAuE;AACvE,wEAAwE;AACxE,0CAA0C;AAC1C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tool-providers/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;;;AAEH,mDAA+C;AAAtC,6GAAA,WAAW,OAAA;AACpB,iDAA6C;AAApC,2GAAA,UAAU,OAAA;AACnB,6DAM+B;AAL7B,uHAAA,gBAAgB,OAAA;AAChB,kFAAkF;AAClF,kFAAkF;AAClF,6HAAA,sBAAsB,OAAA;AACtB,mIAAA,4BAA4B,OAAA;AAI9B,uEAAuE;AACvE,wEAAwE;AACxE,0CAA0C;AAC1C,gDAe6B;AAd3B,qGAAA,SAAS,OAAA;AACT,oGAAA,QAAQ,OAAA;AACR,yGAAA,aAAa,OAAA;AACb,4GAAA,gBAAgB,OAAA;AAChB,6HAAA,iCAAiC,OAAA;AACjC,2EAA2E;AAC3E,yEAAyE;AACzE,wDAAwD;AACxD,+GAAA,mBAAmB,OAAA;AACnB,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,iCAAiC;AACjC,yGAAA,aAAa,OAAA;AAEf,yEAAyE;AACzE,8EAA8E;AAC9E,8EAA8E;AAC9E,yCAAyC;AACzC,6DAQsC;AAPpC,yHAAA,yBAAyB,OAAA;AACzB,mHAAA,mBAAmB,OAAA;AACnB,iHAAA,iBAAiB,OAAA;AACjB,gHAAA,gBAAgB,OAAA;AAChB,6HAAA,6BAA6B,OAAA;AAC7B,+HAAA,+BAA+B,OAAA;AAC/B,uHAAA,uBAAuB,OAAA"}
|
|
@@ -57,6 +57,14 @@ export interface RunbookVerdictsOptions {
|
|
|
57
57
|
* in this run's decide() evidence refine them (and are the only source
|
|
58
58
|
* when the decider lives inside a dynamically generated fan-out branch,
|
|
59
59
|
* where build-time structure cannot see it).
|
|
60
|
+
*
|
|
61
|
+
* The DEFAULT branch is chosen by no rule, so no rule label describes it.
|
|
62
|
+
* Name it where the rules are named — `decide(scope, rules, { branch,
|
|
63
|
+
* label })` — and the label arrives here on the same evidence:
|
|
64
|
+
*
|
|
65
|
+
* ```ts
|
|
66
|
+
* decide(scope, rules, { branch: 'protected', label: 'No rule fired — asset stays protected' });
|
|
67
|
+
* ```
|
|
60
68
|
*/
|
|
61
69
|
readonly decider: string;
|
|
62
70
|
/** Cap on `verdicts` rows AND the rendered table — ONE number for both
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/runbook/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAA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C1C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;QACjC;;;;;;8CAMsC;QACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QACxB;;;;kEAI0D;QAC1D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAC9B;iFACyE;QACzE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QAC7D;;sEAE8D;QAC9D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAC9B;;;;oDAI4C;QAC5C,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;KACtC,CAAC;CACH"}
|
|
@@ -23,10 +23,21 @@
|
|
|
23
23
|
* GENERATED MEANINGS, never hand-restated: `verdict_meanings` is composed
|
|
24
24
|
* from (a) the named decider's declared branches in the chart's own structure
|
|
25
25
|
* (branch description, falling back to branch name), overlaid by (b) the rule
|
|
26
|
-
* LABELS this run's decide() evidence carried — the rule speaking for itself
|
|
26
|
+
* LABELS this run's decide() evidence carried — the rule speaking for itself —
|
|
27
|
+
* and (c) the DEFAULT branch's declared label, carried by the same evidence.
|
|
27
28
|
* A decider inside a dynamically generated fan-out branch is invisible to (a)
|
|
28
29
|
* by construction (the branch chart does not exist at build time); (b) still
|
|
29
30
|
* covers every verdict an executed rule produced.
|
|
31
|
+
*
|
|
32
|
+
* (c) exists because the default branch is chosen by NO rule — it fires
|
|
33
|
+
* exactly when every rule failed, so it appears in no `rules[]` entry and (b)
|
|
34
|
+
* can never name it. In a generated fan-out branch, where (a) is blind too, it
|
|
35
|
+
* was the one verdict the rowset could show and the meanings map could not
|
|
36
|
+
* explain. `decide(scope, rules, { branch, label })` (footprintjs ≥ 9.16.1) puts
|
|
37
|
+
* that label on the decision evidence, so it arrives here the way every other
|
|
38
|
+
* label does: harvested from the run, never declared at this boundary. There is
|
|
39
|
+
* deliberately no caller-supplied meanings map — a map a caller can write is a
|
|
40
|
+
* map that can describe rules that never ran.
|
|
30
41
|
*/
|
|
31
42
|
import type { CombinedRecorder } from 'footprintjs';
|
|
32
43
|
import type { FlowChart } from 'footprintjs';
|
|
@@ -80,7 +91,8 @@ export interface MeaningsHarvest {
|
|
|
80
91
|
* A tiny flow recorder capturing the named decider's decide() evidence as it
|
|
81
92
|
* fires — collected DURING the traversal, never reconstructed after. Rule
|
|
82
93
|
* labels are harvested for every rule the evidence lists (matched or not):
|
|
83
|
-
* a rule that was evaluated has spoken its label, whichever branch won.
|
|
94
|
+
* a rule that was evaluated has spoken its label, whichever branch won. The
|
|
95
|
+
* DEFAULT branch's label rides the same evidence and is harvested with them.
|
|
84
96
|
*
|
|
85
97
|
* A decider inside a subflow (including a generated fan-out branch) reports
|
|
86
98
|
* itself PATH-PREFIXED (`per-subject~0/Protection posture`), so the match is
|
|
@@ -89,8 +101,9 @@ export interface MeaningsHarvest {
|
|
|
89
101
|
* marker opaque here.
|
|
90
102
|
*/
|
|
91
103
|
export declare function meaningsRecorder(identity: DeciderIdentity): MeaningsHarvest;
|
|
92
|
-
/** Compose the final meanings: declared branches first,
|
|
93
|
-
*
|
|
94
|
-
*
|
|
104
|
+
/** Compose the final meanings: declared branches first, the labels this run
|
|
105
|
+
* observed (rule labels, and the default branch's own) winning where both
|
|
106
|
+
* speak — the declaration made beside the rules is the sharper sentence.
|
|
107
|
+
* Undefined when neither source produced anything — absent, never `{}`. */
|
|
95
108
|
export declare function composeMeanings(identity: DeciderIdentity, observed: ReadonlyMap<string, string>): Record<string, string> | undefined;
|
|
96
109
|
//# sourceMappingURL=verdicts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verdicts.d.ts","sourceRoot":"","sources":["../../../../src/core/runbook/verdicts.ts"],"names":[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AC,CAAC;CAChD;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,eAAe,CA4B3E;AAED;;;4EAG4E;AAC5E,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAKpC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* connectionRefusals — the two arms of `mcpClient` refuse to be mixed, at
|
|
3
|
+
* CONSTRUCTION, in words that name where the behaviour went.
|
|
4
|
+
*
|
|
5
|
+
* ── Why refuse rather than ignore ────────────────────────────────────────────
|
|
6
|
+
* `mcpClient({ connection })` hands over a client somebody else built, so this
|
|
7
|
+
* library builds no transport on that arm — and every option consumed INSIDE a
|
|
8
|
+
* transport therefore has nothing to act on. `retryOnThrottle` is the sharp
|
|
9
|
+
* one: it is ON by default, it is consumed by `retryingFetch` around the
|
|
10
|
+
* transport's `fetch`, and accepting it here would leave a caller holding an
|
|
11
|
+
* option that NAMES a behaviour which no longer happens. A knob that lies about
|
|
12
|
+
* what it does is worse than one that is absent, so these throw.
|
|
13
|
+
*
|
|
14
|
+
* The type union refuses the same combinations at compile time
|
|
15
|
+
* (`McpConnectionOptions` declares each of them `?: undefined`). This is the
|
|
16
|
+
* runtime half, and it is not redundant: excess-property checking does not
|
|
17
|
+
* survive a spread, and JavaScript callers have no compiler at all.
|
|
18
|
+
*
|
|
19
|
+
* Pattern: pure guard. Role: Layer-3 tool integration.
|
|
20
|
+
*/
|
|
21
|
+
import type { McpClientOptions, McpConnectionOptions } from './types.js';
|
|
22
|
+
/**
|
|
23
|
+
* Refuse a mixed or malformed options object before anything connects.
|
|
24
|
+
*
|
|
25
|
+
* @param opts what the caller passed, before any defaulting
|
|
26
|
+
* @param name the client's logical name, so a multi-server app knows which one
|
|
27
|
+
* @throws naming the two options that cannot travel together, or the member the
|
|
28
|
+
* connection is missing
|
|
29
|
+
*/
|
|
30
|
+
export declare function refuseConflictingOptions(opts: McpClientOptions | McpConnectionOptions, name: string): void;
|
|
31
|
+
//# sourceMappingURL=connectionRefusals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectionRefusals.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/connectionRefusals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAKzE;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,gBAAgB,GAAG,oBAAoB,EAC7C,IAAI,EAAE,MAAM,GACX,IAAI,CA6BN"}
|
|
@@ -9,6 +9,7 @@ export { mcpServe } from './mcpServe.js';
|
|
|
9
9
|
export { MCP_TOOL_EXTRAS_KEY, type McpToolExtras } from './toolExtras.js';
|
|
10
10
|
export { mockMcpClient, type MockMcpClientOptions, type MockMcpTool } from './mockMcpClient.js';
|
|
11
11
|
export { gatewayTransport, GatewayAuthorizationRequiredError, type GatewayTransportOptions, } from './gatewayTransport.js';
|
|
12
|
-
export
|
|
13
|
-
export type {
|
|
12
|
+
export { retryingFetch } from './throttleRetry.js';
|
|
13
|
+
export type { RetryOnThrottle, ThrottleFetch, ThrottleRetryInfo, ThrottleRetryOptions, } from './throttleRetry.js';
|
|
14
|
+
export type { McpCallToolResult, McpClient, McpClientOptions, McpConnection, McpConnectionOptions, McpSdk, McpGatewayTransport, McpHttpTransport, McpStdioTransport, McpTransport, McpSdkClient, McpServeOptions, McpServeHandle, McpServeTransport, McpHttpServeTransport, McpStdioServeTransport, McpSdkServer, } from './types.js';
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChG,OAAO,EACL,gBAAgB,EAChB,iCAAiC,EACjC,KAAK,uBAAuB,GAC7B,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChG,OAAO,EACL,gBAAgB,EAChB,iCAAiC,EACjC,KAAK,uBAAuB,GAC7B,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EACV,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,MAAM,EACN,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,YAAY,GACb,MAAM,YAAY,CAAC"}
|
|
@@ -39,15 +39,28 @@
|
|
|
39
39
|
* loads only when a consumer actually constructs a client. Tests
|
|
40
40
|
* inject `_client` and skip the import path entirely.
|
|
41
41
|
*/
|
|
42
|
-
import type { McpClient, McpClientOptions } from './types.js';
|
|
42
|
+
import type { McpClient, McpClientOptions, McpConnectionOptions } from './types.js';
|
|
43
43
|
/**
|
|
44
44
|
* Connect to an MCP server. Returns an `McpClient` that exposes the
|
|
45
45
|
* server's tools as agentfootprint `Tool[]` and a `close()` to tear
|
|
46
46
|
* down the transport.
|
|
47
47
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
48
|
+
* Three ways to get a connection, and they are three because a browser can
|
|
49
|
+
* only take the last two:
|
|
50
|
+
*
|
|
51
|
+
* - `{ transport }` — the library loads the SDK through its Node loader and
|
|
52
|
+
* builds everything. The default, and what every Node consumer already
|
|
53
|
+
* does.
|
|
54
|
+
* - `{ transport, sdk }` — you supply the two SDK modules with static
|
|
55
|
+
* imports; the library still builds the transport, so gateway vending,
|
|
56
|
+
* `retryOnThrottle`, `headers` and your own `fetch` all keep working.
|
|
57
|
+
* - `{ connection }` — you built and connected the client yourself; the
|
|
58
|
+
* library only adapts its tools.
|
|
59
|
+
*
|
|
60
|
+
* @throws when the two arms are mixed, when a `connection` is not one, or when
|
|
61
|
+
* `@modelcontextprotocol/sdk` cannot be loaded (the message says which of
|
|
62
|
+
* "not installed" and "no Node loader here" actually happened), or when the
|
|
63
|
+
* transport fails to connect.
|
|
51
64
|
*/
|
|
52
|
-
export declare function mcpClient(opts: McpClientOptions): Promise<McpClient>;
|
|
65
|
+
export declare function mcpClient(opts: McpClientOptions | McpConnectionOptions): Promise<McpClient>;
|
|
53
66
|
//# sourceMappingURL=mcpClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpClient.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/mcpClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAGH,OAAO,KAAK,EAEV,SAAS,EACT,gBAAgB,
|
|
1
|
+
{"version":3,"file":"mcpClient.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/mcpClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAGH,OAAO,KAAK,EAEV,SAAS,EACT,gBAAgB,EAEhB,oBAAoB,EAKrB,MAAM,YAAY,CAAC;AAiBpB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC,CAgDjG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpServe.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/mcpServe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAMH,OAAO,KAAK,EAAE,IAAI,EAAwB,MAAM,qBAAqB,CAAC;AAMtE,OAAO,KAAK,EAIV,cAAc,EACd,eAAe,EAEhB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"mcpServe.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/mcpServe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAMH,OAAO,KAAK,EAAE,IAAI,EAAwB,MAAM,qBAAqB,CAAC;AAMtE,OAAO,KAAK,EAIV,cAAc,EACd,eAAe,EAEhB,MAAM,YAAY,CAAC;AAUpB;;;;;;;;;GASG;AACH,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,IAAI,GAAE,eAAoB,GACzB,OAAO,CAAC,cAAc,CAAC,CA+LzB;AAiPD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;EAA0C,CAAC;AAC3E,yCAAyC;AACzC,eAAO,MAAM,kBAAkB;;EAA0C,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sdkLoadFailure — say WHY the MCP SDK did not load, because there are two
|
|
3
|
+
* reasons and only one of them is "install it".
|
|
4
|
+
*
|
|
5
|
+
* ── The lie this exists to stop ──────────────────────────────────────────────
|
|
6
|
+
* Every SDK load in this module used to sit behind a BARE `catch`, and a bare
|
|
7
|
+
* catch cannot tell the two apart:
|
|
8
|
+
*
|
|
9
|
+
* 1. the package really is absent — `Cannot find module …`; and
|
|
10
|
+
* 2. the LOADER is absent — `lazyRequire` reaches for `createRequire`, which
|
|
11
|
+
* exists in Node and does not exist in a browser bundle, where a bundler
|
|
12
|
+
* has externalized `node:module` to a stub.
|
|
13
|
+
*
|
|
14
|
+
* Case 2 raises `TypeError: nodeModule.createRequire is not a function`, and a
|
|
15
|
+
* bare catch reported it as "install @modelcontextprotocol/sdk" — to a browser
|
|
16
|
+
* that had the SDK installed all along. The reader then installs a package they
|
|
17
|
+
* already have, watches nothing change, and concludes MCP does not work here.
|
|
18
|
+
*
|
|
19
|
+
* ── The contract ─────────────────────────────────────────────────────────────
|
|
20
|
+
* The absent-package message is passed IN and returned VERBATIM, so the message
|
|
21
|
+
* every release before this one produced is byte-identical to the one this one
|
|
22
|
+
* produces. Only the second arm is new, and it names the underlying failure and
|
|
23
|
+
* the seam that gets past it.
|
|
24
|
+
*
|
|
25
|
+
* Pattern: pure classifier. No I/O, no throwing, no vendor names beyond the
|
|
26
|
+
* package it reports on. Role: Layer-3 tool transport, shared by `mcpClient`
|
|
27
|
+
* and `mcpServe` so the two cannot drift into telling different stories.
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Everything a load site knows about its own failure. Split out so the same
|
|
31
|
+
* classifier serves seven call sites that each name a different specifier and
|
|
32
|
+
* offer a different way past it.
|
|
33
|
+
*/
|
|
34
|
+
export interface SdkLoadFailureNotes {
|
|
35
|
+
/**
|
|
36
|
+
* The exact message this site produced before the classifier existed — the
|
|
37
|
+
* absent-package case, returned unchanged. Byte-compatibility is the point:
|
|
38
|
+
* a consumer scripting against that text keeps working.
|
|
39
|
+
*/
|
|
40
|
+
readonly notInstalled: string;
|
|
41
|
+
/** The function the consumer called, e.g. `'mcpClient'`. */
|
|
42
|
+
readonly caller: string;
|
|
43
|
+
/** The module specifier that failed to load. */
|
|
44
|
+
readonly specifier: string;
|
|
45
|
+
/**
|
|
46
|
+
* One sentence naming what to pass instead when the LOADER, not the package,
|
|
47
|
+
* is what is missing. Written per site because the answer differs: the http
|
|
48
|
+
* path has `sdk` / `connection`, stdio has neither and never will.
|
|
49
|
+
*/
|
|
50
|
+
readonly instead: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Which of the two failures happened, as a message.
|
|
54
|
+
*
|
|
55
|
+
* @param err whatever the `catch` bound — an `Error`, or anything else a
|
|
56
|
+
* loader can throw.
|
|
57
|
+
* @returns the absent-package message verbatim when the specifier could not be
|
|
58
|
+
* RESOLVED; otherwise a message naming the real failure and the way past it.
|
|
59
|
+
*/
|
|
60
|
+
export declare function sdkLoadFailure(err: unknown, notes: SdkLoadFailureNotes): string;
|
|
61
|
+
//# sourceMappingURL=sdkLoadFailure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdkLoadFailure.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/sdkLoadFailure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAU/E"}
|
|
@@ -102,9 +102,28 @@ export type RetryOnThrottle = boolean | ThrottleRetryOptions;
|
|
|
102
102
|
* so a transport that passed no custom fetch keeps passing none and its
|
|
103
103
|
* behaviour is byte-identical to before this existed.
|
|
104
104
|
*
|
|
105
|
+
* ── Why this is public ───────────────────────────────────────────────────────
|
|
106
|
+
* `mcpClient({ transport })` applies it for you, ON by default. `mcpClient({
|
|
107
|
+
* connection })` cannot: the library builds no transport on that arm, so there
|
|
108
|
+
* is no `fetch` of its own to wrap — and a browser consumer, who is the main
|
|
109
|
+
* reason that arm exists, would silently lose the 429 handling Node gets for
|
|
110
|
+
* free. That asymmetry is invisible from the outside, which is why the answer
|
|
111
|
+
* is to hand over the same implementation rather than to document the gap:
|
|
112
|
+
*
|
|
113
|
+
* ```ts
|
|
114
|
+
* import { retryingFetch } from 'agentfootprint/providers';
|
|
115
|
+
* import { StreamableHTTPClientTransport }
|
|
116
|
+
* from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
117
|
+
*
|
|
118
|
+
* const transport = new StreamableHTTPClientTransport(new URL('/mcp', location.href), {
|
|
119
|
+
* fetch: retryingFetch(undefined, { maxAttempts: 5 }),
|
|
120
|
+
* });
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
105
123
|
* @param inner the fetch to wrap. `undefined` means the global `fetch`,
|
|
106
124
|
* resolved at CALL time so a later polyfill still wins.
|
|
107
|
-
* @
|
|
125
|
+
* @param config `true` / `undefined` for the defaults, `false` to get `inner`
|
|
126
|
+
* back unchanged, or an object to tune the ceilings.
|
|
108
127
|
*/
|
|
109
128
|
export declare function retryingFetch(inner: ThrottleFetch | undefined, config: RetryOnThrottle | undefined): ThrottleFetch | undefined;
|
|
110
129
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throttleRetry.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/throttleRetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAI3F,yEAAyE;AACzE,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,mEAAmE;IACnE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,sDAAsD;IACtD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;4DACwD;IACxD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;6EACyE;IACzE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,gEAAgE;AAChE,MAAM,WAAW,oBAAoB;IACnC,gEAAgE;IAChE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;;;OAQG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;CACtD;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,oBAAoB,CAAC;AA4B7D
|
|
1
|
+
{"version":3,"file":"throttleRetry.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/throttleRetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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time it is running in
|
|
3
|
+
* would read it.
|
|
4
|
+
*
|
|
5
|
+
* ── Why ──────────────────────────────────────────────────────────────────────
|
|
6
|
+
* `new URL('/py/mcp')` throws `TypeError: Invalid URL`. In Node that is the
|
|
7
|
+
* right answer: there is no document, so there is no base, and a path on its
|
|
8
|
+
* own names nothing. In a browser it is the wrong answer twice over — the page
|
|
9
|
+
* HAS a base, and `/py/mcp` is the single most ordinary way to name a sidecar
|
|
10
|
+
* behind the same origin (which is also how you avoid a CORS preflight
|
|
11
|
+
* entirely). Before this, a browser consumer's first attempt died on a
|
|
12
|
+
* `TypeError` from deep inside the transport constructor, with nothing in the
|
|
13
|
+
* message naming the URL or the fix.
|
|
14
|
+
*
|
|
15
|
+
* ── The rule ─────────────────────────────────────────────────────────────────
|
|
16
|
+
* An ABSOLUTE url takes the identical first branch it always took, so every
|
|
17
|
+
* existing caller is byte-identical. A relative one resolves against
|
|
18
|
+
* `globalThis.location.href` when there is one. With neither, the refusal says
|
|
19
|
+
* which of the two worlds it is in, because "Invalid URL" does not.
|
|
20
|
+
*
|
|
21
|
+
* Pattern: pure function. Role: Layer-3 tool transport.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Resolve a transport URL, honouring a document base when the runtime has one.
|
|
25
|
+
*
|
|
26
|
+
* @param raw the `url` from an `http` or `gateway` transport descriptor
|
|
27
|
+
* @param caller the function to name in the refusal, e.g. `'mcpClient'`
|
|
28
|
+
* @throws when `raw` is neither absolute nor resolvable against a base
|
|
29
|
+
*/
|
|
30
|
+
export declare function transportUrl(raw: string, caller: string): URL;
|
|
31
|
+
//# sourceMappingURL=transportUrl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transportUrl.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/transportUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAyB7D"}
|