@lovable.dev/mcp-js 0.23.0 → 0.25.0

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.
Files changed (55) hide show
  1. package/dist/{authorize-CumVyk7p.d.cts → authorize-D3zzoTAG.d.cts} +1 -1
  2. package/dist/{authorize-D6p4-9_D.d.ts → authorize-Y6Jm8GhR.d.ts} +1 -1
  3. package/dist/{base-DCe0kP79.d.cts → base-D-dYxK8t.d.cts} +1 -1
  4. package/dist/{base-DCe0kP79.d.ts → base-D-dYxK8t.d.ts} +1 -1
  5. package/dist/cli/extract-manifest.cjs +2 -2
  6. package/dist/cli/extract-manifest.js +2 -2
  7. package/dist/{cors-BXcpNLm9.js → cors-1Iz86PSf.js} +89 -16
  8. package/dist/{cors-CDnoIzo6.cjs → cors-DW1p9Uzw.cjs} +89 -16
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.d.cts +1 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/{io-DPYvBqET.d.cts → io-BlJ298VF.d.cts} +1 -1
  14. package/dist/{io-CfSPxeBN.d.ts → io-CSsqm26s.d.ts} +1 -1
  15. package/dist/{list-tools-DChR_9Q2.cjs → list-tools-DBidJV3L.cjs} +1 -1
  16. package/dist/{list-tools-bh6-eqZM.d.ts → list-tools-DKz6nJQ6.d.ts} +3 -3
  17. package/dist/{list-tools-ChLj1G6z.js → list-tools-DjzEigXr.js} +1 -1
  18. package/dist/{list-tools-B4TTPEl1.d.cts → list-tools-Dk-QKfqy.d.cts} +3 -3
  19. package/dist/{logger-2OXtfiIW.js → logger-3-kwsF-5.js} +4 -3
  20. package/dist/{logger-BqPOa_E1.cjs → logger-BSKbuM66.cjs} +9 -2
  21. package/dist/{mcp-BiyuOOzg.js → mcp-CoVt8EO9.js} +2 -2
  22. package/dist/{mcp-C_SCcw5F.cjs → mcp-DSo7xlpz.cjs} +2 -2
  23. package/dist/{package-T7npsn7f.js → package-CUrmd7C5.js} +1 -1
  24. package/dist/{package-DlVwsYdc.cjs → package-Wvf1u2OZ.cjs} +1 -1
  25. package/dist/protocols/mcp/index.cjs +1 -1
  26. package/dist/protocols/mcp/index.d.cts +3 -3
  27. package/dist/protocols/mcp/index.d.ts +3 -3
  28. package/dist/protocols/mcp/index.js +1 -1
  29. package/dist/protocols/oauth-metadata.cjs +2 -2
  30. package/dist/protocols/oauth-metadata.d.cts +2 -2
  31. package/dist/protocols/oauth-metadata.d.ts +2 -2
  32. package/dist/protocols/oauth-metadata.js +2 -2
  33. package/dist/protocols/rest/index.cjs +2 -2
  34. package/dist/protocols/rest/index.d.cts +4 -4
  35. package/dist/protocols/rest/index.d.ts +4 -4
  36. package/dist/protocols/rest/index.js +2 -2
  37. package/dist/{rest-DSfFaL-p.cjs → rest-CvdOnTsb.cjs} +2 -2
  38. package/dist/{rest-DdHrbXrU.js → rest-DdQMWvF4.js} +2 -2
  39. package/dist/stacks/supabase/index.cjs +5 -5
  40. package/dist/stacks/supabase/index.d.cts +1 -1
  41. package/dist/stacks/supabase/index.d.ts +1 -1
  42. package/dist/stacks/supabase/index.js +5 -5
  43. package/dist/stacks/supabase/vite.cjs +1 -1
  44. package/dist/stacks/supabase/vite.d.cts +1 -1
  45. package/dist/stacks/supabase/vite.d.ts +1 -1
  46. package/dist/stacks/supabase/vite.js +1 -1
  47. package/dist/stacks/tanstack/index.cjs +4 -4
  48. package/dist/stacks/tanstack/index.d.cts +2 -2
  49. package/dist/stacks/tanstack/index.d.ts +2 -2
  50. package/dist/stacks/tanstack/index.js +4 -4
  51. package/dist/stacks/tanstack/vite.d.cts +1 -1
  52. package/dist/stacks/tanstack/vite.d.ts +1 -1
  53. package/dist/{types-BYdYYTjk.d.cts → types-C0Wgm9zp.d.cts} +1 -1
  54. package/dist/{types-BYdYYTjk.d.ts → types-C0Wgm9zp.d.ts} +1 -1
  55. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import "./types-BYdYYTjk.cjs";
1
+ import "./types-C0Wgm9zp.cjs";
2
2
  //#region src/auth/authorize.d.ts
