@ai-sdk/mcp 1.0.38 → 1.0.40

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @ai-sdk/mcp
2
2
 
3
+ ## 1.0.40
4
+
5
+ ### Patch Changes
6
+
7
+ - 221a984: Add `resource_link` content type to `CallToolResultSchema` and `PromptMessageSchema` per MCP spec. Fixes hard rejection when MCP servers return `resource_link` content parts with zod ≥ 4.4.x.
8
+ - 0084974: feat(mcp): deprecate name and use clientName for MCPClient
9
+
10
+ ## 1.0.39
11
+
12
+ ### Patch Changes
13
+
14
+ - 7beadf0: feat(mcp): propagate the server name through dynamic tool parts
15
+ - Updated dependencies [7beadf0]
16
+ - @ai-sdk/provider-utils@4.0.26
17
+
3
18
  ## 1.0.38
4
19
 
5
20
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -369,6 +369,12 @@ declare const CallToolResultSchema: z.ZodUnion<[z.ZodObject<{
369
369
  mimeType: z.ZodOptional<z.ZodString>;
370
370
  blob: z.ZodBase64;
371
371
  }, z.core.$loose>]>;
372
+ }, z.core.$loose>, z.ZodObject<{
373
+ type: z.ZodLiteral<"resource_link">;
374
+ uri: z.ZodString;
375
+ name: z.ZodString;
376
+ description: z.ZodOptional<z.ZodString>;
377
+ mimeType: z.ZodOptional<z.ZodString>;
372
378
  }, z.core.$loose>]>>;
373
379
  structuredContent: z.ZodOptional<z.ZodUnknown>;
374
380
  isError: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -447,6 +453,12 @@ declare const GetPromptResultSchema: z.ZodObject<{
447
453
  mimeType: z.ZodOptional<z.ZodString>;
448
454
  blob: z.ZodBase64;
449
455
  }, z.core.$loose>]>;
456
+ }, z.core.$loose>, z.ZodObject<{
457
+ type: z.ZodLiteral<"resource_link">;
458
+ uri: z.ZodString;
459
+ name: z.ZodString;
460
+ description: z.ZodOptional<z.ZodString>;
461
+ mimeType: z.ZodOptional<z.ZodString>;
450
462
  }, z.core.$loose>]>;
451
463
  }, z.core.$loose>>;
452
464
  }, z.core.$loose>;
@@ -473,6 +485,12 @@ interface MCPClientConfig {
473
485
  /** Optional callback for uncaught errors */
474
486
  onUncaughtError?: (error: unknown) => void;
475
487
  /** Optional client name, defaults to 'ai-sdk-mcp-client' */
488
+ clientName?: string;
489
+ /**
490
+ * Optional client name, defaults to 'ai-sdk-mcp-client'
491
+ *
492
+ * @deprecated Use `clientName` instead.
493
+ */
476
494
  name?: string;
477
495
  /** Optional client version, defaults to '1.0.0' */
478
496
  version?: string;
package/dist/index.d.ts CHANGED
@@ -369,6 +369,12 @@ declare const CallToolResultSchema: z.ZodUnion<[z.ZodObject<{
369
369
  mimeType: z.ZodOptional<z.ZodString>;
370
370
  blob: z.ZodBase64;
371
371
  }, z.core.$loose>]>;
372
+ }, z.core.$loose>, z.ZodObject<{
373
+ type: z.ZodLiteral<"resource_link">;
374
+ uri: z.ZodString;
375
+ name: z.ZodString;
376
+ description: z.ZodOptional<z.ZodString>;
377
+ mimeType: z.ZodOptional<z.ZodString>;
372
378
  }, z.core.$loose>]>>;
373
379
  structuredContent: z.ZodOptional<z.ZodUnknown>;
374
380
  isError: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
@@ -447,6 +453,12 @@ declare const GetPromptResultSchema: z.ZodObject<{
447
453
  mimeType: z.ZodOptional<z.ZodString>;
448
454
  blob: z.ZodBase64;
449
455
  }, z.core.$loose>]>;
456
+ }, z.core.$loose>, z.ZodObject<{
457
+ type: z.ZodLiteral<"resource_link">;
458
+ uri: z.ZodString;
459
+ name: z.ZodString;
460
+ description: z.ZodOptional<z.ZodString>;
461
+ mimeType: z.ZodOptional<z.ZodString>;
450
462
  }, z.core.$loose>]>;
