@lovable.dev/mcp-js 0.20.1-rc.0 → 0.21.0-rc.1

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.
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-6DXGZZA4.js";
14
14
  import {
15
15
  version
16
- } from "./chunk-OMEL6F6I.js";
16
+ } from "./chunk-V6LIWJJB.js";
17
17
 
18
18
  // src/core/http.ts
19
19
  var JSON_HEADERS = { "Content-Type": "application/json" };
@@ -325,32 +325,28 @@ function oauthMetadataUrlsForIssuer(issuer) {
325
325
  return [...pathInsertedOAuthMetadataUrls(url, path), `${normalizedIssuer}/.well-known/openid-configuration`];
326
326
  }
327
327
  async function fetchFirstValidOAuthServerMetadata(metadataUrls, expectedIssuer) {
328
- const controller = new AbortController();
329
- const attempts = metadataUrls.map(
330
- (url) => fetchOAuthServerMetadata(url, expectedIssuer, controller.signal).catch((err) => {
331
- log.debug("oauth.discovery.attempt_failed", { url, ...describeError(err) });
332
- throw err instanceof Error ? err : new Error(String(err));
333
- })
334
- );
335
- try {
336
- const metadata = await Promise.any(attempts);
337
- controller.abort();
338
- return metadata;
339
- } catch (aggregate) {
340
- const causes = aggregate instanceof AggregateError ? aggregate.errors : [aggregate];
341
- const unreachable = causes.some((c) => c instanceof MetadataUnreachableError);
342
- const detail = causes.map((c) => c instanceof Error ? c.message : String(c)).join("; ");
343
- log.error("oauth.discovery.exhausted", { expectedIssuer, urlsTried: metadataUrls, errors: detail, unreachable });
344
- const message = `failed to discover OAuth server metadata (${detail})`;
345
- throw unreachable ? new MetadataUnreachableError(message) : new Error(message);
346
- }
347
- }
348
- async function fetchOAuthServerMetadata(url, expectedIssuer, signal) {
328
+ const errors = [];
329
+ for (const url of metadataUrls) {
330
+ try {
331
+ return await fetchOAuthServerMetadata(url, expectedIssuer);
332
+ } catch (err) {
333
+ const error = err instanceof Error ? err : new Error(String(err));
334
+ log.debug("oauth.discovery.attempt_failed", { url, ...describeError(error) });
335
+ errors.push(error);
336
+ }
337
+ }
338
+ const unreachable = errors.some((e) => e instanceof MetadataUnreachableError);
339
+ const detail = errors.map((e) => e.message).join("; ");
340
+ log.error("oauth.discovery.exhausted", { expectedIssuer, urlsTried: metadataUrls, errors: detail, unreachable });
341
+ const message = `failed to discover OAuth server metadata (${detail})`;
342
+ throw unreachable ? new MetadataUnreachableError(message) : new Error(message);
343
+ }
344
+ async function fetchOAuthServerMetadata(url, expectedIssuer) {
349
345
  log.debug("oauth.discovery.fetch", { url });
350
346
  let response;
351
347
  try {
352
348
  response = await fetch(url, {
353
- signal: AbortSignal.any([signal, AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS)]),
349
+ signal: AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS),
354
350
  redirect: "manual"
355
351
  });
356
352
  } catch (err) {
@@ -7,7 +7,7 @@ import {
7
7
  oauthConfigurationErrorResponse,
8
8
  resolveProtectedResource,
9
9
  withCors
10
- } from "./chunk-E7CPOJN6.js";
10
+ } from "./chunk-D32HYMP7.js";
11
11
  import {
12
12
  describeError,
13
13
  log
@@ -7,7 +7,7 @@ import {
7
7
  createRequestAuthorizer,
8
8
  nowMs,
9
9
  withCors
10
- } from "./chunk-E7CPOJN6.js";
10
+ } from "./chunk-D32HYMP7.js";
11
11
  import {
12
12
  describeError,
13
13
  log
@@ -6,7 +6,7 @@ import {
6
6
  headResponse,
7
7
  methodNotAllowed,
8
8
  withCors
9
- } from "./chunk-E7CPOJN6.js";
9
+ } from "./chunk-D32HYMP7.js";
10
10
 