3
3
  interface McpRuntimeOptions {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import "./types-BYdYYTjk.js";
1
+ import "./types-C0Wgm9zp.js";
2
2
  //#region src/auth/authorize.d.ts
3
3
  interface McpRuntimeOptions {
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  //#region src/metrics/impl/base.d.ts
2
- type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "auth_config_error";
2
+ type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "auth_discovery_config_error" | "auth_discovery_unreachable" | "auth_jwks_config_error" | "auth_jwks_unreachable";
3
3
  /** One recorded MCP call. Carries no arguments or response payloads — only the
4
4
  * tool name, the JSON-RPC method, the result class, timing, and byte sizes.
5
5
  * `errorText` is the sole exception: it is logged locally for debugging and
@@ -1,5 +1,5 @@
1
1
  //#region src/metrics/impl/base.d.ts
2
- type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "auth_config_error";
2
+ type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "auth_discovery_config_error" | "auth_discovery_unreachable" | "auth_jwks_config_error" | "auth_jwks_unreachable";
3
3
  /** One recorded MCP call. Carries no arguments or response payloads — only the
4
4
  * tool name, the JSON-RPC method, the result class, timing, and byte sizes.
5
5
  * `errorText` is the sole exception: it is logged locally for debugging and
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- const require_package = require("../package-DlVwsYdc.cjs");
3
- const require_list_tools = require("../list-tools-DChR_9Q2.cjs");
2
+ const require_package = require("../package-Wvf1u2OZ.cjs");
3
+ const require_list_tools = require("../list-tools-DBidJV3L.cjs");
4
4
  const require_fs_errors = require("../fs-errors-CWNzOV75.cjs");
5
5
  let node_fs = require("node:fs");
6
6
  let node_path = require("node:path");
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as version } from "../package-T7npsn7f.js";
3
- import { t as buildMcpListing } from "../list-tools-ChLj1G6z.js";
2
+ import { t as version } from "../package-CUrmd7C5.js";
3
+ import { t as buildMcpListing } from "../list-tools-DjzEigXr.js";
4
4
  import { t as isFileMissing } from "../fs-errors-PA2t1TIp.js";
5
5
  import { lstatSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
6
6
  import { dirname, resolve } from "node:path";
@@ -1,5 +1,5 @@
1
- import { c as DEFAULT_METRICS_ENDPOINT, i as log, l as resolveMetricsConfig, n as applyLogLevelFromEnv, o as parseSafeUrl, r as describeError, s as trimTrailingSlash, t as LOG_LEVEL_ENV_VAR } from "./logger-2OXtfiIW.js";
2
- import { t as version } from "./package-T7npsn7f.js";
1
+ import { i as log, n as applyLogLevelFromEnv, o as parseSafeUrl, r as describeError, s as trimTrailingSlash, t as LOG_LEVEL_ENV_VAR, u as resolveMetricsConfig } from "./logger-3-kwsF-5.js";
2
+ import { t as version } from "./package-CUrmd7C5.js";
3
3
  import "./metadata-path-CAkNcfyY.js";
4
4
  import { createLocalJWKSet, decodeProtectedHeader, jwtVerify } from "jose";
5
5
  //#region src/core/http.ts
@@ -133,7 +133,7 @@ var BaseMetricRecorder = class {
133
133
  this.server = server;
134
134
  this.deps = deps;
135
135
  this.doFetch = deps.fetch ?? (typeof globalThis.fetch === "function" ? globalThis.fetch.bind(globalThis) : void 0);
136
- this.usesLovableEndpoint = config.endpoint === DEFAULT_METRICS_ENDPOINT;
136
+ this.usesLovableEndpoint = config.endpoint === "https://api.lovable.dev/internal/v1/app-mcp-usage" || config.endpoint === "https://api.lovable.dev/v1/app-mcp-usage";
137
137
  const headers = {};
138
138
  if (!this.usesLovableEndpoint) {
139
139
  for (const [key, value] of Object.entries(config.headers)) if (key.toLowerCase() !== "content-type") headers[key] = value;
@@ -315,11 +315,28 @@ function cachedPromise(load, label) {
315
315
  //#endregion
316
316
  //#region src/auth/discovery.ts
317
317
  var OAuthConfigurationError = class extends Error {
318
- constructor(message) {
318
+ stage;
319
+ constructor(message, stage) {
319
320
  super(message);
321
+ this.stage = stage;
320
322
  this.name = "OAuthConfigurationError";
321
323
  }
322
324
  };
325
+ /** The AS never answered at the network layer — an upstream outage, not a misconfiguration. */
326
+ var OAuthUpstreamUnreachableError = class extends Error {
327
+ stage;
328
+ constructor(message, stage) {
329
+ super(message);
330
+ this.stage = stage;
331
+ this.name = "OAuthUpstreamUnreachableError";
332
+ }
333
+ };
334
+ var MetadataUnreachableError = class extends Error {
335
+ constructor(message) {
336
+ super(message);
337
+ this.name = "MetadataUnreachableError";
338
+ }
339
+ };
323
340
  const METADATA_FETCH_TIMEOUT_MS = 5e3;
324
341
  function issuerPath(url) {
325
342
  const path = trimTrailingSlash(url.pathname);
@@ -346,25 +363,35 @@ async function fetchFirstValidOAuthServerMetadata(metadataUrls, expectedIssuer)
346
363
  for (const url of metadataUrls) try {
347
364
  return await fetchOAuthServerMetadata(url, expectedIssuer);
348
365
  } catch (err) {
366
+ const error = err instanceof Error ? err : new Error(String(err));
349
367
  log.debug("oauth.discovery.attempt_failed", {
350
368
  url,
351
- ...describeError(err)
369
+ ...describeError(error)
352
370
  });
353
- errors.push(`${url}: ${err instanceof Error ? err.message : String(err)}`);
371
+ errors.push(error);
354
372
  }
373
+ const unreachable = errors.some((e) => e instanceof MetadataUnreachableError);
374
+ const detail = errors.map((e) => e.message).join("; ");
355
375
  log.error("oauth.discovery.exhausted", {
356
376
  expectedIssuer,
357
377
  urlsTried: metadataUrls,
358
- errors
378
+ errors: detail,
379
+ unreachable
359
380
  });
360
- throw new Error(`failed to discover OAuth server metadata (${errors.join("; ")})`);
381
+ const message = `failed to discover OAuth server metadata (${detail})`;
382
+ throw unreachable ? new MetadataUnreachableError(message) : new Error(message);
361
383
  }
362
384
  async function fetchOAuthServerMetadata(url, expectedIssuer) {
363
385
  log.debug("oauth.discovery.fetch", { url });
364
- const response = await fetch(url, {
365
- signal: AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS),
366
- redirect: "manual"
367
- });
386
+ let response;
387
+ try {
388
+ response = await fetch(url, {
389
+ signal: AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS),
390
+ redirect: "manual"
391
+ });
392
+ } catch (err) {
393
+ throw new MetadataUnreachableError(err instanceof Error ? err.message : String(err));
394
+ }
368
395
  if (!response.ok) throw new Error(String(response.status));
369
396
  const json = await response.json();
370
397
  if (typeof json.issuer !== "string") throw new Error("missing issuer");
@@ -388,12 +415,21 @@ async function fetchIssuerOAuthServerMetadata(issuer) {
388
415
  try {
389
416
  return await fetchFirstValidOAuthServerMetadata(oauthMetadataUrlsForIssuer(issuer), issuer);
390
417
  } catch (err) {
418
+ const message = `OAuth issuer discovery failed: ${err instanceof Error ? err.message : String(err)}`;
419
+ if (err instanceof MetadataUnreachableError) {
420
+ log.error("oauth.discovery.unreachable", {
421
+ issuer,
422
+ ...describeError(err),
423
+ outcome: "503 authorization server unreachable"
424
+ });
425
+ throw new OAuthUpstreamUnreachableError(message, "discovery");
426
+ }
391
427
  log.error("oauth.discovery.config_error", {
392
428
  issuer,
393
429
  ...describeError(err),
394
430
  outcome: "500 oauth configuration error"
395
431
  });
396
- throw new OAuthConfigurationError(`OAuth issuer discovery failed: ${err instanceof Error ? err.message : String(err)}`);
432
+ throw new OAuthConfigurationError(message, "discovery");
397
433
  }
398
434
  }
399
435
  /** Metadata and token verification share issuer/JWKS discovery, but transient failures must not poison the runtime. */
@@ -507,11 +543,20 @@ function tokenHeaderFields(token) {
507
543
  }
508
544
  }
