@lovable.dev/mcp-js 0.22.2 → 0.24.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 (43) hide show
  1. package/dist/{base-DCe0kP79.d.cts → base-D-dYxK8t.d.cts} +1 -1
  2. package/dist/{base-DCe0kP79.d.ts → base-D-dYxK8t.d.ts} +1 -1
  3. package/dist/cli/extract-manifest.cjs +2 -2
  4. package/dist/cli/extract-manifest.js +2 -2
  5. package/dist/{cors-CJct3BEI.js → cors-Ftb-tw1d.js} +87 -14
  6. package/dist/{cors-CTtLtFQR.cjs → cors-Y_FmMkXK.cjs} +87 -14
  7. package/dist/{io-DPYvBqET.d.cts → io-BIvFmJK1.d.cts} +1 -1
  8. package/dist/{io-CfSPxeBN.d.ts → io-Bi7DYgft.d.ts} +1 -1
  9. package/dist/{list-tools-B4TTPEl1.d.cts → list-tools--SBVo58Z.d.cts} +1 -1
  10. package/dist/{list-tools-YHIrPuuR.cjs → list-tools-BeVzrTT-.cjs} +1 -1
  11. package/dist/{list-tools--Kx40Dg2.js → list-tools-BrSIMpBi.js} +1 -1
  12. package/dist/{list-tools-bh6-eqZM.d.ts → list-tools-Go45Ib1W.d.ts} +1 -1
  13. package/dist/{mcp-DzSswp-q.js → mcp-BarAJ9N0.js} +1 -1
  14. package/dist/{mcp-CQGMfpLc.cjs → mcp-_a39WlhN.cjs} +1 -1
  15. package/dist/{package-CFrZxdHL.cjs → package-DtnkW7Jc.cjs} +1 -1
  16. package/dist/{package-CLHBPGM1.js → package-DudvPdrW.js} +1 -1
  17. package/dist/protocols/mcp/index.cjs +1 -1
  18. package/dist/protocols/mcp/index.d.cts +1 -1
  19. package/dist/protocols/mcp/index.d.ts +1 -1
  20. package/dist/protocols/mcp/index.js +1 -1
  21. package/dist/protocols/oauth-metadata.cjs +1 -1
  22. package/dist/protocols/oauth-metadata.js +1 -1
  23. package/dist/protocols/rest/index.cjs +2 -2
  24. package/dist/protocols/rest/index.d.cts +2 -2
  25. package/dist/protocols/rest/index.d.ts +2 -2
  26. package/dist/protocols/rest/index.js +2 -2
  27. package/dist/{rest-BVBQmkWy.js → rest-Be8uOb6r.js} +2 -2
  28. package/dist/{rest-Cp3jPs0S.cjs → rest-C9kWgxK5.cjs} +2 -2
  29. package/dist/stacks/supabase/index.cjs +4 -4
  30. package/dist/stacks/supabase/index.js +4 -4
  31. package/dist/stacks/supabase/vite.cjs +8 -2
  32. package/dist/stacks/supabase/vite.d.cts +1 -1
  33. package/dist/stacks/supabase/vite.d.ts +1 -1
  34. package/dist/stacks/supabase/vite.js +8 -2
  35. package/dist/stacks/tanstack/index.cjs +4 -4
  36. package/dist/stacks/tanstack/index.js +4 -4
  37. package/dist/stacks/tanstack/vite.cjs +10 -0
  38. package/dist/stacks/tanstack/vite.d.cts +1 -1
  39. package/dist/stacks/tanstack/vite.d.ts +1 -1
  40. package/dist/stacks/tanstack/vite.js +10 -0
  41. package/dist/supabase-config-CakTU8YF.js +26 -0
  42. package/dist/supabase-config-Dz7dnUv0.cjs +31 -0
  43. package/package.json +2 -2