11
11
  // src/protocols/rest/list-tools.ts
12
12
  import { objectFromShape } from "@modelcontextprotocol/sdk/server/zod-compat.js";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.20.1-rc.0";
2
+ var version = "0.21.0-rc.1";
3
3
 
4
4
  export {
5
5
  version
@@ -10,7 +10,7 @@ import {
10
10
  methodNotAllowed,
11
11
  nowMs,
12
12
  withCors
13
- } from "./chunk-E7CPOJN6.js";
13
+ } from "./chunk-D32HYMP7.js";
14
14
 
15
15
  // src/protocols/rest/invoke-tool.ts
16
16
  import { getParseErrorMessage, objectFromShape, safeParseAsync } from "@modelcontextprotocol/sdk/server/zod-compat.js";
@@ -13,7 +13,7 @@ function isFileMissing(err) {
13
13
  }
14
14
 
15
15
  // package.json
16
- var version = "0.20.1-rc.0";
16
+ var version = "0.21.0-rc.1";
17
17
 
18
18
  // src/protocols/rest/list-tools.ts
19
19
  var import_zod_compat = require("@modelcontextprotocol/sdk/server/zod-compat.js");
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  buildMcpListing
4
- } from "../chunk-YAXKWTJK.js";
5
- import "../chunk-E7CPOJN6.js";
4
+ } from "../chunk-MYVH5NU2.js";
5
+ import "../chunk-D32HYMP7.js";
6
6
  import "../chunk-H37EB22A.js";
7
7
  import "../chunk-6DXGZZA4.js";
8
8
  import {
@@ -10,7 +10,7 @@ import {
10
10
  } from "../chunk-Y3ZFPEQH.js";
11
11
  import {
12
12
  version
13
- } from "../chunk-OMEL6F6I.js";
13
+ } from "../chunk-V6LIWJJB.js";
14
14
 
15
15
  // src/manifest/io.ts
16
16
  import { randomUUID } from "crypto";
@@ -189,32 +189,28 @@ function oauthMetadataUrlsForIssuer(issuer) {
189
189
  return [...pathInsertedOAuthMetadataUrls(url, path), `${normalizedIssuer}/.well-known/openid-configuration`];
190
190
  }
191
191
  async function fetchFirstValidOAuthServerMetadata(metadataUrls, expectedIssuer) {
192
- const controller = new AbortController();
193
- const attempts = metadataUrls.map(
194
- (url) => fetchOAuthServerMetadata(url, expectedIssuer, controller.signal).catch((err) => {
195
- log.debug("oauth.discovery.attempt_failed", { url, ...describeError(err) });
196
- throw err instanceof Error ? err : new Error(String(err));
197
- })
198
- );
199
- try {
200
- const metadata = await Promise.any(attempts);
201
- controller.abort();
202
- return metadata;
203
- } catch (aggregate) {
204
- const causes = aggregate instanceof AggregateError ? aggregate.errors : [aggregate];
205
- const unreachable = causes.some((c) => c instanceof MetadataUnreachableError);
206
- const detail = causes.map((c) => c instanceof Error ? c.message : String(c)).join("; ");
207
- log.error("oauth.discovery.exhausted", { expectedIssuer, urlsTried: metadataUrls, errors: detail, unreachable });
208
- const message = `failed to discover OAuth server metadata (${detail})`;
209
- throw unreachable ? new MetadataUnreachableError(message) : new Error(message);
210
- }
211
- }
212
- async function fetchOAuthServerMetadata(url, expectedIssuer, signal) {
192
+ const errors = [];
193
+ for (const url of metadataUrls) {
194
+ try {
195
+ return await fetchOAuthServerMetadata(url, expectedIssuer);
196
+ } catch (err) {
197
+ const error = err instanceof Error ? err : new Error(String(err));
198
+ log.debug("oauth.discovery.attempt_failed", { url, ...describeError(error) });
199
+ errors.push(error);
200
+ }
201
+ }
202
+ const unreachable = errors.some((e) => e instanceof MetadataUnreachableError);
203
+ const detail = errors.map((e) => e.message).join("; ");
204
+ log.error("oauth.discovery.exhausted", { expectedIssuer, urlsTried: metadataUrls, errors: detail, unreachable });
205
+ const message = `failed to discover OAuth server metadata (${detail})`;
206
+ throw unreachable ? new MetadataUnreachableError(message) : new Error(message);
207
+ }
208
+ async function fetchOAuthServerMetadata(url, expectedIssuer) {
213
209
  log.debug("oauth.discovery.fetch", { url });
214
210
  let response;
215
211
  try {
216
212
  response = await fetch(url, {
217
- signal: AbortSignal.any([signal, AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS)]),
213
+ signal: AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS),
218
214
  redirect: "manual"
219
215
  });