509
545
  async function fetchVerificationKeySet(jwksUri) {
546
+ let response;
510
547
  try {
511
- const response = await fetch(jwksUri, {
548
+ response = await fetch(jwksUri, {
512
549
  signal: AbortSignal.timeout(JWKS_FETCH_TIMEOUT_MS),
513
550
  redirect: "manual"
514
551
  });
552
+ } catch (err) {
553
+ log.error("oauth.jwks.unreachable", {
554
+ ...describeError(err),
555
+ outcome: "503 authorization server unreachable"
556
+ });
557
+ throw new OAuthUpstreamUnreachableError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`, "jwks");
558
+ }
559
+ try {
515
560
  if (!response.ok) throw new Error(`JWKS endpoint returned ${response.status}`);
516
561
  return createLocalJWKSet(await response.json());
517
562
  } catch (err) {
@@ -519,7 +564,7 @@ async function fetchVerificationKeySet(jwksUri) {
519
564
  ...describeError(err),
520
565
  outcome: "500 oauth configuration error"
521
566
  });
522
- throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`);
567
+ throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`, "jwks");
523
568
  }
524
569
  }
525
570
  function assertAccessTokenTyp(token, allowed) {
@@ -695,6 +740,16 @@ function oauthConfigurationErrorResponse() {
695
740
  }
696
741
  });
697
742
  }
743
+ function oauthUpstreamUnreachableResponse() {
744
+ return new Response(JSON.stringify({ error: "authorization server unreachable" }), {
745
+ status: 503,
746
+ headers: {
747
+ ...JSON_HEADERS,
748
+ "Cache-Control": "no-store",
749
+ "Retry-After": "30"
750
+ }
751
+ });
752
+ }
698
753
  function parseBearerToken(request) {
699
754
  const header = request.headers.get("Authorization");
700
755
  if (!header) return void 0;
@@ -768,15 +823,33 @@ function createRequestAuthorizer(mcp, options = {}) {
768
823
  auth
769
824
  };
770
825
  } catch (err) {
826
+ if (err instanceof OAuthUpstreamUnreachableError) {
827
+ log.error("auth.upstream_unreachable", {
828
+ ...describeError(err),
829
+ stage: err.stage,
830
+ outcome: "503"
831
+ });
832
+ await recorder?.emit({
833
+ tool: null,
834
+ method: "authorize",
835
+ outcome: err.stage === "jwks" ? "auth_jwks_unreachable" : "auth_discovery_unreachable",
836
+ durationMs: nowMs() - startedAt
837
+ });
838
+ return {
839
+ ok: false,
840
+ response: oauthUpstreamUnreachableResponse()
841
+ };
842
+ }
771
843
  if (err instanceof OAuthConfigurationError) {
772
844
  log.error("auth.config_error", {
773
845
  ...describeError(err),
846
+ stage: err.stage,
774
847
  outcome: "500"
775
848
  });
776
849
  await recorder?.emit({
777
850
  tool: null,
778
851
  method: "authorize",
779
- outcome: "auth_config_error",
852
+ outcome: err.stage === "jwks" ? "auth_jwks_config_error" : "auth_discovery_config_error",
780
853
  durationMs: nowMs() - startedAt
781
854
  });
782
855
  return {
@@ -1,5 +1,5 @@
1
- const require_logger = require("./logger-BqPOa_E1.cjs");
2
- const require_package = require("./package-DlVwsYdc.cjs");
1
+ const require_logger = require("./logger-BSKbuM66.cjs");
2
+ const require_package = require("./package-Wvf1u2OZ.cjs");
3
3
  require("./metadata-path-zd7NSNoa.cjs");
4
4
  let jose = require("jose");
5
5
  //#region src/core/http.ts
@@ -133,7 +133,7 @@ var BaseMetricRecorder = class {
133
133
  this.server = server;
134
134
  this.deps = deps;
135
135
  this.doFetch = deps.fetch ?? (typeof globalThis.fetch === "function" ? globalThis.fetch.bind(globalThis) : void 0);
136
- this.usesLovableEndpoint = config.endpoint === require_logger.DEFAULT_METRICS_ENDPOINT;
136
+ this.usesLovableEndpoint = config.endpoint === "https://api.lovable.dev/internal/v1/app-mcp-usage" || config.endpoint === "https://api.lovable.dev/v1/app-mcp-usage";
137
137
  const headers = {};
138
138
  if (!this.usesLovableEndpoint) {
139
139
  for (const [key, value] of Object.entries(config.headers)) if (key.toLowerCase() !== "content-type") headers[key] = value;
@@ -315,11 +315,28 @@ function cachedPromise(load, label) {
315
315
  //#endregion
316
316
  //#region src/auth/discovery.ts
317
317
  var OAuthConfigurationError = class extends Error {
318
- constructor(message) {
318
+ stage;
319
+ constructor(message, stage) {
319
320
  super(message);
321
+ this.stage = stage;
320
322
  this.name = "OAuthConfigurationError";
321
323
  }
322
324
  };
325
+ /** The AS never answered at the network layer — an upstream outage, not a misconfiguration. */
326
+ var OAuthUpstreamUnreachableError = class extends Error {
327
+ stage;
328
+ constructor(message, stage) {
329
+ super(message);
330
+ this.stage = stage;
331
+ this.name = "OAuthUpstreamUnreachableError";
332
+ }
333
+ };
334
+ var MetadataUnreachableError = class extends Error {
335
+ constructor(message) {
336
+ super(message);
337
+ this.name = "MetadataUnreachableError";
338
+ }
339
+ };
323
340
  const METADATA_FETCH_TIMEOUT_MS = 5e3;
324
341
  function issuerPath(url) {
325
342
  const path = require_logger.trimTrailingSlash(url.pathname);
@@ -346,25 +363,35 @@ async function fetchFirstValidOAuthServerMetadata(metadataUrls, expectedIssuer)
346
363
  for (const url of metadataUrls) try {
347
364
  return await fetchOAuthServerMetadata(url, expectedIssuer);
348
365
  } catch (err) {
366
+ const error = err instanceof Error ? err : new Error(String(err));
349
367
  require_logger.log.debug("oauth.discovery.attempt_failed", {
350
368
  url,
351
- ...require_logger.describeError(err)
369
+ ...require_logger.describeError(error)
352
370
  });
353
- errors.push(`${url}: ${err instanceof Error ? err.message : String(err)}`);
371
+ errors.push(error);
354
372
  }
373
+ const unreachable = errors.some((e) => e instanceof MetadataUnreachableError);
374
+ const detail = errors.map((e) => e.message).join("; ");
355
375
  require_logger.log.error("oauth.discovery.exhausted", {
356
376
  expectedIssuer,
357
377
  urlsTried: metadataUrls,
358
- errors
378
+ errors: detail,
379
+ unreachable
359
380
  });
360
- throw new Error(`failed to discover OAuth server metadata (${errors.join("; ")})`);
381
+ const message = `failed to discover OAuth server metadata (${detail})`;
382
+ throw unreachable ? new MetadataUnreachableError(message) : new Error(message);
361
383
  }
362
384
  async function fetchOAuthServerMetadata(url, expectedIssuer) {
363
385
  require_logger.log.debug("oauth.discovery.fetch", { url });
364
- const response = await fetch(url, {
365
- signal: AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS),
366
- redirect: "manual"
367
- });
386
+ let response;
387
+ try {
388
+ response = await fetch(url, {
389
+ signal: AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS),
390
+ redirect: "manual"
391
+ });
392
+ } catch (err) {
393
+ throw new MetadataUnreachableError(err instanceof Error ? err.message : String(err));
394
+ }
368
395
  if (!response.ok) throw new Error(String(response.status));
369
396
  const json = await response.json();
370
397
  if (typeof json.issuer !== "string") throw new Error("missing issuer");
@@ -388,12 +415,21 @@ async function fetchIssuerOAuthServerMetadata(issuer) {
388
415
  try {
389
416
  return await fetchFirstValidOAuthServerMetadata(oauthMetadataUrlsForIssuer(issuer), issuer);
390
417
  } catch (err) {
418
+ const message = `OAuth issuer discovery failed: ${err instanceof Error ? err.message : String(err)}`;
419
+ if (err instanceof MetadataUnreachableError) {
420
+ require_logger.log.error("oauth.discovery.unreachable", {
421
+ issuer,
422
+ ...require_logger.describeError(err),
423
+ outcome: "503 authorization server unreachable"
424
+ });
425
+ throw new OAuthUpstreamUnreachableError(message, "discovery");
426
+ }
391
427
  require_logger.log.error("oauth.discovery.config_error", {
392
428
  issuer,
393
429
  ...require_logger.describeError(err),
394
430
  outcome: "500 oauth configuration error"
395
431
  });
396
- throw new OAuthConfigurationError(`OAuth issuer discovery failed: ${err instanceof Error ? err.message : String(err)}`);
432
+ throw new OAuthConfigurationError(message, "discovery");
397
433
  }
398
434
  }
399
435
  /** Metadata and token verification share issuer/JWKS discovery, but transient failures must not poison the runtime. */
@@ -507,11 +543,20 @@ function tokenHeaderFields(token) {
507
543
  }
508
544
  }
509
545
  async function fetchVerificationKeySet(jwksUri) {
546
+ let response;
510
547
  try {
511
- const response = await fetch(jwksUri, {
548
+ response = await fetch(jwksUri, {
512
549
  signal: AbortSignal.timeout(JWKS_FETCH_TIMEOUT_MS),
513
550
  redirect: "manual"
514
551
  });
552
+ } catch (err) {
553
+ require_logger.log.error("oauth.jwks.unreachable", {
554
+ ...require_logger.describeError(err),
555
+ outcome: "503 authorization server unreachable"
556
+ });
557
+ throw new OAuthUpstreamUnreachableError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`, "jwks");
558
+ }
559
+ try {
515
560
  if (!response.ok) throw new Error(`JWKS endpoint returned ${response.status}`);
516
561
  return (0, jose.createLocalJWKSet)(await response.json());
517
562
  } catch (err) {
@@ -519,7 +564,7 @@ async function fetchVerificationKeySet(jwksUri) {
519
564
  ...require_logger.describeError(err),
520
565
  outcome: "500 oauth configuration error"
521
566
  });
522
- throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`);
567
+ throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`, "jwks");
523
568
  }
