@mastra/mcp 2.4.0-alpha.0 → 2.4.1-alpha.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/dist/client/client.d.ts.map +1 -1
- package/dist/client/configuration.d.ts.map +1 -1
- package/dist/client/input-schema-meta-schema.d.ts +29 -0
- package/dist/client/input-schema-meta-schema.d.ts.map +1 -0
- package/dist/client/input-schema-test-cases.d.ts +5 -0
- package/dist/client/input-schema-test-cases.d.ts.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +359 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +359 -19
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAK/C,OAAO,KAAK,EAAmB,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAShE,OAAO,KAAK,EAEV,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,2BAA2B,EAG3B,kBAAkB,EAMnB,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAK/C,OAAO,KAAK,EAAmB,IAAI,E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AAO,CAAC,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC,CAU9E;IAED,OAAO,CAAC,wBAAwB;IAoBhC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,6BAA6B,CAAA;KAAE,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CA4B1G;IAEK,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAiB/D;IAED;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IA+P9B,OAAO,CAAC,mBAAmB;CAQ5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/client/configuration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAIjH,OAAO,KAAK,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/client/configuration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,E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U,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,6BAA6B,CAAC;KAC3C,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAOpC;IAED;;;;;;;;;;;;;;;OAeG;IACU,oBAAoB,CAAC,EAChC,WAAW,EAAE,OAAO,GACrB,EAAE;QACD,WAAW,EAAE,0BAA0B,CAAC;KACzC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAuBpD;YAEa,uBAAuB;YAcvB,+BAA+B;YAiB/B,qBAAqB;YAcrB,wBAAwB;IA8BtC;;;;;;;;;;;OAWG;YACW,qBAAqB;IAsEnC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACI,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAQzD;IAED;;;;;;;;OAQG;IACI,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIxD;IAED,OAAO,CAAC,eAAe;YAQT,iBAAiB;YAoCjB,kBAAkB;IAchC,OAAO,CAAC,kBAAkB;YAyBZ,2BAA2B;YAI3B,kBAAkB;YAIlB,iBAAiB;CAuBhC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { JsonSchemaType } from '@modelcontextprotocol/client';
|
|
2
|
+
/**
|
|
3
|
+
* Structural JSON Schema meta-schema, used to check that a server-supplied tool input schema is
|
|
4
|
+
* shaped like a JSON Schema before it is handed to a model provider.
|
|
5
|
+
*
|
|
6
|
+
* Based on https://json-schema.org/draft-07/schema (`$schema`/`$id` dropped so the validator does
|
|
7
|
+
* not try to resolve them). Draft-07 is used because its meta-schema is a single self-contained
|
|
8
|
+
* document; the 2020-12 meta-schema is split across vocabulary documents. Changes from upstream:
|
|
9
|
+
* - `format`, `uniqueItems` and the non-empty `enum` rule are removed, so only wrong value types
|
|
10
|
+
* and non-schemas in schema positions drop a tool, not regex dialects, non-URI ids or duplicates;
|
|
11
|
+
* - the block at the end of `properties` adds the 2019-09/2020-12 subschema keywords.
|
|
12
|
+
* Unknown keywords stay allowed, as in every dialect.
|
|
13
|
+
*/
|
|
14
|
+
export declare const INPUT_SCHEMA_META_SCHEMA: JsonSchemaType;
|
|
15
|
+
/**
|
|
16
|
+
* Loads the SDK's cf-worker validator, which interprets schemas instead of compiling them with
|
|
17
|
+
* `new Function`, so it also runs on Cloudflare Workers. It is imported lazily because
|
|
18
|
+
* `@cfworker/json-schema` builds a URL from `self.location` at import time, which throws in some
|
|
19
|
+
* browser worker locations; importing `@mastra/mcp` must not fail there. Until it has loaded, or
|
|
20
|
+
* if it cannot load, the structural fallback check is used instead.
|
|
21
|
+
*/
|
|
22
|
+
export declare function loadInputSchemaMetaValidator(): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Checks a server-supplied input schema against {@link INPUT_SCHEMA_META_SCHEMA}, falling back to
|
|
25
|
+
* a structural check while the validator is not loaded. Callers must rule out oversized schemas
|
|
26
|
+
* with getJsonSchemaComplexityError first.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getInputSchemaError(schema: unknown): string | undefined;
|
|
29
|
+
//# sourceMappingURL=input-schema-meta-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-schema-meta-schema.d.ts","sourceRoot":"","sources":["../../src/client/input-schema-meta-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAuB,MAAM,8BAA8B,CAAC;AAExF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,EAAE,cAkKtC,CAAC;AAsIF;;;;;;GAMG;AACH,wBAAgB,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC,CAQ5D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAavE"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Input schemas both the cf-worker validator and the structural fallback must reject. */
|
|
2
|
+
export declare const MALFORMED_INPUT_SCHEMAS: [string, unknown][];
|
|
3
|
+
/** Input schemas both the cf-worker validator and the structural fallback must accept. */
|
|
4
|
+
export declare const VALID_INPUT_SCHEMAS: [string, unknown][];
|
|
5
|
+
//# sourceMappingURL=input-schema-test-cases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-schema-test-cases.d.ts","sourceRoot":"","sources":["../../src/client/input-schema-test-cases.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,eAAO,MAAM,uBAAuB,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAuBtD,CAAC;AAEF,0FAA0F;AAC1F,eAAO,MAAM,mBAAmB,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAsBlD,CAAC"}
|
package/dist/docs/SKILL.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -22241,7 +22241,7 @@ require_json_schema_traverse();
|
|
|
22241
22241
|
const JSON_SCHEMA_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
|
22242
22242
|
const JSON_SCHEMA_2019_09 = /^https?:\/\/json-schema\.org\/draft\/2019-09\/schema#?$/;
|
|
22243
22243
|
/** Keywords whose value is a subschema (`items` may also be an array of subschemas). */
|
|
22244
|
-
const SCHEMA_KEYWORDS = /* @__PURE__ */ new Set([
|
|
22244
|
+
const SCHEMA_KEYWORDS$1 = /* @__PURE__ */ new Set([
|
|
22245
22245
|
"items",
|
|
22246
22246
|
"additionalItems",
|
|
22247
22247
|
"contains",
|
|
@@ -22255,13 +22255,13 @@ const SCHEMA_KEYWORDS = /* @__PURE__ */ new Set([
|
|
|
22255
22255
|
"not"
|
|
22256
22256
|
]);
|
|
22257
22257
|
/** Keywords whose value is an array of subschemas. */
|
|
22258
|
-
const SCHEMA_ARRAY_KEYWORDS = /* @__PURE__ */ new Set([
|
|
22258
|
+
const SCHEMA_ARRAY_KEYWORDS$1 = /* @__PURE__ */ new Set([
|
|
22259
22259
|
"allOf",
|
|
22260
22260
|
"anyOf",
|
|
22261
22261
|
"oneOf"
|
|
22262
22262
|
]);
|
|
22263
22263
|
/** Keywords whose values map arbitrary names to subschemas. */
|
|
22264
|
-
const SCHEMA_MAP_KEYWORDS = /* @__PURE__ */ new Set([
|
|
22264
|
+
const SCHEMA_MAP_KEYWORDS$1 = /* @__PURE__ */ new Set([
|
|
22265
22265
|
"properties",
|
|
22266
22266
|
"patternProperties",
|
|
22267
22267
|
"$defs",
|
|
@@ -22305,11 +22305,11 @@ function rewrite(schema, depth, budget, isRoot = false) {
|
|
|
22305
22305
|
if ("$recursiveRef" in out || "$recursiveAnchor" in out) throw new Unconvertible();
|
|
22306
22306
|
if ("unevaluatedItems" in out || "prefixItems" in out || "contentSchema" in out) throw new Unconvertible();
|
|
22307
22307
|
if (typeof out.$ref === "string" && /\/(items\/\d+|additionalItems)(\/|$)/.test(out.$ref)) throw new Unconvertible();
|
|
22308
|
-
for (const [key, child] of Object.entries(out)) if (SCHEMA_KEYWORDS.has(key)) out[key] = Array.isArray(child) ? (checkBudget(depth + 1, budget), child.map((item) => rewrite(item, depth + 2, budget))) : rewrite(child, depth + 1, budget);
|
|
22309
|
-
else if (SCHEMA_ARRAY_KEYWORDS.has(key) && Array.isArray(child)) {
|
|
22308
|
+
for (const [key, child] of Object.entries(out)) if (SCHEMA_KEYWORDS$1.has(key)) out[key] = Array.isArray(child) ? (checkBudget(depth + 1, budget), child.map((item) => rewrite(item, depth + 2, budget))) : rewrite(child, depth + 1, budget);
|
|
22309
|
+
else if (SCHEMA_ARRAY_KEYWORDS$1.has(key) && Array.isArray(child)) {
|
|
22310
22310
|
checkBudget(depth + 1, budget);
|
|
22311
22311
|
out[key] = child.map((item) => rewrite(item, depth + 2, budget));
|
|
22312
|
-
} else if (SCHEMA_MAP_KEYWORDS.has(key) && child && typeof child === "object" && !Array.isArray(child)) {
|
|
22312
|
+
} else if (SCHEMA_MAP_KEYWORDS$1.has(key) && child && typeof child === "object" && !Array.isArray(child)) {
|
|
22313
22313
|
checkBudget(depth + 1, budget);
|
|
22314
22314
|
out[key] = Object.fromEntries(Object.entries(child).map(([name, sub]) => [name, rewrite(sub, depth + 2, budget)]));
|
|
22315
22315
|
}
|
|
@@ -22923,6 +22923,326 @@ function getMCPDiscoveryErrorDetails(error) {
|
|
|
22923
22923
|
};
|
|
22924
22924
|
}
|
|
22925
22925
|
//#endregion
|
|
22926
|
+
//#region src/client/input-schema-meta-schema.ts
|
|
22927
|
+
/**
|
|
22928
|
+
* Structural JSON Schema meta-schema, used to check that a server-supplied tool input schema is
|
|
22929
|
+
* shaped like a JSON Schema before it is handed to a model provider.
|
|
22930
|
+
*
|
|
22931
|
+
* Based on https://json-schema.org/draft-07/schema (`$schema`/`$id` dropped so the validator does
|
|
22932
|
+
* not try to resolve them). Draft-07 is used because its meta-schema is a single self-contained
|
|
22933
|
+
* document; the 2020-12 meta-schema is split across vocabulary documents. Changes from upstream:
|
|
22934
|
+
* - `format`, `uniqueItems` and the non-empty `enum` rule are removed, so only wrong value types
|
|
22935
|
+
* and non-schemas in schema positions drop a tool, not regex dialects, non-URI ids or duplicates;
|
|
22936
|
+
* - the block at the end of `properties` adds the 2019-09/2020-12 subschema keywords.
|
|
22937
|
+
* Unknown keywords stay allowed, as in every dialect.
|
|
22938
|
+
*/
|
|
22939
|
+
const INPUT_SCHEMA_META_SCHEMA = {
|
|
22940
|
+
title: "Core schema meta-schema",
|
|
22941
|
+
definitions: {
|
|
22942
|
+
schemaArray: {
|
|
22943
|
+
type: "array",
|
|
22944
|
+
minItems: 1,
|
|
22945
|
+
items: { $ref: "#" }
|
|
22946
|
+
},
|
|
22947
|
+
nonNegativeInteger: {
|
|
22948
|
+
type: "integer",
|
|
22949
|
+
minimum: 0
|
|
22950
|
+
},
|
|
22951
|
+
nonNegativeIntegerDefault0: { allOf: [{ $ref: "#/definitions/nonNegativeInteger" }, { default: 0 }] },
|
|
22952
|
+
simpleTypes: { enum: [
|
|
22953
|
+
"array",
|
|
22954
|
+
"boolean",
|
|
22955
|
+
"integer",
|
|
22956
|
+
"null",
|
|
22957
|
+
"number",
|
|
22958
|
+
"object",
|
|
22959
|
+
"string"
|
|
22960
|
+
] },
|
|
22961
|
+
stringArray: {
|
|
22962
|
+
type: "array",
|
|
22963
|
+
items: { type: "string" },
|
|
22964
|
+
default: []
|
|
22965
|
+
}
|
|
22966
|
+
},
|
|
22967
|
+
type: ["object", "boolean"],
|
|
22968
|
+
properties: {
|
|
22969
|
+
$id: { type: "string" },
|
|
22970
|
+
$schema: { type: "string" },
|
|
22971
|
+
$ref: { type: "string" },
|
|
22972
|
+
$comment: { type: "string" },
|
|
22973
|
+
title: { type: "string" },
|
|
22974
|
+
description: { type: "string" },
|
|
22975
|
+
default: true,
|
|
22976
|
+
readOnly: {
|
|
22977
|
+
type: "boolean",
|
|
22978
|
+
default: false
|
|
22979
|
+
},
|
|
22980
|
+
writeOnly: {
|
|
22981
|
+
type: "boolean",
|
|
22982
|
+
default: false
|
|
22983
|
+
},
|
|
22984
|
+
examples: {
|
|
22985
|
+
type: "array",
|
|
22986
|
+
items: true
|
|
22987
|
+
},
|
|
22988
|
+
multipleOf: {
|
|
22989
|
+
type: "number",
|
|
22990
|
+
exclusiveMinimum: 0
|
|
22991
|
+
},
|
|
22992
|
+
maximum: { type: "number" },
|
|
22993
|
+
exclusiveMaximum: { type: "number" },
|
|
22994
|
+
minimum: { type: "number" },
|
|
22995
|
+
exclusiveMinimum: { type: "number" },
|
|
22996
|
+
maxLength: { $ref: "#/definitions/nonNegativeInteger" },
|
|
22997
|
+
minLength: { $ref: "#/definitions/nonNegativeIntegerDefault0" },
|
|
22998
|
+
pattern: { type: "string" },
|
|
22999
|
+
additionalItems: { $ref: "#" },
|
|
23000
|
+
items: {
|
|
23001
|
+
anyOf: [{ $ref: "#" }, { $ref: "#/definitions/schemaArray" }],
|
|
23002
|
+
default: true
|
|
23003
|
+
},
|
|
23004
|
+
maxItems: { $ref: "#/definitions/nonNegativeInteger" },
|
|
23005
|
+
minItems: { $ref: "#/definitions/nonNegativeIntegerDefault0" },
|
|
23006
|
+
uniqueItems: {
|
|
23007
|
+
type: "boolean",
|
|
23008
|
+
default: false
|
|
23009
|
+
},
|
|
23010
|
+
contains: { $ref: "#" },
|
|
23011
|
+
maxProperties: { $ref: "#/definitions/nonNegativeInteger" },
|
|
23012
|
+
minProperties: { $ref: "#/definitions/nonNegativeIntegerDefault0" },
|
|
23013
|
+
required: { $ref: "#/definitions/stringArray" },
|
|
23014
|
+
additionalProperties: { $ref: "#" },
|
|
23015
|
+
definitions: {
|
|
23016
|
+
type: "object",
|
|
23017
|
+
additionalProperties: { $ref: "#" },
|
|
23018
|
+
default: {}
|
|
23019
|
+
},
|
|
23020
|
+
properties: {
|
|
23021
|
+
type: "object",
|
|
23022
|
+
additionalProperties: { $ref: "#" },
|
|
23023
|
+
default: {}
|
|
23024
|
+
},
|
|
23025
|
+
patternProperties: {
|
|
23026
|
+
type: "object",
|
|
23027
|
+
additionalProperties: { $ref: "#" },
|
|
23028
|
+
default: {}
|
|
23029
|
+
},
|
|
23030
|
+
dependencies: {
|
|
23031
|
+
type: "object",
|
|
23032
|
+
additionalProperties: { anyOf: [{ $ref: "#" }, { $ref: "#/definitions/stringArray" }] }
|
|
23033
|
+
},
|
|
23034
|
+
propertyNames: { $ref: "#" },
|
|
23035
|
+
const: true,
|
|
23036
|
+
enum: {
|
|
23037
|
+
type: "array",
|
|
23038
|
+
items: true
|
|
23039
|
+
},
|
|
23040
|
+
type: { anyOf: [{ $ref: "#/definitions/simpleTypes" }, {
|
|
23041
|
+
type: "array",
|
|
23042
|
+
items: { $ref: "#/definitions/simpleTypes" },
|
|
23043
|
+
minItems: 1
|
|
23044
|
+
}] },
|
|
23045
|
+
format: { type: "string" },
|
|
23046
|
+
contentMediaType: { type: "string" },
|
|
23047
|
+
contentEncoding: { type: "string" },
|
|
23048
|
+
if: { $ref: "#" },
|
|
23049
|
+
then: { $ref: "#" },
|
|
23050
|
+
else: { $ref: "#" },
|
|
23051
|
+
allOf: { $ref: "#/definitions/schemaArray" },
|
|
23052
|
+
anyOf: { $ref: "#/definitions/schemaArray" },
|
|
23053
|
+
oneOf: { $ref: "#/definitions/schemaArray" },
|
|
23054
|
+
not: { $ref: "#" },
|
|
23055
|
+
$defs: {
|
|
23056
|
+
type: "object",
|
|
23057
|
+
additionalProperties: { $ref: "#" },
|
|
23058
|
+
default: {}
|
|
23059
|
+
},
|
|
23060
|
+
prefixItems: { $ref: "#/definitions/schemaArray" },
|
|
23061
|
+
dependentSchemas: {
|
|
23062
|
+
type: "object",
|
|
23063
|
+
additionalProperties: { $ref: "#" }
|
|
23064
|
+
},
|
|
23065
|
+
dependentRequired: {
|
|
23066
|
+
type: "object",
|
|
23067
|
+
additionalProperties: { $ref: "#/definitions/stringArray" }
|
|
23068
|
+
},
|
|
23069
|
+
unevaluatedItems: { $ref: "#" },
|
|
23070
|
+
unevaluatedProperties: { $ref: "#" },
|
|
23071
|
+
contentSchema: { $ref: "#" }
|
|
23072
|
+
},
|
|
23073
|
+
default: true
|
|
23074
|
+
};
|
|
23075
|
+
let inputSchemaMetaValidator;
|
|
23076
|
+
let inputSchemaMetaValidatorLoad;
|
|
23077
|
+
const SCHEMA_TYPES = /* @__PURE__ */ new Set([
|
|
23078
|
+
"array",
|
|
23079
|
+
"boolean",
|
|
23080
|
+
"integer",
|
|
23081
|
+
"null",
|
|
23082
|
+
"number",
|
|
23083
|
+
"object",
|
|
23084
|
+
"string"
|
|
23085
|
+
]);
|
|
23086
|
+
const SCHEMA_MAP_KEYWORDS = [
|
|
23087
|
+
"$defs",
|
|
23088
|
+
"definitions",
|
|
23089
|
+
"properties",
|
|
23090
|
+
"patternProperties",
|
|
23091
|
+
"dependentSchemas",
|
|
23092
|
+
"dependencies"
|
|
23093
|
+
];
|
|
23094
|
+
const SCHEMA_ARRAY_KEYWORDS = [
|
|
23095
|
+
"prefixItems",
|
|
23096
|
+
"allOf",
|
|
23097
|
+
"anyOf",
|
|
23098
|
+
"oneOf"
|
|
23099
|
+
];
|
|
23100
|
+
const SCHEMA_KEYWORDS = [
|
|
23101
|
+
"additionalProperties",
|
|
23102
|
+
"unevaluatedProperties",
|
|
23103
|
+
"additionalItems",
|
|
23104
|
+
"unevaluatedItems",
|
|
23105
|
+
"contains",
|
|
23106
|
+
"propertyNames",
|
|
23107
|
+
"not",
|
|
23108
|
+
"if",
|
|
23109
|
+
"then",
|
|
23110
|
+
"else",
|
|
23111
|
+
"contentSchema"
|
|
23112
|
+
];
|
|
23113
|
+
const isStringArray = (value) => Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
23114
|
+
const isNumber = (value) => typeof value === "number";
|
|
23115
|
+
const isCount = (value) => Number.isInteger(value) && value >= 0;
|
|
23116
|
+
const isString = (value) => typeof value === "string";
|
|
23117
|
+
const isBoolean = (value) => typeof value === "boolean";
|
|
23118
|
+
/** Value types the meta-schema requires for the keywords that do not hold subschemas. */
|
|
23119
|
+
const KEYWORD_VALUE_CHECKS = {
|
|
23120
|
+
multipleOf: [(value) => isNumber(value) && value > 0, "a positive number"],
|
|
23121
|
+
...Object.fromEntries([
|
|
23122
|
+
"maximum",
|
|
23123
|
+
"exclusiveMaximum",
|
|
23124
|
+
"minimum",
|
|
23125
|
+
"exclusiveMinimum"
|
|
23126
|
+
].map((k) => [k, [isNumber, "a number"]])),
|
|
23127
|
+
...Object.fromEntries([
|
|
23128
|
+
"maxLength",
|
|
23129
|
+
"minLength",
|
|
23130
|
+
"maxItems",
|
|
23131
|
+
"minItems",
|
|
23132
|
+
"maxProperties",
|
|
23133
|
+
"minProperties"
|
|
23134
|
+
].map((k) => [k, [isCount, "a non-negative integer"]])),
|
|
23135
|
+
...Object.fromEntries([
|
|
23136
|
+
"$id",
|
|
23137
|
+
"$schema",
|
|
23138
|
+
"$ref",
|
|
23139
|
+
"$comment",
|
|
23140
|
+
"title",
|
|
23141
|
+
"description",
|
|
23142
|
+
"pattern",
|
|
23143
|
+
"format",
|
|
23144
|
+
"contentMediaType",
|
|
23145
|
+
"contentEncoding"
|
|
23146
|
+
].map((k) => [k, [isString, "a string"]])),
|
|
23147
|
+
...Object.fromEntries([
|
|
23148
|
+
"readOnly",
|
|
23149
|
+
"writeOnly",
|
|
23150
|
+
"uniqueItems"
|
|
23151
|
+
].map((k) => [k, [isBoolean, "a boolean"]])),
|
|
23152
|
+
examples: [Array.isArray, "an array"],
|
|
23153
|
+
enum: [Array.isArray, "an array"],
|
|
23154
|
+
required: [isStringArray, "an array of strings"]
|
|
23155
|
+
};
|
|
23156
|
+
/**
|
|
23157
|
+
* Fallback for runtimes where the cf-worker validator cannot be imported. Applies the same rules as
|
|
23158
|
+
* {@link INPUT_SCHEMA_META_SCHEMA}: every subschema is an object or boolean, and every known
|
|
23159
|
+
* keyword has a value of the right type.
|
|
23160
|
+
*/
|
|
23161
|
+
function getStructuralInputSchemaError(schema) {
|
|
23162
|
+
const seen = /* @__PURE__ */ new Set();
|
|
23163
|
+
const stack = [{
|
|
23164
|
+
value: schema,
|
|
23165
|
+
path: "#"
|
|
23166
|
+
}];
|
|
23167
|
+
while (stack.length > 0) {
|
|
23168
|
+
const { value, path } = stack.pop();
|
|
23169
|
+
if (typeof value === "boolean") continue;
|
|
23170
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return `${path}: must be a JSON Schema object or boolean`;
|
|
23171
|
+
if (seen.has(value)) continue;
|
|
23172
|
+
seen.add(value);
|
|
23173
|
+
const record = value;
|
|
23174
|
+
const { type, dependentRequired } = record;
|
|
23175
|
+
const types = Array.isArray(type) ? type : [type];
|
|
23176
|
+
if (type !== void 0 && (types.length === 0 || !types.every((t) => SCHEMA_TYPES.has(t)))) return `${path}/type: must be a JSON Schema type name or a non-empty array of them`;
|
|
23177
|
+
for (const [keyword, [isValid, expected]] of Object.entries(KEYWORD_VALUE_CHECKS)) if (record[keyword] !== void 0 && !isValid(record[keyword])) return `${path}/${keyword}: must be ${expected}`;
|
|
23178
|
+
if (dependentRequired !== void 0 && (!dependentRequired || typeof dependentRequired !== "object" || Array.isArray(dependentRequired) || !Object.values(dependentRequired).every(isStringArray))) return `${path}/dependentRequired: must be an object of string arrays`;
|
|
23179
|
+
for (const keyword of SCHEMA_MAP_KEYWORDS) {
|
|
23180
|
+
const schemas = record[keyword];
|
|
23181
|
+
if (schemas === void 0) continue;
|
|
23182
|
+
if (!schemas || typeof schemas !== "object" || Array.isArray(schemas)) return `${path}/${keyword}: must be an object`;
|
|
23183
|
+
for (const [key, child] of Object.entries(schemas)) {
|
|
23184
|
+
if (keyword === "dependencies" && isStringArray(child)) continue;
|
|
23185
|
+
stack.push({
|
|
23186
|
+
value: child,
|
|
23187
|
+
path: `${path}/${keyword}/${key}`
|
|
23188
|
+
});
|
|
23189
|
+
}
|
|
23190
|
+
}
|
|
23191
|
+
for (const keyword of SCHEMA_ARRAY_KEYWORDS) {
|
|
23192
|
+
const schemas = record[keyword];
|
|
23193
|
+
if (schemas === void 0) continue;
|
|
23194
|
+
if (!Array.isArray(schemas) || schemas.length === 0) return `${path}/${keyword}: must be a non-empty array`;
|
|
23195
|
+
schemas.forEach((child, index) => stack.push({
|
|
23196
|
+
value: child,
|
|
23197
|
+
path: `${path}/${keyword}/${index}`
|
|
23198
|
+
}));
|
|
23199
|
+
}
|
|
23200
|
+
if (Array.isArray(record.items)) {
|
|
23201
|
+
if (record.items.length === 0) return `${path}/items: must be a schema or a non-empty array`;
|
|
23202
|
+
record.items.forEach((child, index) => stack.push({
|
|
23203
|
+
value: child,
|
|
23204
|
+
path: `${path}/items/${index}`
|
|
23205
|
+
}));
|
|
23206
|
+
} else if (record.items !== void 0) stack.push({
|
|
23207
|
+
value: record.items,
|
|
23208
|
+
path: `${path}/items`
|
|
23209
|
+
});
|
|
23210
|
+
for (const keyword of SCHEMA_KEYWORDS) if (record[keyword] !== void 0) stack.push({
|
|
23211
|
+
value: record[keyword],
|
|
23212
|
+
path: `${path}/${keyword}`
|
|
23213
|
+
});
|
|
23214
|
+
}
|
|
23215
|
+
}
|
|
23216
|
+
/**
|
|
23217
|
+
* Loads the SDK's cf-worker validator, which interprets schemas instead of compiling them with
|
|
23218
|
+
* `new Function`, so it also runs on Cloudflare Workers. It is imported lazily because
|
|
23219
|
+
* `@cfworker/json-schema` builds a URL from `self.location` at import time, which throws in some
|
|
23220
|
+
* browser worker locations; importing `@mastra/mcp` must not fail there. Until it has loaded, or
|
|
23221
|
+
* if it cannot load, the structural fallback check is used instead.
|
|
23222
|
+
*/
|
|
23223
|
+
function loadInputSchemaMetaValidator() {
|
|
23224
|
+
inputSchemaMetaValidatorLoad ??= import("@modelcontextprotocol/client/validators/cf-worker").then(({ CfWorkerJsonSchemaValidator }) => {
|
|
23225
|
+
inputSchemaMetaValidator = new CfWorkerJsonSchemaValidator({ draft: "7" }).getValidator(INPUT_SCHEMA_META_SCHEMA);
|
|
23226
|
+
}, () => {});
|
|
23227
|
+
return inputSchemaMetaValidatorLoad;
|
|
23228
|
+
}
|
|
23229
|
+
/**
|
|
23230
|
+
* Checks a server-supplied input schema against {@link INPUT_SCHEMA_META_SCHEMA}, falling back to
|
|
23231
|
+
* a structural check while the validator is not loaded. Callers must rule out oversized schemas
|
|
23232
|
+
* with getJsonSchemaComplexityError first.
|
|
23233
|
+
*/
|
|
23234
|
+
function getInputSchemaError(schema) {
|
|
23235
|
+
if (!schema || typeof schema !== "object" || Array.isArray(schema)) return "#: input schema must be a JSON object";
|
|
23236
|
+
if (!inputSchemaMetaValidator) return getStructuralInputSchemaError(schema);
|
|
23237
|
+
let result;
|
|
23238
|
+
try {
|
|
23239
|
+
result = inputSchemaMetaValidator(schema);
|
|
23240
|
+
} catch {
|
|
23241
|
+
return;
|
|
23242
|
+
}
|
|
23243
|
+
return result.valid ? void 0 : result.errorMessage.split("; ").at(-1);
|
|
23244
|
+
}
|
|
23245
|
+
//#endregion
|
|
22926
23246
|
//#region src/client/url-policy.ts
|
|
22927
23247
|
/**
|
|
22928
23248
|
* Redirect status codes the manual redirect loop follows. Other 3xx statuses
|
|
@@ -23380,6 +23700,7 @@ var InternalMastraMCPClient = class extends _mastra_core_base.MastraBase {
|
|
|
23380
23700
|
*/
|
|
23381
23701
|
constructor({ name, version = "1.0.0", clientInfo, server, timeout = _modelcontextprotocol_client.DEFAULT_REQUEST_TIMEOUT_MSEC }) {
|
|
23382
23702
|
super({ name: "MastraMCPClient" });
|
|
23703
|
+
loadInputSchemaMetaValidator();
|
|
23383
23704
|
this.name = name;
|
|
23384
23705
|
this.timeout = timeout;
|
|
23385
23706
|
this.logHandler = server.logger;
|
|
@@ -24012,14 +24333,7 @@ var InternalMastraMCPClient = class extends _mastra_core_base.MastraBase {
|
|
|
24012
24333
|
return this.jsonSchemaValidator;
|
|
24013
24334
|
}
|
|
24014
24335
|
convertInputSchema(inputSchema) {
|
|
24015
|
-
|
|
24016
|
-
const standardSchema = toStandardSchema$2(schema);
|
|
24017
|
-
const complexityError = getJsonSchemaComplexityError(schema);
|
|
24018
|
-
if (!complexityError) return standardSchema;
|
|
24019
|
-
return { "~standard": {
|
|
24020
|
-
...standardSchema["~standard"],
|
|
24021
|
-
validate: () => ({ issues: [{ message: complexityError }] })
|
|
24022
|
-
} };
|
|
24336
|
+
return toStandardSchema$2(withDefaultDialect("jsonSchema" in inputSchema ? inputSchema.jsonSchema : inputSchema));
|
|
24023
24337
|
}
|
|
24024
24338
|
/**
|
|
24025
24339
|
* Wraps the output schema with a validator that always succeeds. The tool's execute wrapper
|
|
@@ -24101,6 +24415,7 @@ var InternalMastraMCPClient = class extends _mastra_core_base.MastraBase {
|
|
|
24101
24415
|
async tools() {
|
|
24102
24416
|
this.log("debug", `Requesting tools from MCP server`);
|
|
24103
24417
|
const { tools } = await this.client.listTools({ _meta: this.requestMeta() }, { timeout: this.timeout });
|
|
24418
|
+
await loadInputSchemaMetaValidator();
|
|
24104
24419
|
const toolsRes = {};
|
|
24105
24420
|
for (const tool of tools) {
|
|
24106
24421
|
const mastraTool = this.buildToolFromListEntry(tool, {
|
|
@@ -24116,6 +24431,25 @@ var InternalMastraMCPClient = class extends _mastra_core_base.MastraBase {
|
|
|
24116
24431
|
* tools behave identically to discovered ones.
|
|
24117
24432
|
*/
|
|
24118
24433
|
buildToolFromListEntry(tool, serverMeta) {
|
|
24434
|
+
const rawInputSchema = tool.inputSchema;
|
|
24435
|
+
const inputSchema = rawInputSchema && typeof rawInputSchema === "object" && "jsonSchema" in rawInputSchema ? rawInputSchema.jsonSchema : rawInputSchema;
|
|
24436
|
+
const inputSchemaError = getJsonSchemaComplexityError(inputSchema) ?? getInputSchemaError(inputSchema);
|
|
24437
|
+
if (inputSchemaError) {
|
|
24438
|
+
const details = {
|
|
24439
|
+
serverName: this.name,
|
|
24440
|
+
toolName: tool.name,
|
|
24441
|
+
reason: inputSchemaError
|
|
24442
|
+
};
|
|
24443
|
+
this.log("warning", `Skipping MCP tool "${tool.name}" with an invalid input schema: ${inputSchemaError}`, details);
|
|
24444
|
+
if (serverMeta.connectFirst) throw new _mastra_core_error.MastraError({
|
|
24445
|
+
id: "MCP_CLIENT_INVALID_TOOL_INPUT_SCHEMA",
|
|
24446
|
+
domain: _mastra_core_error.ErrorDomain.MCP,
|
|
24447
|
+
category: _mastra_core_error.ErrorCategory.THIRD_PARTY,
|
|
24448
|
+
text: `Invalid input schema for MCP tool "${tool.name}": ${inputSchemaError}`,
|
|
24449
|
+
details
|
|
24450
|
+
});
|
|
24451
|
+
return;
|
|
24452
|
+
}
|
|
24119
24453
|
try {
|
|
24120
24454
|
let requireApproval;
|
|
24121
24455
|
let needsApprovalFn;
|
|
@@ -25929,7 +26263,9 @@ onListChanged: async (serverName, handler) => {
|
|
|
25929
26263
|
*/
|
|
25930
26264
|
async toolFromDefinition({ serverName, definition }) {
|
|
25931
26265
|
this.addToInstanceCache();
|
|
25932
|
-
|
|
26266
|
+
const client = await this.getOrCreateClient(serverName, this.getServerConfig(serverName));
|
|
26267
|
+
await loadInputSchemaMetaValidator();
|
|
26268
|
+
return client.toolFromDefinition({ definition });
|
|
25933
26269
|
}
|
|
25934
26270
|
/**
|
|
25935
26271
|
* Rebuilds an entire cached catalog into a namespaced tool map, without connecting.
|
|
@@ -25955,10 +26291,14 @@ onListChanged: async (serverName, handler) => {
|
|
|
25955
26291
|
this.logger.warn("Skipping cached MCP tool definitions for a server that is no longer configured", { serverName });
|
|
25956
26292
|
continue;
|
|
25957
26293
|
}
|
|
25958
|
-
for (const [toolName, definition] of Object.entries(definitions))
|
|
25959
|
-
serverName
|
|
25960
|
-
|
|
25961
|
-
|
|
26294
|
+
for (const [toolName, definition] of Object.entries(definitions)) try {
|
|
26295
|
+
tools[`${serverName}_${toolName}`] = await this.toolFromDefinition({
|
|
26296
|
+
serverName,
|
|
26297
|
+
definition
|
|
26298
|
+
});
|
|
26299
|
+
} catch (error) {
|
|
26300
|
+
if (!(error instanceof _mastra_core_error.MastraError && error.id === "MCP_CLIENT_INVALID_TOOL_INPUT_SCHEMA")) throw error;
|
|
26301
|
+
}
|
|
25962
26302
|
}
|
|
25963
26303
|
return tools;
|
|
25964
26304
|
}
|