220
216
  } catch (err) {
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  createMcpProtocolHandler
3
- } from "../../chunk-ID3YWZBR.js";
3
+ } from "../../chunk-KKAXS2RA.js";
4
4
  import "../../chunk-MA5H6PSF.js";
5
- import "../../chunk-E7CPOJN6.js";
5
+ import "../../chunk-D32HYMP7.js";
6
6
  import "../../chunk-H37EB22A.js";
7
7
  import "../../chunk-6DXGZZA4.js";
8
- import "../../chunk-OMEL6F6I.js";
8
+ import "../../chunk-V6LIWJJB.js";
9
9
  export {
10
10
  createMcpProtocolHandler
11
11
  };
@@ -184,32 +184,28 @@ function oauthMetadataUrlsForIssuer(issuer) {
184
184
  return [...pathInsertedOAuthMetadataUrls(url, path), `${normalizedIssuer}/.well-known/openid-configuration`];
185
185
  }
186
186
  async function fetchFirstValidOAuthServerMetadata(metadataUrls, expectedIssuer) {
187
- const controller = new AbortController();
188
- const attempts = metadataUrls.map(
189
- (url) => fetchOAuthServerMetadata(url, expectedIssuer, controller.signal).catch((err) => {
190
- log.debug("oauth.discovery.attempt_failed", { url, ...describeError(err) });
191
- throw err instanceof Error ? err : new Error(String(err));
192
- })
193
- );
194
- try {
195
- const metadata = await Promise.any(attempts);
196
- controller.abort();
197
- return metadata;
198
- } catch (aggregate) {
199
- const causes = aggregate instanceof AggregateError ? aggregate.errors : [aggregate];
200
- const unreachable = causes.some((c) => c instanceof MetadataUnreachableError);
201
- const detail = causes.map((c) => c instanceof Error ? c.message : String(c)).join("; ");
202
- log.error("oauth.discovery.exhausted", { expectedIssuer, urlsTried: metadataUrls, errors: detail, unreachable });
203
- const message = `failed to discover OAuth server metadata (${detail})`;
204
- throw unreachable ? new MetadataUnreachableError(message) : new Error(message);
187
+ const errors = [];
188
+ for (const url of metadataUrls) {
189
+ try {
190
+ return await fetchOAuthServerMetadata(url, expectedIssuer);
191
+ } catch (err) {
192
+ const error = err instanceof Error ? err : new Error(String(err));
193
+ log.debug("oauth.discovery.attempt_failed", { url, ...describeError(error) });
194
+ errors.push(error);
195
+ }
205
196
  }
197
+ const unreachable = errors.some((e) => e instanceof MetadataUnreachableError);
198
+ const detail = errors.map((e) => e.message).join("; ");
199
+ log.error("oauth.discovery.exhausted", { expectedIssuer, urlsTried: metadataUrls, errors: detail, unreachable });
200
+ const message = `failed to discover OAuth server metadata (${detail})`;
201
+ throw unreachable ? new MetadataUnreachableError(message) : new Error(message);
206
202
  }
207
- async function fetchOAuthServerMetadata(url, expectedIssuer, signal) {
203
+ async function fetchOAuthServerMetadata(url, expectedIssuer) {
208
204
  log.debug("oauth.discovery.fetch", { url });
209
205
  let response;
210
206
  try {
211
207
  response = await fetch(url, {
212
- signal: AbortSignal.any([signal, AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS)]),
208
+ signal: AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS),
213
209
  redirect: "manual"
214
210
  });
215
211
  } catch (err) {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createOAuthProtectedResourceMetadataHandler
3
- } from "../chunk-A2GUTEAK.js";
4
- import "../chunk-E7CPOJN6.js";
3
+ } from "../chunk-KI5LOYRQ.js";
4
+ import "../chunk-D32HYMP7.js";
5
5
  import "../chunk-H37EB22A.js";
