@mastra/mcp 2.6.0-alpha.0 → 2.6.0-alpha.1
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/cli/{generate-K-rW1Wck.js → generate-D0K0N5WQ.js} +3 -4
- package/dist/cli/{generate-K-rW1Wck.js.map → generate-D0K0N5WQ.js.map} +1 -1
- package/dist/cli/index.js +3 -4
- package/dist/cli/{json-schema-dialect-B5B7l9Po.js → json-schema-dialect-CdIOPBiC.js} +1 -2
- package/dist/cli/{json-schema-dialect-B5B7l9Po.js.map → json-schema-dialect-CdIOPBiC.js.map} +1 -1
- package/dist/cli/{typegen-CLDjVF16.js → typegen-B5dH_z0t.js} +3 -4
- package/dist/cli/{typegen-CLDjVF16.js.map → typegen-B5dH_z0t.js.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/reference-tools-mcp-client.md +6 -6
- package/dist/docs/references/reference-tools-mcp-server.md +4 -4
- package/dist/index.cjs +154 -136
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +153 -134
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __create$2 = Object.create;
|
|
4
4
|
var __defProp$3 = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
@@ -20,7 +20,6 @@ var __toESM$2 = (mod, isNodeMode, target) => (target = mod != null ? __create$2(
|
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
23
|
let async_hooks = require("async_hooks");
|
|
25
24
|
let module$1 = require("module");
|
|
26
25
|
let _mastra_core_base = require("@mastra/core/base");
|
|
@@ -54,11 +53,10 @@ let _modelcontextprotocol_server_stdio = require("@modelcontextprotocol/server/s
|
|
|
54
53
|
let https = require("https");
|
|
55
54
|
https = __toESM$2(https, 1);
|
|
56
55
|
let _mastra_core_signals = require("@mastra/core/signals");
|
|
57
|
-
|
|
56
|
+
// src/client/types.ts
|
|
58
57
|
/** The current protocol revision; the one `/mcp` servers speak. */
|
|
59
58
|
const MCP_CLIENT_PROTOCOL_VERSION = "2026-07-28";
|
|
60
|
-
|
|
61
|
-
//#region ../schema-compat/dist/json-schema-traverse-Jrimn_T_.js
|
|
59
|
+
// ../schema-compat/dist/json-schema-traverse-D0CId4oM.js
|
|
62
60
|
var __create$1 = Object.create;
|
|
63
61
|
var __defProp$2 = Object.defineProperty;
|
|
64
62
|
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
@@ -153,8 +151,7 @@ var require_json_schema_traverse = /* @__PURE__ */ __commonJSMin$1(((exports, mo
|
|
|
153
151
|
return str.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
154
152
|
}
|
|
155
153
|
}));
|
|
156
|
-
|
|
157
|
-
//#region ../schema-compat/dist/esm-DA8owk0L.js
|
|
154
|
+
// ../schema-compat/dist/esm-BG70JlG8.js
|
|
158
155
|
const ignoreOverride$1 = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
159
156
|
const defaultOptions$1 = {
|
|
160
157
|
name: void 0,
|
|
@@ -1160,8 +1157,7 @@ const zodToJsonSchema$1 = (schema, options) => {
|
|
|
1160
1157
|
return combined;
|
|
1161
1158
|
};
|
|
1162
1159
|
var esm_default$1 = zodToJsonSchema$1;
|
|
1163
|
-
|
|
1164
|
-
//#region ../schema-compat/dist/zod-to-json.js
|
|
1160
|
+
// ../schema-compat/dist/zod-to-json.js
|
|
1165
1161
|
const PATCHED = Symbol("__mastra_patched__");
|
|
1166
1162
|
/**
|
|
1167
1163
|
* Recursively patch Zod v4 record schemas that are missing valueType.
|
|
@@ -1212,8 +1208,7 @@ function patchRecordSchemas(schema) {
|
|
|
1212
1208
|
if (def.innerType) patchRecordSchemas(def.innerType);
|
|
1213
1209
|
return schema;
|
|
1214
1210
|
}
|
|
1215
|
-
|
|
1216
|
-
//#region ../schema-compat/dist/standard-schema/adapters/ai-sdk.js
|
|
1211
|
+
// ../schema-compat/dist/standard-schema/adapters/ai-sdk.js
|
|
1217
1212
|
/**
|
|
1218
1213
|
* Vendor name for AI SDK wrapped schemas.
|
|
1219
1214
|
*/
|
|
@@ -1361,8 +1356,7 @@ var AiSdkSchemaWrapper = class {
|
|
|
1361
1356
|
function toStandardSchema$2(schema) {
|
|
1362
1357
|
return new AiSdkSchemaWrapper(schema);
|
|
1363
1358
|
}
|
|
1364
|
-
|
|
1365
|
-
//#region ../schema-compat/dist/json-schema-DcMkkbbI.js
|
|
1359
|
+
// ../schema-compat/dist/json-schema-BdCwqjfN.js
|
|
1366
1360
|
var require_code$1 = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
1367
1361
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1368
1362
|
exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
|
|
@@ -4257,6 +4251,38 @@ var require_utils = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4257
4251
|
return output.join("");
|
|
4258
4252
|
}
|
|
4259
4253
|
/**
|
|
4254
|
+
* Removes dot segments from the path of a relative reference (a path that does
|
|
4255
|
+
* not start with "/") without changing what it resolves to against any base.
|
|
4256
|
+
* Unlike `removeDotSegments`, leading ".." segments that cannot be collapsed
|
|
4257
|
+
* are kept, the result never becomes root-relative, and a result that would be
|
|
4258
|
+
* empty or start with an empty segment is prefixed with "." (an empty path
|
|
4259
|
+
* means "same document" and a leading "//" would introduce an authority).
|
|
4260
|
+
*
|
|
4261
|
+
* @param {string} path
|
|
4262
|
+
* @returns {string}
|
|
4263
|
+
*/
|
|
4264
|
+
function removeDotSegmentsRelative(path) {
|
|
4265
|
+
if (path === "" || path[0] === "/") return removeDotSegments(path);
|
|
4266
|
+
const segments = path.split("/");
|
|
4267
|
+
const last = segments.length - 1;
|
|
4268
|
+
/** @type {string[]} */
|
|
4269
|
+
const output = [];
|
|
4270
|
+
let trailingDirectory = false;
|
|
4271
|
+
for (let i = 0; i <= last; i++) {
|
|
4272
|
+
const segment = segments[i];
|
|
4273
|
+
if (segment === "." || segment === "..") {
|
|
4274
|
+
if (segment === "..") {
|
|
4275
|
+
if (output.length !== 0 && output[output.length - 1] !== "..") output.pop();
|
|
4276
|
+
else output.push("..");
|
|
4277
|
+
}
|
|
4278
|
+
trailingDirectory = i === last;
|
|
4279
|
+
} else output.push(segment);
|
|
4280
|
+
}
|
|
4281
|
+
if (trailingDirectory && output[output.length - 1] !== "..") output.push("");
|
|
4282
|
+
if (output.length === 0 || output[0] === "" || output[0].includes(":")) output.unshift(".");
|
|
4283
|
+
return output.join("/");
|
|
4284
|
+
}
|
|
4285
|
+
/**
|
|
4260
4286
|
* Re-escape RFC 3986 gen-delims that must not appear literally in the host.
|
|
4261
4287
|
* After the URI regex parses, these characters cannot be literal in the host
|
|
4262
4288
|
* field, so any that appear after decoding came from percent-encoding and
|
|
@@ -4560,6 +4586,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4560
4586
|
encodeFragment,
|
|
4561
4587
|
escapePreservingEscapes,
|
|
4562
4588
|
removeDotSegments,
|
|
4589
|
+
removeDotSegmentsRelative,
|
|
4563
4590
|
isIPv4,
|
|
4564
4591
|
isUUID,
|
|
4565
4592
|
normalizeIPv6,
|
|
@@ -4749,18 +4776,24 @@ var require_schemes = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4749
4776
|
};
|
|
4750
4777
|
}));
|
|
4751
4778
|
var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
4752
|
-
const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
4779
|
+
const { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
4753
4780
|
const { SCHEMES, getSchemeHandler } = require_schemes();
|
|
4754
4781
|
const VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
4755
4782
|
const MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
4783
|
+
const MALFORMED_HOST_ERROR = "URI host is malformed.";
|
|
4784
|
+
const FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;
|
|
4756
4785
|
/**
|
|
4786
|
+
* RFC 3986 section 3.1 does not allow percent-encoding in a scheme, so the
|
|
4787
|
+
* scheme is validated as-is and never decoded. Decoding would let inert input
|
|
4788
|
+
* such as `%6Aavascript:` become a live `javascript:` scheme.
|
|
4789
|
+
*
|
|
4757
4790
|
* @param {string} scheme
|
|
4758
4791
|
* @returns {string}
|
|
4759
4792
|
*/
|
|
4760
|
-
function
|
|
4761
|
-
const
|
|
4762
|
-
if (!VALID_SCHEME.test(
|
|
4763
|
-
return
|
|
4793
|
+
function validateScheme(scheme) {
|
|
4794
|
+
const stringScheme = String(scheme);
|
|
4795
|
+
if (!VALID_SCHEME.test(stringScheme)) throw new TypeError(MALFORMED_SCHEME_ERROR);
|
|
4796
|
+
return stringScheme;
|
|
4764
4797
|
}
|
|
4765
4798
|
/**
|
|
4766
4799
|
* @template {import('./types/index').URIComponent|string} T
|
|
@@ -4788,6 +4821,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4788
4821
|
const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
|
|
4789
4822
|
const resolvedHost = resolved.host;
|
|
4790
4823
|
const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
4824
|
+
if (hasForbiddenDomainHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) throw new Error(MALFORMED_HOST_ERROR);
|
|
4791
4825
|
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
4792
4826
|
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost);
|
|
4793
4827
|
if (resolved.error && !encodedASCIIHost) throw new Error(resolved.error);
|
|
@@ -4831,10 +4865,11 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4831
4865
|
} else {
|
|
4832
4866
|
if (relative.path[0] === "/") target.path = removeDotSegments(relative.path);
|
|
4833
4867
|
else {
|
|
4834
|
-
|
|
4868
|
+
const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0;
|
|
4869
|
+
if (baseHasAuthority && !base.path) target.path = "/" + relative.path;
|
|
4835
4870
|
else if (!base.path) target.path = relative.path;
|
|
4836
4871
|
else target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
|
|
4837
|
-
target.path = removeDotSegments(target.path);
|
|
4872
|
+
target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path);
|
|
4838
4873
|
}
|
|
4839
4874
|
target.query = relative.query;
|
|
4840
4875
|
}
|
|
@@ -4882,17 +4917,18 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4882
4917
|
};
|
|
4883
4918
|
const options = Object.assign({}, opts);
|
|
4884
4919
|
const uriTokens = [];
|
|
4885
|
-
if (component.scheme) component.scheme =
|
|
4920
|
+
if (component.scheme) component.scheme = validateScheme(component.scheme);
|
|
4886
4921
|
const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
|
|
4887
4922
|
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
|
|
4888
4923
|
const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
|
|
4889
|
-
const
|
|
4924
|
+
const schemelessReference = (component.scheme === void 0 || options.reference === "suffix") && !hasAuthority;
|
|
4925
|
+
const pathNoScheme = !options.skipEscape && schemelessReference;
|
|
4890
4926
|
if (component.path !== void 0) {
|
|
4891
4927
|
if (!options.skipEscape) component.path = serializePathEncoding(component.path, pathNoScheme);
|
|
4892
4928
|
else component.path = normalizePercentEncoding(component.path);
|
|
4893
4929
|
}
|
|
4894
4930
|
if (options.reference !== "suffix" && component.scheme) {
|
|
4895
|
-
component.scheme =
|
|
4931
|
+
component.scheme = validateScheme(component.scheme);
|
|
4896
4932
|
uriTokens.push(component.scheme, ":");
|
|
4897
4933
|
}
|
|
4898
4934
|
const authority = recomposeAuthority(component);
|
|
@@ -4903,8 +4939,8 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4903
4939
|
}
|
|
4904
4940
|
if (component.path !== void 0) {
|
|
4905
4941
|
let s = component.path;
|
|
4906
|
-
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) s = removeDotSegments(s);
|
|
4907
|
-
if (
|
|
4942
|
+
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) s = schemelessReference && s[0] !== "/" ? removeDotSegmentsRelative(s) : removeDotSegments(s);
|
|
4943
|
+
if (schemelessReference) s = serializePathEncoding(s, true);
|
|
4908
4944
|
if (authority === void 0 && s[0] === "/" && s[1] === "/") s = "/%2F" + s.slice(2);
|
|
4909
4945
|
uriTokens.push(s);
|
|
4910
4946
|
}
|
|
@@ -4968,15 +5004,50 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4968
5004
|
* @returns {boolean} whether host conversion failed
|
|
4969
5005
|
*/
|
|
4970
5006
|
function canonicalizeHost(parsed, options, schemeHandler, isIP) {
|
|
4971
|
-
if (
|
|
4972
|
-
parsed.
|
|
4973
|
-
} catch (e) {
|
|
4974
|
-
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
5007
|
+
if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
|
|
5008
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
4975
5009
|
return true;
|
|
4976
5010
|
}
|
|
5011
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
5012
|
+
let url;
|
|
5013
|
+
try {
|
|
5014
|
+
url = new URL("http://" + parsed.host);
|
|
5015
|
+
} catch (e) {
|
|
5016
|
+
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
5017
|
+
return true;
|
|
5018
|
+
}
|
|
5019
|
+
if (!isHostOnlyURL(url)) {
|
|
5020
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
5021
|
+
return true;
|
|
5022
|
+
}
|
|
5023
|
+
parsed.host = url.hostname;
|
|
5024
|
+
}
|
|
4977
5025
|
return false;
|
|
4978
5026
|
}
|
|
4979
5027
|
/**
|
|
5028
|
+
* Whether a domain host contains an ASCII character that RFC 3986 does not
|
|
5029
|
+
* allow in a reg-name (unreserved, sub-delims, or pct-encoded). Such a host is
|
|
5030
|
+
* rejected instead of being handed to the WHATWG URL parser, which would treat
|
|
5031
|
+
* "@" as a userinfo delimiter (silently dropping the data before it) and strip
|
|
5032
|
+
* TAB, LF, and CR. Non-ASCII characters remain allowed for IDNs.
|
|
5033
|
+
*
|
|
5034
|
+
* @param {import('./types/index').URIComponent} parsed
|
|
5035
|
+
* @param {import('./types/index').Options} options
|
|
5036
|
+
* @param {{ domainHost?: boolean }|undefined} schemeHandler
|
|
5037
|
+
* @param {boolean} isIP
|
|
5038
|
+
* @returns {boolean}
|
|
5039
|
+
*/
|
|
5040
|
+
function hasForbiddenDomainHost(parsed, options, schemeHandler, isIP) {
|
|
5041
|
+
return Boolean(parsed.host && isIP === false && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host));
|
|
5042
|
+
}
|
|
5043
|
+
/**
|
|
5044
|
+
* @param {URL} url
|
|
5045
|
+
* @returns {boolean}
|
|
5046
|
+
*/
|
|
5047
|
+
function isHostOnlyURL(url) {
|
|
5048
|
+
return url.username === "" && url.password === "" && url.port === "" && url.pathname === "/" && url.search === "" && url.hash === "" && url.hostname !== "";
|
|
5049
|
+
}
|
|
5050
|
+
/**
|
|
4980
5051
|
* @param {string} uri
|
|
4981
5052
|
* @param {import('./types/index').Options} [opts]
|
|
4982
5053
|
* @returns {{ parsed: import('./types/index').URIComponent, malformedAuthorityOrPort: boolean, malformedPercentEncoding: boolean, malformedSchemeSpecific: boolean, malformedHost: boolean, malformedScheme: boolean }}
|
|
@@ -5033,8 +5104,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
5033
5104
|
parsed.query = matches[7];
|
|
5034
5105
|
parsed.fragment = matches[8];
|
|
5035
5106
|
if (parsed.scheme !== void 0) {
|
|
5036
|
-
|
|
5037
|
-
if (VALID_SCHEME.test(decodedScheme)) parsed.scheme = decodedScheme.toLowerCase();
|
|
5107
|
+
if (VALID_SCHEME.test(parsed.scheme)) parsed.scheme = parsed.scheme.toLowerCase();
|
|
5038
5108
|
else {
|
|
5039
5109
|
parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
|
|
5040
5110
|
malformedScheme = true;
|
|
@@ -5057,7 +5127,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
5057
5127
|
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
|
|
5058
5128
|
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
5059
5129
|
if (malformedIPLiteral) {
|
|
5060
|
-
parsed.error = parsed.error ||
|
|
5130
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
5061
5131
|
malformedAuthorityOrPort = true;
|
|
5062
5132
|
}
|
|
5063
5133
|
} else isIP = true;
|
|
@@ -5072,7 +5142,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
5072
5142
|
if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
|
|
5073
5143
|
let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
|
|
5074
5144
|
if (!isIP) host = normalizePercentEncoding(host.toLowerCase());
|
|
5075
|
-
parsed.host = reescapeHostDelimiters(host, isIP);
|
|
5145
|
+
parsed.host = isIP || options.scheme !== "null" ? reescapeHostDelimiters(host, isIP) : host;
|
|
5076
5146
|
}
|
|
5077
5147
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
5078
5148
|
if (parsed.path) parsed.path = normalizePathEncoding(parsed.path);
|
|
@@ -8318,8 +8388,7 @@ var JsonSchemaWrapper = class {
|
|
|
8318
8388
|
function toStandardSchema$4(schema, options) {
|
|
8319
8389
|
return new JsonSchemaWrapper(schema, options);
|
|
8320
8390
|
}
|
|
8321
|
-
|
|
8322
|
-
//#region ../schema-compat/dist/standard-schema/adapters/zod-v3.js
|
|
8391
|
+
// ../schema-compat/dist/standard-schema/adapters/zod-v3.js
|
|
8323
8392
|
var import_json_schema_traverse$1 = /* @__PURE__ */ __toESM$1(require_json_schema_traverse(), 1);
|
|
8324
8393
|
/**
|
|
8325
8394
|
* Target mapping from Standard Schema targets to zod-to-json-schema targets.
|
|
@@ -8413,8 +8482,7 @@ function toStandardSchema$3(zodSchema) {
|
|
|
8413
8482
|
});
|
|
8414
8483
|
return wrapper;
|
|
8415
8484
|
}
|
|
8416
|
-
|
|
8417
|
-
//#region ../schema-compat/dist/schema-CzbEIyhE.js
|
|
8485
|
+
// ../schema-compat/dist/schema-Bf12g7KC.js
|
|
8418
8486
|
/**
|
|
8419
8487
|
* Supported JSON Schema targets for z.toJSONSchema().
|
|
8420
8488
|
* Works with both real Zod v4 and Zod 3.25's v4 compat layer.
|
|
@@ -8621,8 +8689,7 @@ function isStandardJSONSchema(value) {
|
|
|
8621
8689
|
function isStandardSchemaWithJSON$2(value) {
|
|
8622
8690
|
return isStandardSchema(value) && isStandardJSONSchema(value);
|
|
8623
8691
|
}
|
|
8624
|
-
|
|
8625
|
-
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod-from-json-schema/0.5.2/938b1a90632b5c19aade6e212477c764befeb6d6e1cdb7cfde7de2557cd03f99/node_modules/zod-from-json-schema/dist/index.mjs
|
|
8692
|
+
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/zod-from-json-schema/0.5.2/938b1a90632b5c19aade6e212477c764befeb6d6e1cdb7cfde7de2557cd03f99/node_modules/zod-from-json-schema/dist/index.mjs
|
|
8626
8693
|
var TypeHandler = class {
|
|
8627
8694
|
apply(types, schema) {
|
|
8628
8695
|
if (!schema.type) return;
|
|
@@ -9178,8 +9245,7 @@ function convertJsonSchemaToZod(schema) {
|
|
|
9178
9245
|
for (const handler of refinementHandlers) zodSchema = handler.apply(zodSchema, schema);
|
|
9179
9246
|
return zodSchema;
|
|
9180
9247
|
}
|
|
9181
|
-
|
|
9182
|
-
//#region ../schema-compat/dist/index.js
|
|
9248
|
+
// ../schema-compat/dist/index.js
|
|
9183
9249
|
var marker$1 = "vercel.ai.error";
|
|
9184
9250
|
var symbol$1 = Symbol.for(marker$1);
|
|
9185
9251
|
var _a$1;
|
|
@@ -12403,8 +12469,7 @@ function trimStartOfStream() {
|
|
|
12403
12469
|
};
|
|
12404
12470
|
}
|
|
12405
12471
|
require_json_schema_traverse();
|
|
12406
|
-
|
|
12407
|
-
//#region src/shared/events/constants.ts
|
|
12472
|
+
// src/shared/events/constants.ts
|
|
12408
12473
|
/**
|
|
12409
12474
|
* Wire constants for the MCP Events extension (SEP-3415).
|
|
12410
12475
|
*
|
|
@@ -12460,8 +12525,7 @@ const WEBHOOK_HEADERS = {
|
|
|
12460
12525
|
signature: "webhook-signature",
|
|
12461
12526
|
subscriptionId: "x-mcp-subscription-id"
|
|
12462
12527
|
};
|
|
12463
|
-
|
|
12464
|
-
//#region src/shared/events/schemas.ts
|
|
12528
|
+
// src/shared/events/schemas.ts
|
|
12465
12529
|
/**
|
|
12466
12530
|
* Zod schemas for the MCP Events extension (SEP-3415) wire format.
|
|
12467
12531
|
*
|
|
@@ -12667,8 +12731,7 @@ function parseWebhookBody(body) {
|
|
|
12667
12731
|
event: EventOccurrenceSchema.parse(body)
|
|
12668
12732
|
};
|
|
12669
12733
|
}
|
|
12670
|
-
|
|
12671
|
-
//#region src/shared/events/capability.ts
|
|
12734
|
+
// src/shared/events/capability.ts
|
|
12672
12735
|
/**
|
|
12673
12736
|
* Read the negotiated events extension settings from a capabilities object.
|
|
12674
12737
|
* Returns `undefined` when the peer did not advertise the extension (or advertised a malformed entry).
|
|
@@ -12684,8 +12747,7 @@ function getEventsCapability(capabilities) {
|
|
|
12684
12747
|
const parsed = EventsCapabilitySchema.safeParse(entry);
|
|
12685
12748
|
return parsed.success ? parsed.data : void 0;
|
|
12686
12749
|
}
|
|
12687
|
-
|
|
12688
|
-
//#region src/shared/events/webhook.ts
|
|
12750
|
+
// src/shared/events/webhook.ts
|
|
12689
12751
|
/**
|
|
12690
12752
|
* Standard Webhooks signing and verification for MCP Events webhook delivery (SEP-3415).
|
|
12691
12753
|
*
|
|
@@ -12773,8 +12835,7 @@ function verifyWebhook({ secret, headers, body, toleranceSec = DEFAULT_TOLERANCE
|
|
|
12773
12835
|
reason: "invalid_signature"
|
|
12774
12836
|
};
|
|
12775
12837
|
}
|
|
12776
|
-
|
|
12777
|
-
//#region src/shared/events/webhook-url.ts
|
|
12838
|
+
// src/shared/events/webhook-url.ts
|
|
12778
12839
|
/**
|
|
12779
12840
|
* SSRF policy for MCP Events webhook callback URLs (SEP-3415 "Webhook security").
|
|
12780
12841
|
*
|
|
@@ -12944,8 +13005,7 @@ async function resolveAndValidate(url, opts = {}) {
|
|
|
12944
13005
|
family: first.family
|
|
12945
13006
|
};
|
|
12946
13007
|
}
|
|
12947
|
-
|
|
12948
|
-
//#region src/shared/json-schema-dialect.ts
|
|
13008
|
+
// src/shared/json-schema-dialect.ts
|
|
12949
13009
|
const JSON_SCHEMA_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
|
12950
13010
|
const JSON_SCHEMA_2019_09 = /^https?:\/\/json-schema\.org\/draft\/2019-09\/schema#?$/;
|
|
12951
13011
|
/** Keywords whose value is a subschema (`items` may also be an array of subschemas). */
|
|
@@ -13111,8 +13171,7 @@ function rewrite(schema, depth, budget, isRoot = false) {
|
|
|
13111
13171
|
delete out.additionalItems;
|
|
13112
13172
|
return out;
|
|
13113
13173
|
}
|
|
13114
|
-
|
|
13115
|
-
//#region src/shared/mastra-tool-meta.ts
|
|
13174
|
+
// src/shared/mastra-tool-meta.ts
|
|
13116
13175
|
const MASTRA_META_KEY$1 = "mastra";
|
|
13117
13176
|
const STRICT_META_KEY = "strict";
|
|
13118
13177
|
function withMastraToolStrictMeta(meta, strict) {
|
|
@@ -13132,8 +13191,7 @@ function getMastraToolStrictMeta(meta) {
|
|
|
13132
13191
|
const strict = mastraMeta[STRICT_META_KEY];
|
|
13133
13192
|
return typeof strict === "boolean" ? strict : void 0;
|
|
13134
13193
|
}
|
|
13135
|
-
|
|
13136
|
-
//#region src/shared/oauth-types.ts
|
|
13194
|
+
// src/shared/oauth-types.ts
|
|
13137
13195
|
/**
|
|
13138
13196
|
* Escapes backslashes and double quotes in a string for use in HTTP header quoted-string values.
|
|
13139
13197
|
*/
|
|
@@ -13192,8 +13250,7 @@ function extractBearerToken(authHeader) {
|
|
|
13192
13250
|
if (authHeader.slice(0, 7).toLowerCase() !== prefix) return void 0;
|
|
13193
13251
|
return authHeader.slice(7).trim() || void 0;
|
|
13194
13252
|
}
|
|
13195
|
-
|
|
13196
|
-
//#region src/shared/trace-context.ts
|
|
13253
|
+
// src/shared/trace-context.ts
|
|
13197
13254
|
/** `_meta` keys defined by the MCP specification for W3C trace propagation. */
|
|
13198
13255
|
const TRACEPARENT_META_KEY = "traceparent";
|
|
13199
13256
|
const TRACESTATE_META_KEY = "tracestate";
|
|
@@ -13337,8 +13394,7 @@ function takeServerTraceContext(result) {
|
|
|
13337
13394
|
} } : {}
|
|
13338
13395
|
};
|
|
13339
13396
|
}
|
|
13340
|
-
|
|
13341
|
-
//#region src/client/events/errors.ts
|
|
13397
|
+
// src/client/events/errors.ts
|
|
13342
13398
|
function eventsError(id, text, details = {}, cause) {
|
|
13343
13399
|
return new _mastra_core_error.MastraError({
|
|
13344
13400
|
id,
|
|
@@ -13370,8 +13426,7 @@ function toTransientError(error, details) {
|
|
|
13370
13426
|
if (error instanceof _mastra_core_error.MastraError) return error;
|
|
13371
13427
|
return eventsError("MCP_EVENTS_DELIVERY_INTERRUPTED", `Event delivery interrupted: ${error instanceof Error ? error.message : String(error)}`, details, error);
|
|
13372
13428
|
}
|
|
13373
|
-
|
|
13374
|
-
//#region src/client/events/mode.ts
|
|
13429
|
+
// src/client/events/mode.ts
|
|
13375
13430
|
/**
|
|
13376
13431
|
* Modes this client can drive, most preferred first. Webhook comes first, as the SEP recommends,
|
|
13377
13432
|
* but only when the caller configured a receiver.
|
|
@@ -13432,8 +13487,7 @@ const pollDriver = {
|
|
|
13432
13487
|
}
|
|
13433
13488
|
}
|
|
13434
13489
|
};
|
|
13435
|
-
|
|
13436
|
-
//#region src/client/events/push-driver.ts
|
|
13490
|
+
// src/client/events/push-driver.ts
|
|
13437
13491
|
/**
|
|
13438
13492
|
* Delivers a subscription over one `events/stream` request. The session ends when the stream
|
|
13439
13493
|
* closes, fails, goes silent for `heartbeatTimeoutMs`, or the server terminates it.
|
|
@@ -13514,8 +13568,7 @@ const pushDriver = {
|
|
|
13514
13568
|
}
|
|
13515
13569
|
}
|
|
13516
13570
|
};
|
|
13517
|
-
|
|
13518
|
-
//#region src/client/events/webhook-driver.ts
|
|
13571
|
+
// src/client/events/webhook-driver.ts
|
|
13519
13572
|
const DAY_MS = 864e5;
|
|
13520
13573
|
const MAX_MARGIN_MS = 6e4;
|
|
13521
13574
|
const MIN_REFRESH_DELAY_MS = 1e3;
|
|
@@ -13711,8 +13764,7 @@ var WebhookShare = class {
|
|
|
13711
13764
|
}
|
|
13712
13765
|
};
|
|
13713
13766
|
const sharesByPort = /* @__PURE__ */ new WeakMap();
|
|
13714
|
-
|
|
13715
|
-
//#region src/client/actions/events.ts
|
|
13767
|
+
// src/client/actions/events.ts
|
|
13716
13768
|
const DRIVERS = {
|
|
13717
13769
|
webhook: {
|
|
13718
13770
|
mode: "webhook",
|
|
@@ -13889,8 +13941,7 @@ var EventClientActions = class {
|
|
|
13889
13941
|
return events;
|
|
13890
13942
|
}
|
|
13891
13943
|
};
|
|
13892
|
-
|
|
13893
|
-
//#region src/client/actions/progress.ts
|
|
13944
|
+
// src/client/actions/progress.ts
|
|
13894
13945
|
/**
|
|
13895
13946
|
* Client-side progress actions for handling progress notifications from MCP servers.
|
|
13896
13947
|
*/
|
|
@@ -13909,8 +13960,7 @@ var ProgressClientActions = class {
|
|
|
13909
13960
|
this.client.setProgressNotificationHandler(handler);
|
|
13910
13961
|
}
|
|
13911
13962
|
};
|
|
13912
|
-
|
|
13913
|
-
//#region src/client/actions/prompt.ts
|
|
13963
|
+
// src/client/actions/prompt.ts
|
|
13914
13964
|
/**
|
|
13915
13965
|
* Client-side prompt actions for interacting with MCP server prompts.
|
|
13916
13966
|
*
|
|
@@ -14015,8 +14065,7 @@ var PromptClientActions = class {
|
|
|
14015
14065
|
await this.client.setPromptListChangedNotificationHandler(handler);
|
|
14016
14066
|
}
|
|
14017
14067
|
};
|
|
14018
|
-
|
|
14019
|
-
//#region src/client/actions/resource.ts
|
|
14068
|
+
// src/client/actions/resource.ts
|
|
14020
14069
|
/**
|
|
14021
14070
|
* Client-side resource actions for interacting with MCP server resources.
|
|
14022
14071
|
*
|
|
@@ -14183,8 +14232,7 @@ var ResourceClientActions = class {
|
|
|
14183
14232
|
await this.client.setResourceListChangedNotificationHandler(handler);
|
|
14184
14233
|
}
|
|
14185
14234
|
};
|
|
14186
|
-
|
|
14187
|
-
//#region src/client/error-utils.ts
|
|
14235
|
+
// src/client/error-utils.ts
|
|
14188
14236
|
/**
|
|
14189
14237
|
* Whether a failed MCP call is worth one transport reconnect and retry.
|
|
14190
14238
|
*
|
|
@@ -14265,8 +14313,7 @@ function getMCPDiscoveryErrorDetails(error) {
|
|
|
14265
14313
|
...code !== void 0 ? { code } : {}
|
|
14266
14314
|
};
|
|
14267
14315
|
}
|
|
14268
|
-
|
|
14269
|
-
//#region src/client/events/stream-router.ts
|
|
14316
|
+
// src/client/events/stream-router.ts
|
|
14270
14317
|
/**
|
|
14271
14318
|
* Routes push-stream notifications for one MCP server to the subscription that owns them.
|
|
14272
14319
|
*
|
|
@@ -14389,8 +14436,7 @@ var EventStreamRouter = class {
|
|
|
14389
14436
|
});
|
|
14390
14437
|
}
|
|
14391
14438
|
};
|
|
14392
|
-
|
|
14393
|
-
//#region src/client/events/subscription.ts
|
|
14439
|
+
// src/client/events/subscription.ts
|
|
14394
14440
|
const DEFAULT_DEDUP_WINDOW = 1e3;
|
|
14395
14441
|
const DEFAULT_MAX_BUFFERED_EVENTS = 1e3;
|
|
14396
14442
|
const DEFAULT_RETRY = {
|
|
@@ -14763,8 +14809,7 @@ var EventSubscription = class EventSubscription {
|
|
|
14763
14809
|
this.end();
|
|
14764
14810
|
}
|
|
14765
14811
|
};
|
|
14766
|
-
|
|
14767
|
-
//#region src/client/input-schema-meta-schema.ts
|
|
14812
|
+
// src/client/input-schema-meta-schema.ts
|
|
14768
14813
|
/**
|
|
14769
14814
|
* Structural JSON Schema meta-schema, used to check that a server-supplied tool input schema is
|
|
14770
14815
|
* shaped like a JSON Schema before it is handed to a model provider.
|
|
@@ -15083,8 +15128,7 @@ function getInputSchemaError(schema) {
|
|
|
15083
15128
|
}
|
|
15084
15129
|
return result.valid ? void 0 : result.errorMessage.split("; ").at(-1);
|
|
15085
15130
|
}
|
|
15086
|
-
|
|
15087
|
-
//#region src/client/url-policy.ts
|
|
15131
|
+
// src/client/url-policy.ts
|
|
15088
15132
|
/**
|
|
15089
15133
|
* Redirect status codes the manual redirect loop follows. Other 3xx statuses
|
|
15090
15134
|
* (e.g. 304) are not redirects and are returned to the caller as-is.
|
|
@@ -15249,8 +15293,7 @@ async function fetchFollowingAllowedRedirects(fetchImpl, url, init, allowedHosts
|
|
|
15249
15293
|
currentUrl = nextUrl;
|
|
15250
15294
|
}
|
|
15251
15295
|
}
|
|
15252
|
-
|
|
15253
|
-
//#region src/client/client.ts
|
|
15296
|
+
// src/client/client.ts
|
|
15254
15297
|
const DEFAULT_SERVER_CONNECT_TIMEOUT_MSEC = 3e3;
|
|
15255
15298
|
const SUPPORTED_DIALECTS = /* @__PURE__ */ new Set([
|
|
15256
15299
|
JSON_SCHEMA_2020_12,
|
|
@@ -16575,8 +16618,7 @@ var InternalMastraMCPClient = class extends _mastra_core_base.MastraBase {
|
|
|
16575
16618
|
};
|
|
16576
16619
|
}
|
|
16577
16620
|
};
|
|
16578
|
-
|
|
16579
|
-
//#region src/client/events/webhook-receiver.ts
|
|
16621
|
+
// src/client/events/webhook-receiver.ts
|
|
16580
16622
|
function respond(status, body) {
|
|
16581
16623
|
return body ? new Response(JSON.stringify(body), {
|
|
16582
16624
|
status,
|
|
@@ -16684,8 +16726,7 @@ async function readBody(request, limit) {
|
|
|
16684
16726
|
}
|
|
16685
16727
|
return body;
|
|
16686
16728
|
}
|
|
16687
|
-
|
|
16688
|
-
//#region src/client/oauth-callback-server.ts
|
|
16729
|
+
// src/client/oauth-callback-server.ts
|
|
16689
16730
|
/**
|
|
16690
16731
|
* Loopback OAuth Callback Server for MCP Client
|
|
16691
16732
|
*
|
|
@@ -16897,8 +16938,7 @@ async function createOAuthCallbackServer(options) {
|
|
|
16897
16938
|
}
|
|
16898
16939
|
};
|
|
16899
16940
|
}
|
|
16900
|
-
|
|
16901
|
-
//#region src/client/oauth-provider.ts
|
|
16941
|
+
// src/client/oauth-provider.ts
|
|
16902
16942
|
/**
|
|
16903
16943
|
* OAuth Client Provider Implementation for MCP Client
|
|
16904
16944
|
*
|
|
@@ -17247,8 +17287,7 @@ function createSimpleTokenProvider(accessToken, options) {
|
|
|
17247
17287
|
storage
|
|
17248
17288
|
});
|
|
17249
17289
|
}
|
|
17250
|
-
|
|
17251
|
-
//#region src/client/server-proxy.ts
|
|
17290
|
+
// src/client/server-proxy.ts
|
|
17252
17291
|
/**
|
|
17253
17292
|
* Wraps a single MCPClient server connection as an `MCPServerBase` so external
|
|
17254
17293
|
* (non-Mastra) MCP servers connected through MCPClient can be registered in Mastra's
|
|
@@ -17367,8 +17406,7 @@ var MCPClientServerProxy = class extends _mastra_core_mcp.MCPServerBase {
|
|
|
17367
17406
|
};
|
|
17368
17407
|
}
|
|
17369
17408
|
};
|
|
17370
|
-
|
|
17371
|
-
//#region src/client/configuration.ts
|
|
17409
|
+
// src/client/configuration.ts
|
|
17372
17410
|
const mcpClientInstances = /* @__PURE__ */ new Map();
|
|
17373
17411
|
/** Reads the shared cache without promising the snapshot shape it was created with. */
|
|
17374
17412
|
function cachedClient(id) {
|
|
@@ -18638,8 +18676,7 @@ onListChanged: async (serverName, handler) => {
|
|
|
18638
18676
|
return {};
|
|
18639
18677
|
}
|
|
18640
18678
|
};
|
|
18641
|
-
|
|
18642
|
-
//#region src/server/actions.ts
|
|
18679
|
+
// src/server/actions.ts
|
|
18643
18680
|
/** Runtime tool catalogue mutations. Every change is published to listening clients. */
|
|
18644
18681
|
var ServerToolActions = class {
|
|
18645
18682
|
deps;
|
|
@@ -18683,8 +18720,7 @@ var ServerPromptActions = class {
|
|
|
18683
18720
|
this.deps.getNotifier()?.promptsChanged();
|
|
18684
18721
|
}
|
|
18685
18722
|
};
|
|
18686
|
-
|
|
18687
|
-
//#region src/server/events/actions.ts
|
|
18723
|
+
// src/server/events/actions.ts
|
|
18688
18724
|
/**
|
|
18689
18725
|
* `server.events`: publishes occurrences of the event types configured in `MCPServer`'s `events`.
|
|
18690
18726
|
*
|
|
@@ -18723,8 +18759,7 @@ var ServerEventActions = class {
|
|
|
18723
18759
|
return this.describe();
|
|
18724
18760
|
}
|
|
18725
18761
|
};
|
|
18726
|
-
|
|
18727
|
-
//#region src/server/request.ts
|
|
18762
|
+
// src/server/request.ts
|
|
18728
18763
|
const unavailable = (feature, replacement) => () => Promise.reject(/* @__PURE__ */ new Error(`${feature} is not available on a 2026-07-28 server; ${replacement}`));
|
|
18729
18764
|
/**
|
|
18730
18765
|
* The `context.mcp` a 2026-07-28 request hands to tools: the 1.x shape, with the
|
|
@@ -18837,8 +18872,7 @@ function readContinuation(ctx, requestContext, expected) {
|
|
|
18837
18872
|
resumeData: answer.action === "accept" ? answer.content ?? {} : void 0
|
|
18838
18873
|
};
|
|
18839
18874
|
}
|
|
18840
|
-
|
|
18841
|
-
//#region src/server/events/ring-buffer.ts
|
|
18875
|
+
// src/server/events/ring-buffer.ts
|
|
18842
18876
|
/**
|
|
18843
18877
|
* Bounded, in-memory history of one event type's emitted occurrences.
|
|
18844
18878
|
*
|
|
@@ -18939,8 +18973,7 @@ var EventRingBuffer = class {
|
|
|
18939
18973
|
return seq <= this.seq ? seq : void 0;
|
|
18940
18974
|
}
|
|
18941
18975
|
};
|
|
18942
|
-
|
|
18943
|
-
//#region src/server/events/registry.ts
|
|
18976
|
+
// src/server/events/registry.ts
|
|
18944
18977
|
const DEFAULT_BUFFER_SIZE = 1e3;
|
|
18945
18978
|
/**
|
|
18946
18979
|
* Delivery modes advertised for a definition. They are fixed at construction because clients
|
|
@@ -19085,8 +19118,7 @@ function toDescriptor(event, convert) {
|
|
|
19085
19118
|
if (payloadSchema) descriptor.payloadSchema = payloadSchema;
|
|
19086
19119
|
return descriptor;
|
|
19087
19120
|
}
|
|
19088
|
-
|
|
19089
|
-
//#region src/server/events/stream.ts
|
|
19121
|
+
// src/server/events/stream.ts
|
|
19090
19122
|
/**
|
|
19091
19123
|
* Server side of one push subscription (`events/stream`).
|
|
19092
19124
|
*
|
|
@@ -19197,8 +19229,7 @@ var EventStream = class {
|
|
|
19197
19229
|
}, this.options.heartbeatIntervalMs);
|
|
19198
19230
|
}
|
|
19199
19231
|
};
|
|
19200
|
-
|
|
19201
|
-
//#region src/server/events/handlers.ts
|
|
19232
|
+
// src/server/events/handlers.ts
|
|
19202
19233
|
const DEFAULT_MAX_EVENTS = 100;
|
|
19203
19234
|
const DEFAULT_LIST_PAGE_SIZE = 100;
|
|
19204
19235
|
/**
|
|
@@ -19429,8 +19460,7 @@ function decodeListCursor(cursor) {
|
|
|
19429
19460
|
} catch {}
|
|
19430
19461
|
throw new _modelcontextprotocol_server.ProtocolError(_modelcontextprotocol_server.ProtocolErrorCode.InvalidParams, "Invalid events/list cursor");
|
|
19431
19462
|
}
|
|
19432
|
-
|
|
19433
|
-
//#region src/server/events/inspector.ts
|
|
19463
|
+
// src/server/events/inspector.ts
|
|
19434
19464
|
/** Prefix of the `eventId` of occurrences sent with the inspector's `emit`. */
|
|
19435
19465
|
const TEST_EMIT_EVENT_ID_PREFIX = "mastra-test-";
|
|
19436
19466
|
let localStreamIds = 0;
|
|
@@ -19547,8 +19577,7 @@ function protocolErrorId(code) {
|
|
|
19547
19577
|
default: return;
|
|
19548
19578
|
}
|
|
19549
19579
|
}
|
|
19550
|
-
|
|
19551
|
-
//#region src/server/events/webhook-store.ts
|
|
19580
|
+
// src/server/events/webhook-store.ts
|
|
19552
19581
|
/**
|
|
19553
19582
|
* Default {@link WebhookSubscriptionStore}: a process-local map.
|
|
19554
19583
|
*
|
|
@@ -19569,8 +19598,7 @@ var InMemoryWebhookSubscriptionStore = class {
|
|
|
19569
19598
|
return [...this.records.values()].filter((record) => record.name === name);
|
|
19570
19599
|
}
|
|
19571
19600
|
};
|
|
19572
|
-
|
|
19573
|
-
//#region src/server/events/webhook-transport.ts
|
|
19601
|
+
// src/server/events/webhook-transport.ts
|
|
19574
19602
|
/** Largest response body read from a callback endpoint. Enough for a verification echo. */
|
|
19575
19603
|
const MAX_RESPONSE_BYTES = 4096;
|
|
19576
19604
|
/** Maps a non-2xx status to its failure category. */
|
|
@@ -19645,8 +19673,7 @@ const nodeWebhookTransport = (request) => new Promise((resolve) => {
|
|
|
19645
19673
|
});
|
|
19646
19674
|
req.end(request.body);
|
|
19647
19675
|
});
|
|
19648
|
-
|
|
19649
|
-
//#region src/server/events/webhook-dispatcher.ts
|
|
19676
|
+
// src/server/events/webhook-dispatcher.ts
|
|
19650
19677
|
const MINUTE = 6e4;
|
|
19651
19678
|
const HOUR = 60 * MINUTE;
|
|
19652
19679
|
const MAX_TIMER_MS = 2147483647;
|
|
@@ -20203,8 +20230,7 @@ function echoes(body, challenge) {
|
|
|
20203
20230
|
const b = Buffer.from(challenge);
|
|
20204
20231
|
return a.length === b.length && (0, crypto$1.timingSafeEqual)(a, b);
|
|
20205
20232
|
}
|
|
20206
|
-
|
|
20207
|
-
//#region src/server/server.ts
|
|
20233
|
+
// src/server/server.ts
|
|
20208
20234
|
const EMPTY_OBJECT_SCHEMA = {
|
|
20209
20235
|
type: "object",
|
|
20210
20236
|
properties: {}
|
|
@@ -21319,12 +21345,10 @@ function normalizeUiMeta(meta) {
|
|
|
21319
21345
|
[_modelcontextprotocol_ext_apps.RESOURCE_URI_META_KEY]: resourceUri
|
|
21320
21346
|
};
|
|
21321
21347
|
}
|
|
21322
|
-
|
|
21323
|
-
//#region src/server/types.ts
|
|
21348
|
+
// src/server/types.ts
|
|
21324
21349
|
/** The only protocol revision `@mastra/mcp` serves. */
|
|
21325
21350
|
const MCP_PROTOCOL_VERSION = "2026-07-28";
|
|
21326
|
-
|
|
21327
|
-
//#region src/server/oauth-middleware.ts
|
|
21351
|
+
// src/server/oauth-middleware.ts
|
|
21328
21352
|
/**
|
|
21329
21353
|
* Creates an OAuth middleware function for protecting MCP server endpoints.
|
|
21330
21354
|
*
|
|
@@ -21569,8 +21593,7 @@ function createIntrospectionValidator(introspectionEndpoint, clientCredentials)
|
|
|
21569
21593
|
}
|
|
21570
21594
|
};
|
|
21571
21595
|
}
|
|
21572
|
-
|
|
21573
|
-
//#region src/server/events/define-event.ts
|
|
21596
|
+
// src/server/events/define-event.ts
|
|
21574
21597
|
/**
|
|
21575
21598
|
* Declares an event type for `MCPServer`'s `events` option. An identity helper: it types `match`
|
|
21576
21599
|
* and `poll` from `inputSchema` and `payloadSchema`.
|
|
@@ -21590,8 +21613,7 @@ function createIntrospectionValidator(introspectionEndpoint, clientCredentials)
|
|
|
21590
21613
|
function defineEvent(definition) {
|
|
21591
21614
|
return definition;
|
|
21592
21615
|
}
|
|
21593
|
-
|
|
21594
|
-
//#region src/integrations/events-cursor-store.ts
|
|
21616
|
+
// src/integrations/events-cursor-store.ts
|
|
21595
21617
|
/**
|
|
21596
21618
|
* Process-local {@link MCPEventCursorStore}. Cursors survive a provider restart within the same
|
|
21597
21619
|
* process, not a process restart.
|
|
@@ -21610,8 +21632,7 @@ var InMemoryMCPEventCursorStore = class {
|
|
|
21610
21632
|
this.#cursors.delete(key);
|
|
21611
21633
|
}
|
|
21612
21634
|
};
|
|
21613
|
-
|
|
21614
|
-
//#region src/integrations/events-utils.ts
|
|
21635
|
+
// src/integrations/events-utils.ts
|
|
21615
21636
|
function canonicalize(value) {
|
|
21616
21637
|
if (Array.isArray(value)) return value.map(canonicalize);
|
|
21617
21638
|
if (value !== null && typeof value === "object") {
|
|
@@ -21654,8 +21675,7 @@ function formatUntrustedEvent({ header, data, footer }) {
|
|
|
21654
21675
|
...footer ? [footer] : []
|
|
21655
21676
|
].join("\n");
|
|
21656
21677
|
}
|
|
21657
|
-
|
|
21658
|
-
//#region src/integrations/events-tools.ts
|
|
21678
|
+
// src/integrations/events-tools.ts
|
|
21659
21679
|
function decodeArguments(value) {
|
|
21660
21680
|
try {
|
|
21661
21681
|
const parsed = JSON.parse(value);
|
|
@@ -21763,8 +21783,7 @@ function createMCPEventsTools({ provider, client, servers }) {
|
|
|
21763
21783
|
})
|
|
21764
21784
|
};
|
|
21765
21785
|
}
|
|
21766
|
-
|
|
21767
|
-
//#region src/integrations/events-signals.ts
|
|
21786
|
+
// src/integrations/events-signals.ts
|
|
21768
21787
|
const GAP_NOTE = "Some events may have been skipped (gap); re-fetch authoritative state with tools if it matters.";
|
|
21769
21788
|
/**
|
|
21770
21789
|
* Delivers MCP Events (SEP-3415) occurrences into agent threads as notification signals.
|
|
@@ -22017,7 +22036,6 @@ var MCPEventsSignalProvider = class MCPEventsSignalProvider extends _mastra_core
|
|
|
22017
22036
|
else console.warn(`[${this.id}] ${info.key}:`, error);
|
|
22018
22037
|
}
|
|
22019
22038
|
};
|
|
22020
|
-
//#endregion
|
|
22021
22039
|
exports.InMemoryMCPEventCursorStore = InMemoryMCPEventCursorStore;
|
|
22022
22040
|
exports.InMemoryOAuthStorage = InMemoryOAuthStorage;
|
|
22023
22041
|
exports.InMemoryWebhookSubscriptionStore = InMemoryWebhookSubscriptionStore;
|