@lovable.dev/mcp-js 0.30.0-rc.0 → 1.0.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 (57) hide show
  1. package/README.internal.md +3 -3
  2. package/README.md +2 -25
  3. package/dist/{cors-5P69YRDK.js → authorize-9wHgaqeQ.js} +28 -79
  4. package/dist/{authorize-DNUlPT7k.d.ts → authorize-CqYsQYfa.d.ts} +1 -1
  5. package/dist/{cors-DIQIXIHY.cjs → authorize-DBk5GkN_.cjs} +33 -90
  6. package/dist/{authorize-9hTTG-qJ.d.cts → authorize-DIYS7zBP.d.cts} +1 -1
  7. package/dist/cli/extract-manifest.cjs +12 -7
  8. package/dist/cli/extract-manifest.js +12 -7
  9. package/dist/{errors-Cr95rSkB.cjs → errors-CN6Da8iz.cjs} +8 -23
  10. package/dist/{errors-Bwd1L0Rf.js → errors-DSe96Ffd.js} +8 -23
  11. package/dist/forwarded-Bhwcj22u.cjs +48 -0
  12. package/dist/forwarded-BlLF3dfc.js +43 -0
  13. package/dist/index.cjs +1 -38
  14. package/dist/index.d.cts +3 -3
  15. package/dist/index.d.ts +3 -3
  16. package/dist/index.js +1 -38
  17. package/dist/{io-D_5cuaEL.d.ts → io-DP3icuxa.d.ts} +1 -1
  18. package/dist/{io-CDV3mud0.d.cts → io-Dx0nPc1-.d.cts} +1 -1
  19. package/dist/mcp-BDsG9I0t.js +174 -0
  20. package/dist/mcp-CS1MF39p.cjs +179 -0
  21. package/dist/{package-ZFJI6B7S.js → package-CLhOKbJP.js} +1 -1
  22. package/dist/{package-QViIguII.cjs → package-C_8WAZRS.cjs} +1 -1
  23. package/dist/protocols/mcp/index.cjs +1 -1
  24. package/dist/protocols/mcp/index.d.cts +33 -3
  25. package/dist/protocols/mcp/index.d.ts +33 -3
  26. package/dist/protocols/mcp/index.js +1 -1
  27. package/dist/protocols/oauth-metadata.cjs +10 -27
  28. package/dist/protocols/oauth-metadata.d.cts +3 -4
  29. package/dist/protocols/oauth-metadata.d.ts +3 -4
  30. package/dist/protocols/oauth-metadata.js +4 -21
  31. package/dist/stacks/supabase/index.cjs +6 -6
  32. package/dist/stacks/supabase/index.d.cts +1 -1
  33. package/dist/stacks/supabase/index.d.ts +1 -1
  34. package/dist/stacks/supabase/index.js +4 -4
  35. package/dist/stacks/supabase/vite.cjs +1 -1
  36. package/dist/stacks/supabase/vite.d.cts +1 -1
  37. package/dist/stacks/supabase/vite.d.ts +1 -1
  38. package/dist/stacks/supabase/vite.js +1 -1
  39. package/dist/stacks/tanstack/index.cjs +5 -5
  40. package/dist/stacks/tanstack/index.d.cts +2 -2
  41. package/dist/stacks/tanstack/index.d.ts +2 -2
  42. package/dist/stacks/tanstack/index.js +4 -4
  43. package/dist/stacks/tanstack/vite.cjs +4 -8
  44. package/dist/stacks/tanstack/vite.d.cts +1 -4
  45. package/dist/stacks/tanstack/vite.d.ts +1 -4
  46. package/dist/stacks/tanstack/vite.js +4 -8
  47. package/dist/{types-3CZPz364.d.cts → types-C0Wgm9zp.d.cts} +29 -65
  48. package/dist/{types-3CZPz364.d.ts → types-C0Wgm9zp.d.ts} +29 -65
  49. package/package.json +1 -5
  50. package/dist/base-7cq6HCPO.d.ts +0 -36
  51. package/dist/base-CHNFFrMG.d.cts +0 -36
  52. package/dist/forwarded-DG83ubwT.js +0 -26
  53. package/dist/forwarded-zNAIofM2.cjs +0 -31
  54. package/dist/mcp-Cb5SavFT.js +0 -348
  55. package/dist/mcp-Dq6dXUKT.cjs +0 -353
  56. package/dist/schema-CW1jKvio.js +0 -65
  57. package/dist/schema-D3vClxb7.cjs +0 -76