6
6
  import "../chunk-6DXGZZA4.js";
7
- import "../chunk-OMEL6F6I.js";
7
+ import "../chunk-V6LIWJJB.js";
8
8
  export {
9
9
  createOAuthProtectedResourceMetadataHandler
10
10
  };
@@ -199,32 +199,28 @@ function oauthMetadataUrlsForIssuer(issuer) {
199
199
  return [...pathInsertedOAuthMetadataUrls(url, path), `${normalizedIssuer}/.well-known/openid-configuration`];
200
200
  }
201
201
  async function fetchFirstValidOAuthServerMetadata(metadataUrls, expectedIssuer) {
202
- const controller = new AbortController();
203
- const attempts = metadataUrls.map(
204
- (url) => fetchOAuthServerMetadata(url, expectedIssuer, controller.signal).catch((err) => {
205
- log.debug("oauth.discovery.attempt_failed", { url, ...describeError(err) });
206
- throw err instanceof Error ? err : new Error(String(err));
207
- })
208
- );
209
- try {
210
- const metadata = await Promise.any(attempts);
211
- controller.abort();
212
- return metadata;
213
- } catch (aggregate) {
214
- const causes = aggregate instanceof AggregateError ? aggregate.errors : [aggregate];
215
- const unreachable = causes.some((c) => c instanceof MetadataUnreachableError);
216
- const detail = causes.map((c) => c instanceof Error ? c.message : String(c)).join("; ");
217
- log.error("oauth.discovery.exhausted", { expectedIssuer, urlsTried: metadataUrls, errors: detail, unreachable });
218
- const message = `failed to discover OAuth server metadata (${detail})`;
219
- throw unreachable ? new MetadataUnreachableError(message) : new Error(message);
220
- }
221
- }
222
- async function fetchOAuthServerMetadata(url, expectedIssuer, signal) {
202
+ const errors = [];
203
+ for (const url of metadataUrls) {
204
+ try {
205
+ return await fetchOAuthServerMetadata(url, expectedIssuer);
206
+ } catch (err) {
207
+ const error = err instanceof Error ? err : new Error(String(err));
208
+ log.debug("oauth.discovery.attempt_failed", { url, ...describeError(error) });
209
+ errors.push(error);
210
+ }
211
+ }
212
+ const unreachable = errors.some((e) => e instanceof MetadataUnreachableError);
213
+ const detail = errors.map((e) => e.message).join("; ");
214
+ log.error("oauth.discovery.exhausted", { expectedIssuer, urlsTried: metadataUrls, errors: detail, unreachable });
215
+ const message = `failed to discover OAuth server metadata (${detail})`;
216
+ throw unreachable ? new MetadataUnreachableError(message) : new Error(message);
217
+ }
218
+ async function fetchOAuthServerMetadata(url, expectedIssuer) {
223
219
  log.debug("oauth.discovery.fetch", { url });
224
220
  let response;
225
221
  try {
226
222
  response = await fetch(url, {
227
- signal: AbortSignal.any([signal, AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS)]),
223
+ signal: AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS),
228
224
  redirect: "manual"
229
225
  });
