@ai-sdk/mcp 1.0.77 → 1.0.79
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/CHANGELOG.md +12 -0
- package/dist/index.d.mts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +21 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -8
- package/dist/index.mjs.map +1 -1
- package/dist/mcp-stdio/index.js +5 -1
- package/dist/mcp-stdio/index.js.map +1 -1
- package/dist/mcp-stdio/index.mjs +5 -1
- package/dist/mcp-stdio/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/tool/mcp-client.ts +27 -6
- package/src/tool/oauth.ts +6 -1
- package/src/tool/types.ts +27 -0
package/dist/index.mjs
CHANGED
|
@@ -79,7 +79,11 @@ var ToolSchema = z.object({
|
|
|
79
79
|
outputSchema: z.optional(z.object({}).loose()),
|
|
80
80
|
annotations: z.optional(
|
|
81
81
|
z.object({
|
|
82
|
-
title: z.optional(z.string())
|
|
82
|
+
title: z.optional(z.string()),
|
|
83
|
+
readOnlyHint: z.optional(z.boolean()),
|
|
84
|
+
destructiveHint: z.optional(z.boolean()),
|
|
85
|
+
idempotentHint: z.optional(z.boolean()),
|
|
86
|
+
openWorldHint: z.optional(z.boolean())
|
|
83
87
|
}).loose()
|
|
84
88
|
),
|
|
85
89
|
_meta: ToolMetaSchema
|
|
@@ -806,7 +810,8 @@ function buildDiscoveryUrls(authorizationServerUrl) {
|
|
|
806
810
|
return urlsToTry;
|
|
807
811
|
}
|
|
808
812
|
function assertMetadataIssuerMatches(metadata, expectedIssuer) {
|
|
809
|
-
|
|
813
|
+
const issuerMatches = metadata.issuer === expectedIssuer || expectedIssuer === new URL(expectedIssuer).origin && metadata.issuer === `${expectedIssuer}/`;
|
|
814
|
+
if (!issuerMatches) {
|
|
810
815
|
throw new MCPClientOAuthError({
|
|
811
816
|
message: `OAuth authorization server metadata issuer ${metadata.issuer} does not match expected issuer ${expectedIssuer}`
|
|
812
817
|
});
|
|
@@ -2568,6 +2573,18 @@ var DefaultMCPClient = class {
|
|
|
2568
2573
|
}
|
|
2569
2574
|
const self = this;
|
|
2570
2575
|
const outputSchema = schemas !== "automatic" ? (_a3 = schemas[name3]) == null ? void 0 : _a3.outputSchema : void 0;
|
|
2576
|
+
const metadata = {
|
|
2577
|
+
clientName: this.clientInfo.name,
|
|
2578
|
+
...annotations != null ? {
|
|
2579
|
+
annotations: {
|
|
2580
|
+
...annotations.title != null ? { title: annotations.title } : {},
|
|
2581
|
+
...annotations.readOnlyHint != null ? { readOnlyHint: annotations.readOnlyHint } : {},
|
|
2582
|
+
...annotations.destructiveHint != null ? { destructiveHint: annotations.destructiveHint } : {},
|
|
2583
|
+
...annotations.idempotentHint != null ? { idempotentHint: annotations.idempotentHint } : {},
|
|
2584
|
+
...annotations.openWorldHint != null ? { openWorldHint: annotations.openWorldHint } : {}
|
|
2585
|
+
}
|
|
2586
|
+
} : {}
|
|
2587
|
+
};
|
|
2571
2588
|
const execute = async (args, options) => {
|
|
2572
2589
|
var _a4;
|
|
2573
2590
|
(_a4 = options == null ? void 0 : options.abortSignal) == null ? void 0 : _a4.throwIfAborted();
|
|
@@ -2583,9 +2600,7 @@ var DefaultMCPClient = class {
|
|
|
2583
2600
|
const toolWithExecute = schemas === "automatic" ? dynamicTool({
|
|
2584
2601
|
description,
|
|
2585
2602
|
title: resolvedTitle,
|
|
2586
|
-
metadata
|
|
2587
|
-
clientName: this.clientInfo.name
|
|
2588
|
-
},
|
|
2603
|
+
metadata,
|
|
2589
2604
|
inputSchema: jsonSchema({
|
|
2590
2605
|
...inputSchema,
|
|
2591
2606
|
properties: (_b3 = inputSchema.properties) != null ? _b3 : {},
|
|
@@ -2596,9 +2611,7 @@ var DefaultMCPClient = class {
|
|
|
2596
2611
|
}) : tool({
|
|
2597
2612
|
description,
|
|
2598
2613
|
title: resolvedTitle,
|
|
2599
|
-
metadata
|
|
2600
|
-
clientName: this.clientInfo.name
|
|
2601
|
-
},
|
|
2614
|
+
metadata,
|
|
2602
2615
|
inputSchema: schemas[name3].inputSchema,
|
|
2603
2616
|
...outputSchema != null ? { outputSchema } : {},
|
|
2604
2617
|
execute,
|