@ai-sdk/mcp 1.0.47 → 1.0.48

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/index.mjs CHANGED
@@ -1075,7 +1075,7 @@ async function authInternal(provider, {
1075
1075
  resourceMetadataUrl,
1076
1076
  fetchFn
1077
1077
  }) {
1078
- var _a3;
1078
+ var _a3, _b3;
1079
1079
  let resourceMetadata;
1080
1080
  let authorizationServerUrl;
1081
1081
  assertResourceMetadataUrlSameOrigin(serverUrl, resourceMetadataUrl);
@@ -1098,6 +1098,11 @@ async function authInternal(provider, {
1098
1098
  provider,
1099
1099
  resourceMetadata
1100
1100
  );
1101
+ await ((_a3 = provider.validateAuthorizationServerURL) == null ? void 0 : _a3.call(
1102
+ provider,
1103
+ serverUrl,
1104
+ authorizationServerUrl
1105
+ ));
1101
1106
  const metadata = await discoverAuthorizationServerMetadata(
1102
1107
  authorizationServerUrl,
1103
1108
  {
@@ -1182,7 +1187,7 @@ async function authInternal(provider, {
1182
1187
  currentAuthorizationServerInformation
1183
1188
  });
1184
1189
  } else {
1185
- await ((_a3 = provider.invalidateCredentials) == null ? void 0 : _a3.call(provider, "tokens"));
1190
+ await ((_b3 = provider.invalidateCredentials) == null ? void 0 : _b3.call(provider, "tokens"));
1186
1191
  }
1187
1192
  try {
1188
1193
  if (storedAuthorizationServerInformation) {
@@ -1258,6 +1263,9 @@ var SseMCPTransport = class {
1258
1263
  this.redirectMode = redirect;
1259
1264
  this.fetchFn = fetchFn != null ? fetchFn : globalThis.fetch;
1260
1265
  }
1266
+ setProtocolVersion(version) {
1267
+ this.protocolVersion = version;
1268
+ }
1261
1269
  async commonHeaders(base) {
1262
1270
  var _a3;
1263
1271
  const headers = {
@@ -1477,6 +1485,9 @@ var HttpMCPTransport = class {
1477
1485
  this.redirectMode = redirect;
1478
1486
  this.fetchFn = fetchFn != null ? fetchFn : globalThis.fetch;
1479
1487
  }
1488
+ setProtocolVersion(version) {
1489
+ this.protocolVersion = version;
1490
+ }
1480
1491
  async commonHeaders(base) {
1481
1492
  var _a3;
1482
1493
  const headers = {
@@ -1920,8 +1931,12 @@ var DefaultMCPClient = class {
1920
1931
  }
1921
1932
  this.serverCapabilities = result.capabilities;
1922
1933
  this._serverInfo = result.serverInfo;
1934
+ if (this.transport.setProtocolVersion) {
1935
+ this.transport.setProtocolVersion(result.protocolVersion);
1936
+ } else {
1937
+ this.transport.protocolVersion = result.protocolVersion;
1938
+ }
1923
1939
  this._serverInstructions = result.instructions;
1924
- this.transport.protocolVersion = result.protocolVersion;
1925
1940
  await this.notification({
1926
1941
  method: "notifications/initialized"
1927
1942
  });