@@ -1,6 +1,36 @@
1
- import { d as McpDefinition } from "../../types-3CZPz364.cjs";
2
- import { t as MetricsRecorder } from "../../base-CHNFFrMG.cjs";
3
- import { t as McpRuntimeOptions } from "../../authorize-9hTTG-qJ.cjs";
1
+ import { c as McpDefinition } from "../../types-C0Wgm9zp.cjs";
2
+ import { t as McpRuntimeOptions } from "../../authorize-DIYS7zBP.cjs";
3
+ //#region src/metrics/impl/base.d.ts
4
+ type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "auth_challenge" | "auth_discovery_config_error" | "auth_discovery_unreachable" | "auth_jwks_config_error" | "auth_jwks_unreachable";
5
+ /** One recorded MCP call. Carries no arguments or response payloads — only the
6
+ * tool name, the JSON-RPC method, the result class, timing, and byte sizes.
7
+ * `errorText` is the sole exception: it is logged locally for debugging and
8
+ * deliberately never included in the OTLP payload (see `emit` / `buildLogsPayload`). */
9
+ interface InvocationRecord {
10
+ /** Tool name for `tools/call`; `null` for list/initialize, transport faults, and `authorize` records. */
11
+ tool: string | null;
12
+ /** JSON-RPC method, e.g. `tools/call`; `authorize` for records from the authorization gate. */
13
+ method: string;
14
+ outcome: InvocationOutcome;
15
+ durationMs: number;
16
+ reqBytes?: number;
17
+ resBytes?: number;
18
+ /** HTTP request method. Set on `auth_challenge` so probe traffic (GET vs
19
+ * POST discovery) is distinguishable; absent on tool-call records. */
20
+ httpMethod?: string;
21
+ /** The app end-user that made the call (the access token `sub`), or
22
+ * `undefined` when the request is unauthenticated. Not a Lovable identity. */
23
+ endUserId?: string;
24
+ /** Caller-visible `isError` text (`tool_error`) or a bounded internal-exception
25
+ * summary (`handler_error`). Local log only — never sent to the collector. */
26
+ errorText?: string;
27
+ }
28
+ /** A per-request telemetry recorder. `emit` logs the invocation and sends it as a
29
+ * single OTLP POST, awaited so it lands before the request ends. */
30
+ interface MetricsRecorder {
31
+ emit(ev: InvocationRecord): Promise<void>;
32
+ }
33
+ //#endregion
4
34
  //#region src/protocols/mcp/protocol.d.ts
5
35
  type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
6
36
  /**
@@ -1,6 +1,36 @@
1
- import { d as McpDefinition } from "../../types-3CZPz364.js";
2
- import { t as MetricsRecorder } from "../../base-7cq6HCPO.js";
3
- import { t as McpRuntimeOptions } from "../../authorize-DNUlPT7k.js";
1
+ import { c as McpDefinition } from "../../types-C0Wgm9zp.js";
2
+ import { t as McpRuntimeOptions } from "../../authorize-CqYsQYfa.js";
3
+ //#region src/metrics/impl/base.d.ts
4
+ type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "auth_challenge" | "auth_discovery_config_error" | "auth_discovery_unreachable" | "auth_jwks_config_error" | "auth_jwks_unreachable";
5
+ /** One recorded MCP call. Carries no arguments or response payloads — only the
6
+ * tool name, the JSON-RPC method, the result class, timing, and byte sizes.
7
+ * `errorText` is the sole exception: it is logged locally for debugging and
8
+ * deliberately never included in the OTLP payload (see `emit` / `buildLogsPayload`). */
9
+ interface InvocationRecord {
10
+ /** Tool name for `tools/call`; `null` for list/initialize, transport faults, and `authorize` records. */
11
+ tool: string | null;
12
+ /** JSON-RPC method, e.g. `tools/call`; `authorize` for records from the authorization gate. */
13
+ method: string;
14
+ outcome: InvocationOutcome;
15
+ durationMs: number;
16
+ reqBytes?: number;
17
+ resBytes?: number;
18
+ /** HTTP request method. Set on `auth_challenge` so probe traffic (GET vs
19
+ * POST discovery) is distinguishable; absent on tool-call records. */
20
+ httpMethod?: string;
21
+ /** The app end-user that made the call (the access token `sub`), or
22
+ * `undefined` when the request is unauthenticated. Not a Lovable identity. */
23
+ endUserId?: string;
24
+ /** Caller-visible `isError` text (`tool_error`) or a bounded internal-exception
25
+ * summary (`handler_error`). Local log only — never sent to the collector. */
26
+ errorText?: string;
27
+ }
28
+ /** A per-request telemetry recorder. `emit` logs the invocation and sends it as a
29
+ * single OTLP POST, awaited so it lands before the request ends. */
30
+ interface MetricsRecorder {
31
+ emit(ev: InvocationRecord): Promise<void>;
32
+ }
33
+ //#endregion
4
34
  //#region src/protocols/mcp/protocol.d.ts
5
35
  type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
