@mastra/mcp 2.6.0-alpha.0 → 2.6.0-alpha.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/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 +175 -147
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +174 -145
- package/dist/index.js.map +1 -1
- package/dist/server/server.d.ts.map +1 -1
- package/package.json +14 -14
package/dist/index.js
CHANGED
|
@@ -27,11 +27,10 @@ import { CLIENT_INFO_META_KEY, PROTOCOL_VERSION_META_KEY, ProtocolError as Proto
|
|
|
27
27
|
import { serveStdio } from "@modelcontextprotocol/server/stdio";
|
|
28
28
|
import https from "https";
|
|
29
29
|
import { SignalProvider } from "@mastra/core/signals";
|
|
30
|
-
|
|
30
|
+
// src/client/types.ts
|
|
31
31
|
/** The current protocol revision; the one `/mcp` servers speak. */
|
|
32
32
|
const MCP_CLIENT_PROTOCOL_VERSION = "2026-07-28";
|
|
33
|
-
|
|
34
|
-
//#region ../schema-compat/dist/json-schema-traverse-Jrimn_T_.js
|
|
33
|
+
// ../schema-compat/dist/json-schema-traverse-D0CId4oM.js
|
|
35
34
|
var __create$1 = Object.create;
|
|
36
35
|
var __defProp$2 = Object.defineProperty;
|
|
37
36
|
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
@@ -126,8 +125,7 @@ var require_json_schema_traverse = /* @__PURE__ */ __commonJSMin$1(((exports, mo
|
|
|
126
125
|
return str.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
127
126
|
}
|
|
128
127
|
}));
|
|
129
|
-
|
|
130
|
-
//#region ../schema-compat/dist/esm-DA8owk0L.js
|
|
128
|
+
// ../schema-compat/dist/esm-BG70JlG8.js
|
|
131
129
|
const ignoreOverride$1 = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
132
130
|
const defaultOptions$1 = {
|
|
133
131
|
name: void 0,
|
|
@@ -1133,8 +1131,7 @@ const zodToJsonSchema$1 = (schema, options) => {
|
|
|
1133
1131
|
return combined;
|
|
1134
1132
|
};
|
|
1135
1133
|
var esm_default$1 = zodToJsonSchema$1;
|
|
1136
|
-
|
|
1137
|
-
//#region ../schema-compat/dist/zod-to-json.js
|
|
1134
|
+
// ../schema-compat/dist/zod-to-json.js
|
|
1138
1135
|
const PATCHED = Symbol("__mastra_patched__");
|
|
1139
1136
|
/**
|
|
1140
1137
|
* Recursively patch Zod v4 record schemas that are missing valueType.
|
|
@@ -1185,8 +1182,7 @@ function patchRecordSchemas(schema) {
|
|
|
1185
1182
|
if (def.innerType) patchRecordSchemas(def.innerType);
|
|
1186
1183
|
return schema;
|
|
1187
1184
|
}
|
|
1188
|
-
|
|
1189
|
-
//#region ../schema-compat/dist/standard-schema/adapters/ai-sdk.js
|
|
1185
|
+
// ../schema-compat/dist/standard-schema/adapters/ai-sdk.js
|
|
1190
1186
|
/**
|
|
1191
1187
|
* Vendor name for AI SDK wrapped schemas.
|
|
1192
1188
|
*/
|
|
@@ -1334,8 +1330,7 @@ var AiSdkSchemaWrapper = class {
|
|
|
1334
1330
|
function toStandardSchema$4(schema) {
|
|
1335
1331
|
return new AiSdkSchemaWrapper(schema);
|
|
1336
1332
|
}
|
|
1337
|
-
|
|
1338
|
-
//#region ../schema-compat/dist/json-schema-DcMkkbbI.js
|
|
1333
|
+
// ../schema-compat/dist/json-schema-BdCwqjfN.js
|
|
1339
1334
|
var require_code$1 = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
1340
1335
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1341
1336
|
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;
|
|
@@ -4230,6 +4225,38 @@ var require_utils = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4230
4225
|
return output.join("");
|
|
4231
4226
|
}
|
|
4232
4227
|
/**
|
|
4228
|
+
* Removes dot segments from the path of a relative reference (a path that does
|
|
4229
|
+
* not start with "/") without changing what it resolves to against any base.
|
|
4230
|
+
* Unlike `removeDotSegments`, leading ".." segments that cannot be collapsed
|
|
4231
|
+
* are kept, the result never becomes root-relative, and a result that would be
|
|
4232
|
+
* empty or start with an empty segment is prefixed with "." (an empty path
|
|
4233
|
+
* means "same document" and a leading "//" would introduce an authority).
|
|
4234
|
+
*
|
|
4235
|
+
* @param {string} path
|
|
4236
|
+
* @returns {string}
|
|
4237
|
+
*/
|
|
4238
|
+
function removeDotSegmentsRelative(path) {
|
|
4239
|
+
if (path === "" || path[0] === "/") return removeDotSegments(path);
|
|
4240
|
+
const segments = path.split("/");
|
|
4241
|
+
const last = segments.length - 1;
|
|
4242
|
+
/** @type {string[]} */
|
|
4243
|
+
const output = [];
|
|
4244
|
+
let trailingDirectory = false;
|
|
4245
|
+
for (let i = 0; i <= last; i++) {
|
|
4246
|
+
const segment = segments[i];
|
|
4247
|
+
if (segment === "." || segment === "..") {
|
|
4248
|
+
if (segment === "..") {
|
|
4249
|
+
if (output.length !== 0 && output[output.length - 1] !== "..") output.pop();
|
|
4250
|
+
else output.push("..");
|
|
4251
|
+
}
|
|
4252
|
+
trailingDirectory = i === last;
|
|
4253
|
+
} else output.push(segment);
|
|
4254
|
+
}
|
|
4255
|
+
if (trailingDirectory && output[output.length - 1] !== "..") output.push("");
|
|
4256
|
+
if (output.length === 0 || output[0] === "" || output[0].includes(":")) output.unshift(".");
|
|
4257
|
+
return output.join("/");
|
|
4258
|
+
}
|
|
4259
|
+
/**
|
|
4233
4260
|
* Re-escape RFC 3986 gen-delims that must not appear literally in the host.
|
|
4234
4261
|
* After the URI regex parses, these characters cannot be literal in the host
|
|
4235
4262
|
* field, so any that appear after decoding came from percent-encoding and
|
|
@@ -4533,6 +4560,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4533
4560
|
encodeFragment,
|
|
4534
4561
|
escapePreservingEscapes,
|
|
4535
4562
|
removeDotSegments,
|
|
4563
|
+
removeDotSegmentsRelative,
|
|
4536
4564
|
isIPv4,
|
|
4537
4565
|
isUUID,
|
|
4538
4566
|
normalizeIPv6,
|
|
@@ -4722,18 +4750,24 @@ var require_schemes = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4722
4750
|
};
|
|
4723
4751
|
}));
|
|
4724
4752
|
var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
4725
|
-
const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
4753
|
+
const { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
4726
4754
|
const { SCHEMES, getSchemeHandler } = require_schemes();
|
|
4727
4755
|
const VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
4728
4756
|
const MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
4757
|
+
const MALFORMED_HOST_ERROR = "URI host is malformed.";
|
|
4758
|
+
const FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;
|
|
4729
4759
|
/**
|
|
4760
|
+
* RFC 3986 section 3.1 does not allow percent-encoding in a scheme, so the
|
|
4761
|
+
* scheme is validated as-is and never decoded. Decoding would let inert input
|
|
4762
|
+
* such as `%6Aavascript:` become a live `javascript:` scheme.
|
|
4763
|
+
*
|
|
4730
4764
|
* @param {string} scheme
|
|
4731
4765
|
* @returns {string}
|
|
4732
4766
|
*/
|
|
4733
|
-
function
|
|
4734
|
-
const
|
|
4735
|
-
if (!VALID_SCHEME.test(
|
|
4736
|
-
return
|
|
4767
|
+
function validateScheme(scheme) {
|
|
4768
|
+
const stringScheme = String(scheme);
|
|
4769
|
+
if (!VALID_SCHEME.test(stringScheme)) throw new TypeError(MALFORMED_SCHEME_ERROR);
|
|
4770
|
+
return stringScheme;
|
|
4737
4771
|
}
|
|
4738
4772
|
/**
|
|
4739
4773
|
* @template {import('./types/index').URIComponent|string} T
|
|
@@ -4761,6 +4795,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4761
4795
|
const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
|
|
4762
4796
|
const resolvedHost = resolved.host;
|
|
4763
4797
|
const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
4798
|
+
if (hasForbiddenDomainHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP)) throw new Error(MALFORMED_HOST_ERROR);
|
|
4764
4799
|
canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
4765
4800
|
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost);
|
|
4766
4801
|
if (resolved.error && !encodedASCIIHost) throw new Error(resolved.error);
|
|
@@ -4804,10 +4839,11 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4804
4839
|
} else {
|
|
4805
4840
|
if (relative.path[0] === "/") target.path = removeDotSegments(relative.path);
|
|
4806
4841
|
else {
|
|
4807
|
-
|
|
4842
|
+
const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0;
|
|
4843
|
+
if (baseHasAuthority && !base.path) target.path = "/" + relative.path;
|
|
4808
4844
|
else if (!base.path) target.path = relative.path;
|
|
4809
4845
|
else target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
|
|
4810
|
-
target.path = removeDotSegments(target.path);
|
|
4846
|
+
target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path);
|
|
4811
4847
|
}
|
|
4812
4848
|
target.query = relative.query;
|
|
4813
4849
|
}
|
|
@@ -4855,17 +4891,18 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4855
4891
|
};
|
|
4856
4892
|
const options = Object.assign({}, opts);
|
|
4857
4893
|
const uriTokens = [];
|
|
4858
|
-
if (component.scheme) component.scheme =
|
|
4894
|
+
if (component.scheme) component.scheme = validateScheme(component.scheme);
|
|
4859
4895
|
const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
|
|
4860
4896
|
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
|
|
4861
4897
|
const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
|
|
4862
|
-
const
|
|
4898
|
+
const schemelessReference = (component.scheme === void 0 || options.reference === "suffix") && !hasAuthority;
|
|
4899
|
+
const pathNoScheme = !options.skipEscape && schemelessReference;
|
|
4863
4900
|
if (component.path !== void 0) {
|
|
4864
4901
|
if (!options.skipEscape) component.path = serializePathEncoding(component.path, pathNoScheme);
|
|
4865
4902
|
else component.path = normalizePercentEncoding(component.path);
|
|
4866
4903
|
}
|
|
4867
4904
|
if (options.reference !== "suffix" && component.scheme) {
|
|
4868
|
-
component.scheme =
|
|
4905
|
+
component.scheme = validateScheme(component.scheme);
|
|
4869
4906
|
uriTokens.push(component.scheme, ":");
|
|
4870
4907
|
}
|
|
4871
4908
|
const authority = recomposeAuthority(component);
|
|
@@ -4876,8 +4913,8 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4876
4913
|
}
|
|
4877
4914
|
if (component.path !== void 0) {
|
|
4878
4915
|
let s = component.path;
|
|
4879
|
-
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) s = removeDotSegments(s);
|
|
4880
|
-
if (
|
|
4916
|
+
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) s = schemelessReference && s[0] !== "/" ? removeDotSegmentsRelative(s) : removeDotSegments(s);
|
|
4917
|
+
if (schemelessReference) s = serializePathEncoding(s, true);
|
|
4881
4918
|
if (authority === void 0 && s[0] === "/" && s[1] === "/") s = "/%2F" + s.slice(2);
|
|
4882
4919
|
uriTokens.push(s);
|
|
4883
4920
|
}
|
|
@@ -4941,15 +4978,50 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
4941
4978
|
* @returns {boolean} whether host conversion failed
|
|
4942
4979
|
*/
|
|
4943
4980
|
function canonicalizeHost(parsed, options, schemeHandler, isIP) {
|
|
4944
|
-
if (
|
|
4945
|
-
parsed.
|
|
4946
|
-
} catch (e) {
|
|
4947
|
-
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
4981
|
+
if (hasForbiddenDomainHost(parsed, options, schemeHandler, isIP)) {
|
|
4982
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
4948
4983
|
return true;
|
|
4949
4984
|
}
|
|
4985
|
+
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
4986
|
+
let url;
|
|
4987
|
+
try {
|
|
4988
|
+
url = new URL("http://" + parsed.host);
|
|
4989
|
+
} catch (e) {
|
|
4990
|
+
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
|
|
4991
|
+
return true;
|
|
4992
|
+
}
|
|
4993
|
+
if (!isHostOnlyURL(url)) {
|
|
4994
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
4995
|
+
return true;
|
|
4996
|
+
}
|
|
4997
|
+
parsed.host = url.hostname;
|
|
4998
|
+
}
|
|
4950
4999
|
return false;
|
|
4951
5000
|
}
|
|
4952
5001
|
/**
|
|
5002
|
+
* Whether a domain host contains an ASCII character that RFC 3986 does not
|
|
5003
|
+
* allow in a reg-name (unreserved, sub-delims, or pct-encoded). Such a host is
|
|
5004
|
+
* rejected instead of being handed to the WHATWG URL parser, which would treat
|
|
5005
|
+
* "@" as a userinfo delimiter (silently dropping the data before it) and strip
|
|
5006
|
+
* TAB, LF, and CR. Non-ASCII characters remain allowed for IDNs.
|
|
5007
|
+
*
|
|
5008
|
+
* @param {import('./types/index').URIComponent} parsed
|
|
5009
|
+
* @param {import('./types/index').Options} options
|
|
5010
|
+
* @param {{ domainHost?: boolean }|undefined} schemeHandler
|
|
5011
|
+
* @param {boolean} isIP
|
|
5012
|
+
* @returns {boolean}
|
|
5013
|
+
*/
|
|
5014
|
+
function hasForbiddenDomainHost(parsed, options, schemeHandler, isIP) {
|
|
5015
|
+
return Boolean(parsed.host && isIP === false && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host));
|
|
5016
|
+
}
|
|
5017
|
+
/**
|
|
5018
|
+
* @param {URL} url
|
|
5019
|
+
* @returns {boolean}
|
|
5020
|
+
*/
|
|
5021
|
+
function isHostOnlyURL(url) {
|
|
5022
|
+
return url.username === "" && url.password === "" && url.port === "" && url.pathname === "/" && url.search === "" && url.hash === "" && url.hostname !== "";
|
|
5023
|
+
}
|
|
5024
|
+
/**
|
|
4953
5025
|
* @param {string} uri
|
|
4954
5026
|
* @param {import('./types/index').Options} [opts]
|
|
4955
5027
|
* @returns {{ parsed: import('./types/index').URIComponent, malformedAuthorityOrPort: boolean, malformedPercentEncoding: boolean, malformedSchemeSpecific: boolean, malformedHost: boolean, malformedScheme: boolean }}
|
|
@@ -5006,8 +5078,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
5006
5078
|
parsed.query = matches[7];
|
|
5007
5079
|
parsed.fragment = matches[8];
|
|
5008
5080
|
if (parsed.scheme !== void 0) {
|
|
5009
|
-
|
|
5010
|
-
if (VALID_SCHEME.test(decodedScheme)) parsed.scheme = decodedScheme.toLowerCase();
|
|
5081
|
+
if (VALID_SCHEME.test(parsed.scheme)) parsed.scheme = parsed.scheme.toLowerCase();
|
|
5011
5082
|
else {
|
|
5012
5083
|
parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
|
|
5013
5084
|
malformedScheme = true;
|
|
@@ -5030,7 +5101,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
5030
5101
|
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
|
|
5031
5102
|
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
5032
5103
|
if (malformedIPLiteral) {
|
|
5033
|
-
parsed.error = parsed.error ||
|
|
5104
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
5034
5105
|
malformedAuthorityOrPort = true;
|
|
5035
5106
|
}
|
|
5036
5107
|
} else isIP = true;
|
|
@@ -5045,7 +5116,7 @@ var require_fast_uri = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
5045
5116
|
if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
|
|
5046
5117
|
let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
|
|
5047
5118
|
if (!isIP) host = normalizePercentEncoding(host.toLowerCase());
|
|
5048
|
-
parsed.host = reescapeHostDelimiters(host, isIP);
|
|
5119
|
+
parsed.host = isIP || options.scheme !== "null" ? reescapeHostDelimiters(host, isIP) : host;
|
|
5049
5120
|
}
|
|
5050
5121
|
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
5051
5122
|
if (parsed.path) parsed.path = normalizePathEncoding(parsed.path);
|
|
@@ -8291,8 +8362,7 @@ var JsonSchemaWrapper = class {
|
|
|
8291
8362
|
function toStandardSchema$3(schema, options) {
|
|
8292
8363
|
return new JsonSchemaWrapper(schema, options);
|
|
8293
8364
|
}
|
|
8294
|
-
|
|
8295
|
-
//#region ../schema-compat/dist/standard-schema/adapters/zod-v3.js
|
|
8365
|
+
// ../schema-compat/dist/standard-schema/adapters/zod-v3.js
|
|
8296
8366
|
var import_json_schema_traverse$1 = /* @__PURE__ */ __toESM$1(require_json_schema_traverse(), 1);
|
|
8297
8367
|
/**
|
|
8298
8368
|
* Target mapping from Standard Schema targets to zod-to-json-schema targets.
|
|
@@ -8386,8 +8456,7 @@ function toStandardSchema$2(zodSchema) {
|
|
|
8386
8456
|
});
|
|
8387
8457
|
return wrapper;
|
|
8388
8458
|
}
|
|
8389
|
-
|
|
8390
|
-
//#region ../schema-compat/dist/schema-CzbEIyhE.js
|
|
8459
|
+
// ../schema-compat/dist/schema-Bf12g7KC.js
|
|
8391
8460
|
/**
|
|
8392
8461
|
* Supported JSON Schema targets for z.toJSONSchema().
|
|
8393
8462
|
* Works with both real Zod v4 and Zod 3.25's v4 compat layer.
|
|
@@ -8594,8 +8663,7 @@ function isStandardJSONSchema(value) {
|
|
|
8594
8663
|
function isStandardSchemaWithJSON$1(value) {
|
|
8595
8664
|
return isStandardSchema(value) && isStandardJSONSchema(value);
|
|
8596
8665
|
}
|
|
8597
|
-
|
|
8598
|
-
//#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
|
|
8666
|
+
// ../../../../../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
|
|
8599
8667
|
var TypeHandler = class {
|
|
8600
8668
|
apply(types, schema) {
|
|
8601
8669
|
if (!schema.type) return;
|
|
@@ -9151,8 +9219,7 @@ function convertJsonSchemaToZod(schema) {
|
|
|
9151
9219
|
for (const handler of refinementHandlers) zodSchema = handler.apply(zodSchema, schema);
|
|
9152
9220
|
return zodSchema;
|
|
9153
9221
|
}
|
|
9154
|
-
|
|
9155
|
-
//#region ../schema-compat/dist/index.js
|
|
9222
|
+
// ../schema-compat/dist/index.js
|
|
9156
9223
|
var marker$1 = "vercel.ai.error";
|
|
9157
9224
|
var symbol$1 = Symbol.for(marker$1);
|
|
9158
9225
|
var _a$1;
|
|
@@ -12376,8 +12443,7 @@ function trimStartOfStream() {
|
|
|
12376
12443
|
};
|
|
12377
12444
|
}
|
|
12378
12445
|
require_json_schema_traverse();
|
|
12379
|
-
|
|
12380
|
-
//#region src/shared/events/constants.ts
|
|
12446
|
+
// src/shared/events/constants.ts
|
|
12381
12447
|
/**
|
|
12382
12448
|
* Wire constants for the MCP Events extension (SEP-3415).
|
|
12383
12449
|
*
|
|
@@ -12433,8 +12499,7 @@ const WEBHOOK_HEADERS = {
|
|
|
12433
12499
|
signature: "webhook-signature",
|
|
12434
12500
|
subscriptionId: "x-mcp-subscription-id"
|
|
12435
12501
|
};
|
|
12436
|
-
|
|
12437
|
-
//#region src/shared/events/schemas.ts
|
|
12502
|
+
// src/shared/events/schemas.ts
|
|
12438
12503
|
/**
|
|
12439
12504
|
* Zod schemas for the MCP Events extension (SEP-3415) wire format.
|
|
12440
12505
|
*
|
|
@@ -12640,8 +12705,7 @@ function parseWebhookBody(body) {
|
|
|
12640
12705
|
event: EventOccurrenceSchema.parse(body)
|
|
12641
12706
|
};
|
|
12642
12707
|
}
|
|
12643
|
-
|
|
12644
|
-
//#region src/shared/events/capability.ts
|
|
12708
|
+
// src/shared/events/capability.ts
|
|
12645
12709
|
/**
|
|
12646
12710
|
* Read the negotiated events extension settings from a capabilities object.
|
|
12647
12711
|
* Returns `undefined` when the peer did not advertise the extension (or advertised a malformed entry).
|
|
@@ -12657,8 +12721,7 @@ function getEventsCapability(capabilities) {
|
|
|
12657
12721
|
const parsed = EventsCapabilitySchema.safeParse(entry);
|
|
12658
12722
|
return parsed.success ? parsed.data : void 0;
|
|
12659
12723
|
}
|
|
12660
|
-
|
|
12661
|
-
//#region src/shared/events/webhook.ts
|
|
12724
|
+
// src/shared/events/webhook.ts
|
|
12662
12725
|
/**
|
|
12663
12726
|
* Standard Webhooks signing and verification for MCP Events webhook delivery (SEP-3415).
|
|
12664
12727
|
*
|
|
@@ -12746,8 +12809,7 @@ function verifyWebhook({ secret, headers, body, toleranceSec = DEFAULT_TOLERANCE
|
|
|
12746
12809
|
reason: "invalid_signature"
|
|
12747
12810
|
};
|
|
12748
12811
|
}
|
|
12749
|
-
|
|
12750
|
-
//#region src/shared/events/webhook-url.ts
|
|
12812
|
+
// src/shared/events/webhook-url.ts
|
|
12751
12813
|
/**
|
|
12752
12814
|
* SSRF policy for MCP Events webhook callback URLs (SEP-3415 "Webhook security").
|
|
12753
12815
|
*
|
|
@@ -12917,8 +12979,7 @@ async function resolveAndValidate(url, opts = {}) {
|
|
|
12917
12979
|
family: first.family
|
|
12918
12980
|
};
|
|
12919
12981
|
}
|
|
12920
|
-
|
|
12921
|
-
//#region src/shared/json-schema-dialect.ts
|
|
12982
|
+
// src/shared/json-schema-dialect.ts
|
|
12922
12983
|
const JSON_SCHEMA_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
|
12923
12984
|
const JSON_SCHEMA_2019_09 = /^https?:\/\/json-schema\.org\/draft\/2019-09\/schema#?$/;
|
|
12924
12985
|
/** Keywords whose value is a subschema (`items` may also be an array of subschemas). */
|
|
@@ -13084,8 +13145,7 @@ function rewrite(schema, depth, budget, isRoot = false) {
|
|
|
13084
13145
|
delete out.additionalItems;
|
|
13085
13146
|
return out;
|
|
13086
13147
|
}
|
|
13087
|
-
|
|
13088
|
-
//#region src/shared/mastra-tool-meta.ts
|
|
13148
|
+
// src/shared/mastra-tool-meta.ts
|
|
13089
13149
|
const MASTRA_META_KEY$1 = "mastra";
|
|
13090
13150
|
const STRICT_META_KEY = "strict";
|
|
13091
13151
|
function withMastraToolStrictMeta(meta, strict) {
|
|
@@ -13105,8 +13165,7 @@ function getMastraToolStrictMeta(meta) {
|
|
|
13105
13165
|
const strict = mastraMeta[STRICT_META_KEY];
|
|
13106
13166
|
return typeof strict === "boolean" ? strict : void 0;
|
|
13107
13167
|
}
|
|
13108
|
-
|
|
13109
|
-
//#region src/shared/oauth-types.ts
|
|
13168
|
+
// src/shared/oauth-types.ts
|
|
13110
13169
|
/**
|
|
13111
13170
|
* Escapes backslashes and double quotes in a string for use in HTTP header quoted-string values.
|
|
13112
13171
|
*/
|
|
@@ -13165,8 +13224,7 @@ function extractBearerToken(authHeader) {
|
|
|
13165
13224
|
if (authHeader.slice(0, 7).toLowerCase() !== prefix) return void 0;
|
|
13166
13225
|
return authHeader.slice(7).trim() || void 0;
|
|
13167
13226
|
}
|
|
13168
|
-
|
|
13169
|
-
//#region src/shared/trace-context.ts
|
|
13227
|
+
// src/shared/trace-context.ts
|
|
13170
13228
|
/** `_meta` keys defined by the MCP specification for W3C trace propagation. */
|
|
13171
13229
|
const TRACEPARENT_META_KEY = "traceparent";
|
|
13172
13230
|
const TRACESTATE_META_KEY = "tracestate";
|
|
@@ -13310,8 +13368,7 @@ function takeServerTraceContext(result) {
|
|
|
13310
13368
|
} } : {}
|
|
13311
13369
|
};
|
|
13312
13370
|
}
|
|
13313
|
-
|
|
13314
|
-
//#region src/client/events/errors.ts
|
|
13371
|
+
// src/client/events/errors.ts
|
|
13315
13372
|
function eventsError(id, text, details = {}, cause) {
|
|
13316
13373
|
return new MastraError({
|
|
13317
13374
|
id,
|
|
@@ -13343,8 +13400,7 @@ function toTransientError(error, details) {
|
|
|
13343
13400
|
if (error instanceof MastraError) return error;
|
|
13344
13401
|
return eventsError("MCP_EVENTS_DELIVERY_INTERRUPTED", `Event delivery interrupted: ${error instanceof Error ? error.message : String(error)}`, details, error);
|
|
13345
13402
|
}
|
|
13346
|
-
|
|
13347
|
-
//#region src/client/events/mode.ts
|
|
13403
|
+
// src/client/events/mode.ts
|
|
13348
13404
|
/**
|
|
13349
13405
|
* Modes this client can drive, most preferred first. Webhook comes first, as the SEP recommends,
|
|
13350
13406
|
* but only when the caller configured a receiver.
|
|
@@ -13405,8 +13461,7 @@ const pollDriver = {
|
|
|
13405
13461
|
}
|
|
13406
13462
|
}
|
|
13407
13463
|
};
|
|
13408
|
-
|
|
13409
|
-
//#region src/client/events/push-driver.ts
|
|
13464
|
+
// src/client/events/push-driver.ts
|
|
13410
13465
|
/**
|
|
13411
13466
|
* Delivers a subscription over one `events/stream` request. The session ends when the stream
|
|
13412
13467
|
* closes, fails, goes silent for `heartbeatTimeoutMs`, or the server terminates it.
|
|
@@ -13487,8 +13542,7 @@ const pushDriver = {
|
|
|
13487
13542
|
}
|
|
13488
13543
|
}
|
|
13489
13544
|
};
|
|
13490
|
-
|
|
13491
|
-
//#region src/client/events/webhook-driver.ts
|
|
13545
|
+
// src/client/events/webhook-driver.ts
|
|
13492
13546
|
const DAY_MS = 864e5;
|
|
13493
13547
|
const MAX_MARGIN_MS = 6e4;
|
|
13494
13548
|
const MIN_REFRESH_DELAY_MS = 1e3;
|
|
@@ -13684,8 +13738,7 @@ var WebhookShare = class {
|
|
|
13684
13738
|
}
|
|
13685
13739
|
};
|
|
13686
13740
|
const sharesByPort = /* @__PURE__ */ new WeakMap();
|
|
13687
|
-
|
|
13688
|
-
//#region src/client/actions/events.ts
|
|
13741
|
+
// src/client/actions/events.ts
|
|
13689
13742
|
const DRIVERS = {
|
|
13690
13743
|
webhook: {
|
|
13691
13744
|
mode: "webhook",
|
|
@@ -13862,8 +13915,7 @@ var EventClientActions = class {
|
|
|
13862
13915
|
return events;
|
|
13863
13916
|
}
|
|
13864
13917
|
};
|
|
13865
|
-
|
|
13866
|
-
//#region src/client/actions/progress.ts
|
|
13918
|
+
// src/client/actions/progress.ts
|
|
13867
13919
|
/**
|
|
13868
13920
|
* Client-side progress actions for handling progress notifications from MCP servers.
|
|
13869
13921
|
*/
|
|
@@ -13882,8 +13934,7 @@ var ProgressClientActions = class {
|
|
|
13882
13934
|
this.client.setProgressNotificationHandler(handler);
|
|
13883
13935
|
}
|
|
13884
13936
|
};
|
|
13885
|
-
|
|
13886
|
-
//#region src/client/actions/prompt.ts
|
|
13937
|
+
// src/client/actions/prompt.ts
|
|
13887
13938
|
/**
|
|
13888
13939
|
* Client-side prompt actions for interacting with MCP server prompts.
|
|
13889
13940
|
*
|
|
@@ -13988,8 +14039,7 @@ var PromptClientActions = class {
|
|
|
13988
14039
|
await this.client.setPromptListChangedNotificationHandler(handler);
|
|
13989
14040
|
}
|
|
13990
14041
|
};
|
|
13991
|
-
|
|
13992
|
-
//#region src/client/actions/resource.ts
|
|
14042
|
+
// src/client/actions/resource.ts
|
|
13993
14043
|
/**
|
|
13994
14044
|
* Client-side resource actions for interacting with MCP server resources.
|
|
13995
14045
|
*
|
|
@@ -14156,8 +14206,7 @@ var ResourceClientActions = class {
|
|
|
14156
14206
|
await this.client.setResourceListChangedNotificationHandler(handler);
|
|
14157
14207
|
}
|
|
14158
14208
|
};
|
|
14159
|
-
|
|
14160
|
-
//#region src/client/error-utils.ts
|
|
14209
|
+
// src/client/error-utils.ts
|
|
14161
14210
|
/**
|
|
14162
14211
|
* Whether a failed MCP call is worth one transport reconnect and retry.
|
|
14163
14212
|
*
|
|
@@ -14238,8 +14287,7 @@ function getMCPDiscoveryErrorDetails(error) {
|
|
|
14238
14287
|
...code !== void 0 ? { code } : {}
|
|
14239
14288
|
};
|
|
14240
14289
|
}
|
|
14241
|
-
|
|
14242
|
-
//#region src/client/events/stream-router.ts
|
|
14290
|
+
// src/client/events/stream-router.ts
|
|
14243
14291
|
/**
|
|
14244
14292
|
* Routes push-stream notifications for one MCP server to the subscription that owns them.
|
|
14245
14293
|
*
|
|
@@ -14362,8 +14410,7 @@ var EventStreamRouter = class {
|
|
|
14362
14410
|
});
|
|
14363
14411
|
}
|
|
14364
14412
|
};
|
|
14365
|
-
|
|
14366
|
-
//#region src/client/events/subscription.ts
|
|
14413
|
+
// src/client/events/subscription.ts
|
|
14367
14414
|
const DEFAULT_DEDUP_WINDOW = 1e3;
|
|
14368
14415
|
const DEFAULT_MAX_BUFFERED_EVENTS = 1e3;
|
|
14369
14416
|
const DEFAULT_RETRY = {
|
|
@@ -14736,8 +14783,7 @@ var EventSubscription = class EventSubscription {
|
|
|
14736
14783
|
this.end();
|
|
14737
14784
|
}
|
|
14738
14785
|
};
|
|
14739
|
-
|
|
14740
|
-
//#region src/client/input-schema-meta-schema.ts
|
|
14786
|
+
// src/client/input-schema-meta-schema.ts
|
|
14741
14787
|
/**
|
|
14742
14788
|
* Structural JSON Schema meta-schema, used to check that a server-supplied tool input schema is
|
|
14743
14789
|
* shaped like a JSON Schema before it is handed to a model provider.
|
|
@@ -15056,8 +15102,7 @@ function getInputSchemaError(schema) {
|
|
|
15056
15102
|
}
|
|
15057
15103
|
return result.valid ? void 0 : result.errorMessage.split("; ").at(-1);
|
|
15058
15104
|
}
|
|
15059
|
-
|
|
15060
|
-
//#region src/client/url-policy.ts
|
|
15105
|
+
// src/client/url-policy.ts
|
|
15061
15106
|
/**
|
|
15062
15107
|
* Redirect status codes the manual redirect loop follows. Other 3xx statuses
|
|
15063
15108
|
* (e.g. 304) are not redirects and are returned to the caller as-is.
|
|
@@ -15222,8 +15267,7 @@ async function fetchFollowingAllowedRedirects(fetchImpl, url, init, allowedHosts
|
|
|
15222
15267
|
currentUrl = nextUrl;
|
|
15223
15268
|
}
|
|
15224
15269
|
}
|
|
15225
|
-
|
|
15226
|
-
//#region src/client/client.ts
|
|
15270
|
+
// src/client/client.ts
|
|
15227
15271
|
const DEFAULT_SERVER_CONNECT_TIMEOUT_MSEC = 3e3;
|
|
15228
15272
|
const SUPPORTED_DIALECTS = /* @__PURE__ */ new Set([
|
|
15229
15273
|
JSON_SCHEMA_2020_12,
|
|
@@ -16548,8 +16592,7 @@ var InternalMastraMCPClient = class extends MastraBase {
|
|
|
16548
16592
|
};
|
|
16549
16593
|
}
|
|
16550
16594
|
};
|
|
16551
|
-
|
|
16552
|
-
//#region src/client/events/webhook-receiver.ts
|
|
16595
|
+
// src/client/events/webhook-receiver.ts
|
|
16553
16596
|
function respond(status, body) {
|
|
16554
16597
|
return body ? new Response(JSON.stringify(body), {
|
|
16555
16598
|
status,
|
|
@@ -16657,8 +16700,7 @@ async function readBody(request, limit) {
|
|
|
16657
16700
|
}
|
|
16658
16701
|
return body;
|
|
16659
16702
|
}
|
|
16660
|
-
|
|
16661
|
-
//#region src/client/oauth-callback-server.ts
|
|
16703
|
+
// src/client/oauth-callback-server.ts
|
|
16662
16704
|
/**
|
|
16663
16705
|
* Loopback OAuth Callback Server for MCP Client
|
|
16664
16706
|
*
|
|
@@ -16870,8 +16912,7 @@ async function createOAuthCallbackServer(options) {
|
|
|
16870
16912
|
}
|
|
16871
16913
|
};
|
|
16872
16914
|
}
|
|
16873
|
-
|
|
16874
|
-
//#region src/client/oauth-provider.ts
|
|
16915
|
+
// src/client/oauth-provider.ts
|
|
16875
16916
|
/**
|
|
16876
16917
|
* OAuth Client Provider Implementation for MCP Client
|
|
16877
16918
|
*
|
|
@@ -17220,8 +17261,7 @@ function createSimpleTokenProvider(accessToken, options) {
|
|
|
17220
17261
|
storage
|
|
17221
17262
|
});
|
|
17222
17263
|
}
|
|
17223
|
-
|
|
17224
|
-
//#region src/client/server-proxy.ts
|
|
17264
|
+
// src/client/server-proxy.ts
|
|
17225
17265
|
/**
|
|
17226
17266
|
* Wraps a single MCPClient server connection as an `MCPServerBase` so external
|
|
17227
17267
|
* (non-Mastra) MCP servers connected through MCPClient can be registered in Mastra's
|
|
@@ -17340,8 +17380,7 @@ var MCPClientServerProxy = class extends MCPServerBase {
|
|
|
17340
17380
|
};
|
|
17341
17381
|
}
|
|
17342
17382
|
};
|
|
17343
|
-
|
|
17344
|
-
//#region src/client/configuration.ts
|
|
17383
|
+
// src/client/configuration.ts
|
|
17345
17384
|
const mcpClientInstances = /* @__PURE__ */ new Map();
|
|
17346
17385
|
/** Reads the shared cache without promising the snapshot shape it was created with. */
|
|
17347
17386
|
function cachedClient(id) {
|
|
@@ -18611,8 +18650,7 @@ onListChanged: async (serverName, handler) => {
|
|
|
18611
18650
|
return {};
|
|
18612
18651
|
}
|
|
18613
18652
|
};
|
|
18614
|
-
|
|
18615
|
-
//#region src/server/actions.ts
|
|
18653
|
+
// src/server/actions.ts
|
|
18616
18654
|
/** Runtime tool catalogue mutations. Every change is published to listening clients. */
|
|
18617
18655
|
var ServerToolActions = class {
|
|
18618
18656
|
deps;
|
|
@@ -18656,8 +18694,7 @@ var ServerPromptActions = class {
|
|
|
18656
18694
|
this.deps.getNotifier()?.promptsChanged();
|
|
18657
18695
|
}
|
|
18658
18696
|
};
|
|
18659
|
-
|
|
18660
|
-
//#region src/server/events/actions.ts
|
|
18697
|
+
// src/server/events/actions.ts
|
|
18661
18698
|
/**
|
|
18662
18699
|
* `server.events`: publishes occurrences of the event types configured in `MCPServer`'s `events`.
|
|
18663
18700
|
*
|
|
@@ -18696,8 +18733,7 @@ var ServerEventActions = class {
|
|
|
18696
18733
|
return this.describe();
|
|
18697
18734
|
}
|
|
18698
18735
|
};
|
|
18699
|
-
|
|
18700
|
-
//#region src/server/request.ts
|
|
18736
|
+
// src/server/request.ts
|
|
18701
18737
|
const unavailable = (feature, replacement) => () => Promise.reject(/* @__PURE__ */ new Error(`${feature} is not available on a 2026-07-28 server; ${replacement}`));
|
|
18702
18738
|
/**
|
|
18703
18739
|
* The `context.mcp` a 2026-07-28 request hands to tools: the 1.x shape, with the
|
|
@@ -18810,8 +18846,7 @@ function readContinuation(ctx, requestContext, expected) {
|
|
|
18810
18846
|
resumeData: answer.action === "accept" ? answer.content ?? {} : void 0
|
|
18811
18847
|
};
|
|
18812
18848
|
}
|
|
18813
|
-
|
|
18814
|
-
//#region src/server/events/ring-buffer.ts
|
|
18849
|
+
// src/server/events/ring-buffer.ts
|
|
18815
18850
|
/**
|
|
18816
18851
|
* Bounded, in-memory history of one event type's emitted occurrences.
|
|
18817
18852
|
*
|
|
@@ -18912,8 +18947,7 @@ var EventRingBuffer = class {
|
|
|
18912
18947
|
return seq <= this.seq ? seq : void 0;
|
|
18913
18948
|
}
|
|
18914
18949
|
};
|
|
18915
|
-
|
|
18916
|
-
//#region src/server/events/registry.ts
|
|
18950
|
+
// src/server/events/registry.ts
|
|
18917
18951
|
const DEFAULT_BUFFER_SIZE = 1e3;
|
|
18918
18952
|
/**
|
|
18919
18953
|
* Delivery modes advertised for a definition. They are fixed at construction because clients
|
|
@@ -19058,8 +19092,7 @@ function toDescriptor(event, convert) {
|
|
|
19058
19092
|
if (payloadSchema) descriptor.payloadSchema = payloadSchema;
|
|
19059
19093
|
return descriptor;
|
|
19060
19094
|
}
|
|
19061
|
-
|
|
19062
|
-
//#region src/server/events/stream.ts
|
|
19095
|
+
// src/server/events/stream.ts
|
|
19063
19096
|
/**
|
|
19064
19097
|
* Server side of one push subscription (`events/stream`).
|
|
19065
19098
|
*
|
|
@@ -19170,8 +19203,7 @@ var EventStream = class {
|
|
|
19170
19203
|
}, this.options.heartbeatIntervalMs);
|
|
19171
19204
|
}
|
|
19172
19205
|
};
|
|
19173
|
-
|
|
19174
|
-
//#region src/server/events/handlers.ts
|
|
19206
|
+
// src/server/events/handlers.ts
|
|
19175
19207
|
const DEFAULT_MAX_EVENTS = 100;
|
|
19176
19208
|
const DEFAULT_LIST_PAGE_SIZE = 100;
|
|
19177
19209
|
/**
|
|
@@ -19402,8 +19434,7 @@ function decodeListCursor(cursor) {
|
|
|
19402
19434
|
} catch {}
|
|
19403
19435
|
throw new ProtocolError$1(ProtocolErrorCode$1.InvalidParams, "Invalid events/list cursor");
|
|
19404
19436
|
}
|
|
19405
|
-
|
|
19406
|
-
//#region src/server/events/inspector.ts
|
|
19437
|
+
// src/server/events/inspector.ts
|
|
19407
19438
|
/** Prefix of the `eventId` of occurrences sent with the inspector's `emit`. */
|
|
19408
19439
|
const TEST_EMIT_EVENT_ID_PREFIX = "mastra-test-";
|
|
19409
19440
|
let localStreamIds = 0;
|
|
@@ -19520,8 +19551,7 @@ function protocolErrorId(code) {
|
|
|
19520
19551
|
default: return;
|
|
19521
19552
|
}
|
|
19522
19553
|
}
|
|
19523
|
-
|
|
19524
|
-
//#region src/server/events/webhook-store.ts
|
|
19554
|
+
// src/server/events/webhook-store.ts
|
|
19525
19555
|
/**
|
|
19526
19556
|
* Default {@link WebhookSubscriptionStore}: a process-local map.
|
|
19527
19557
|
*
|
|
@@ -19542,8 +19572,7 @@ var InMemoryWebhookSubscriptionStore = class {
|
|
|
19542
19572
|
return [...this.records.values()].filter((record) => record.name === name);
|
|
19543
19573
|
}
|
|
19544
19574
|
};
|
|
19545
|
-
|
|
19546
|
-
//#region src/server/events/webhook-transport.ts
|
|
19575
|
+
// src/server/events/webhook-transport.ts
|
|
19547
19576
|
/** Largest response body read from a callback endpoint. Enough for a verification echo. */
|
|
19548
19577
|
const MAX_RESPONSE_BYTES = 4096;
|
|
19549
19578
|
/** Maps a non-2xx status to its failure category. */
|
|
@@ -19618,8 +19647,7 @@ const nodeWebhookTransport = (request) => new Promise((resolve) => {
|
|
|
19618
19647
|
});
|
|
19619
19648
|
req.end(request.body);
|
|
19620
19649
|
});
|
|
19621
|
-
|
|
19622
|
-
//#region src/server/events/webhook-dispatcher.ts
|
|
19650
|
+
// src/server/events/webhook-dispatcher.ts
|
|
19623
19651
|
const MINUTE = 6e4;
|
|
19624
19652
|
const HOUR = 60 * MINUTE;
|
|
19625
19653
|
const MAX_TIMER_MS = 2147483647;
|
|
@@ -20176,8 +20204,7 @@ function echoes(body, challenge) {
|
|
|
20176
20204
|
const b = Buffer.from(challenge);
|
|
20177
20205
|
return a.length === b.length && timingSafeEqual(a, b);
|
|
20178
20206
|
}
|
|
20179
|
-
|
|
20180
|
-
//#region src/server/server.ts
|
|
20207
|
+
// src/server/server.ts
|
|
20181
20208
|
const EMPTY_OBJECT_SCHEMA = {
|
|
20182
20209
|
type: "object",
|
|
20183
20210
|
properties: {}
|
|
@@ -20850,21 +20877,31 @@ var MCPServer = class extends MCPServerBase {
|
|
|
20850
20877
|
ui: { resourceUri },
|
|
20851
20878
|
[RESOURCE_URI_META_KEY]: resourceUri
|
|
20852
20879
|
} } : {};
|
|
20853
|
-
if (!tool.outputSchema)
|
|
20854
|
-
|
|
20855
|
-
|
|
20856
|
-
|
|
20857
|
-
|
|
20858
|
-
|
|
20859
|
-
|
|
20860
|
-
|
|
20861
|
-
|
|
20880
|
+
if (!tool.outputSchema) {
|
|
20881
|
+
const text = typeof value === "string" ? value : JSON.stringify(value);
|
|
20882
|
+
return {
|
|
20883
|
+
isError: false,
|
|
20884
|
+
content: text === void 0 ? [] : [{
|
|
20885
|
+
type: "text",
|
|
20886
|
+
text
|
|
20887
|
+
}],
|
|
20888
|
+
...meta
|
|
20889
|
+
};
|
|
20890
|
+
}
|
|
20891
|
+
const text = JSON.stringify(value);
|
|
20892
|
+
if (text === void 0) {
|
|
20893
|
+
this.logger.warn(`Tool '${name}' declares an outputSchema but returned no structured output.`);
|
|
20894
|
+
return {
|
|
20895
|
+
...errorResult$1(`Tool '${name}' declares an outputSchema but returned no output.`),
|
|
20896
|
+
...meta
|
|
20897
|
+
};
|
|
20898
|
+
}
|
|
20862
20899
|
return {
|
|
20863
20900
|
isError: false,
|
|
20864
|
-
structuredContent,
|
|
20901
|
+
structuredContent: value,
|
|
20865
20902
|
content: [{
|
|
20866
20903
|
type: "text",
|
|
20867
|
-
text
|
|
20904
|
+
text
|
|
20868
20905
|
}],
|
|
20869
20906
|
...meta
|
|
20870
20907
|
};
|
|
@@ -21292,12 +21329,10 @@ function normalizeUiMeta(meta) {
|
|
|
21292
21329
|
[RESOURCE_URI_META_KEY]: resourceUri
|
|
21293
21330
|
};
|
|
21294
21331
|
}
|
|
21295
|
-
|
|
21296
|
-
//#region src/server/types.ts
|
|
21332
|
+
// src/server/types.ts
|
|
21297
21333
|
/** The only protocol revision `@mastra/mcp` serves. */
|
|
21298
21334
|
const MCP_PROTOCOL_VERSION = "2026-07-28";
|
|
21299
|
-
|
|
21300
|
-
//#region src/server/oauth-middleware.ts
|
|
21335
|
+
// src/server/oauth-middleware.ts
|
|
21301
21336
|
/**
|
|
21302
21337
|
* Creates an OAuth middleware function for protecting MCP server endpoints.
|
|
21303
21338
|
*
|
|
@@ -21542,8 +21577,7 @@ function createIntrospectionValidator(introspectionEndpoint, clientCredentials)
|
|
|
21542
21577
|
}
|
|
21543
21578
|
};
|
|
21544
21579
|
}
|
|
21545
|
-
|
|
21546
|
-
//#region src/server/events/define-event.ts
|
|
21580
|
+
// src/server/events/define-event.ts
|
|
21547
21581
|
/**
|
|
21548
21582
|
* Declares an event type for `MCPServer`'s `events` option. An identity helper: it types `match`
|
|
21549
21583
|
* and `poll` from `inputSchema` and `payloadSchema`.
|
|
@@ -21563,8 +21597,7 @@ function createIntrospectionValidator(introspectionEndpoint, clientCredentials)
|
|
|
21563
21597
|
function defineEvent(definition) {
|
|
21564
21598
|
return definition;
|
|
21565
21599
|
}
|
|
21566
|
-
|
|
21567
|
-
//#region src/integrations/events-cursor-store.ts
|
|
21600
|
+
// src/integrations/events-cursor-store.ts
|
|
21568
21601
|
/**
|
|
21569
21602
|
* Process-local {@link MCPEventCursorStore}. Cursors survive a provider restart within the same
|
|
21570
21603
|
* process, not a process restart.
|
|
@@ -21583,8 +21616,7 @@ var InMemoryMCPEventCursorStore = class {
|
|
|
21583
21616
|
this.#cursors.delete(key);
|
|
21584
21617
|
}
|
|
21585
21618
|
};
|
|
21586
|
-
|
|
21587
|
-
//#region src/integrations/events-utils.ts
|
|
21619
|
+
// src/integrations/events-utils.ts
|
|
21588
21620
|
function canonicalize(value) {
|
|
21589
21621
|
if (Array.isArray(value)) return value.map(canonicalize);
|
|
21590
21622
|
if (value !== null && typeof value === "object") {
|
|
@@ -21627,8 +21659,7 @@ function formatUntrustedEvent({ header, data, footer }) {
|
|
|
21627
21659
|
...footer ? [footer] : []
|
|
21628
21660
|
].join("\n");
|
|
21629
21661
|
}
|
|
21630
|
-
|
|
21631
|
-
//#region src/integrations/events-tools.ts
|
|
21662
|
+
// src/integrations/events-tools.ts
|
|
21632
21663
|
function decodeArguments(value) {
|
|
21633
21664
|
try {
|
|
21634
21665
|
const parsed = JSON.parse(value);
|
|
@@ -21736,8 +21767,7 @@ function createMCPEventsTools({ provider, client, servers }) {
|
|
|
21736
21767
|
})
|
|
21737
21768
|
};
|
|
21738
21769
|
}
|
|
21739
|
-
|
|
21740
|
-
//#region src/integrations/events-signals.ts
|
|
21770
|
+
// src/integrations/events-signals.ts
|
|
21741
21771
|
const GAP_NOTE = "Some events may have been skipped (gap); re-fetch authoritative state with tools if it matters.";
|
|
21742
21772
|
/**
|
|
21743
21773
|
* Delivers MCP Events (SEP-3415) occurrences into agent threads as notification signals.
|
|
@@ -21990,7 +22020,6 @@ var MCPEventsSignalProvider = class MCPEventsSignalProvider extends SignalProvid
|
|
|
21990
22020
|
else console.warn(`[${this.id}] ${info.key}:`, error);
|
|
21991
22021
|
}
|
|
21992
22022
|
};
|
|
21993
|
-
//#endregion
|
|
21994
22023
|
export { InMemoryMCPEventCursorStore, InMemoryOAuthStorage, InMemoryWebhookSubscriptionStore, InternalMastraMCPClient, MCPClient, MCPClientServerProxy, MCPEventsSignalProvider, MCPOAuthClientProvider, MCPServer, MCP_CALL_TOOL_CONTENT, MCP_CALL_TOOL_META, MCP_CLIENT_PROTOCOL_VERSION, MCP_PROTOCOL_VERSION, ServerEventActions, ServerPromptActions, ServerResourceActions, ServerToolActions, UnauthorizedError, auth, buildDiscoveryUrls, createIntrospectionValidator, createOAuthCallbackServer, createOAuthMiddleware, createSimpleTokenProvider, createStaticTokenValidator, defineEvent, discoverAuthorizationServerMetadata, discoverOAuthMetadata, discoverOAuthProtectedResourceMetadata, exchangeAuthorization, extractBearerToken, extractResourceMetadataUrl, generateProtectedResourceMetadata, generateWWWAuthenticateHeader, getCallbackUrlCandidates, getMcpCallToolContent, getMcpCallToolMeta, parseErrorResponse, refreshAuthorization, selectResourceURL, startAuthorization, traceContextFromMeta, traceContextToMeta };
|
|
21995
22024
|
|
|
21996
22025
|
//# sourceMappingURL=index.js.map
|