524
569
  }
525
570
  function assertAccessTokenTyp(token, allowed) {
@@ -695,6 +740,16 @@ function oauthConfigurationErrorResponse() {
695
740
  }
696
741
  });
697
742
  }
743
+ function oauthUpstreamUnreachableResponse() {
744
+ return new Response(JSON.stringify({ error: "authorization server unreachable" }), {
745
+ status: 503,
746
+ headers: {
747
+ ...JSON_HEADERS,
748
+ "Cache-Control": "no-store",
749
+ "Retry-After": "30"
750
+ }
751
+ });
752
+ }
698
753
  function parseBearerToken(request) {
699
754
  const header = request.headers.get("Authorization");
700
755
  if (!header) return void 0;
@@ -768,15 +823,33 @@ function createRequestAuthorizer(mcp, options = {}) {
768
823
  auth
769
824
  };
770
825
  } catch (err) {
826
+ if (err instanceof OAuthUpstreamUnreachableError) {
827
+ require_logger.log.error("auth.upstream_unreachable", {
828
+ ...require_logger.describeError(err),
829
+ stage: err.stage,
830
+ outcome: "503"
831
+ });
832
+ await recorder?.emit({
833
+ tool: null,
834
+ method: "authorize",
835
+ outcome: err.stage === "jwks" ? "auth_jwks_unreachable" : "auth_discovery_unreachable",
836
+ durationMs: nowMs() - startedAt
837
+ });
838
+ return {
839
+ ok: false,
840
+ response: oauthUpstreamUnreachableResponse()
841
+ };
842
+ }
771
843
  if (err instanceof OAuthConfigurationError) {
772
844
  require_logger.log.error("auth.config_error", {
773
845
  ...require_logger.describeError(err),
846
+ stage: err.stage,
774
847
  outcome: "500"
775
848
  });
776
849
  await recorder?.emit({
777
850
  tool: null,
778
851
  method: "authorize",
779
- outcome: "auth_config_error",
852
+ outcome: err.stage === "jwks" ? "auth_jwks_config_error" : "auth_discovery_config_error",
780
853
  durationMs: nowMs() - startedAt
781
854
  });
782
855
  return {
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_logger = require("./logger-BqPOa_E1.cjs");
2
+ const require_logger = require("./logger-BSKbuM66.cjs");
3
3
  const require_context = require("./context-BweeEcoA.cjs");
4
4
  //#region src/core/define.ts
5
5
  function assertUniqueNames(mcp) {
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as McpAuthConfig, S as JwtClaims, _ as ZodRawShape, a as EmbeddedResource, b as MetricsOptions, c as McpDefinition, d as ResourceLinkIcon, f as TextContent, g as ToolHandlerResult, h as ToolDefinition, i as EmbeddedBlobResource, l as McpDefinitionInput, m as ToolContent, n as ContentAnnotations, o as EmbeddedTextResource, p as ToolAnnotations, r as ContentBlock, s as ImageContent, t as AudioContent, u as ResourceLink, v as ZodSchema, x as ToolContext, y as MetricsConfig } from "./types-BYdYYTjk.cjs";
1
+ import { C as McpAuthConfig, S as JwtClaims, _ as ZodRawShape, a as EmbeddedResource, b as MetricsOptions, c as McpDefinition, d as ResourceLinkIcon, f as TextContent, g as ToolHandlerResult, h as ToolDefinition, i as EmbeddedBlobResource, l as McpDefinitionInput, m as ToolContent, n as ContentAnnotations, o as EmbeddedTextResource, p as ToolAnnotations, r as ContentBlock, s as ImageContent, t as AudioContent, u as ResourceLink, v as ZodSchema, x as ToolContext, y as MetricsConfig } from "./types-C0Wgm9zp.cjs";
2
2
  //#region src/core/define.d.ts
3
3
  /**
4
4
  * Declare a single MCP tool. Import the result into your MCP definition's
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as McpAuthConfig, S as JwtClaims, _ as ZodRawShape, a as EmbeddedResource, b as MetricsOptions, c as McpDefinition, d as ResourceLinkIcon, f as TextContent, g as ToolHandlerResult, h as ToolDefinition, i as EmbeddedBlobResource, l as McpDefinitionInput, m as ToolContent, n as ContentAnnotations, o as EmbeddedTextResource, p as ToolAnnotations, r as ContentBlock, s as ImageContent, t as AudioContent, u as ResourceLink, v as ZodSchema, x as ToolContext, y as MetricsConfig } from "./types-BYdYYTjk.js";
1
+ import { C as McpAuthConfig, S as JwtClaims, _ as ZodRawShape, a as EmbeddedResource, b as MetricsOptions, c as McpDefinition, d as ResourceLinkIcon, f as TextContent, g as ToolHandlerResult, h as ToolDefinition, i as EmbeddedBlobResource, l as McpDefinitionInput, m as ToolContent, n as ContentAnnotations, o as EmbeddedTextResource, p as ToolAnnotations, r as ContentBlock, s as ImageContent, t as AudioContent, u as ResourceLink, v as ZodSchema, x as ToolContext, y as MetricsConfig } from "./types-C0Wgm9zp.js";
2
2
  //#region src/core/define.d.ts
3
3
  /**
4
4
  * Declare a single MCP tool. Import the result into your MCP definition's
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as setLogLevel, l as resolveMetricsConfig, o as parseSafeUrl, s as trimTrailingSlash } from "./logger-2OXtfiIW.js";
1
+ import { a as setLogLevel, o as parseSafeUrl, s as trimTrailingSlash, u as resolveMetricsConfig } from "./logger-3-kwsF-5.js";
2
2
  import { t as ToolContext } from "./context-CIpPzN7P.js";
3
3
  //#region src/core/define.ts
4
4
  function assertUniqueNames(mcp) {
@@ -1,4 +1,4 @@
1
- import "./list-tools-B4TTPEl1.cjs";
1
+ import "./list-tools-Dk-QKfqy.cjs";
2
2
  //#region src/manifest/io.d.ts
3
3
  /**
4
4
  * Shape every MCP Vite plugin exposes on its `api` so `runExtract` can read
@@ -1,4 +1,4 @@
1
- import "./list-tools-bh6-eqZM.js";
1
+ import "./list-tools-DKz6nJQ6.js";
2
2
  //#region src/manifest/io.d.ts
3
3
  /**
4
4
  * Shape every MCP Vite plugin exposes on its `api` so `runExtract` can read
@@ -1,4 +1,4 @@
1
- const require_cors = require("./cors-CDnoIzo6.cjs");
1
+ const require_cors = require("./cors-DW1p9Uzw.cjs");
2
2
  let _modelcontextprotocol_sdk_server_zod_compat_js = require("@modelcontextprotocol/sdk/server/zod-compat.js");
3
3
  let _modelcontextprotocol_sdk_server_zod_json_schema_compat_js = require("@modelcontextprotocol/sdk/server/zod-json-schema-compat.js");
4
4
  //#region src/protocols/rest/list-tools.ts
@@ -1,6 +1,6 @@
1
- import { c as McpDefinition } from "./types-BYdYYTjk.js";
2
- import { t as MetricsRecorder } from "./base-DCe0kP79.js";
3
- import { t as McpRuntimeOptions } from "./authorize-D6p4-9_D.js";
1
+ import { c as McpDefinition } from "./types-C0Wgm9zp.js";
2
+ import { t as MetricsRecorder } from "./base-D-dYxK8t.js";
3
+ import { t as McpRuntimeOptions } from "./authorize-Y6Jm8GhR.js";
4
4
  //#region src/protocols/rest/list-tools.d.ts
5
5
  type RestListToolsHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
6
6
  declare function createListToolsHandler(mcp: McpDefinition, options?: McpRuntimeOptions): RestListToolsHandler;
@@ -1,4 +1,4 @@
1
- import { i as createRequestAuthorizer, m as methodNotAllowed, n as withCors, p as headResponse, r as assertRestResourceBinding, t as corsPreflightResponse, u as createNoopRecorder } from "./cors-BXcpNLm9.js";
1
+ import { i as createRequestAuthorizer, m as methodNotAllowed, n as withCors, p as headResponse, r as assertRestResourceBinding, t as corsPreflightResponse, u as createNoopRecorder } from "./cors-1Iz86PSf.js";
2
2
  import { objectFromShape } from "@modelcontextprotocol/sdk/server/zod-compat.js";
3
3
  import { toJsonSchemaCompat } from "@modelcontextprotocol/sdk/server/zod-json-schema-compat.js";
4
4
  //#region src/protocols/rest/list-tools.ts
@@ -1,6 +1,6 @@
1
- import { c as McpDefinition } from "./types-BYdYYTjk.cjs";
2
- import { t as MetricsRecorder } from "./base-DCe0kP79.cjs";
3
- import { t as McpRuntimeOptions } from "./authorize-CumVyk7p.cjs";
1
+ import { c as McpDefinition } from "./types-C0Wgm9zp.cjs";
2
+ import { t as MetricsRecorder } from "./base-D-dYxK8t.cjs";
3
+ import { t as McpRuntimeOptions } from "./authorize-D3zzoTAG.cjs";
4
4
  //#region src/protocols/rest/list-tools.d.ts
5
5
  type RestListToolsHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
6
6
  declare function createListToolsHandler(mcp: McpDefinition, options?: McpRuntimeOptions): RestListToolsHandler;
@@ -1,5 +1,6 @@
1
1
  //#region src/metrics/config.ts
2
- const DEFAULT_METRICS_ENDPOINT = "https://api.lovable.dev/v1/app-mcp-usage";
2
+ const DEFAULT_METRICS_ENDPOINT = "https://api.lovable.dev/internal/v1/app-mcp-usage";
3
+ const LEGACY_METRICS_ENDPOINT = "https://api.lovable.dev/v1/app-mcp-usage";
3
4
  const METRICS_API_KEY_ENV_VAR = "LOVABLE_API_KEY";
4
5
  /**
5
6
  * Validate the ingest endpoint at plugin-construction time so a malformed URL
@@ -21,7 +22,7 @@ function assertMetricsEndpoint(endpoint) {
21
22
  */
22
23
  function resolveMetricsConfig(config = true) {
23
24
  const options = typeof config === "boolean" ? { enabled: config } : config;
24
- const endpoint = options.endpoint ?? "https://api.lovable.dev/v1/app-mcp-usage";
25
+ const endpoint = options.endpoint ?? "https://api.lovable.dev/internal/v1/app-mcp-usage";
25
26
  assertMetricsEndpoint(endpoint);
26
27
  return Object.freeze({
27
28
  enabled: options.enabled ?? true,
@@ -138,4 +139,4 @@ function describeError(err) {
138
139
  return { value: String(err) };
139
140
  }
140
141
  //#endregion
141
- export { setLogLevel as a, DEFAULT_METRICS_ENDPOINT as c, log as i, resolveMetricsConfig as l, applyLogLevelFromEnv as n, parseSafeUrl as o, describeError as r, trimTrailingSlash as s, LOG_LEVEL_ENV_VAR as t };
142
+ export { setLogLevel as a, DEFAULT_METRICS_ENDPOINT as c, log as i, LEGACY_METRICS_ENDPOINT as l, applyLogLevelFromEnv as n, parseSafeUrl as o, describeError as r, trimTrailingSlash as s, LOG_LEVEL_ENV_VAR as t, resolveMetricsConfig as u };
@@ -1,5 +1,6 @@
1
1
  //#region src/metrics/config.ts
2
- const DEFAULT_METRICS_ENDPOINT = "https://api.lovable.dev/v1/app-mcp-usage";
2
+ const DEFAULT_METRICS_ENDPOINT = "https://api.lovable.dev/internal/v1/app-mcp-usage";
3
+ const LEGACY_METRICS_ENDPOINT = "https://api.lovable.dev/v1/app-mcp-usage";
3
4
  const METRICS_API_KEY_ENV_VAR = "LOVABLE_API_KEY";
4
5
  /**
5
6
  * Validate the ingest endpoint at plugin-construction time so a malformed URL
@@ -21,7 +22,7 @@ function assertMetricsEndpoint(endpoint) {
21
22
  */
22
23
  function resolveMetricsConfig(config = true) {
23
24
  const options = typeof config === "boolean" ? { enabled: config } : config;
24
- const endpoint = options.endpoint ?? "https://api.lovable.dev/v1/app-mcp-usage";
25
+ const endpoint = options.endpoint ?? "https://api.lovable.dev/internal/v1/app-mcp-usage";
25
26
  assertMetricsEndpoint(endpoint);
26
27
  return Object.freeze({
27
28
  enabled: options.enabled ?? true,
@@ -144,6 +145,12 @@ Object.defineProperty(exports, "DEFAULT_METRICS_ENDPOINT", {
144
145
  return DEFAULT_METRICS_ENDPOINT;
145
146
  }
146
147
  });
148
+ Object.defineProperty(exports, "LEGACY_METRICS_ENDPOINT", {
149
+ enumerable: true,
150
+ get: function() {
151
+ return LEGACY_METRICS_ENDPOINT;
152
+ }
153
+ });
147
154
  Object.defineProperty(exports, "LOG_LEVEL_ENV_VAR", {
148
155
  enumerable: true,
149
156
  get: function() {
@@ -1,6 +1,6 @@
1
- import { i as log, r as describeError } from "./logger-2OXtfiIW.js";
1
+ import { i as log, r as describeError } from "./logger-3-kwsF-5.js";
2
2
  import { t as ToolContext } from "./context-CIpPzN7P.js";
3
- import { d as nowMs, i as createRequestAuthorizer, n as withCors, t as corsPreflightResponse, u as createNoopRecorder } from "./cors-BXcpNLm9.js";
3
+ import { d as nowMs, i as createRequestAuthorizer, n as withCors, t as corsPreflightResponse, u as createNoopRecorder } from "./cors-1Iz86PSf.js";
4
4
  import { t as extractTextContent } from "./content-D5LJAHyM.js";
5
5
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
6
6
  import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
@@ -1,6 +1,6 @@
1
- const require_logger = require("./logger-BqPOa_E1.cjs");
1
+ const require_logger = require("./logger-BSKbuM66.cjs");
2
2
  const require_context = require("./context-BweeEcoA.cjs");
3
- const require_cors = require("./cors-CDnoIzo6.cjs");
3
+ const require_cors = require("./cors-DW1p9Uzw.cjs");
4
4
  const require_content = require("./content-NCYIGgOb.cjs");
5
5
  let _modelcontextprotocol_sdk_server_mcp_js = require("@modelcontextprotocol/sdk/server/mcp.js");
6
6
  let _modelcontextprotocol_sdk_server_webStandardStreamableHttp_js = require("@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js");
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.23.0";
2
+ var version = "0.25.0";
3
3
  //#endregion
4
4
  export { version as t };
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.23.0";
2
+ var version = "0.25.0";
3
3
  //#endregion
4
4
  Object.defineProperty(exports, "version", {
5
5
  enumerable: true,
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_mcp = require("../../mcp-C_SCcw5F.cjs");
2
+ const require_mcp = require("../../mcp-DSo7xlpz.cjs");
3
3
  exports.createMcpProtocolHandler = require_mcp.createMcpProtocolHandler;
@@ -1,6 +1,6 @@
1
- import { c as McpDefinition } from "../../types-BYdYYTjk.cjs";
2
- import { t as MetricsRecorder } from "../../base-DCe0kP79.cjs";
3
- import { t as McpRuntimeOptions } from "../../authorize-CumVyk7p.cjs";
1
+ import { c as McpDefinition } from "../../types-C0Wgm9zp.cjs";
2
+ import { t as MetricsRecorder } from "../../base-D-dYxK8t.cjs";
3
+ import { t as McpRuntimeOptions } from "../../authorize-D3zzoTAG.cjs";
4
4
  //#region src/protocols/mcp/protocol.d.ts
5
5
  type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { c as McpDefinition } from "../../types-BYdYYTjk.js";
2
- import { t as MetricsRecorder } from "../../base-DCe0kP79.js";
3
- import { t as McpRuntimeOptions } from "../../authorize-D6p4-9_D.js";
1
+ import { c as McpDefinition } from "../../types-C0Wgm9zp.js";
2
+ import { t as MetricsRecorder } from "../../base-D-dYxK8t.js";
3
+ import { t as McpRuntimeOptions } from "../../authorize-Y6Jm8GhR.js";
4
4
  //#region src/protocols/mcp/protocol.d.ts
5
5
  type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
6
6
  /**
@@ -1,2 +1,2 @@
1
- import { t as createMcpProtocolHandler } from "../../mcp-BiyuOOzg.js";
1
+ import { t as createMcpProtocolHandler } from "../../mcp-CoVt8EO9.js";
2
2
  export { createMcpProtocolHandler };
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_logger = require("../logger-BqPOa_E1.cjs");
3
- const require_cors = require("../cors-CDnoIzo6.cjs");
2
+ const require_logger = require("../logger-BSKbuM66.cjs");
3
+ const require_cors = require("../cors-DW1p9Uzw.cjs");
4
4
  //#region src/protocols/oauth-metadata.ts
5
5
  function notFound() {
6
6
  return require_cors.withCors(new Response(JSON.stringify({ error: "not found" }), {
@@ -1,5 +1,5 @@
1
- import { c as McpDefinition } from "../types-BYdYYTjk.cjs";
2
- import { t as McpRuntimeOptions } from "../authorize-CumVyk7p.cjs";
1
+ import { c as McpDefinition } from "../types-C0Wgm9zp.cjs";
2
+ import { t as McpRuntimeOptions } from "../authorize-D3zzoTAG.cjs";
3
3
  //#region src/protocols/oauth-metadata.d.ts
4
4
  type OAuthProtectedResourceMetadataHandler = (request: Request) => Promise<Response>;
5
5
  declare function createOAuthProtectedResourceMetadataHandler(mcp: McpDefinition, options?: McpRuntimeOptions): OAuthProtectedResourceMetadataHandler;
@@ -1,5 +1,5 @@
1
- import { c as McpDefinition } from "../types-BYdYYTjk.js";
2
- import { t as McpRuntimeOptions } from "../authorize-D6p4-9_D.js";
1
+ import { c as McpDefinition } from "../types-C0Wgm9zp.js";
2
+ import { t as McpRuntimeOptions } from "../authorize-Y6Jm8GhR.js";
3
3
  //#region src/protocols/oauth-metadata.d.ts
4
4
  type OAuthProtectedResourceMetadataHandler = (request: Request) => Promise<Response>;
5
5
  declare function createOAuthProtectedResourceMetadataHandler(mcp: McpDefinition, options?: McpRuntimeOptions): OAuthProtectedResourceMetadataHandler;
@@ -1,5 +1,5 @@
1
- import { i as log, r as describeError } from "../logger-2OXtfiIW.js";
2
- import { a as getOAuthRuntime, c as resolveProtectedResource, f as JSON_HEADERS, m as methodNotAllowed, n as withCors, o as oauthConfigurationErrorResponse, p as headResponse, t as corsPreflightResponse } from "../cors-BXcpNLm9.js";
1
+ import { i as log, r as describeError } from "../logger-3-kwsF-5.js";
2
+ import { a as getOAuthRuntime, c as resolveProtectedResource, f as JSON_HEADERS, m as methodNotAllowed, n as withCors, o as oauthConfigurationErrorResponse, p as headResponse, t as corsPreflightResponse } from "../cors-1Iz86PSf.js";
3
3
  //#region src/protocols/oauth-metadata.ts
4
4
  function notFound() {
5
5
  return withCors(new Response(JSON.stringify({ error: "not found" }), {
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_list_tools = require("../../list-tools-DChR_9Q2.cjs");
3
- const require_rest = require("../../rest-DSfFaL-p.cjs");
2
+ const require_list_tools = require("../../list-tools-DBidJV3L.cjs");
3
+ const require_rest = require("../../rest-CvdOnTsb.cjs");
4
4
  exports.createInvokeToolHandler = require_rest.createInvokeToolHandler;
5
5
  exports.createListToolsHandler = require_list_tools.createListToolsHandler;
@@ -1,7 +1,7 @@
1
- import { c as McpDefinition } from "../../types-BYdYYTjk.cjs";
2
- import { t as MetricsRecorder } from "../../base-DCe0kP79.cjs";
3
- import { t as McpRuntimeOptions } from "../../authorize-CumVyk7p.cjs";
4
- import { n as createListToolsHandler, t as RestListToolsHandler } from "../../list-tools-B4TTPEl1.cjs";
1
+ import { c as McpDefinition } from "../../types-C0Wgm9zp.cjs";
2
+ import { t as MetricsRecorder } from "../../base-D-dYxK8t.cjs";
3
+ import { t as McpRuntimeOptions } from "../../authorize-D3zzoTAG.cjs";
4
+ import { n as createListToolsHandler, t as RestListToolsHandler } from "../../list-tools-Dk-QKfqy.cjs";
5
5
  //#region src/protocols/rest/invoke-tool.d.ts
6
6
  type RestInvokeToolHandler = (request: Request, toolName: string, recorder?: MetricsRecorder) => Promise<Response>;
7
7
  declare function createInvokeToolHandler(mcp: McpDefinition, options?: McpRuntimeOptions): RestInvokeToolHandler;
@@ -1,7 +1,7 @@
1
- import { c as McpDefinition } from "../../types-BYdYYTjk.js";
2
- import { t as MetricsRecorder } from "../../base-DCe0kP79.js";
3
- import { t as McpRuntimeOptions } from "../../authorize-D6p4-9_D.js";
4
- import { n as createListToolsHandler, t as RestListToolsHandler } from "../../list-tools-bh6-eqZM.js";
1
+ import { c as McpDefinition } from "../../types-C0Wgm9zp.js";
2
+ import { t as MetricsRecorder } from "../../base-D-dYxK8t.js";
3
+ import { t as McpRuntimeOptions } from "../../authorize-Y6Jm8GhR.js";
4
+ import { n as createListToolsHandler, t as RestListToolsHandler } from "../../list-tools-DKz6nJQ6.js";
5
5
  //#region src/protocols/rest/invoke-tool.d.ts
6
6
  type RestInvokeToolHandler = (request: Request, toolName: string, recorder?: MetricsRecorder) => Promise<Response>;
7
7
  declare function createInvokeToolHandler(mcp: McpDefinition, options?: McpRuntimeOptions): RestInvokeToolHandler;
@@ -1,3 +1,3 @@
1
- import { n as createListToolsHandler } from "../../list-tools-ChLj1G6z.js";
2
- import { t as createInvokeToolHandler } from "../../rest-DdHrbXrU.js";
1
+ import { n as createListToolsHandler } from "../../list-tools-DjzEigXr.js";
2
+ import { t as createInvokeToolHandler } from "../../rest-DdQMWvF4.js";
3
3
  export { createInvokeToolHandler, createListToolsHandler };
@@ -1,7 +1,7 @@
1
1
  const require_context = require("./context-BweeEcoA.cjs");
2
- const require_cors = require("./cors-CDnoIzo6.cjs");
2
+ const require_cors = require("./cors-DW1p9Uzw.cjs");
3
3
  const require_content = require("./content-NCYIGgOb.cjs");
4
- require("./list-tools-DChR_9Q2.cjs");
4
+ require("./list-tools-DBidJV3L.cjs");
5
5
  let _modelcontextprotocol_sdk_server_zod_compat_js = require("@modelcontextprotocol/sdk/server/zod-compat.js");
6
6
  //#region src/protocols/rest/invoke-tool.ts
7
7
  const MAX_REFLECTED_TOOL_NAME = 256;
@@ -1,7 +1,7 @@
1
1
  import { t as ToolContext } from "./context-CIpPzN7P.js";
2
- import { d as nowMs, f as JSON_HEADERS, i as createRequestAuthorizer, m as methodNotAllowed, n as withCors, r as assertRestResourceBinding, t as corsPreflightResponse, u as createNoopRecorder } from "./cors-BXcpNLm9.js";
2
+ import { d as nowMs, f as JSON_HEADERS, i as createRequestAuthorizer, m as methodNotAllowed, n as withCors, r as assertRestResourceBinding, t as corsPreflightResponse, u as createNoopRecorder } from "./cors-1Iz86PSf.js";
3
3
  import { t as extractTextContent } from "./content-D5LJAHyM.js";
4
- import "./list-tools-ChLj1G6z.js";
4
+ import "./list-tools-DjzEigXr.js";
5
5
  import { getParseErrorMessage, objectFromShape, safeParseAsync } from "@modelcontextprotocol/sdk/server/zod-compat.js";
6
6
  //#region src/protocols/rest/invoke-tool.ts
7
7
  const MAX_REFLECTED_TOOL_NAME = 256;
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_logger = require("../../logger-BqPOa_E1.cjs");
3
- const require_cors = require("../../cors-CDnoIzo6.cjs");
2
+ const require_logger = require("../../logger-BSKbuM66.cjs");
3
+ const require_cors = require("../../cors-DW1p9Uzw.cjs");
4
4
  const require_metadata_path = require("../../metadata-path-zd7NSNoa.cjs");
5
- const require_mcp = require("../../mcp-C_SCcw5F.cjs");
5
+ const require_mcp = require("../../mcp-DSo7xlpz.cjs");
6
6
  const require_protocols_oauth_metadata = require("../../protocols/oauth-metadata.cjs");
7
- const require_list_tools = require("../../list-tools-DChR_9Q2.cjs");
8
- const require_rest = require("../../rest-DSfFaL-p.cjs");
7
+ const require_list_tools = require("../../list-tools-DBidJV3L.cjs");
8
+ const require_rest = require("../../rest-CvdOnTsb.cjs");
9
9
  const require_forwarded = require("../../forwarded-Pi8Hs5Ps.cjs");
10
10
  const require_paths = require("../../paths-OP318a6c.cjs");
11
11
  //#region src/stacks/supabase/handler.ts
@@ -1,4 +1,4 @@
1
- import { c as McpDefinition } from "../../types-BYdYYTjk.cjs";
1
+ import { c as McpDefinition } from "../../types-C0Wgm9zp.cjs";
2
2
  //#region src/stacks/supabase/handler.d.ts
3
3
  type SupabaseHandler = (request: Request) => Promise<Response>;
4
4
  interface SupabaseHandlerOptions {
@@ -1,4 +1,4 @@
1
- import { c as McpDefinition } from "../../types-BYdYYTjk.js";
1
+ import { c as McpDefinition } from "../../types-C0Wgm9zp.js";
2
2
  //#region src/stacks/supabase/handler.d.ts
3
3
  type SupabaseHandler = (request: Request) => Promise<Response>;
4
4
  interface SupabaseHandlerOptions {
@@ -1,10 +1,10 @@
1
- import { s as trimTrailingSlash } from "../../logger-2OXtfiIW.js";
2
- import { l as createRecorderForRuntime, s as assertResourcePathShape } from "../../cors-BXcpNLm9.js";
1
+ import { s as trimTrailingSlash } from "../../logger-3-kwsF-5.js";
2
+ import { l as createRecorderForRuntime, s as assertResourcePathShape } from "../../cors-1Iz86PSf.js";
3
3
  import { t as OAUTH_PROTECTED_RESOURCE_METADATA_PATH } from "../../metadata-path-CAkNcfyY.js";
4
- import { t as createMcpProtocolHandler } from "../../mcp-BiyuOOzg.js";
4
+ import { t as createMcpProtocolHandler } from "../../mcp-CoVt8EO9.js";
5
5
  import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
6
- import { n as createListToolsHandler } from "../../list-tools-ChLj1G6z.js";
7
- import { t as createInvokeToolHandler } from "../../rest-DdHrbXrU.js";
6
+ import { n as createListToolsHandler } from "../../list-tools-DjzEigXr.js";
7
+ import { t as createInvokeToolHandler } from "../../rest-DdQMWvF4.js";
8
8
  import { t as applyForwardedOrigin } from "../../forwarded--h4efJy-.js";
9
9
  import { n as assertFunctionName, t as FUNCTIONS_MOUNT_PREFIX } from "../../paths-IS65L6TA.js";
10
10
  //#region src/stacks/supabase/handler.ts
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_package = require("../../package-DlVwsYdc.cjs");
5
+ const require_package = require("../../package-Wvf1u2OZ.cjs");
6
6
  const require_fs_errors = require("../../fs-errors-CWNzOV75.cjs");
7
7
  const require_supabase_config = require("../../supabase-config-Dz7dnUv0.cjs");
8
8
  const require_paths = require("../../paths-OP318a6c.cjs");
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-DPYvBqET.cjs";
1
+ import { t as McpPluginApi } from "../../io-BlJ298VF.cjs";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/supabase/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-CfSPxeBN.js";
1
+ import { t as McpPluginApi } from "../../io-CSsqm26s.js";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/supabase/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -1,4 +1,4 @@
1
- import { t as version } from "../../package-T7npsn7f.js";
1
+ import { t as version } from "../../package-CUrmd7C5.js";
2
2
  import { t as isFileMissing } from "../../fs-errors-PA2t1TIp.js";
3
3
  import { t as readSupabaseProjectRef } from "../../supabase-config-CakTU8YF.js";
4
4
  import { n as assertFunctionName, t as FUNCTIONS_MOUNT_PREFIX } from "../../paths-IS65L6TA.js";
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_cors = require("../../cors-CDnoIzo6.cjs");
3
- const require_mcp = require("../../mcp-C_SCcw5F.cjs");
2
+ const require_cors = require("../../cors-DW1p9Uzw.cjs");
3
+ const require_mcp = require("../../mcp-DSo7xlpz.cjs");
4
4
  const require_protocols_oauth_metadata = require("../../protocols/oauth-metadata.cjs");
5
- const require_list_tools = require("../../list-tools-DChR_9Q2.cjs");
6
- const require_rest = require("../../rest-DSfFaL-p.cjs");
5
+ const require_list_tools = require("../../list-tools-DBidJV3L.cjs");
6
+ const require_rest = require("../../rest-CvdOnTsb.cjs");
7
7
  const require_forwarded = require("../../forwarded-Pi8Hs5Ps.cjs");
8
8
  //#region src/stacks/tanstack/handlers.ts
9
9
  const STACK = "tanstack";
@@ -1,5 +1,5 @@
1
- import { c as McpDefinition } from "../../types-BYdYYTjk.cjs";
2
- import { t as McpRuntimeOptions } from "../../authorize-CumVyk7p.cjs";
1
+ import { c as McpDefinition } from "../../types-C0Wgm9zp.cjs";
2
+ import { t as McpRuntimeOptions } from "../../authorize-D3zzoTAG.cjs";
3
3
  //#region src/stacks/tanstack/handlers.d.ts
4
4
  interface TanStackRouteCtx {
5
5
  request: Request;
@@ -1,5 +1,5 @@
1
- import { c as McpDefinition } from "../../types-BYdYYTjk.js";
2
- import { t as McpRuntimeOptions } from "../../authorize-D6p4-9_D.js";
1
+ import { c as McpDefinition } from "../../types-C0Wgm9zp.js";
2
+ import { t as McpRuntimeOptions } from "../../authorize-Y6Jm8GhR.js";
3
3
  //#region src/stacks/tanstack/handlers.d.ts
4
4
  interface TanStackRouteCtx {
5
5
  request: Request;
@@ -1,8 +1,8 @@
1
- import { l as createRecorderForRuntime } from "../../cors-BXcpNLm9.js";
2
- import { t as createMcpProtocolHandler } from "../../mcp-BiyuOOzg.js";
1
+ import { l as createRecorderForRuntime } from "../../cors-1Iz86PSf.js";
2
+ import { t as createMcpProtocolHandler } from "../../mcp-CoVt8EO9.js";
3
3
  import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
4
- import { n as createListToolsHandler } from "../../list-tools-ChLj1G6z.js";
5
- import { t as createInvokeToolHandler } from "../../rest-DdHrbXrU.js";
4
+ import { n as createListToolsHandler } from "../../list-tools-DjzEigXr.js";
5
+ import { t as createInvokeToolHandler } from "../../rest-DdQMWvF4.js";
6
6
  import { t as applyForwardedOrigin } from "../../forwarded--h4efJy-.js";
7
7
  //#region src/stacks/tanstack/handlers.ts
8
8
  const STACK = "tanstack";
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-DPYvBqET.cjs";
1
+ import { t as McpPluginApi } from "../../io-BlJ298VF.cjs";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/tanstack/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-CfSPxeBN.js";
1
+ import { t as McpPluginApi } from "../../io-CSsqm26s.js";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/tanstack/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -128,7 +128,7 @@ interface MetricsOptions {
128
128
  enabled?: boolean;
129
129
  /** OTLP/HTTP (JSON) logs URL to POST each invocation to — the default Lovable
130
130
  * route or any OTLP collector. Must be an absolute http(s) URL.
131
- * @default "https://api.lovable.dev/v1/app-mcp-usage" */
131
+ * @default "https://api.lovable.dev/internal/v1/app-mcp-usage" */
132
132
  endpoint?: string;
133
133
  /** Extra request headers — e.g. the auth token for a private OTLP collector.
134
134
  * Sent verbatim with every request (and baked into the build output, so source
@@ -128,7 +128,7 @@ interface MetricsOptions {
128
128
  enabled?: boolean;
129
129
  /** OTLP/HTTP (JSON) logs URL to POST each invocation to — the default Lovable
130
130
  * route or any OTLP collector. Must be an absolute http(s) URL.
131
- * @default "https://api.lovable.dev/v1/app-mcp-usage" */
131
+ * @default "https://api.lovable.dev/internal/v1/app-mcp-usage" */
132
132
  endpoint?: string;
133
133
  /** Extra request headers — e.g. the auth token for a private OTLP collector.
134
134
  * Sent verbatim with every request (and baked into the build output, so source
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/mcp-js",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
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": {