230
226
  } catch (err) {
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  createInvokeToolHandler
3
- } from "../../chunk-RT2I26ZN.js";
3
+ } from "../../chunk-ZFPENIDM.js";
4
4
  import {
5
5
  createListToolsHandler
6
- } from "../../chunk-YAXKWTJK.js";
6
+ } from "../../chunk-MYVH5NU2.js";
7
7
  import "../../chunk-MA5H6PSF.js";
8
- import "../../chunk-E7CPOJN6.js";
8
+ import "../../chunk-D32HYMP7.js";
9
9
  import "../../chunk-H37EB22A.js";
10
10
  import "../../chunk-6DXGZZA4.js";
11
- import "../../chunk-OMEL6F6I.js";
11
+ import "../../chunk-V6LIWJJB.js";
12
12
  export {
13
13
  createInvokeToolHandler,
14
14
  createListToolsHandler
@@ -174,7 +174,7 @@ function describeError(err) {
174
174
  }
175
175
 
176
176
  // package.json
177
- var version = "0.20.1-rc.0";
177
+ var version = "0.21.0-rc.1";
178
178
 
179
179
  // src/metrics/otlp.ts
180
180
  var SCOPE_NAME = "@lovable.dev/mcp-js";
@@ -481,32 +481,28 @@ function oauthMetadataUrlsForIssuer(issuer) {
481
481
  return [...pathInsertedOAuthMetadataUrls(url, path), `${normalizedIssuer}/.well-known/openid-configuration`];
482
482
  }
483
483
  async function fetchFirstValidOAuthServerMetadata(metadataUrls, expectedIssuer) {
484
- const controller = new AbortController();
485
- const attempts = metadataUrls.map(
486
- (url) => fetchOAuthServerMetadata(url, expectedIssuer, controller.signal).catch((err) => {
487
- log.debug("oauth.discovery.attempt_failed", { url, ...describeError(err) });
488
- throw err instanceof Error ? err : new Error(String(err));
489
- })
490
- );
491
- try {
492
- const metadata = await Promise.any(attempts);
493
- controller.abort();
494
- return metadata;
495
- } catch (aggregate) {
496
- const causes = aggregate instanceof AggregateError ? aggregate.errors : [aggregate];
497
- const unreachable = causes.some((c) => c instanceof MetadataUnreachableError);
498
- const detail = causes.map((c) => c instanceof Error ? c.message : String(c)).join("; ");
499
- log.error("oauth.discovery.exhausted", { expectedIssuer, urlsTried: metadataUrls, errors: detail, unreachable });
500
- const message = `failed to discover OAuth server metadata (${detail})`;
501
- throw unreachable ? new MetadataUnreachableError(message) : new Error(message);
484
+ const errors = [];
485
+ for (const url of metadataUrls) {
486
+ try {
487
+ return await fetchOAuthServerMetadata(url, expectedIssuer);
488
+ } catch (err) {
489
+ const error = err instanceof Error ? err : new Error(String(err));
490
+ log.debug("oauth.discovery.attempt_failed", { url, ...describeError(error) });
491
+ errors.push(error);
492
+ }
502
493
  }
494
+ const unreachable = errors.some((e) => e instanceof MetadataUnreachableError);
495
+ const detail = errors.map((e) => e.message).join("; ");
496
+ log.error("oauth.discovery.exhausted", { expectedIssuer, urlsTried: metadataUrls, errors: detail, unreachable });
497
+ const message = `failed to discover OAuth server metadata (${detail})`;
498
+ throw unreachable ? new MetadataUnreachableError(message) : new Error(message);
503
499
  }
504
- async function fetchOAuthServerMetadata(url, expectedIssuer, signal) {
500
+ async function fetchOAuthServerMetadata(url, expectedIssuer) {
505
501
  log.debug("oauth.discovery.fetch", { url });
506
502
  let response;
507
503
  try {
508
504
  response = await fetch(url, {
509
- signal: AbortSignal.any([signal, AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS)]),
505
+ signal: AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS),
510
506
  redirect: "manual"
511
507
  });
512
508
  } catch (err) {
@@ -3,21 +3,21 @@ import {
3
3
  } from "../../chunk-UQK5UO6C.js";
4
4
  import {
5
5
  createMcpProtocolHandler
6
- } from "../../chunk-ID3YWZBR.js";
6
+ } from "../../chunk-KKAXS2RA.js";
7
7
  import {
8
8
  createOAuthProtectedResourceMetadataHandler
9
- } from "../../chunk-A2GUTEAK.js";
9
+ } from "../../chunk-KI5LOYRQ.js";
10
10
  import {
11
11
  createInvokeToolHandler
12
- } from "../../chunk-RT2I26ZN.js";
12
+ } from "../../chunk-ZFPENIDM.js";
13
13
  import {
14
14
  createListToolsHandler
15
- } from "../../chunk-YAXKWTJK.js";
15
+ } from "../../chunk-MYVH5NU2.js";
16
16
  import "../../chunk-MA5H6PSF.js";