6
36
  /**
@@ -1,2 +1,2 @@
1
- import { t as createMcpProtocolHandler } from "../../mcp-Cb5SavFT.js";
1
+ import { t as createMcpProtocolHandler } from "../../mcp-BDsG9I0t.js";
2
2
  export { createMcpProtocolHandler };
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_logger = require("../logger-CN1q-KNn.cjs");
3
- const require_cors = require("../cors-DIQIXIHY.cjs");
3
+ const require_authorize = require("../authorize-DBk5GkN_.cjs");
4
4
  //#region src/protocols/oauth-metadata.ts
5
5
  function notFound() {
6
6
  return new Response(JSON.stringify({ error: "not found" }), {
7
7
  status: 404,
8
8
  headers: {
9
- ...require_cors.JSON_HEADERS,
9
+ ...require_authorize.JSON_HEADERS,
10
10
  "Cache-Control": "no-store"
11
11
  }
12
12
  });
@@ -14,7 +14,7 @@ function notFound() {
14
14
  async function buildProtectedResourceMetadata(mcp, auth, request, options, discovery) {
15
15
  const issuer = await discovery.resolveIssuer();
16
16
  const body = {
17
- resource: require_cors.resolveProtectedResource(auth, request, options),
17
+ resource: require_authorize.resolveProtectedResource(auth, request, options),
18
18
  authorization_servers: [issuer],
19
19
  bearer_methods_supported: ["header"],
20
20
  resource_name: auth.resourceName ?? mcp.title,
@@ -24,7 +24,7 @@ async function buildProtectedResourceMetadata(mcp, auth, request, options, disco
24
24
  return body;
25
25
  }
26
26
  function createOAuthProtectedResourceMetadataHandler(mcp, options = {}) {
27
- const runtime = require_cors.getOAuthRuntime(mcp, options);
27
+ const runtime = require_authorize.getOAuthRuntime(mcp, options);
28
28
  if (runtime.kind === "configured" && runtime.auth.protectedResourceMetadataUrl === void 0 && runtime.auth.resource === void 0) {
29
29
  if (runtime.options.resourcePath === void 0) throw new Error(`@lovable.dev/mcp-js: auth.resource or a resourcePath is required so the protected-resource metadata doesn't advertise the well-known URL as the resource`);
30
30
  if (runtime.options.trustForwardedHost === true && runtime.options.forwardedHostTrustedByPlatform !== true) require_logger.log.warn("oauth.metadata.host_derived_resource", { detail: "trustForwardedHost is on and auth.resource is unpinned; the advertised resource follows X-Forwarded-Host. Pin auth.resource unless a trusted proxy overwrites that header." });
@@ -35,9 +35,9 @@ function createOAuthProtectedResourceMetadataHandler(mcp, options = {}) {
35
35
  const vary = varyHeaders.join(", ");
36
36
  const respond = async (request) => {
37
37
  if (runtime.kind !== "configured" || runtime.auth.protectedResourceMetadataUrl !== void 0) return notFound();
38
- if (request.method !== "GET" && request.method !== "HEAD") return require_cors.methodNotAllowed("GET, HEAD, OPTIONS");
38
+ if (request.method !== "GET" && request.method !== "HEAD") return require_authorize.methodNotAllowed("GET, HEAD, OPTIONS");
39
39
  const headers = {
40
- ...require_cors.JSON_HEADERS,
40
+ ...require_authorize.JSON_HEADERS,
41
41
  "Cache-Control": "public, max-age=300",
42
42
  Vary: vary
43
43
  };
@@ -49,29 +49,12 @@ function createOAuthProtectedResourceMetadataHandler(mcp, options = {}) {
49
49
  ...require_logger.describeError(err),
50
50
  outcome: "500 oauth configuration error"
51
51
  });
52
- return require_cors.oauthConfigurationErrorResponse();
52
+ return require_authorize.oauthConfigurationErrorResponse();
53
53
  }
54
54
  };
55
- return async (request, recorder = require_cors.createNoopRecorder()) => {
56
- const cors = require_cors.evaluateCors(request, mcp.allowedOrigins);
57
- if (!cors.ok) {
58
- const httpMethod = require_cors.normalizeHttpMethod(request.method);
59
- require_logger.log.info("cors.origin_rejected", {
60
- origin: request.headers.get("Origin"),
61
- httpMethod,
62
- route: "oauth-metadata"
63
- });
64
- await recorder.emit({
65
- tool: null,
66
- method: "authorize",
67
- outcome: "origin_rejected",
68
- httpMethod,
69
- durationMs: 0
70
- });
71
- return require_cors.finalizeWireResponse(request, cors.response);
72
- }
73
- if (request.method === "OPTIONS") return cors.preflight("GET, HEAD, OPTIONS");
74
- return require_cors.finalizeWireResponse(request, cors.withHeaders(await respond(request)));
55
+ return async (request) => {
56
+ if (request.method === "OPTIONS") return require_authorize.corsPreflightResponse("GET, HEAD, OPTIONS");
57
+ return require_authorize.finalizeWireResponse(request, await respond(request));
75
58
  };
76
59
  }
77
60
  //#endregion
@@ -1,8 +1,7 @@
1
- import { d as McpDefinition } from "../types-3CZPz364.cjs";
2
- import { t as MetricsRecorder } from "../base-CHNFFrMG.cjs";
3
- import { t as McpRuntimeOptions } from "../authorize-9hTTG-qJ.cjs";
1
+ import { c as McpDefinition } from "../types-C0Wgm9zp.cjs";
2
+ import { t as McpRuntimeOptions } from "../authorize-DIYS7zBP.cjs";
4
3
  //#region src/protocols/oauth-metadata.d.ts
5
- type OAuthProtectedResourceMetadataHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
4
+ type OAuthProtectedResourceMetadataHandler = (request: Request) => Promise<Response>;
6
5
  declare function createOAuthProtectedResourceMetadataHandler(mcp: McpDefinition, options?: McpRuntimeOptions): OAuthProtectedResourceMetadataHandler;
7
6
  //#endregion
8
7
  export { OAuthProtectedResourceMetadataHandler, createOAuthProtectedResourceMetadataHandler };
@@ -1,8 +1,7 @@
1
- import { d as McpDefinition } from "../types-3CZPz364.js";
2
- import { t as MetricsRecorder } from "../base-7cq6HCPO.js";
3
- import { t as McpRuntimeOptions } from "../authorize-DNUlPT7k.js";
1
+ import { c as McpDefinition } from "../types-C0Wgm9zp.js";
2
+ import { t as McpRuntimeOptions } from "../authorize-CqYsQYfa.js";
4
3
  //#region src/protocols/oauth-metadata.d.ts
5
- type OAuthProtectedResourceMetadataHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
4
+ type OAuthProtectedResourceMetadataHandler = (request: Request) => Promise<Response>;
6
5
  declare function createOAuthProtectedResourceMetadataHandler(mcp: McpDefinition, options?: McpRuntimeOptions): OAuthProtectedResourceMetadataHandler;
7
6
  //#endregion
8
7
  export { OAuthProtectedResourceMetadataHandler, createOAuthProtectedResourceMetadataHandler };
@@ -1,5 +1,5 @@
1
1
  import { i as log, r as describeError } from "../logger-Ctv5xUSD.js";
2
- import { a as oauthConfigurationErrorResponse, d as JSON_HEADERS, f as finalizeWireResponse, i as normalizeHttpMethod, l as createNoopRecorder, p as methodNotAllowed, r as getOAuthRuntime, s as resolveProtectedResource, t as evaluateCors } from "../cors-5P69YRDK.js";
2
+ import { a as resolveProtectedResource, d as methodNotAllowed, f as corsPreflightResponse, l as JSON_HEADERS, n as getOAuthRuntime, r as oauthConfigurationErrorResponse, u as finalizeWireResponse } from "../authorize-9wHgaqeQ.js";
3
3
  //#region src/protocols/oauth-metadata.ts
4
4
  function notFound() {
5
5
  return new Response(JSON.stringify({ error: "not found" }), {
@@ -51,26 +51,9 @@ function createOAuthProtectedResourceMetadataHandler(mcp, options = {}) {
51
51
  return oauthConfigurationErrorResponse();
52
52
  }
53
53
  };
54
- return async (request, recorder = createNoopRecorder()) => {
55
- const cors = evaluateCors(request, mcp.allowedOrigins);
56
- if (!cors.ok) {
57
- const httpMethod = normalizeHttpMethod(request.method);
58
- log.info("cors.origin_rejected", {
59
- origin: request.headers.get("Origin"),
60
- httpMethod,
61
- route: "oauth-metadata"
62
- });
63
- await recorder.emit({
64
- tool: null,
65
- method: "authorize",
66
- outcome: "origin_rejected",
67
- httpMethod,
68
- durationMs: 0
69
- });
70
- return finalizeWireResponse(request, cors.response);
71
- }
72
- if (request.method === "OPTIONS") return cors.preflight("GET, HEAD, OPTIONS");
73
- return finalizeWireResponse(request, cors.withHeaders(await respond(request)));
54
+ return async (request) => {
55
+ if (request.method === "OPTIONS") return corsPreflightResponse("GET, HEAD, OPTIONS");
56
+ return finalizeWireResponse(request, await respond(request));
74
57
  };
75
58
  }
76
59
  //#endregion
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_logger = require("../../logger-CN1q-KNn.cjs");
3
- const require_cors = require("../../cors-DIQIXIHY.cjs");
3
+ const require_authorize = require("../../authorize-DBk5GkN_.cjs");
4
4
  const require_metadata_path = require("../../metadata-path-zd7NSNoa.cjs");
5
- const require_mcp = require("../../mcp-Dq6dXUKT.cjs");
5
+ const require_mcp = require("../../mcp-CS1MF39p.cjs");
6
6
  const require_protocols_oauth_metadata = require("../../protocols/oauth-metadata.cjs");
7
- const require_forwarded = require("../../forwarded-zNAIofM2.cjs");
7
+ const require_forwarded = require("../../forwarded-Bhwcj22u.cjs");
8
8
  const require_paths = require("../../paths-OP318a6c.cjs");
9
9
  //#region src/stacks/supabase/handler.ts
10
10
  function deriveResourcePath(options) {
@@ -29,7 +29,7 @@ function isMetadataPath(pathname) {
29
29
  */
