@ai-sdk/mcp 2.0.84 → 2.0.86

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,21 @@
1
1
  # @ai-sdk/mcp
2
2
 
3
+ ## 2.0.86
4
+
5
+ ### Patch Changes
6
+
7
+ - ade2a33: Improve unsupported-version discovery errors when a server advertises a compatible legacy version. Include the requested and advertised versions and explain how to explicitly select legacy initialization with `protocolVersionDiscovery: false`, while preserving the original error details and avoiding automatic legacy fallback.
8
+ - Updated dependencies [57086ff]
9
+ - Updated dependencies [95348b3]
10
+ - @ai-sdk/provider-utils@5.0.70
11
+
12
+ ## 2.0.85
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [e64ed82]
17
+ - @ai-sdk/provider-utils@5.0.69
18
+
3
19
  ## 2.0.84
4
20
 
5
21
  ### Patch Changes
package/dist/index.js CHANGED
@@ -526,7 +526,7 @@ function createManagedMCPEvents(operations, list) {
526
526
  }
527
527
  //#endregion
528
528
  //#region src/version.ts
529
- const VERSION = "2.0.84";
529
+ const VERSION = "2.0.86";
530
530
  //#endregion
531
531
  //#region src/tool/oauth-types.ts
532
532
  /**
@@ -2489,7 +2489,21 @@ var DefaultMCPClient = class {
2489
2489
  this.applyDiscoverResult(result);
2490
2490
  return true;
2491
2491
  } catch (error) {
2492
- if (MCPClientError.isInstance(error) && error.code != null && MODERN_PROTOCOL_ERROR_CODES.includes(error.code)) throw error;
2492
+ if (MCPClientError.isInstance(error) && error.code != null && MODERN_PROTOCOL_ERROR_CODES.includes(error.code)) {
2493
+ if (error.code === -32022 && error.data != null && typeof error.data === "object" && "supported" in error.data && Array.isArray(error.data.supported) && error.data.supported.every((version) => typeof version === "string")) {
2494
+ const supportedVersions = error.data.supported;
2495
+ if (!supportedVersions.includes(this.protocolVersion) && supportedVersions.some((version) => version <= "2025-11-25" && SUPPORTED_PROTOCOL_VERSIONS.includes(version))) throw new MCPClientError({
2496
+ message: `MCP server rejected protocol version ${this.protocolVersion} during discovery. Server-supported versions: ${supportedVersions.join(", ")}. The client does not automatically switch to legacy initialization after this error. If this is a known legacy server, set protocolVersionDiscovery: false to use initialize.`,
2497
+ code: error.code,
2498
+ data: error.data,
2499
+ statusCode: error.statusCode,
2500
+ url: error.url,
2501
+ responseBody: error.responseBody,
2502
+ cause: error
2503
+ });
2504
+ }
2505
+ throw error;
2506
+ }
2493
2507
  return false;
2494
2508
  }
2495
2509
  }