17
17
  import {
18
18
  assertResourcePathShape,
19
19
  createRecorderForRuntime
20
- } from "../../chunk-E7CPOJN6.js";
20
+ } from "../../chunk-D32HYMP7.js";
21
21
  import {
22
22
  trimTrailingSlash
23
23
  } from "../../chunk-H37EB22A.js";
@@ -28,7 +28,7 @@ import {
28
28
  FUNCTIONS_MOUNT_PREFIX,
29
29
  assertFunctionName
30
30
  } from "../../chunk-XQWJN6DC.js";
31
- import "../../chunk-OMEL6F6I.js";
31
+ import "../../chunk-V6LIWJJB.js";
32
32
 
33
33
  // src/stacks/supabase/handler.ts
34
34
  function deriveResourcePath(options) {
@@ -33,7 +33,7 @@ var import_node_fs = require("fs");
33
33
  var import_node_path = require("path");
34
34
 
35
35
  // package.json
36
- var version = "0.20.1-rc.0";
36
+ var version = "0.21.0-rc.1";
37
37
 
38
38
  // src/core/fs-errors.ts
39
39
  function isFileMissing(err) {
@@ -7,7 +7,7 @@ import {
7
7
  } from "../../chunk-XQWJN6DC.js";
8
8
  import {
9
9
  version
10
- } from "../../chunk-OMEL6F6I.js";
10
+ } from "../../chunk-V6LIWJJB.js";
11
11
 
12
12
  // src/stacks/supabase/vite.ts
13
13
  import { resolve as resolve2, sep as sep2 } from "path";
@@ -129,7 +129,7 @@ function describeError(err) {
129
129
  }
130
130
 
131
131
  // package.json
132
- var version = "0.20.1-rc.0";
132
+ var version = "0.21.0-rc.1";
133
133
 
134
134
  // src/metrics/otlp.ts
135
135
  var SCOPE_NAME = "@lovable.dev/mcp-js";
@@ -457,32 +457,28 @@ function oauthMetadataUrlsForIssuer(issuer) {
457
457
  return [...pathInsertedOAuthMetadataUrls(url, path), `${normalizedIssuer}/.well-known/openid-configuration`];
458
458
  }
459
459
  async function fetchFirstValidOAuthServerMetadata(metadataUrls, expectedIssuer) {
460
- const controller = new AbortController();
461
- const attempts = metadataUrls.map(
462
- (url) => fetchOAuthServerMetadata(url, expectedIssuer, controller.signal).catch((err) => {
463
- log.debug("oauth.discovery.attempt_failed", { url, ...describeError(err) });
464
- throw err instanceof Error ? err : new Error(String(err));
465
- })
466
- );
467
- try {
468
- const metadata = await Promise.any(attempts);
469
- controller.abort();
470
- return metadata;
471
- } catch (aggregate) {
472
- const causes = aggregate instanceof AggregateError ? aggregate.errors : [aggregate];
473
- const unreachable = causes.some((c) => c instanceof MetadataUnreachableError);
474
- const detail = causes.map((c) => c instanceof Error ? c.message : String(c)).join("; ");
475
- log.error("oauth.discovery.exhausted", { expectedIssuer, urlsTried: metadataUrls, errors: detail, unreachable });
476
- const message = `failed to discover OAuth server metadata (${detail})`;
477
- throw unreachable ? new MetadataUnreachableError(message) : new Error(message);
460
+ const errors = [];
461
+ for (const url of metadataUrls) {
462
+ try {
463
+ return await fetchOAuthServerMetadata(url, expectedIssuer);
464
+ } catch (err) {
465
+ const error = err instanceof Error ? err : new Error(String(err));
466
+ log.debug("oauth.discovery.attempt_failed", { url, ...describeError(error) });
467
+ errors.push(error);
468
+ }
478
469
  }
470
+ const unreachable = errors.some((e) => e instanceof MetadataUnreachableError);
471
+ const detail = errors.map((e) => e.message).join("; ");
472
+ log.error("oauth.discovery.exhausted", { expectedIssuer, urlsTried: metadataUrls, errors: detail, unreachable });
473
+ const message = `failed to discover OAuth server metadata (${detail})`;
474
+ throw unreachable ? new MetadataUnreachableError(message) : new Error(message);
479
475
  }
480
- async function fetchOAuthServerMetadata(url, expectedIssuer, signal) {
476
+ async function fetchOAuthServerMetadata(url, expectedIssuer) {
481
477
  log.debug("oauth.discovery.fetch", { url });
482
478
  let response;
483
479
  try {
484
480
  response = await fetch(url, {
485
- signal: AbortSignal.any([signal, AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS)]),
481
+ signal: AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS),
486
482
  redirect: "manual"
487
483
  });
488
484
  } catch (err) {
@@ -3,23 +3,23 @@ import {
3
3
  } from "../../chunk-UQK5UO6C.js";
4
4
  import {
5
5
  createMcpProtocolHandler
6
- } from "../../chunk-ID3YWZBR.js";
6
+ } from "../../chunk-KKAXS2RA.js";
7
7
  import {
8
8
  createOAuthProtectedResourceMetadataHandler
9
- } from "../../chunk-A2GUTEAK.js";
9
+ } from "../../chunk-KI5LOYRQ.js";
10
10
  import {
11
11
  createInvokeToolHandler
12
- } from "../../chunk-RT2I26ZN.js";
12
+ } from "../../chunk-ZFPENIDM.js";
13
13
  import {
14
14
  createListToolsHandler
15
- } from "../../chunk-YAXKWTJK.js";
15
+ } from "../../chunk-MYVH5NU2.js";
16
16
  import "../../chunk-MA5H6PSF.js";
17
17
  import {
18
18
  createRecorderForRuntime
19
- } from "../../chunk-E7CPOJN6.js";
19
+ } from "../../chunk-D32HYMP7.js";
20
20
  import "../../chunk-H37EB22A.js";
21
21
  import "../../chunk-6DXGZZA4.js";
22
- import "../../chunk-OMEL6F6I.js";
22
+ import "../../chunk-V6LIWJJB.js";
23
23
 
24
24
  // src/stacks/tanstack/handlers.ts
25
25
  var STACK = "tanstack";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/mcp-js",
3
- "version": "0.20.1-rc.0",
3
+ "version": "0.21.0-rc.1",
4
4
  "description": "Author MCP servers for Lovable apps. Declare tools with defineTool, register them in defineMcp, and a framework adapter (TanStack or Supabase Edge Functions) emits the route(s) at build time.",
5
5
  "type": "module",
6
6
  "repository": {