@ai-sdk/mcp 1.0.28 → 1.0.29

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
@@ -1042,12 +1042,14 @@ var SseMCPTransport = class {
1042
1042
  constructor({
1043
1043
  url,
1044
1044
  headers,
1045
- authProvider
1045
+ authProvider,
1046
+ redirect = "follow"
1046
1047
  }) {
1047
1048
  this.connected = false;
1048
1049
  this.url = new URL(url);
1049
1050
  this.headers = headers;
1050
1051
  this.authProvider = authProvider;
1052
+ this.redirectMode = redirect;
1051
1053
  }
1052
1054
  async commonHeaders(base) {
1053
1055
  const headers = {
@@ -1081,7 +1083,8 @@ var SseMCPTransport = class {
1081
1083
  });
1082
1084
  const response = await fetch(this.url.href, {
1083
1085
  headers,
1084
- signal: (_a3 = this.abortController) == null ? void 0 : _a3.signal
1086
+ signal: (_a3 = this.abortController) == null ? void 0 : _a3.signal,
1087
+ redirect: this.redirectMode
1085
1088
  });
1086
1089
  if (response.status === 401 && this.authProvider && !triedAuth) {
1087
1090
  this.resourceMetadataUrl = extractResourceMetadataUrl(response);
@@ -1200,7 +1203,8 @@ var SseMCPTransport = class {
1200
1203
  method: "POST",
1201
1204
  headers,
1202
1205
  body: JSON.stringify(message),
1203
- signal: (_a3 = this.abortController) == null ? void 0 : _a3.signal
1206
+ signal: (_a3 = this.abortController) == null ? void 0 : _a3.signal,
1207
+ redirect: this.redirectMode
1204
1208
  };
1205
1209
  const response = await fetch(endpoint, init);
1206
1210
  if (response.status === 401 && this.authProvider && !triedAuth) {
@@ -1248,7 +1252,8 @@ var HttpMCPTransport = class {
1248
1252
  constructor({
1249
1253
  url,
1250
1254
  headers,
1251
- authProvider
1255
+ authProvider,
1256
+ redirect = "follow"
1252
1257
  }) {
1253
1258
  this.inboundReconnectAttempts = 0;
1254
1259
  this.reconnectionOptions = {
@@ -1260,6 +1265,7 @@ var HttpMCPTransport = class {
1260
1265
  this.url = new URL(url);
1261
1266
  this.headers = headers;
1262
1267
  this.authProvider = authProvider;
1268
+ this.redirectMode = redirect;
1263
1269
  }
1264
1270
  async commonHeaders(base) {
1265
1271
  const headers = {
@@ -1300,7 +1306,8 @@ var HttpMCPTransport = class {
1300
1306
  await fetch(this.url, {
1301
1307
  method: "DELETE",
1302
1308
  headers,
1303
- signal: this.abortController.signal
1309
+ signal: this.abortController.signal,
1310
+ redirect: this.redirectMode
1304
1311
  }).catch(() => void 0);
1305
1312
  }
1306
1313
  } catch (e) {
@@ -1320,7 +1327,8 @@ var HttpMCPTransport = class {
1320
1327
  method: "POST",
1321
1328
  headers,
1322
1329
  body: JSON.stringify(message),
1323
- signal: (_a3 = this.abortController) == null ? void 0 : _a3.signal
1330
+ signal: (_a3 = this.abortController) == null ? void 0 : _a3.signal,
1331
+ redirect: this.redirectMode
1324
1332
  };
1325
1333
  const response = await fetch(this.url, init);
1326
1334
  const sessionId = response.headers.get("mcp-session-id");
@@ -1469,7 +1477,8 @@ var HttpMCPTransport = class {
1469
1477
  const response = await fetch(this.url.href, {
1470
1478
  method: "GET",
1471
1479
  headers,
1472
- signal: (_a3 = this.abortController) == null ? void 0 : _a3.signal
1480
+ signal: (_a3 = this.abortController) == null ? void 0 : _a3.signal,
1481
+ redirect: this.redirectMode
1473
1482
  });
1474
1483
  const sessionId = response.headers.get("mcp-session-id");
1475
1484
  if (sessionId) {