451
463
  }, z.core.$loose>>;
452
464
  }, z.core.$loose>;
@@ -473,6 +485,12 @@ interface MCPClientConfig {
473
485
  /** Optional callback for uncaught errors */
474
486
  onUncaughtError?: (error: unknown) => void;
475
487
  /** Optional client name, defaults to 'ai-sdk-mcp-client' */
488
+ clientName?: string;
489
+ /**
490
+ * Optional client name, defaults to 'ai-sdk-mcp-client'
491
+ *
492
+ * @deprecated Use `clientName` instead.
493
+ */
476
494
  name?: string;
477
495
  /** Optional client version, defaults to '1.0.0' */
478
496
  version?: string;
package/dist/index.js CHANGED
@@ -205,9 +205,21 @@ var EmbeddedResourceSchema = import_v4.z.object({
205
205
  type: import_v4.z.literal("resource"),
206
206
  resource: import_v4.z.union([TextResourceContentsSchema, BlobResourceContentsSchema])
207
207
  }).loose();
208
+ var ResourceLinkContentSchema = import_v4.z.object({
209
+ type: import_v4.z.literal("resource_link"),
210
+ uri: import_v4.z.string(),
211
+ name: import_v4.z.string(),
212
+ description: import_v4.z.optional(import_v4.z.string()),
213
+ mimeType: import_v4.z.optional(import_v4.z.string())
214
+ }).loose();
208
215
  var CallToolResultSchema = ResultSchema.extend({
209
216
  content: import_v4.z.array(
210
- import_v4.z.union([TextContentSchema, ImageContentSchema, EmbeddedResourceSchema])
217
+ import_v4.z.union([
218
+ TextContentSchema,
219
+ ImageContentSchema,
220
+ EmbeddedResourceSchema,
221
+ ResourceLinkContentSchema
222
+ ])
211
223
  ),
212
224
  /**
213
225
  * @see https://modelcontextprotocol.io/specification/2025-06-18/server/tools#structured-content
@@ -253,7 +265,8 @@ var PromptMessageSchema = import_v4.z.object({
253
265
  content: import_v4.z.union([
254
266
  TextContentSchema,
255
267
  ImageContentSchema,
256
- EmbeddedResourceSchema
268
+ EmbeddedResourceSchema,
269
+ ResourceLinkContentSchema
257
270
  ])
258
271
  }).loose();
259
272
  var GetPromptResultSchema = ResultSchema.extend({
@@ -1665,7 +1678,8 @@ async function createMCPClient(config) {
1665
1678
  var DefaultMCPClient = class {
1666
1679
  constructor({
1667
1680
  transport: transportConfig,
1668
- name: name3 = "ai-sdk-mcp-client",
1681
+ name: name3,
1682
+ clientName = name3 != null ? name3 : "ai-sdk-mcp-client",
1669
1683
  version = CLIENT_VERSION,
1670
1684
  onUncaughtError,
1671
1685
  capabilities
@@ -1700,7 +1714,7 @@ var DefaultMCPClient = class {
1700
1714
  this.onResponse(message);
1701
1715
  };
1702
1716
  this.clientInfo = {
1703
- name: name3,
1717
+ name: clientName,
1704
1718
  version
1705
1719
  };
1706
1720
  }
@@ -1990,6 +2004,9 @@ var DefaultMCPClient = class {
1990
2004
  const toolWithExecute = schemas === "automatic" ? (0, import_provider_utils5.dynamicTool)({
1991
2005
  description,
1992
2006
  title: resolvedTitle,
2007
+ providerMetadata: {
2008
+ mcp: { clientName: this.clientInfo.name }
2009
+ },
1993
2010
  inputSchema: (0, import_provider_utils5.jsonSchema)({
1994
2011
  ...inputSchema,
1995
2012
  properties: (_b3 = inputSchema.properties) != null ? _b3 : {},
@@ -2000,6 +2017,9 @@ var DefaultMCPClient = class {
2000
2017
  }) : (0, import_provider_utils5.tool)({
2001
2018
  description,
2002
2019
  title: resolvedTitle,
2020
+ providerMetadata: {
2021
+ mcp: { clientName: this.clientInfo.name }
2022
+ },
2003
2023
  inputSchema: schemas[name3].inputSchema,
2004
2024
  ...outputSchema != null ? { outputSchema } : {},
2005
2025
  execute,