@@ -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-CFrZxdHL.cjs");
3
- const require_list_tools = require("../list-tools-YHIrPuuR.cjs");
2
+ const require_package = require("../package-DtnkW7Jc.cjs");
3
+ const require_list_tools = require("../list-tools-BeVzrTT-.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-CLHBPGM1.js";
3
- import { t as buildMcpListing } from "../list-tools--Kx40Dg2.js";
2
+ import { t as version } from "../package-DudvPdrW.js";
3
+ import { t as buildMcpListing } from "../list-tools-BrSIMpBi.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
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-CLHBPGM1.js";
2
+ import { t as version } from "./package-DudvPdrW.js";
3
3
  import "./metadata-path-CAkNcfyY.js";
4
4
  import { createLocalJWKSet, decodeProtectedHeader, jwtVerify } from "jose";
5
5
  //#region src/core/http.ts
@@ -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
1
  const require_logger = require("./logger-BqPOa_E1.cjs");
2
- const require_package = require("./package-CFrZxdHL.cjs");
2
+ const require_package = require("./package-DtnkW7Jc.cjs");
3
3
  require("./metadata-path-zd7NSNoa.cjs");
4
4
  let jose = require("jose");
5
5
  //#region src/core/http.ts
@@ -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 {
@@ -1,4 +1,4 @@
1
- import "./list-tools-B4TTPEl1.cjs";
1
+ import "./list-tools--SBVo58Z.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-Go45Ib1W.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,5 +1,5 @@
1
1
  import { c as McpDefinition } from "./types-BYdYYTjk.cjs";
2
- import { t as MetricsRecorder } from "./base-DCe0kP79.cjs";
2
+ import { t as MetricsRecorder } from "./base-D-dYxK8t.cjs";
3
3
  import { t as McpRuntimeOptions } from "./authorize-CumVyk7p.cjs";
4
4
  //#region src/protocols/rest/list-tools.d.ts
5
5
  type RestListToolsHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
@@ -1,4 +1,4 @@
1
- const require_cors = require("./cors-CTtLtFQR.cjs");
1
+ const require_cors = require("./cors-Y_FmMkXK.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,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-CJct3BEI.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-Ftb-tw1d.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,5 +1,5 @@
1
1
  import { c as McpDefinition } from "./types-BYdYYTjk.js";
2
- import { t as MetricsRecorder } from "./base-DCe0kP79.js";
2
+ import { t as MetricsRecorder } from "./base-D-dYxK8t.js";
3
3
  import { t as McpRuntimeOptions } from "./authorize-D6p4-9_D.js";
4
4
  //#region src/protocols/rest/list-tools.d.ts
5
5
  type RestListToolsHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
@@ -1,6 +1,6 @@
1
1
  import { i as log, r as describeError } from "./logger-2OXtfiIW.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-CJct3BEI.js";
3
+ import { d as nowMs, i as createRequestAuthorizer, n as withCors, t as corsPreflightResponse, u as createNoopRecorder } from "./cors-Ftb-tw1d.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
1
  const require_logger = require("./logger-BqPOa_E1.cjs");
2
2
  const require_context = require("./context-BweeEcoA.cjs");
3
- const require_cors = require("./cors-CTtLtFQR.cjs");
3
+ const require_cors = require("./cors-Y_FmMkXK.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,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.22.2";
2
+ var version = "0.24.0";
3
3
  //#endregion
4
4
  Object.defineProperty(exports, "version", {
5
5
  enumerable: true,
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.22.2";
2
+ var version = "0.24.0";
3
3
  //#endregion
4
4
  export { version as t };
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_mcp = require("../../mcp-CQGMfpLc.cjs");
2
+ const require_mcp = require("../../mcp-_a39WlhN.cjs");
3
3
  exports.createMcpProtocolHandler = require_mcp.createMcpProtocolHandler;
@@ -1,5 +1,5 @@
1
1
  import { c as McpDefinition } from "../../types-BYdYYTjk.cjs";
2
- import { t as MetricsRecorder } from "../../base-DCe0kP79.cjs";
2
+ import { t as MetricsRecorder } from "../../base-D-dYxK8t.cjs";
3
3
  import { t as McpRuntimeOptions } from "../../authorize-CumVyk7p.cjs";
4
4
  //#region src/protocols/mcp/protocol.d.ts
5
5
  type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
@@ -1,5 +1,5 @@
1
1
  import { c as McpDefinition } from "../../types-BYdYYTjk.js";
2
- import { t as MetricsRecorder } from "../../base-DCe0kP79.js";
2
+ import { t as MetricsRecorder } from "../../base-D-dYxK8t.js";
3
3
  import { t as McpRuntimeOptions } from "../../authorize-D6p4-9_D.js";
4
4
  //#region src/protocols/mcp/protocol.d.ts
5
5
  type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
@@ -1,2 +1,2 @@
1
- import { t as createMcpProtocolHandler } from "../../mcp-DzSswp-q.js";
1
+ import { t as createMcpProtocolHandler } from "../../mcp-BarAJ9N0.js";
2
2
  export { createMcpProtocolHandler };
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_logger = require("../logger-BqPOa_E1.cjs");
3
- const require_cors = require("../cors-CTtLtFQR.cjs");
3
+ const require_cors = require("../cors-Y_FmMkXK.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
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-CJct3BEI.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-Ftb-tw1d.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-YHIrPuuR.cjs");
3
- const require_rest = require("../../rest-Cp3jPs0S.cjs");
2
+ const require_list_tools = require("../../list-tools-BeVzrTT-.cjs");
3
+ const require_rest = require("../../rest-C9kWgxK5.cjs");
4
4
  exports.createInvokeToolHandler = require_rest.createInvokeToolHandler;
5
5
  exports.createListToolsHandler = require_list_tools.createListToolsHandler;
@@ -1,7 +1,7 @@
1
1
  import { c as McpDefinition } from "../../types-BYdYYTjk.cjs";
2
- import { t as MetricsRecorder } from "../../base-DCe0kP79.cjs";
2
+ import { t as MetricsRecorder } from "../../base-D-dYxK8t.cjs";
3
3
  import { t as McpRuntimeOptions } from "../../authorize-CumVyk7p.cjs";
4
- import { n as createListToolsHandler, t as RestListToolsHandler } from "../../list-tools-B4TTPEl1.cjs";
4
+ import { n as createListToolsHandler, t as RestListToolsHandler } from "../../list-tools--SBVo58Z.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
1
  import { c as McpDefinition } from "../../types-BYdYYTjk.js";
2
- import { t as MetricsRecorder } from "../../base-DCe0kP79.js";
2
+ import { t as MetricsRecorder } from "../../base-D-dYxK8t.js";
3
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";
4
+ import { n as createListToolsHandler, t as RestListToolsHandler } from "../../list-tools-Go45Ib1W.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--Kx40Dg2.js";
2
- import { t as createInvokeToolHandler } from "../../rest-BVBQmkWy.js";
1
+ import { n as createListToolsHandler } from "../../list-tools-BrSIMpBi.js";
2
+ import { t as createInvokeToolHandler } from "../../rest-Be8uOb6r.js";
3
3
  export { createInvokeToolHandler, createListToolsHandler };
@@ -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-CJct3BEI.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-Ftb-tw1d.js";
3
3
  import { t as extractTextContent } from "./content-D5LJAHyM.js";
4
- import "./list-tools--Kx40Dg2.js";
4
+ import "./list-tools-BrSIMpBi.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,7 +1,7 @@
1
1
  const require_context = require("./context-BweeEcoA.cjs");
2
- const require_cors = require("./cors-CTtLtFQR.cjs");
2
+ const require_cors = require("./cors-Y_FmMkXK.cjs");
3
3
  const require_content = require("./content-NCYIGgOb.cjs");
4
- require("./list-tools-YHIrPuuR.cjs");
4
+ require("./list-tools-BeVzrTT-.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,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_logger = require("../../logger-BqPOa_E1.cjs");
3
- const require_cors = require("../../cors-CTtLtFQR.cjs");
3
+ const require_cors = require("../../cors-Y_FmMkXK.cjs");
4
4
  const require_metadata_path = require("../../metadata-path-zd7NSNoa.cjs");
5
- const require_mcp = require("../../mcp-CQGMfpLc.cjs");
5
+ const require_mcp = require("../../mcp-_a39WlhN.cjs");
6
6
  const require_protocols_oauth_metadata = require("../../protocols/oauth-metadata.cjs");
7
- const require_list_tools = require("../../list-tools-YHIrPuuR.cjs");
8
- const require_rest = require("../../rest-Cp3jPs0S.cjs");
7
+ const require_list_tools = require("../../list-tools-BeVzrTT-.cjs");
8
+ const require_rest = require("../../rest-C9kWgxK5.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,10 +1,10 @@
1
1
  import { s as trimTrailingSlash } from "../../logger-2OXtfiIW.js";
2
- import { l as createRecorderForRuntime, s as assertResourcePathShape } from "../../cors-CJct3BEI.js";
2
+ import { l as createRecorderForRuntime, s as assertResourcePathShape } from "../../cors-Ftb-tw1d.js";
3
3
  import { t as OAUTH_PROTECTED_RESOURCE_METADATA_PATH } from "../../metadata-path-CAkNcfyY.js";
4
- import { t as createMcpProtocolHandler } from "../../mcp-DzSswp-q.js";
4
+ import { t as createMcpProtocolHandler } from "../../mcp-BarAJ9N0.js";
5
5
  import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
6
- import { n as createListToolsHandler } from "../../list-tools--Kx40Dg2.js";
7
- import { t as createInvokeToolHandler } from "../../rest-BVBQmkWy.js";
6
+ import { n as createListToolsHandler } from "../../list-tools-BrSIMpBi.js";
7
+ import { t as createInvokeToolHandler } from "../../rest-Be8uOb6r.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,8 +2,9 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_package = require("../../package-CFrZxdHL.cjs");
5
+ const require_package = require("../../package-DtnkW7Jc.cjs");
6
6
  const require_fs_errors = require("../../fs-errors-CWNzOV75.cjs");
7
+ const require_supabase_config = require("../../supabase-config-Dz7dnUv0.cjs");
7
8
  const require_paths = require("../../paths-OP318a6c.cjs");
8
9
  let node_fs = require("node:fs");
9
10
  let node_path = require("node:path");
@@ -195,7 +196,7 @@ function normalizePath(p) {
195
196
  return p.split(node_path.sep).join("/");
196
197
  }
197
198
  function productionImportMetaEnv(config) {
198
- return {
199
+ const env = {
199
200
  ...(0, vite.loadEnv)("production", config.envDir, config.envPrefix),
200
201
  MODE: "production",
201
202
  BASE_URL: config.base ?? "/",
@@ -203,6 +204,11 @@ function productionImportMetaEnv(config) {
203
204
  PROD: true,
204
205
  SSR: false
205
206
  };
207
+ if (!env.VITE_SUPABASE_PROJECT_ID) {
208
+ const ref = require_supabase_config.readSupabaseProjectRef(config.root);
209
+ if (ref) env.VITE_SUPABASE_PROJECT_ID = ref;
210
+ }
211
+ return env;
206
212
  }
207
213
  /**
208
214
  * Vite plugin that emits the Supabase Edge Function entry (and its
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-DPYvBqET.cjs";
1
+ import { t as McpPluginApi } from "../../io-BIvFmJK1.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-Bi7DYgft.js";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/supabase/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -1,5 +1,6 @@
1
- import { t as version } from "../../package-CLHBPGM1.js";
1
+ import { t as version } from "../../package-DudvPdrW.js";
2
2
  import { t as isFileMissing } from "../../fs-errors-PA2t1TIp.js";
3
+ import { t as readSupabaseProjectRef } from "../../supabase-config-CakTU8YF.js";
3
4
  import { n as assertFunctionName, t as FUNCTIONS_MOUNT_PREFIX } from "../../paths-IS65L6TA.js";
4
5
  import { lstatSync, mkdirSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
5
6
  import { dirname, join, relative, resolve, sep } from "node:path";
@@ -191,7 +192,7 @@ function normalizePath(p) {
191
192
  return p.split(sep).join("/");
192
193
  }
193
194
  function productionImportMetaEnv(config) {
194
- return {
195
+ const env = {
195
196
  ...loadEnv("production", config.envDir, config.envPrefix),
196
197
  MODE: "production",
197
198
  BASE_URL: config.base ?? "/",
@@ -199,6 +200,11 @@ function productionImportMetaEnv(config) {
199
200
  PROD: true,
200
201
  SSR: false
201
202
  };
203
+ if (!env.VITE_SUPABASE_PROJECT_ID) {
204
+ const ref = readSupabaseProjectRef(config.root);
205
+ if (ref) env.VITE_SUPABASE_PROJECT_ID = ref;
206
+ }
207
+ return env;
202
208
  }
203
209
  /**
204
210
  * Vite plugin that emits the Supabase Edge Function entry (and its
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_cors = require("../../cors-CTtLtFQR.cjs");
3
- const require_mcp = require("../../mcp-CQGMfpLc.cjs");
2
+ const require_cors = require("../../cors-Y_FmMkXK.cjs");
3
+ const require_mcp = require("../../mcp-_a39WlhN.cjs");
4
4
  const require_protocols_oauth_metadata = require("../../protocols/oauth-metadata.cjs");
5
- const require_list_tools = require("../../list-tools-YHIrPuuR.cjs");
6
- const require_rest = require("../../rest-Cp3jPs0S.cjs");
5
+ const require_list_tools = require("../../list-tools-BeVzrTT-.cjs");
6
+ const require_rest = require("../../rest-C9kWgxK5.cjs");
7
7
  const require_forwarded = require("../../forwarded-Pi8Hs5Ps.cjs");
8
8
  //#region src/stacks/tanstack/handlers.ts
9
9
  const STACK = "tanstack";
@@ -1,8 +1,8 @@
1
- import { l as createRecorderForRuntime } from "../../cors-CJct3BEI.js";
2
- import { t as createMcpProtocolHandler } from "../../mcp-DzSswp-q.js";
1
+ import { l as createRecorderForRuntime } from "../../cors-Ftb-tw1d.js";
2
+ import { t as createMcpProtocolHandler } from "../../mcp-BarAJ9N0.js";
3
3
  import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
4
- import { n as createListToolsHandler } from "../../list-tools--Kx40Dg2.js";
5
- import { t as createInvokeToolHandler } from "../../rest-BVBQmkWy.js";
4
+ import { n as createListToolsHandler } from "../../list-tools-BrSIMpBi.js";
5
+ import { t as createInvokeToolHandler } from "../../rest-Be8uOb6r.js";
6
6
  import { t as applyForwardedOrigin } from "../../forwarded--h4efJy-.js";
7
7
  //#region src/stacks/tanstack/handlers.ts
8
8
  const STACK = "tanstack";
@@ -4,9 +4,12 @@ Object.defineProperties(exports, {
4
4
  });
5
5
  require("../../metadata-path-zd7NSNoa.cjs");
6
6
  const require_fs_errors = require("../../fs-errors-CWNzOV75.cjs");
7
+ const require_supabase_config = require("../../supabase-config-Dz7dnUv0.cjs");
7
8
  let node_fs = require("node:fs");
8
9
  let node_path = require("node:path");
10
+ let vite = require("vite");
9
11
  //#region src/stacks/tanstack/vite.ts
12
+ const SUPABASE_PROJECT_REF_ENV = "VITE_SUPABASE_PROJECT_ID";
10
13
  const GENERATED_BANNER = "// AUTO-GENERATED by @lovable.dev/mcp-js — do not edit. Regenerated by the Vite plugin.\n// To take ownership, delete this banner line; the plugin then leaves the file alone.";
11
14
  function normalizePath(p) {
12
15
  return p.split(node_path.sep).join("/");
@@ -241,6 +244,13 @@ function mcpPlugin(options = {}) {
241
244
  return urlPath;
242
245
  }
243
246
  },
247
+ config(userConfig, { mode }) {
248
+ const root = userConfig.root ? (0, node_path.resolve)(userConfig.root) : process.cwd();
249
+ if ((0, vite.loadEnv)(mode, typeof userConfig.envDir === "string" ? (0, node_path.resolve)(root, userConfig.envDir) : root, userConfig.envPrefix ?? "VITE_")[SUPABASE_PROJECT_REF_ENV]) return;
250
+ const ref = require_supabase_config.readSupabaseProjectRef(root);
251
+ if (!ref) return;
252
+ return { define: { [`import.meta.env.${SUPABASE_PROJECT_REF_ENV}`]: JSON.stringify(ref) } };
253
+ },
244
254
  configResolved(config) {
245
255
  projectRoot = config.root;
246
256
  mcpEntry = (0, node_path.resolve)(projectRoot, mcpEntryOption);
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-DPYvBqET.cjs";
1
+ import { t as McpPluginApi } from "../../io-BIvFmJK1.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-Bi7DYgft.js";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/tanstack/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -1,8 +1,11 @@
1
1
  import "../../metadata-path-CAkNcfyY.js";
2
2
  import { t as isFileMissing } from "../../fs-errors-PA2t1TIp.js";
3
+ import { t as readSupabaseProjectRef } from "../../supabase-config-CakTU8YF.js";
3
4
  import { lstatSync, mkdirSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
4
5
  import { dirname, join, relative, resolve, sep } from "node:path";
6
+ import { loadEnv } from "vite";
5
7
  //#region src/stacks/tanstack/vite.ts
8
+ const SUPABASE_PROJECT_REF_ENV = "VITE_SUPABASE_PROJECT_ID";
6
9
  const GENERATED_BANNER = "// AUTO-GENERATED by @lovable.dev/mcp-js — do not edit. Regenerated by the Vite plugin.\n// To take ownership, delete this banner line; the plugin then leaves the file alone.";
7
10
  function normalizePath(p) {
8
11
  return p.split(sep).join("/");
@@ -237,6 +240,13 @@ function mcpPlugin(options = {}) {
237
240
  return urlPath;
238
241
  }
239
242
  },
243
+ config(userConfig, { mode }) {
244
+ const root = userConfig.root ? resolve(userConfig.root) : process.cwd();
245
+ if (loadEnv(mode, typeof userConfig.envDir === "string" ? resolve(root, userConfig.envDir) : root, userConfig.envPrefix ?? "VITE_")[SUPABASE_PROJECT_REF_ENV]) return;
246
+ const ref = readSupabaseProjectRef(root);
247
+ if (!ref) return;
248
+ return { define: { [`import.meta.env.${SUPABASE_PROJECT_REF_ENV}`]: JSON.stringify(ref) } };
249
+ },
240
250
  configResolved(config) {
241
251
  projectRoot = config.root;
242
252
  mcpEntry = resolve(projectRoot, mcpEntryOption);
@@ -0,0 +1,26 @@
1
+ import { t as isFileMissing } from "./fs-errors-PA2t1TIp.js";
2
+ import { readFileSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ //#region src/core/supabase-config.ts
5
+ const SUPABASE_CONFIG_RELATIVE_PATH = "supabase/config.toml";
6
+ function readSupabaseProjectRef(projectRoot) {
7
+ let content;
8
+ try {
9
+ content = readFileSync(join(projectRoot, SUPABASE_CONFIG_RELATIVE_PATH), "utf8");
10
+ } catch (err) {
11
+ if (isFileMissing(err)) return void 0;
12
+ throw err;
13
+ }
14
+ for (const raw of content.split(/\r?\n/)) {
15
+ const line = raw.trim();
16
+ if (line.length === 0 || line.startsWith("#")) continue;
17
+ if (line.startsWith("[")) break;
18
+ const match = /^project_id\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(line);
19
+ if (match) {
20
+ const value = match[1] ?? match[2] ?? "";
21
+ return value.length > 0 ? value : void 0;
22
+ }
23
+ }
24
+ }
25
+ //#endregion
26
+ export { readSupabaseProjectRef as t };
@@ -0,0 +1,31 @@
1
+ const require_fs_errors = require("./fs-errors-CWNzOV75.cjs");
2
+ let node_fs = require("node:fs");
3
+ let node_path = require("node:path");
4
+ //#region src/core/supabase-config.ts
5
+ const SUPABASE_CONFIG_RELATIVE_PATH = "supabase/config.toml";
6
+ function readSupabaseProjectRef(projectRoot) {
7
+ let content;
8
+ try {
9
+ content = (0, node_fs.readFileSync)((0, node_path.join)(projectRoot, SUPABASE_CONFIG_RELATIVE_PATH), "utf8");
10
+ } catch (err) {
11
+ if (require_fs_errors.isFileMissing(err)) return void 0;
12
+ throw err;
13
+ }
14
+ for (const raw of content.split(/\r?\n/)) {
15
+ const line = raw.trim();
16
+ if (line.length === 0 || line.startsWith("#")) continue;
17
+ if (line.startsWith("[")) break;
18
+ const match = /^project_id\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(line);
19
+ if (match) {
20
+ const value = match[1] ?? match[2] ?? "";
21
+ return value.length > 0 ? value : void 0;
22
+ }
23
+ }
24
+ }
25
+ //#endregion
26
+ Object.defineProperty(exports, "readSupabaseProjectRef", {
27
+ enumerable: true,
28
+ get: function() {
29
+ return readSupabaseProjectRef;
30
+ }
31
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/mcp-js",
3
- "version": "0.22.2",
3
+ "version": "0.24.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": {
@@ -127,7 +127,7 @@
127
127
  "@types/node": "22.13.13",
128
128
  "rimraf": "^5.0.0",
129
129
  "tsdown": "^0.22.5",
130
- "typescript": "^5.9.3",
130
+ "typescript": "7.0.2",
131
131
  "vite": "^7.3.1",
132
132
  "vitest": "^4.1.5",
133
133
  "zod": "^4.1.13"