30
30
  function createSupabaseHandler(mcp, options = {}) {
31
31
  const resourcePath = deriveResourcePath(options);
32
- if (resourcePath !== void 0) require_cors.assertResourcePathShape(resourcePath);
32
+ if (resourcePath !== void 0) require_authorize.assertResourcePathShape(resourcePath);
33
33
  const servesOwnPrm = !(mcp.auth?.type === "oauth" && mcp.auth.protectedResourceMetadataUrl !== void 0);
34
34
  const metadataPath = resourcePath === void 0 || !servesOwnPrm ? void 0 : `${require_logger.trimTrailingSlash(resourcePath)}${require_metadata_path.OAUTH_PROTECTED_RESOURCE_METADATA_PATH}`;
35
35
  const runtimeOptions = {
@@ -44,8 +44,8 @@ function createSupabaseHandler(mcp, options = {}) {
44
44
  const metadataHandler = require_protocols_oauth_metadata.createOAuthProtectedResourceMetadataHandler(mcp, runtimeOptions);
45
45
  return async (request) => {
46
46
  const req = require_forwarded.applyForwardedOrigin(request, runtimeOptions);
47
- if (isMetadataPath(new URL(req.url).pathname)) return metadataHandler(req, require_cors.createRecorderForRuntime(mcp, { stack: "supabase" }));
48
- return mcpHandler(req, require_cors.createRecorderForRuntime(mcp, { stack: "supabase" }));
47
+ if (isMetadataPath(new URL(req.url).pathname)) return metadataHandler(req);
48
+ return mcpHandler(req, require_authorize.createRecorderForRuntime(mcp, { stack: "supabase" }));
49
49
  };
50
50
  }
51
51
  //#endregion
@@ -1,4 +1,4 @@
1
- import { d as McpDefinition } from "../../types-3CZPz364.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 { d as McpDefinition } from "../../types-3CZPz364.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,9 +1,9 @@
1
1
  import { s as trimTrailingSlash } from "../../logger-Ctv5xUSD.js";
2
- import { c as createRecorderForRuntime, o as assertResourcePathShape } from "../../cors-5P69YRDK.js";
2
+ import { i as assertResourcePathShape, o as createRecorderForRuntime } from "../../authorize-9wHgaqeQ.js";
3
3
  import { t as OAUTH_PROTECTED_RESOURCE_METADATA_PATH } from "../../metadata-path-CAkNcfyY.js";
4
- import { t as createMcpProtocolHandler } from "../../mcp-Cb5SavFT.js";
4
+ import { t as createMcpProtocolHandler } from "../../mcp-BDsG9I0t.js";
5
5
  import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
6
- import { t as applyForwardedOrigin } from "../../forwarded-DG83ubwT.js";
6
+ import { t as applyForwardedOrigin } from "../../forwarded-BlLF3dfc.js";
7
7
  import { n as assertFunctionName, t as FUNCTIONS_MOUNT_PREFIX } from "../../paths-IS65L6TA.js";
8
8
  //#region src/stacks/supabase/handler.ts
9
9
  function deriveResourcePath(options) {
@@ -43,7 +43,7 @@ function createSupabaseHandler(mcp, options = {}) {
43
43
  const metadataHandler = createOAuthProtectedResourceMetadataHandler(mcp, runtimeOptions);
44
44
  return async (request) => {
45
45
  const req = applyForwardedOrigin(request, runtimeOptions);
46
- if (isMetadataPath(new URL(req.url).pathname)) return metadataHandler(req, createRecorderForRuntime(mcp, { stack: "supabase" }));
46
+ if (isMetadataPath(new URL(req.url).pathname)) return metadataHandler(req);
47
47
  return mcpHandler(req, createRecorderForRuntime(mcp, { stack: "supabase" }));
48
48
  };
49
49
  }
@@ -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-QViIguII.cjs");
5
+ const require_package = require("../../package-C_8WAZRS.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-CDV3mud0.cjs";
1
+ import { t as McpPluginApi } from "../../io-Dx0nPc1-.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-D_5cuaEL.js";
1
+ import { t as McpPluginApi } from "../../io-DP3icuxa.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-ZFJI6B7S.js";
1
+ import { t as version } from "../../package-CLhOKbJP.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,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_cors = require("../../cors-DIQIXIHY.cjs");
3
- const require_mcp = require("../../mcp-Dq6dXUKT.cjs");
2
+ const require_authorize = require("../../authorize-DBk5GkN_.cjs");
3
+ const require_mcp = require("../../mcp-CS1MF39p.cjs");
4
4
  const require_protocols_oauth_metadata = require("../../protocols/oauth-metadata.cjs");
5
- const require_forwarded = require("../../forwarded-zNAIofM2.cjs");
5
+ const require_forwarded = require("../../forwarded-Bhwcj22u.cjs");
6
6
  //#region src/stacks/tanstack/handlers.ts
7
7
  const STACK = "tanstack";
8
8
  /**
@@ -11,7 +11,7 @@ const STACK = "tanstack";
11
11
  */
12
12
  function createTanStackMcpHandler(mcp, options = {}) {
13
13
  const handler = require_mcp.createMcpProtocolHandler(mcp, options);
14
- return ({ request }) => handler(require_forwarded.applyForwardedOrigin(request, options), require_cors.createRecorderForRuntime(mcp, { stack: STACK }));
14
+ return ({ request }) => handler(require_forwarded.applyForwardedOrigin(request, options), require_authorize.createRecorderForRuntime(mcp, { stack: STACK }));
15
15
  }
16
16
  /**
17
17
  * Build a TanStack Start handler for `GET /.well-known/oauth-protected-resource`.
@@ -19,7 +19,7 @@ function createTanStackMcpHandler(mcp, options = {}) {
19
19
  */
20
20
  function createTanStackOAuthProtectedResourceMetadataHandler(mcp, options = {}) {
21
21
  const handler = require_protocols_oauth_metadata.createOAuthProtectedResourceMetadataHandler(mcp, options);
22
- return ({ request }) => handler(require_forwarded.applyForwardedOrigin(request, options), require_cors.createRecorderForRuntime(mcp, { stack: STACK }));
22
+ return ({ request }) => handler(require_forwarded.applyForwardedOrigin(request, options));
23
23
  }
24
24
  //#endregion
25
25
  exports.createTanStackMcpHandler = createTanStackMcpHandler;
@@ -1,5 +1,5 @@
1
- import { d as McpDefinition } from "../../types-3CZPz364.cjs";
2
- import { t as McpRuntimeOptions } from "../../authorize-9hTTG-qJ.cjs";
1
+ import { c as McpDefinition } from "../../types-C0Wgm9zp.cjs";
2
+ import { t as McpRuntimeOptions } from "../../authorize-DIYS7zBP.cjs";
3
3
  //#region src/stacks/tanstack/handlers.d.ts
4
4
  interface TanStackRouteCtx {
5
5
  request: Request;
@@ -1,5 +1,5 @@
1
- import { d as McpDefinition } from "../../types-3CZPz364.js";
2
- import { t as McpRuntimeOptions } from "../../authorize-DNUlPT7k.js";
1
+ import { c as McpDefinition } from "../../types-C0Wgm9zp.js";
2
+ import { t as McpRuntimeOptions } from "../../authorize-CqYsQYfa.js";
3
3
  //#region src/stacks/tanstack/handlers.d.ts
4
4
  interface TanStackRouteCtx {
5
5
  request: Request;
@@ -1,7 +1,7 @@
1
- import { c as createRecorderForRuntime } from "../../cors-5P69YRDK.js";
2
- import { t as createMcpProtocolHandler } from "../../mcp-Cb5SavFT.js";
1
+ import { o as createRecorderForRuntime } from "../../authorize-9wHgaqeQ.js";
2
+ import { t as createMcpProtocolHandler } from "../../mcp-BDsG9I0t.js";
3
3
  import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
4
- import { t as applyForwardedOrigin } from "../../forwarded-DG83ubwT.js";
4
+ import { t as applyForwardedOrigin } from "../../forwarded-BlLF3dfc.js";
5
5
  //#region src/stacks/tanstack/handlers.ts
6
6
  const STACK = "tanstack";
7
7
  /**
@@ -18,7 +18,7 @@ function createTanStackMcpHandler(mcp, options = {}) {
18
18
  */
19
19
  function createTanStackOAuthProtectedResourceMetadataHandler(mcp, options = {}) {
20
20
  const handler = createOAuthProtectedResourceMetadataHandler(mcp, options);
21
- return ({ request }) => handler(applyForwardedOrigin(request, options), createRecorderForRuntime(mcp, { stack: STACK }));
21
+ return ({ request }) => handler(applyForwardedOrigin(request, options));
22
22
  }
23
23
  //#endregion
24
24
  export { createTanStackMcpHandler, createTanStackOAuthProtectedResourceMetadataHandler };
@@ -64,16 +64,13 @@ function relativeImportSpecifier(routeFile, target) {
64
64
  const withoutExt = normalizePath((0, node_path.relative)((0, node_path.dirname)(routeFile), target)).replace(/\.ts$/, "");
65
65
  return withoutExt.startsWith(".") ? withoutExt : `./${withoutExt}`;
66
66
  }
67
- function buildRouteSource(route, resourcePath, metadataPath, trustForwardedHost, trustForwardedProto, mcpEntry, projectRoot) {
67
+ function buildRouteSource(route, resourcePath, metadataPath, trustForwardedHost, mcpEntry, projectRoot) {
68
68
  const mcpImport = relativeImportSpecifier(route.file, mcpEntry);
69
69
  const routeRel = normalizePath((0, node_path.relative)(projectRoot, route.file));
70
70
  const optionEntries = [`resourcePath: "${resourcePath}"`];
71
71
  if (metadataPath !== void 0) optionEntries.push(`metadataPath: "${metadataPath}"`);
72
- if (trustForwardedHost) if (route.attestsForwardedHost) {
73
- const trustNote = trustForwardedProto ? "// Trusting X-Forwarded-Host/-Proto is safe on Lovable hosting only (its\n // proxies overwrite both headers); remove these options behind other proxies." : "// Trusting X-Forwarded-Host is safe on Lovable hosting only (its proxy\n // overwrites the header); remove both options behind other proxies.";
74
- optionEntries.push(`${trustNote}\n trustForwardedHost: true`, "forwardedHostTrustedByPlatform: true");
75
- } else optionEntries.push("trustForwardedHost: true");
76
- if (trustForwardedProto) optionEntries.push("trustForwardedProto: true");
72
+ if (trustForwardedHost) if (route.attestsForwardedHost) optionEntries.push("// Trusting X-Forwarded-Host is safe on Lovable hosting only (its proxy\n // overwrites the header); remove both options behind other proxies.\n trustForwardedHost: true", "forwardedHostTrustedByPlatform: true");
73
+ else optionEntries.push("trustForwardedHost: true");
77
74
  const optionsObject = `{\n${optionEntries.map((entry) => ` ${entry},`).join("\n")}\n }`;
78
75
  const inlineRouteOpen = `export const Route = createFileRoute("${route.routeLiteral}")({`;
79
76
  const routeOpen = inlineRouteOpen.length <= OXFMT_PRINT_WIDTH ? inlineRouteOpen : `export const Route = createFileRoute(\n "${route.routeLiteral}",\n)({`;
@@ -179,7 +176,6 @@ function mcpPlugin(options = {}) {
179
176
  const metadataUrlPath = canonicalUrlPath(options.metadataPath ?? "/.well-known/oauth-protected-resource");
180
177
  const injectedMetadataPath = emitProtectedResourceMetadataRoute ? metadataUrlPath : void 0;
181
178
  const trustForwardedHost = options.trustForwardedHost !== false;
182
- const trustForwardedProto = options.trustForwardedProto !== false;
183
179
  let projectRoot = process.cwd();
184
180
  let mcpEntry = (0, node_path.resolve)(projectRoot, mcpEntryOption);
185
181
  let { routesDir, mcpRouteFile, metadataRouteFile } = resolveAllRoutes(projectRoot, routesDirOption, routeFileName, metadataUrlPath);
@@ -206,7 +202,7 @@ function mcpPlugin(options = {}) {
206
202
  });
207
203
  for (const route of routes) {
208
204
  expected.add(route.file);
209
- writeIfChanged(route.file, buildRouteSource(route, urlPath, injectedMetadataPath, trustForwardedHost, trustForwardedProto, mcpEntry, projectRoot));
205
+ writeIfChanged(route.file, buildRouteSource(route, urlPath, injectedMetadataPath, trustForwardedHost, mcpEntry, projectRoot));
210
206
  }
211
207
  }
212
208
  for (const file of findAdoptedFiles(routesDir)) if (!expected.has(file)) try {
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-CDV3mud0.cjs";
1
+ import { t as McpPluginApi } from "../../io-Dx0nPc1-.cjs";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/tanstack/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -57,9 +57,6 @@ interface McpPluginOptions {
57
57
  * @default true
58
58
  */
59
59
  trustForwardedHost?: boolean;
60
- /** Derive the public scheme from `X-Forwarded-Proto`; safe only behind an
61
- * overwriting proxy. @default true */
62
- trustForwardedProto?: boolean;
63
60
  }
64
61
  declare function assertUrlPathShape(urlPath: string): string;
65
62
  declare function deriveRouteFileName(urlPath: string): string;
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-D_5cuaEL.js";
1
+ import { t as McpPluginApi } from "../../io-DP3icuxa.js";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/tanstack/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -57,9 +57,6 @@ interface McpPluginOptions {
57
57
  * @default true
58
58
  */
59
59
  trustForwardedHost?: boolean;
60
- /** Derive the public scheme from `X-Forwarded-Proto`; safe only behind an
61
- * overwriting proxy. @default true */
62
- trustForwardedProto?: boolean;
63
60
  }
64
61
  declare function assertUrlPathShape(urlPath: string): string;
65
62
  declare function deriveRouteFileName(urlPath: string): string;
@@ -60,16 +60,13 @@ function relativeImportSpecifier(routeFile, target) {
60
60
  const withoutExt = normalizePath(relative(dirname(routeFile), target)).replace(/\.ts$/, "");
61
61
  return withoutExt.startsWith(".") ? withoutExt : `./${withoutExt}`;
62
62
  }
63
- function buildRouteSource(route, resourcePath, metadataPath, trustForwardedHost, trustForwardedProto, mcpEntry, projectRoot) {
63
+ function buildRouteSource(route, resourcePath, metadataPath, trustForwardedHost, mcpEntry, projectRoot) {
64
64
  const mcpImport = relativeImportSpecifier(route.file, mcpEntry);
65
65
  const routeRel = normalizePath(relative(projectRoot, route.file));
66
66
  const optionEntries = [`resourcePath: "${resourcePath}"`];
67
67
  if (metadataPath !== void 0) optionEntries.push(`metadataPath: "${metadataPath}"`);
68
- if (trustForwardedHost) if (route.attestsForwardedHost) {
69
- const trustNote = trustForwardedProto ? "// Trusting X-Forwarded-Host/-Proto is safe on Lovable hosting only (its\n // proxies overwrite both headers); remove these options behind other proxies." : "// Trusting X-Forwarded-Host is safe on Lovable hosting only (its proxy\n // overwrites the header); remove both options behind other proxies.";
70
- optionEntries.push(`${trustNote}\n trustForwardedHost: true`, "forwardedHostTrustedByPlatform: true");
71
- } else optionEntries.push("trustForwardedHost: true");
72
- if (trustForwardedProto) optionEntries.push("trustForwardedProto: true");
68
+ if (trustForwardedHost) if (route.attestsForwardedHost) optionEntries.push("// Trusting X-Forwarded-Host is safe on Lovable hosting only (its proxy\n // overwrites the header); remove both options behind other proxies.\n trustForwardedHost: true", "forwardedHostTrustedByPlatform: true");
69
+ else optionEntries.push("trustForwardedHost: true");
73
70
  const optionsObject = `{\n${optionEntries.map((entry) => ` ${entry},`).join("\n")}\n }`;
74
71
  const inlineRouteOpen = `export const Route = createFileRoute("${route.routeLiteral}")({`;
75
72
  const routeOpen = inlineRouteOpen.length <= OXFMT_PRINT_WIDTH ? inlineRouteOpen : `export const Route = createFileRoute(\n "${route.routeLiteral}",\n)({`;
@@ -175,7 +172,6 @@ function mcpPlugin(options = {}) {
175
172
  const metadataUrlPath = canonicalUrlPath(options.metadataPath ?? "/.well-known/oauth-protected-resource");
176
173
  const injectedMetadataPath = emitProtectedResourceMetadataRoute ? metadataUrlPath : void 0;
177
174
  const trustForwardedHost = options.trustForwardedHost !== false;
178
- const trustForwardedProto = options.trustForwardedProto !== false;
179
175
  let projectRoot = process.cwd();
180
176
  let mcpEntry = resolve(projectRoot, mcpEntryOption);
181
177
  let { routesDir, mcpRouteFile, metadataRouteFile } = resolveAllRoutes(projectRoot, routesDirOption, routeFileName, metadataUrlPath);
@@ -202,7 +198,7 @@ function mcpPlugin(options = {}) {
202
198
  });
203
199
  for (const route of routes) {
204
200
  expected.add(route.file);
205
- writeIfChanged(route.file, buildRouteSource(route, urlPath, injectedMetadataPath, trustForwardedHost, trustForwardedProto, mcpEntry, projectRoot));
201
+ writeIfChanged(route.file, buildRouteSource(route, urlPath, injectedMetadataPath, trustForwardedHost, mcpEntry, projectRoot));
206
202
  }
207
203
  }
208
204
  for (const file of findAdoptedFiles(routesDir)) if (!expected.has(file)) try {