@lovable.dev/mcp-js 0.29.0-rc.2 → 0.29.0-rc.3

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 (45) hide show
  1. package/dist/{authorize-Cqr7Jps0.d.cts → authorize-9hTTG-qJ.d.cts} +1 -1
  2. package/dist/{authorize-Bpz8oxjF.d.ts → authorize-DNUlPT7k.d.ts} +1 -1
  3. package/dist/base-7cq6HCPO.d.ts +36 -0
  4. package/dist/base-CHNFFrMG.d.cts +36 -0
  5. package/dist/cli/extract-manifest.cjs +1 -1
  6. package/dist/cli/extract-manifest.js +1 -1
  7. package/dist/{cors-DNzLB6qa.cjs → cors-BDv7pyfD.cjs} +13 -5
  8. package/dist/{cors-C_VffY86.js → cors-kKiIJSyL.js} +8 -6
  9. package/dist/forwarded-Bnrwxbuj.js +25 -0
  10. package/dist/forwarded-OdBzzCMF.cjs +30 -0
  11. package/dist/index.d.cts +2 -2
  12. package/dist/index.d.ts +2 -2
  13. package/dist/{io-Bh_WpbxU.d.cts → io-CDV3mud0.d.cts} +1 -1
  14. package/dist/{io-DrHivYt0.d.ts → io-D_5cuaEL.d.ts} +1 -1
  15. package/dist/{mcp-CRdT2Fai.cjs → mcp-BSNdmnJl.cjs} +5 -3
  16. package/dist/{mcp-Bl7pQYdv.js → mcp-GT9WU7nd.js} +5 -3
  17. package/dist/{package-CYA-5C24.js → package-2ZppkCKf.js} +1 -1
  18. package/dist/{package-DNSwCau1.cjs → package-DAQNwT8T.cjs} +1 -1
  19. package/dist/protocols/mcp/index.cjs +1 -1
  20. package/dist/protocols/mcp/index.d.cts +3 -36
  21. package/dist/protocols/mcp/index.d.ts +3 -36
  22. package/dist/protocols/mcp/index.js +1 -1
  23. package/dist/protocols/oauth-metadata.cjs +18 -3
  24. package/dist/protocols/oauth-metadata.d.cts +4 -3
  25. package/dist/protocols/oauth-metadata.d.ts +4 -3
  26. package/dist/protocols/oauth-metadata.js +18 -3
  27. package/dist/stacks/supabase/index.cjs +4 -4
  28. package/dist/stacks/supabase/index.d.cts +1 -1
  29. package/dist/stacks/supabase/index.d.ts +1 -1
  30. package/dist/stacks/supabase/index.js +4 -4
  31. package/dist/stacks/supabase/vite.cjs +1 -1
  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 +1 -1
  35. package/dist/stacks/tanstack/index.cjs +4 -4
  36. package/dist/stacks/tanstack/index.d.cts +2 -2
  37. package/dist/stacks/tanstack/index.d.ts +2 -2
  38. package/dist/stacks/tanstack/index.js +4 -4
  39. package/dist/stacks/tanstack/vite.d.cts +1 -1
  40. package/dist/stacks/tanstack/vite.d.ts +1 -1
  41. package/dist/{types-DnGEKnvI.d.cts → types-3CZPz364.d.cts} +13 -8
  42. package/dist/{types-DnGEKnvI.d.ts → types-3CZPz364.d.ts} +13 -8
  43. package/package.json +1 -1
  44. package/dist/forwarded-B3EBjHnA.js +0 -43
  45. package/dist/forwarded-BC_RHnn5.cjs +0 -48
@@ -1,4 +1,4 @@
1
- import "./types-DnGEKnvI.cjs";
1
+ import "./types-3CZPz364.cjs";
2
2
  //#region src/auth/authorize.d.ts
3
3
  interface McpRuntimeOptions {
4
4
  /** Public MCP path OAuth resource/audience checks bind to when it differs from the request path. */
@@ -1,4 +1,4 @@
1
- import "./types-DnGEKnvI.js";
1
+ import "./types-3CZPz364.js";
2
2
  //#region src/auth/authorize.d.ts
3
3
  interface McpRuntimeOptions {
4
4
  /** Public MCP path OAuth resource/audience checks bind to when it differs from the request path. */
@@ -0,0 +1,36 @@
1
+ import { E as McpProtocolEra } from "./types-3CZPz364.js";
2
+ //#region src/metrics/impl/base.d.ts
3
+ type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "auth_challenge" | "origin_rejected" | "auth_discovery_config_error" | "auth_discovery_unreachable" | "auth_jwks_config_error" | "auth_jwks_unreachable";
4
+ /** One recorded MCP call. Carries no arguments or response payloads — only the
5
+ * tool name, the JSON-RPC method, the result class, timing, and byte sizes.
6
+ * `errorText` is the sole exception: it is logged locally for debugging and
7
+ * deliberately never included in the OTLP payload (see `emit` / `buildLogsPayload`). */
8
+ interface InvocationRecord {
9
+ /** Tool name for `tools/call`; `null` for list/initialize, transport faults, and `authorize` records. */
10
+ tool: string | null;
11
+ /** JSON-RPC method, e.g. `tools/call`; `authorize` for records from the authorization gate. */
12
+ method: string;
13
+ outcome: InvocationOutcome;
14
+ durationMs: number;
15
+ reqBytes?: number;
16
+ resBytes?: number;
17
+ /** HTTP request method. Set on `auth_challenge` so probe traffic (GET vs
18
+ * POST discovery) is distinguishable; absent on tool-call records. */
19
+ httpMethod?: string;
20
+ /** Wire surface that served the call; absent on records emitted before
21
+ * protocol classification (auth gate, transport faults). */
22
+ protocol?: McpProtocolEra;
23
+ /** The app end-user that made the call (the access token `sub`), or
24
+ * `undefined` when the request is unauthenticated. Not a Lovable identity. */
25
+ endUserId?: string;
26
+ /** Caller-visible `isError` text (`tool_error`) or a bounded internal-exception
27
+ * summary (`handler_error`). Local log only — never sent to the collector. */
28
+ errorText?: string;
29
+ }
30
+ /** A per-request telemetry recorder. `emit` logs the invocation and sends it as a
31
+ * single OTLP POST, awaited so it lands before the request ends. */
32
+ interface MetricsRecorder {
33
+ emit(ev: InvocationRecord): Promise<void>;
34
+ }
35
+ //#endregion
36
+ export { MetricsRecorder as t };
@@ -0,0 +1,36 @@
1
+ import { E as McpProtocolEra } from "./types-3CZPz364.cjs";
2
+ //#region src/metrics/impl/base.d.ts
3
+ type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "auth_challenge" | "origin_rejected" | "auth_discovery_config_error" | "auth_discovery_unreachable" | "auth_jwks_config_error" | "auth_jwks_unreachable";
4
+ /** One recorded MCP call. Carries no arguments or response payloads — only the
5
+ * tool name, the JSON-RPC method, the result class, timing, and byte sizes.
6
+ * `errorText` is the sole exception: it is logged locally for debugging and
7
+ * deliberately never included in the OTLP payload (see `emit` / `buildLogsPayload`). */
8
+ interface InvocationRecord {
9
+ /** Tool name for `tools/call`; `null` for list/initialize, transport faults, and `authorize` records. */
10
+ tool: string | null;
11
+ /** JSON-RPC method, e.g. `tools/call`; `authorize` for records from the authorization gate. */
12
+ method: string;
13
+ outcome: InvocationOutcome;
14
+ durationMs: number;
15
+ reqBytes?: number;
16
+ resBytes?: number;
17
+ /** HTTP request method. Set on `auth_challenge` so probe traffic (GET vs
18
+ * POST discovery) is distinguishable; absent on tool-call records. */
19
+ httpMethod?: string;
20
+ /** Wire surface that served the call; absent on records emitted before
21
+ * protocol classification (auth gate, transport faults). */
22
+ protocol?: McpProtocolEra;
23
+ /** The app end-user that made the call (the access token `sub`), or
24
+ * `undefined` when the request is unauthenticated. Not a Lovable identity. */
25
+ endUserId?: string;
26
+ /** Caller-visible `isError` text (`tool_error`) or a bounded internal-exception
27
+ * summary (`handler_error`). Local log only — never sent to the collector. */
28
+ errorText?: string;
29
+ }
30
+ /** A per-request telemetry recorder. `emit` logs the invocation and sends it as a
31
+ * single OTLP POST, awaited so it lands before the request ends. */
32
+ interface MetricsRecorder {
33
+ emit(ev: InvocationRecord): Promise<void>;
34
+ }
35
+ //#endregion
36
+ export { MetricsRecorder as t };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  const require_schema = require("../schema-D3vClxb7.cjs");
3
- const require_package = require("../package-DNSwCau1.cjs");
3
+ const require_package = require("../package-DAQNwT8T.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
2
  import { t as jsonSchemaFromDefinition } from "../schema-CW1jKvio.js";
3
- import { t as version } from "../package-CYA-5C24.js";
3
+ import { t as version } from "../package-2ZppkCKf.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
  const require_logger = require("./logger-CN1q-KNn.cjs");
2
- const require_package = require("./package-DNSwCau1.cjs");
2
+ const require_package = require("./package-DAQNwT8T.cjs");
3
3
  require("./metadata-path-zd7NSNoa.cjs");
4
4
  let jose = require("jose");
5
5
  //#region src/core/http.ts
@@ -28,7 +28,8 @@ function methodNotAllowed(allow) {
28
28
  //#endregion
29
29
  //#region src/metrics/otlp.ts
30
30
  const SCOPE_NAME = "@lovable.dev/mcp-js";
31
- const EVENT_NAME = "mcp.tool.invocation";
31
+ const TOOL_EVENT_NAME = "mcp.tool.invocation";
32
+ const GATE_EVENT_NAME = "mcp.gate.rejection";
32
33
  const SEVERITY_INFO = 9;
33
34
  function strAttr(key, value) {
34
35
  return {
@@ -43,8 +44,9 @@ function intAttr(key, value) {
43
44
  };
44
45
  }
45
46
  function toLogRecord(rec) {
47
+ const eventName = rec.method === "authorize" ? GATE_EVENT_NAME : TOOL_EVENT_NAME;
46
48
  const attributes = [
47
- strAttr("event.name", EVENT_NAME),
49
+ strAttr("event.name", eventName),
48
50
  strAttr("mcp.method", rec.method),
49
51
  strAttr("mcp.outcome", rec.outcome),
50
52
  intAttr("mcp.duration_ms", rec.durationMs)
@@ -61,7 +63,7 @@ function toLogRecord(rec) {
61
63
  observedTimeUnixNano: rec.timeUnixNano,
62
64
  severityNumber: SEVERITY_INFO,
63
65
  severityText: "INFO",
64
- body: { stringValue: EVENT_NAME },
66
+ body: { stringValue: eventName },
65
67
  attributes
66
68
  };
67
69
  }
@@ -151,7 +153,7 @@ var BaseMetricRecorder = class {
151
153
  }
152
154
  async emit(ev) {
153
155
  await this.applyLazyLogLevel();
154
- if (ev.outcome !== "auth_challenge") require_logger.log.info("tool.invoked", {
156
+ if (ev.outcome !== "auth_challenge") require_logger.log.info(ev.method === "authorize" ? "gate.rejected" : "tool.invoked", {
155
157
  tool: ev.tool,
156
158
  method: ev.method,
157
159
  outcome: ev.outcome,
@@ -1051,6 +1053,12 @@ Object.defineProperty(exports, "methodNotAllowed", {
1051
1053
  return methodNotAllowed;
1052
1054
  }
1053
1055
  });
1056
+ Object.defineProperty(exports, "normalizeHttpMethod", {
1057
+ enumerable: true,
1058
+ get: function() {
1059
+ return normalizeHttpMethod;
1060
+ }
1061
+ });
1054
1062
  Object.defineProperty(exports, "nowMs", {
1055
1063
  enumerable: true,
1056
1064
  get: function() {
@@ -1,5 +1,5 @@
1
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-Ctv5xUSD.js";
2
- import { t as version } from "./package-CYA-5C24.js";
2
+ import { t as version } from "./package-2ZppkCKf.js";
3
3
  import "./metadata-path-CAkNcfyY.js";
4
4
  import { createLocalJWKSet, decodeProtectedHeader, errors, jwtVerify } from "jose";
5
5
  //#region src/core/http.ts
@@ -28,7 +28,8 @@ function methodNotAllowed(allow) {
28
28
  //#endregion
29
29
  //#region src/metrics/otlp.ts
30
30
  const SCOPE_NAME = "@lovable.dev/mcp-js";
31
- const EVENT_NAME = "mcp.tool.invocation";
31
+ const TOOL_EVENT_NAME = "mcp.tool.invocation";
32
+ const GATE_EVENT_NAME = "mcp.gate.rejection";
32
33
  const SEVERITY_INFO = 9;
33
34
  function strAttr(key, value) {
34
35
  return {
@@ -43,8 +44,9 @@ function intAttr(key, value) {
43
44
  };
44
45
  }
45
46
  function toLogRecord(rec) {
47
+ const eventName = rec.method === "authorize" ? GATE_EVENT_NAME : TOOL_EVENT_NAME;
46
48
  const attributes = [
47
- strAttr("event.name", EVENT_NAME),
49
+ strAttr("event.name", eventName),
48
50
  strAttr("mcp.method", rec.method),
49
51
  strAttr("mcp.outcome", rec.outcome),
50
52
  intAttr("mcp.duration_ms", rec.durationMs)
@@ -61,7 +63,7 @@ function toLogRecord(rec) {
61
63
  observedTimeUnixNano: rec.timeUnixNano,
62
64
  severityNumber: SEVERITY_INFO,
63
65
  severityText: "INFO",
64
- body: { stringValue: EVENT_NAME },
66
+ body: { stringValue: eventName },
65
67
  attributes
66
68
  };
67
69
  }
@@ -151,7 +153,7 @@ var BaseMetricRecorder = class {
151
153
  }
152
154
  async emit(ev) {
153
155
  await this.applyLazyLogLevel();
154
- if (ev.outcome !== "auth_challenge") log.info("tool.invoked", {
156
+ if (ev.outcome !== "auth_challenge") log.info(ev.method === "authorize" ? "gate.rejected" : "tool.invoked", {
155
157
  tool: ev.tool,
156
158
  method: ev.method,
157
159
  outcome: ev.outcome,
@@ -997,4 +999,4 @@ function evaluateCors(request, allowedOrigins) {
997
999
  };
998
1000
  }
999
1001
  //#endregion
1000
- export { assertResourcePathShape as a, createNoopRecorder as c, finalizeWireResponse as d, methodNotAllowed as f, oauthConfigurationErrorResponse as i, nowMs as l, createRequestAuthorizer as n, resolveProtectedResource as o, getOAuthRuntime as r, createRecorderForRuntime as s, evaluateCors as t, JSON_HEADERS as u };
1002
+ export { oauthConfigurationErrorResponse as a, createRecorderForRuntime as c, JSON_HEADERS as d, finalizeWireResponse as f, normalizeHttpMethod as i, createNoopRecorder as l, createRequestAuthorizer as n, assertResourcePathShape as o, methodNotAllowed as p, getOAuthRuntime as r, resolveProtectedResource as s, evaluateCors as t, nowMs as u };
@@ -0,0 +1,25 @@
1
+ //#region src/core/forwarded.ts
2
+ /** Rewrites the request URL to the proxy-forwarded public origin so derived OAuth
3
+ * URLs name the client-facing host. Trust model: AGENTS.md § Forwarded-header trust model. */
4
+ function applyForwardedOrigin(request, options) {
5
+ const proto = options.trustForwardedProto ? firstForwardedValue(request, "x-forwarded-proto") : void 0;
6
+ const host = options.trustForwardedHost ? firstForwardedValue(request, "x-forwarded-host") : void 0;
7
+ if (proto === void 0 && host === void 0) return request;
8
+ const url = new URL(request.url);
9
+ let changed = false;
10
+ if (proto !== void 0 && `${proto}:` !== url.protocol) {
11
+ url.protocol = `${proto}:`;
12
+ changed = true;
13
+ }
14
+ if (host !== void 0 && host !== url.host) {
15
+ url.host = host;
16
+ changed = true;
17
+ }
18
+ return changed ? new Request(url.href, request) : request;
19
+ }
20
+ function firstForwardedValue(request, header) {
21
+ const value = request.headers.get(header)?.split(",")[0]?.trim();
22
+ return value ? value : void 0;
23
+ }
24
+ //#endregion
25
+ export { applyForwardedOrigin as t };
@@ -0,0 +1,30 @@
1
+ //#region src/core/forwarded.ts
2
+ /** Rewrites the request URL to the proxy-forwarded public origin so derived OAuth
3
+ * URLs name the client-facing host. Trust model: AGENTS.md § Forwarded-header trust model. */
4
+ function applyForwardedOrigin(request, options) {
5
+ const proto = options.trustForwardedProto ? firstForwardedValue(request, "x-forwarded-proto") : void 0;
6
+ const host = options.trustForwardedHost ? firstForwardedValue(request, "x-forwarded-host") : void 0;
7
+ if (proto === void 0 && host === void 0) return request;
8
+ const url = new URL(request.url);
9
+ let changed = false;
10
+ if (proto !== void 0 && `${proto}:` !== url.protocol) {
11
+ url.protocol = `${proto}:`;
12
+ changed = true;
13
+ }
14
+ if (host !== void 0 && host !== url.host) {
15
+ url.host = host;
16
+ changed = true;
17
+ }
18
+ return changed ? new Request(url.href, request) : request;
19
+ }
20
+ function firstForwardedValue(request, header) {
21
+ const value = request.headers.get(header)?.split(",")[0]?.trim();
22
+ return value ? value : void 0;
23
+ }
24
+ //#endregion
25
+ Object.defineProperty(exports, "applyForwardedOrigin", {
26
+ enumerable: true,
27
+ get: function() {
28
+ return applyForwardedOrigin;
29
+ }
30
+ });
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as MetricsOptions, D as JwtClaims, E as ToolContext, O as McpAuthConfig, S as MetricsConfig, T as ProgressUpdate, _ as ToolDefinition, a as EmbeddedResource, b as ZodRawShape, c as JsonValue, d as McpDefinitionInput, f as ResourceLink, g as ToolContent, h as ToolAnnotations, i as EmbeddedBlobResource, l as McpAllowedOrigins, m as TextContent, n as ContentAnnotations, o as EmbeddedTextResource, p as ResourceLinkIcon, r as ContentBlock, s as ImageContent, t as AudioContent, u as McpDefinition, v as ToolHandlerResult, w as McpClientInfo, x as ZodSchema, y as ZodOutputSchema } from "./types-DnGEKnvI.cjs";
1
+ import { A as McpAuthConfig, C as MetricsConfig, D as ProgressUpdate, E as McpProtocolEra, O as ToolContext, S as ZodSchema, T as McpClientInfo, _ as ToolContent, a as EmbeddedResource, b as ZodOutputSchema, c as JsonValue, d as McpDefinition, f as McpDefinitionInput, g as ToolAnnotations, h as TextContent, i as EmbeddedBlobResource, k as JwtClaims, l as JsonValueInput, m as ResourceLinkIcon, n as ContentAnnotations, o as EmbeddedTextResource, p as ResourceLink, r as ContentBlock, s as ImageContent, t as AudioContent, u as McpAllowedOrigins, v as ToolDefinition, w as MetricsOptions, x as ZodRawShape, y as ToolHandlerResult } from "./types-3CZPz364.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
@@ -71,4 +71,4 @@ type LogLevel = "silent" | "error" | "warn" | "info" | "debug";
71
71
  */
72
72
  declare function setLogLevel(level: LogLevel): LogLevel;
73
73
  //#endregion
74
- export { type AudioContent, type ContentAnnotations, type ContentBlock, type EmbeddedBlobResource, type EmbeddedResource, type EmbeddedTextResource, type ImageContent, type IssuerOAuthOptions, type JsonValue, type JwtClaims, type LogLevel, type McpAllowedOrigins, type McpClientInfo, type McpDefinitionInput, type MetricsConfig, type MetricsOptions, type ProgressUpdate, type ResourceLink, type ResourceLinkIcon, type TextContent, type ToolAnnotations, type ToolContent, ToolContext, type ToolDefinition, ToolError, type ToolHandlerResult, type ZodOutputSchema, type ZodRawShape, type ZodSchema, auth, defineMcp, defineTool, setLogLevel };
74
+ export { type AudioContent, type ContentAnnotations, type ContentBlock, type EmbeddedBlobResource, type EmbeddedResource, type EmbeddedTextResource, type ImageContent, type IssuerOAuthOptions, type JsonValue, type JsonValueInput, type JwtClaims, type LogLevel, type McpAllowedOrigins, type McpClientInfo, type McpDefinitionInput, type McpProtocolEra, type MetricsConfig, type MetricsOptions, type ProgressUpdate, type ResourceLink, type ResourceLinkIcon, type TextContent, type ToolAnnotations, type ToolContent, ToolContext, type ToolDefinition, ToolError, type ToolHandlerResult, type ZodOutputSchema, type ZodRawShape, type ZodSchema, auth, defineMcp, defineTool, setLogLevel };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as MetricsOptions, D as JwtClaims, E as ToolContext, O as McpAuthConfig, S as MetricsConfig, T as ProgressUpdate, _ as ToolDefinition, a as EmbeddedResource, b as ZodRawShape, c as JsonValue, d as McpDefinitionInput, f as ResourceLink, g as ToolContent, h as ToolAnnotations, i as EmbeddedBlobResource, l as McpAllowedOrigins, m as TextContent, n as ContentAnnotations, o as EmbeddedTextResource, p as ResourceLinkIcon, r as ContentBlock, s as ImageContent, t as AudioContent, u as McpDefinition, v as ToolHandlerResult, w as McpClientInfo, x as ZodSchema, y as ZodOutputSchema } from "./types-DnGEKnvI.js";
1
+ import { A as McpAuthConfig, C as MetricsConfig, D as ProgressUpdate, E as McpProtocolEra, O as ToolContext, S as ZodSchema, T as McpClientInfo, _ as ToolContent, a as EmbeddedResource, b as ZodOutputSchema, c as JsonValue, d as McpDefinition, f as McpDefinitionInput, g as ToolAnnotations, h as TextContent, i as EmbeddedBlobResource, k as JwtClaims, l as JsonValueInput, m as ResourceLinkIcon, n as ContentAnnotations, o as EmbeddedTextResource, p as ResourceLink, r as ContentBlock, s as ImageContent, t as AudioContent, u as McpAllowedOrigins, v as ToolDefinition, w as MetricsOptions, x as ZodRawShape, y as ToolHandlerResult } from "./types-3CZPz364.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
@@ -71,4 +71,4 @@ type LogLevel = "silent" | "error" | "warn" | "info" | "debug";
71
71
  */
72
72
  declare function setLogLevel(level: LogLevel): LogLevel;
73
73
  //#endregion
74
- export { type AudioContent, type ContentAnnotations, type ContentBlock, type EmbeddedBlobResource, type EmbeddedResource, type EmbeddedTextResource, type ImageContent, type IssuerOAuthOptions, type JsonValue, type JwtClaims, type LogLevel, type McpAllowedOrigins, type McpClientInfo, type McpDefinitionInput, type MetricsConfig, type MetricsOptions, type ProgressUpdate, type ResourceLink, type ResourceLinkIcon, type TextContent, type ToolAnnotations, type ToolContent, ToolContext, type ToolDefinition, ToolError, type ToolHandlerResult, type ZodOutputSchema, type ZodRawShape, type ZodSchema, auth, defineMcp, defineTool, setLogLevel };
74
+ export { type AudioContent, type ContentAnnotations, type ContentBlock, type EmbeddedBlobResource, type EmbeddedResource, type EmbeddedTextResource, type ImageContent, type IssuerOAuthOptions, type JsonValue, type JsonValueInput, type JwtClaims, type LogLevel, type McpAllowedOrigins, type McpClientInfo, type McpDefinitionInput, type McpProtocolEra, type MetricsConfig, type MetricsOptions, type ProgressUpdate, type ResourceLink, type ResourceLinkIcon, type TextContent, type ToolAnnotations, type ToolContent, ToolContext, type ToolDefinition, ToolError, type ToolHandlerResult, type ZodOutputSchema, type ZodRawShape, type ZodSchema, auth, defineMcp, defineTool, setLogLevel };
@@ -1,4 +1,4 @@
1
- import "./types-DnGEKnvI.cjs";
1
+ import "./types-3CZPz364.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 "./types-DnGEKnvI.js";
1
+ import "./types-3CZPz364.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,7 +1,7 @@
1
1
  const require_logger = require("./logger-CN1q-KNn.cjs");
2
2
  const require_schema = require("./schema-D3vClxb7.cjs");
3
3
  const require_errors = require("./errors-Cr95rSkB.cjs");
4
- const require_cors = require("./cors-DNzLB6qa.cjs");
4
+ const require_cors = require("./cors-BDv7pyfD.cjs");
5
5
  let _modelcontextprotocol_sdk_server_zod_compat_js = require("@modelcontextprotocol/sdk/server/zod-compat.js");
6
6
  let _modelcontextprotocol_server = require("@modelcontextprotocol/server");
7
7
  //#region src/core/content.ts
@@ -94,15 +94,16 @@ function createGatedHandler(gate) {
94
94
  return async (request, recorder = require_cors.createNoopRecorder()) => {
95
95
  const cors = require_cors.evaluateCors(request, gate.allowedOrigins);
96
96
  if (!cors.ok) {
97
+ const httpMethod = require_cors.normalizeHttpMethod(request.method);
97
98
  require_logger.log.info("cors.origin_rejected", {
98
99
  origin: request.headers.get("Origin"),
99
- httpMethod: request.method
100
+ httpMethod
100
101
  });
101
102
  await recorder.emit({
102
103
  tool: null,
103
104
  method: "authorize",
104
105
  outcome: "origin_rejected",
105
- httpMethod: request.method,
106
+ httpMethod,
106
107
  durationMs: 0
107
108
  });
108
109
  return require_cors.finalizeWireResponse(request, cors.response);
@@ -316,6 +317,7 @@ function createMcpProtocolHandler(mcp, options = {}) {
316
317
  try {
317
318
  const response = await (0, _modelcontextprotocol_server.createMcpHandler)(({ era }) => buildServer(mcp, authResult.auth, recorder, era), {
318
319
  legacy: "stateless",
320
+ maxSubscriptions: 0,
319
321
  onerror: (error) => {
320
322
  protocolError = error;
321
323
  }
@@ -1,7 +1,7 @@
1
1
  import { i as log, r as describeError } from "./logger-Ctv5xUSD.js";
2
2
  import { n as schemaFromDefinition, t as jsonSchemaFromDefinition } from "./schema-CW1jKvio.js";
3
3
  import { i as ToolContext, n as errorSummary, r as resolveToolErrorMessage } from "./errors-Bwd1L0Rf.js";
4
- import { c as createNoopRecorder, d as finalizeWireResponse, l as nowMs, n as createRequestAuthorizer, t as evaluateCors } from "./cors-C_VffY86.js";
4
+ import { f as finalizeWireResponse, i as normalizeHttpMethod, l as createNoopRecorder, n as createRequestAuthorizer, t as evaluateCors, u as nowMs } from "./cors-kKiIJSyL.js";
5
5
  import { getParseErrorMessage, safeParseAsync } from "@modelcontextprotocol/sdk/server/zod-compat.js";
6
6
  import { CLIENT_CAPABILITIES_META_KEY, CLIENT_INFO_META_KEY, McpServer, createMcpHandler } from "@modelcontextprotocol/server";
7
7
  //#region src/core/content.ts
@@ -94,15 +94,16 @@ function createGatedHandler(gate) {
94
94
  return async (request, recorder = createNoopRecorder()) => {
95
95
  const cors = evaluateCors(request, gate.allowedOrigins);
96
96
  if (!cors.ok) {
97
+ const httpMethod = normalizeHttpMethod(request.method);
97
98
  log.info("cors.origin_rejected", {
98
99
  origin: request.headers.get("Origin"),
99
- httpMethod: request.method
100
+ httpMethod
100
101
  });
101
102
  await recorder.emit({
102
103
  tool: null,
103
104
  method: "authorize",
104
105
  outcome: "origin_rejected",
105
- httpMethod: request.method,
106
+ httpMethod,
106
107
  durationMs: 0
107
108
  });
108
109
  return finalizeWireResponse(request, cors.response);
@@ -316,6 +317,7 @@ function createMcpProtocolHandler(mcp, options = {}) {
316
317
  try {
317
318
  const response = await createMcpHandler(({ era }) => buildServer(mcp, authResult.auth, recorder, era), {
318
319
  legacy: "stateless",
320
+ maxSubscriptions: 0,
319
321
  onerror: (error) => {
320
322
  protocolError = error;
321
323
  }
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.29.0-rc.2";
2
+ var version = "0.29.0-rc.3";
3
3
  //#endregion
4
4
  export { version as t };
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.29.0-rc.2";
2
+ var version = "0.29.0-rc.3";
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-CRdT2Fai.cjs");
2
+ const require_mcp = require("../../mcp-BSNdmnJl.cjs");
3
3
  exports.createMcpProtocolHandler = require_mcp.createMcpProtocolHandler;
@@ -1,39 +1,6 @@
1
- import { u as McpDefinition } from "../../types-DnGEKnvI.cjs";
2
- import { t as McpRuntimeOptions } from "../../authorize-Cqr7Jps0.cjs";
3
- //#region src/metrics/impl/base.d.ts
4
- type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "auth_challenge" | "origin_rejected" | "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
- /** Wire surface that served the call; absent on records emitted before
22
- * protocol classification (auth gate, transport faults). */
23
- protocol?: "2026-07-28" | "legacy";
24
- /** The app end-user that made the call (the access token `sub`), or
25
- * `undefined` when the request is unauthenticated. Not a Lovable identity. */
26
- endUserId?: string;
27
- /** Caller-visible `isError` text (`tool_error`) or a bounded internal-exception
28
- * summary (`handler_error`). Local log only — never sent to the collector. */
29
- errorText?: string;
30
- }
31
- /** A per-request telemetry recorder. `emit` logs the invocation and sends it as a
32
- * single OTLP POST, awaited so it lands before the request ends. */
33
- interface MetricsRecorder {
34
- emit(ev: InvocationRecord): Promise<void>;
35
- }
36
- //#endregion
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";
37
4
  //#region src/protocols/mcp/protocol.d.ts
38
5
  type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
39
6
  /**
@@ -1,39 +1,6 @@
1
- import { u as McpDefinition } from "../../types-DnGEKnvI.js";
2
- import { t as McpRuntimeOptions } from "../../authorize-Bpz8oxjF.js";
3
- //#region src/metrics/impl/base.d.ts
4
- type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "auth_challenge" | "origin_rejected" | "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
- /** Wire surface that served the call; absent on records emitted before
22
- * protocol classification (auth gate, transport faults). */
23
- protocol?: "2026-07-28" | "legacy";
24
- /** The app end-user that made the call (the access token `sub`), or
25
- * `undefined` when the request is unauthenticated. Not a Lovable identity. */
26
- endUserId?: string;
27
- /** Caller-visible `isError` text (`tool_error`) or a bounded internal-exception
28
- * summary (`handler_error`). Local log only — never sent to the collector. */
29
- errorText?: string;
30
- }
31
- /** A per-request telemetry recorder. `emit` logs the invocation and sends it as a
32
- * single OTLP POST, awaited so it lands before the request ends. */
33
- interface MetricsRecorder {
34
- emit(ev: InvocationRecord): Promise<void>;
35
- }
36
- //#endregion
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";
37
4
  //#region src/protocols/mcp/protocol.d.ts
38
5
  type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
39
6
  /**
@@ -1,2 +1,2 @@
1
- import { t as createMcpProtocolHandler } from "../../mcp-Bl7pQYdv.js";
1
+ import { t as createMcpProtocolHandler } from "../../mcp-GT9WU7nd.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-CN1q-KNn.cjs");
3
- const require_cors = require("../cors-DNzLB6qa.cjs");
3
+ const require_cors = require("../cors-BDv7pyfD.cjs");
4
4
  //#region src/protocols/oauth-metadata.ts
5
5
  function notFound() {
6
6
  return new Response(JSON.stringify({ error: "not found" }), {
@@ -52,9 +52,24 @@ function createOAuthProtectedResourceMetadataHandler(mcp, options = {}) {
52
52
  return require_cors.oauthConfigurationErrorResponse();
53
53
  }
54
54
  };
55
- return async (request) => {
55
+ return async (request, recorder = require_cors.createNoopRecorder()) => {
56
56
  const cors = require_cors.evaluateCors(request, mcp.allowedOrigins);
57
- if (!cors.ok) return require_cors.finalizeWireResponse(request, cors.response);
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
+ }
58
73
  if (request.method === "OPTIONS") return cors.preflight("GET, HEAD, OPTIONS");
59
74
  return require_cors.finalizeWireResponse(request, cors.withHeaders(await respond(request)));
60
75
  };
@@ -1,7 +1,8 @@
1
- import { u as McpDefinition } from "../types-DnGEKnvI.cjs";
2
- import { t as McpRuntimeOptions } from "../authorize-Cqr7Jps0.cjs";
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";
3
4
  //#region src/protocols/oauth-metadata.d.ts
4
- type OAuthProtectedResourceMetadataHandler = (request: Request) => Promise<Response>;
5
+ type OAuthProtectedResourceMetadataHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
5
6
  declare function createOAuthProtectedResourceMetadataHandler(mcp: McpDefinition, options?: McpRuntimeOptions): OAuthProtectedResourceMetadataHandler;
6
7
  //#endregion
7
8
  export { OAuthProtectedResourceMetadataHandler, createOAuthProtectedResourceMetadataHandler };
@@ -1,7 +1,8 @@
1
- import { u as McpDefinition } from "../types-DnGEKnvI.js";
2
- import { t as McpRuntimeOptions } from "../authorize-Bpz8oxjF.js";
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";
3
4
  //#region src/protocols/oauth-metadata.d.ts
4
- type OAuthProtectedResourceMetadataHandler = (request: Request) => Promise<Response>;
5
+ type OAuthProtectedResourceMetadataHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
5
6
  declare function createOAuthProtectedResourceMetadataHandler(mcp: McpDefinition, options?: McpRuntimeOptions): OAuthProtectedResourceMetadataHandler;
6
7
  //#endregion
7
8
  export { OAuthProtectedResourceMetadataHandler, createOAuthProtectedResourceMetadataHandler };
@@ -1,5 +1,5 @@
1
1
  import { i as log, r as describeError } from "../logger-Ctv5xUSD.js";
2
- import { d as finalizeWireResponse, f as methodNotAllowed, i as oauthConfigurationErrorResponse, o as resolveProtectedResource, r as getOAuthRuntime, t as evaluateCors, u as JSON_HEADERS } from "../cors-C_VffY86.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-kKiIJSyL.js";
3
3
  //#region src/protocols/oauth-metadata.ts
4
4
  function notFound() {
5
5
  return new Response(JSON.stringify({ error: "not found" }), {
@@ -51,9 +51,24 @@ function createOAuthProtectedResourceMetadataHandler(mcp, options = {}) {
51
51
  return oauthConfigurationErrorResponse();
52
52
  }
53
53
  };
54
- return async (request) => {
54
+ return async (request, recorder = createNoopRecorder()) => {
55
55
  const cors = evaluateCors(request, mcp.allowedOrigins);
56
- if (!cors.ok) return finalizeWireResponse(request, cors.response);
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
+ }
57
72
  if (request.method === "OPTIONS") return cors.preflight("GET, HEAD, OPTIONS");
58
73
  return finalizeWireResponse(request, cors.withHeaders(await respond(request)));
59
74
  };
@@ -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-DNzLB6qa.cjs");
3
+ const require_cors = require("../../cors-BDv7pyfD.cjs");
4
4
  const require_metadata_path = require("../../metadata-path-zd7NSNoa.cjs");
5
- const require_mcp = require("../../mcp-CRdT2Fai.cjs");
5
+ const require_mcp = require("../../mcp-BSNdmnJl.cjs");
6
6
  const require_protocols_oauth_metadata = require("../../protocols/oauth-metadata.cjs");
7
- const require_forwarded = require("../../forwarded-BC_RHnn5.cjs");
7
+ const require_forwarded = require("../../forwarded-OdBzzCMF.cjs");
8
8
  const require_paths = require("../../paths-OP318a6c.cjs");
9
9
  //#region src/stacks/supabase/handler.ts
10
10
  function deriveResourcePath(options) {
@@ -44,7 +44,7 @@ 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);
47
+ if (isMetadataPath(new URL(req.url).pathname)) return metadataHandler(req, require_cors.createRecorderForRuntime(mcp, { stack: "supabase" }));
48
48
  return mcpHandler(req, require_cors.createRecorderForRuntime(mcp, { stack: "supabase" }));
49
49
  };
50
50
  }
@@ -1,4 +1,4 @@
1
- import { u as McpDefinition } from "../../types-DnGEKnvI.cjs";
1
+ import { d as McpDefinition } from "../../types-3CZPz364.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 { u as McpDefinition } from "../../types-DnGEKnvI.js";
1
+ import { d as McpDefinition } from "../../types-3CZPz364.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 { a as assertResourcePathShape, s as createRecorderForRuntime } from "../../cors-C_VffY86.js";
2
+ import { c as createRecorderForRuntime, o as assertResourcePathShape } from "../../cors-kKiIJSyL.js";
3
3
  import { t as OAUTH_PROTECTED_RESOURCE_METADATA_PATH } from "../../metadata-path-CAkNcfyY.js";
4
- import { t as createMcpProtocolHandler } from "../../mcp-Bl7pQYdv.js";
4
+ import { t as createMcpProtocolHandler } from "../../mcp-GT9WU7nd.js";
5
5
  import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
6
- import { t as applyForwardedOrigin } from "../../forwarded-B3EBjHnA.js";
6
+ import { t as applyForwardedOrigin } from "../../forwarded-Bnrwxbuj.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);
46
+ if (isMetadataPath(new URL(req.url).pathname)) return metadataHandler(req, createRecorderForRuntime(mcp, { stack: "supabase" }));
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-DNSwCau1.cjs");
5
+ const require_package = require("../../package-DAQNwT8T.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-Bh_WpbxU.cjs";
1
+ import { t as McpPluginApi } from "../../io-CDV3mud0.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-DrHivYt0.js";
1
+ import { t as McpPluginApi } from "../../io-D_5cuaEL.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-CYA-5C24.js";
1
+ import { t as version } from "../../package-2ZppkCKf.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-DNzLB6qa.cjs");
3
- const require_mcp = require("../../mcp-CRdT2Fai.cjs");
2
+ const require_cors = require("../../cors-BDv7pyfD.cjs");
3
+ const require_mcp = require("../../mcp-BSNdmnJl.cjs");
4
4
  const require_protocols_oauth_metadata = require("../../protocols/oauth-metadata.cjs");
5
- const require_forwarded = require("../../forwarded-BC_RHnn5.cjs");
5
+ const require_forwarded = require("../../forwarded-OdBzzCMF.cjs");
6
6
  //#region src/stacks/tanstack/handlers.ts
7
7
  const STACK = "tanstack";
8
8
  /**
@@ -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));
22
+ return ({ request }) => handler(require_forwarded.applyForwardedOrigin(request, options), require_cors.createRecorderForRuntime(mcp, { stack: STACK }));
23
23
  }
24
24
  //#endregion
25
25
  exports.createTanStackMcpHandler = createTanStackMcpHandler;
@@ -1,5 +1,5 @@
1
- import { u as McpDefinition } from "../../types-DnGEKnvI.cjs";
2
- import { t as McpRuntimeOptions } from "../../authorize-Cqr7Jps0.cjs";
1
+ import { d as McpDefinition } from "../../types-3CZPz364.cjs";
2
+ import { t as McpRuntimeOptions } from "../../authorize-9hTTG-qJ.cjs";
3
3
  //#region src/stacks/tanstack/handlers.d.ts
4
4
  interface TanStackRouteCtx {
5
5
  request: Request;
@@ -1,5 +1,5 @@
1
- import { u as McpDefinition } from "../../types-DnGEKnvI.js";
2
- import { t as McpRuntimeOptions } from "../../authorize-Bpz8oxjF.js";
1
+ import { d as McpDefinition } from "../../types-3CZPz364.js";
2
+ import { t as McpRuntimeOptions } from "../../authorize-DNUlPT7k.js";
3
3
  //#region src/stacks/tanstack/handlers.d.ts
4
4
  interface TanStackRouteCtx {
5
5
  request: Request;
@@ -1,7 +1,7 @@
1
- import { s as createRecorderForRuntime } from "../../cors-C_VffY86.js";
2
- import { t as createMcpProtocolHandler } from "../../mcp-Bl7pQYdv.js";
1
+ import { c as createRecorderForRuntime } from "../../cors-kKiIJSyL.js";
2
+ import { t as createMcpProtocolHandler } from "../../mcp-GT9WU7nd.js";
3
3
  import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
4
- import { t as applyForwardedOrigin } from "../../forwarded-B3EBjHnA.js";
4
+ import { t as applyForwardedOrigin } from "../../forwarded-Bnrwxbuj.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));
21
+ return ({ request }) => handler(applyForwardedOrigin(request, options), createRecorderForRuntime(mcp, { stack: STACK }));
22
22
  }
23
23
  //#endregion
24
24
  export { createTanStackMcpHandler, createTanStackOAuthProtectedResourceMetadataHandler };
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-Bh_WpbxU.cjs";
1
+ import { t as McpPluginApi } from "../../io-CDV3mud0.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-DrHivYt0.js";
1
+ import { t as McpPluginApi } from "../../io-D_5cuaEL.js";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/tanstack/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -85,11 +85,14 @@ interface McpAuthConfig {
85
85
  }
86
86
  //#endregion
87
87
  //#region src/auth/context.d.ts
88
+ /** Protocol era of an in-flight request: self-describing `2026-07-28` or the
89
+ * initialization-era `legacy` fallback. */
90
+ type McpProtocolEra = "2026-07-28" | "legacy";
88
91
  /** What the client declared about itself on the in-flight request. Unverified
89
92
  * client input — a hint, never an authorization signal (use the auth accessors). */
90
93
  interface McpClientInfo {
91
94
  /** Protocol era of the in-flight request. */
92
- protocol: "2026-07-28" | "legacy";
95
+ protocol: McpProtocolEra;
93
96
  /** Client name/version from the request envelope (`2026-07-28` era only). */
94
97
  info?: {
95
98
  name: string;
@@ -178,11 +181,8 @@ type MetricsConfig = boolean | MetricsOptions;
178
181
  * `inputSchema`, use `ZodRawShape`.
179
182
  */
180
183
  type ZodSchema = ZodType;
181
- /**
182
- * A raw zod shape (`{ text: z.string(), n: z.number() }`) — the format
183
- * `defineTool`'s `inputSchema` expects and the object shorthand accepted by
184
- * `outputSchema`.
185
- */
184
+ /** A raw zod shape (`{ text: z.string() }`) — the format `defineTool`'s
185
+ * `inputSchema` expects and the object shorthand accepted by `outputSchema`. */
186
186
  type ZodRawShape$1 = ZodRawShape;
187
187
  type ZodOutputSchema = ZodSchema | ZodRawShape$1;
188
188
  /**
@@ -276,6 +276,11 @@ type ToolContent = ContentBlock[];
276
276
  type JsonValue = null | boolean | number | string | JsonValue[] | {
277
277
  [key: string]: JsonValue;
278
278
  };
279
+ /** Handler-input relaxation of `JsonValue`: object properties may be `undefined`
280
+ * (they serialize away, matching `JSON.stringify` semantics). */
281
+ type JsonValueInput = null | boolean | number | string | JsonValueInput[] | {
282
+ [key: string]: JsonValueInput | undefined;
283
+ };
279
284
  type McpAllowedOrigins = "any" | readonly string[];
280
285
  /**
281
286
  * Per-tool client hints (not enforcement). `annotations.title` is
@@ -294,7 +299,7 @@ interface ToolAnnotations {
294
299
  }
295
300
  interface ToolHandlerResult {
296
301
  content?: ToolContent;
297
- structuredContent?: JsonValue;
302
+ structuredContent?: JsonValueInput;
298
303
  isError?: boolean;
299
304
  }
300
305
  interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined> {
@@ -349,4 +354,4 @@ type McpDefinition = McpDefinitionInput & {
349
354
  readonly [McpDefinitionBrand]: never;
350
355
  };
351
356
  //#endregion
352
- export { MetricsOptions as C, JwtClaims as D, ToolContext as E, McpAuthConfig as O, MetricsConfig as S, ProgressUpdate as T, ToolDefinition as _, EmbeddedResource as a, ZodRawShape$1 as b, JsonValue as c, McpDefinitionInput as d, ResourceLink as f, ToolContent as g, ToolAnnotations as h, EmbeddedBlobResource as i, McpAllowedOrigins as l, TextContent as m, ContentAnnotations as n, EmbeddedTextResource as o, ResourceLinkIcon as p, ContentBlock as r, ImageContent as s, AudioContent as t, McpDefinition as u, ToolHandlerResult as v, McpClientInfo as w, ZodSchema as x, ZodOutputSchema as y };
357
+ export { McpAuthConfig as A, MetricsConfig as C, ProgressUpdate as D, McpProtocolEra as E, ToolContext as O, ZodSchema as S, McpClientInfo as T, ToolContent as _, EmbeddedResource as a, ZodOutputSchema as b, JsonValue as c, McpDefinition as d, McpDefinitionInput as f, ToolAnnotations as g, TextContent as h, EmbeddedBlobResource as i, JwtClaims as k, JsonValueInput as l, ResourceLinkIcon as m, ContentAnnotations as n, EmbeddedTextResource as o, ResourceLink as p, ContentBlock as r, ImageContent as s, AudioContent as t, McpAllowedOrigins as u, ToolDefinition as v, MetricsOptions as w, ZodRawShape$1 as x, ToolHandlerResult as y };
@@ -85,11 +85,14 @@ interface McpAuthConfig {
85
85
  }
86
86
  //#endregion
87
87
  //#region src/auth/context.d.ts
88
+ /** Protocol era of an in-flight request: self-describing `2026-07-28` or the
89
+ * initialization-era `legacy` fallback. */
90
+ type McpProtocolEra = "2026-07-28" | "legacy";
88
91
  /** What the client declared about itself on the in-flight request. Unverified
89
92
  * client input — a hint, never an authorization signal (use the auth accessors). */
90
93
  interface McpClientInfo {
91
94
  /** Protocol era of the in-flight request. */
92
- protocol: "2026-07-28" | "legacy";
95
+ protocol: McpProtocolEra;
93
96
  /** Client name/version from the request envelope (`2026-07-28` era only). */
94
97
  info?: {
95
98
  name: string;
@@ -178,11 +181,8 @@ type MetricsConfig = boolean | MetricsOptions;
178
181
  * `inputSchema`, use `ZodRawShape`.
179
182
  */
180
183
  type ZodSchema = ZodType;
181
- /**
182
- * A raw zod shape (`{ text: z.string(), n: z.number() }`) — the format
183
- * `defineTool`'s `inputSchema` expects and the object shorthand accepted by
184
- * `outputSchema`.
185
- */
184
+ /** A raw zod shape (`{ text: z.string() }`) — the format `defineTool`'s
185
+ * `inputSchema` expects and the object shorthand accepted by `outputSchema`. */
186
186
  type ZodRawShape$1 = ZodRawShape;
187
187
  type ZodOutputSchema = ZodSchema | ZodRawShape$1;
188
188
  /**
@@ -276,6 +276,11 @@ type ToolContent = ContentBlock[];
276
276
  type JsonValue = null | boolean | number | string | JsonValue[] | {
277
277
  [key: string]: JsonValue;
278
278
  };
279
+ /** Handler-input relaxation of `JsonValue`: object properties may be `undefined`
280
+ * (they serialize away, matching `JSON.stringify` semantics). */
281
+ type JsonValueInput = null | boolean | number | string | JsonValueInput[] | {
282
+ [key: string]: JsonValueInput | undefined;
283
+ };
279
284
  type McpAllowedOrigins = "any" | readonly string[];
280
285
  /**
281
286
  * Per-tool client hints (not enforcement). `annotations.title` is
@@ -294,7 +299,7 @@ interface ToolAnnotations {
294
299
  }
295
300
  interface ToolHandlerResult {
296
301
  content?: ToolContent;
297
- structuredContent?: JsonValue;
302
+ structuredContent?: JsonValueInput;
298
303
  isError?: boolean;
299
304
  }
300
305
  interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined> {
@@ -349,4 +354,4 @@ type McpDefinition = McpDefinitionInput & {
349
354
  readonly [McpDefinitionBrand]: never;
350
355
  };
351
356
  //#endregion
352
- export { MetricsOptions as C, JwtClaims as D, ToolContext as E, McpAuthConfig as O, MetricsConfig as S, ProgressUpdate as T, ToolDefinition as _, EmbeddedResource as a, ZodRawShape$1 as b, JsonValue as c, McpDefinitionInput as d, ResourceLink as f, ToolContent as g, ToolAnnotations as h, EmbeddedBlobResource as i, McpAllowedOrigins as l, TextContent as m, ContentAnnotations as n, EmbeddedTextResource as o, ResourceLinkIcon as p, ContentBlock as r, ImageContent as s, AudioContent as t, McpDefinition as u, ToolHandlerResult as v, McpClientInfo as w, ZodSchema as x, ZodOutputSchema as y };
357
+ export { McpAuthConfig as A, MetricsConfig as C, ProgressUpdate as D, McpProtocolEra as E, ToolContext as O, ZodSchema as S, McpClientInfo as T, ToolContent as _, EmbeddedResource as a, ZodOutputSchema as b, JsonValue as c, McpDefinition as d, McpDefinitionInput as f, ToolAnnotations as g, TextContent as h, EmbeddedBlobResource as i, JwtClaims as k, JsonValueInput as l, ResourceLinkIcon as m, ContentAnnotations as n, EmbeddedTextResource as o, ResourceLink as p, ContentBlock as r, ImageContent as s, AudioContent as t, McpAllowedOrigins as u, ToolDefinition as v, MetricsOptions as w, ZodRawShape$1 as x, ToolHandlerResult as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/mcp-js",
3
- "version": "0.29.0-rc.2",
3
+ "version": "0.29.0-rc.3",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },
@@ -1,43 +0,0 @@
1
- //#region src/core/forwarded.ts
2
- /**
3
- * Rewrites a request's URL to the public origin a reverse proxy forwards via
4
- * `X-Forwarded-*`, so SDK-derived OAuth `resource`/metadata/`WWW-Authenticate`
5
- * URLs name the host the client actually connected to — not the internal
6
- * backend origin the proxy rewrites `Host` to. Without this, an app on a custom
7
- * domain advertises its internal `*.lovable.dev`/`*.supabase.co` host and every
8
- * MCP call 401s on an audience the client can't satisfy.
9
- *
10
- * Each header is trusted independently, because a forwarded value is only as
11
- * trustworthy as the proxy that sets it:
12
- * - `X-Forwarded-Host` can redirect the advertised resource to an attacker
13
- * origin (the threat `auth/resource.ts` guards against), so it is honored only
14
- * when `trustForwardedHost` is set — enabled on emit paths that sit behind a
15
- * proxy which *overwrites* the header (Lovable's web-proxy does), never by a
16
- * bare SDK consumer.
17
- * - `X-Forwarded-Proto` only selects http/https, so it is gated separately:
18
- * Supabase's gateway stamps it (that stack always trusts it), and Lovable's
19
- * preview proxy overwrites it before the TanStack dev server, so the TanStack
20
- * Vite plugin emits the flag by default.
21
- */
22
- function applyForwardedOrigin(request, options) {
23
- const proto = options.trustForwardedProto ? firstForwardedValue(request, "x-forwarded-proto") : void 0;
24
- const host = options.trustForwardedHost ? firstForwardedValue(request, "x-forwarded-host") : void 0;
25
- if (proto === void 0 && host === void 0) return request;
26
- const url = new URL(request.url);
27
- let changed = false;
28
- if (proto !== void 0 && `${proto}:` !== url.protocol) {
29
- url.protocol = `${proto}:`;
30
- changed = true;
31
- }
32
- if (host !== void 0 && host !== url.host) {
33
- url.host = host;
34
- changed = true;
35
- }
36
- return changed ? new Request(url.href, request) : request;
37
- }
38
- function firstForwardedValue(request, header) {
39
- const value = request.headers.get(header)?.split(",")[0]?.trim();
40
- return value ? value : void 0;
41
- }
42
- //#endregion
43
- export { applyForwardedOrigin as t };
@@ -1,48 +0,0 @@
1
- //#region src/core/forwarded.ts
2
- /**
3
- * Rewrites a request's URL to the public origin a reverse proxy forwards via
4
- * `X-Forwarded-*`, so SDK-derived OAuth `resource`/metadata/`WWW-Authenticate`
5
- * URLs name the host the client actually connected to — not the internal
6
- * backend origin the proxy rewrites `Host` to. Without this, an app on a custom
7
- * domain advertises its internal `*.lovable.dev`/`*.supabase.co` host and every
8
- * MCP call 401s on an audience the client can't satisfy.
9
- *
10
- * Each header is trusted independently, because a forwarded value is only as
11
- * trustworthy as the proxy that sets it:
12
- * - `X-Forwarded-Host` can redirect the advertised resource to an attacker
13
- * origin (the threat `auth/resource.ts` guards against), so it is honored only
14
- * when `trustForwardedHost` is set — enabled on emit paths that sit behind a
15
- * proxy which *overwrites* the header (Lovable's web-proxy does), never by a
16
- * bare SDK consumer.
17
- * - `X-Forwarded-Proto` only selects http/https, so it is gated separately:
18
- * Supabase's gateway stamps it (that stack always trusts it), and Lovable's
19
- * preview proxy overwrites it before the TanStack dev server, so the TanStack
20
- * Vite plugin emits the flag by default.
21
- */
22
- function applyForwardedOrigin(request, options) {
23
- const proto = options.trustForwardedProto ? firstForwardedValue(request, "x-forwarded-proto") : void 0;
24
- const host = options.trustForwardedHost ? firstForwardedValue(request, "x-forwarded-host") : void 0;
25
- if (proto === void 0 && host === void 0) return request;
26
- const url = new URL(request.url);
27
- let changed = false;
28
- if (proto !== void 0 && `${proto}:` !== url.protocol) {
29
- url.protocol = `${proto}:`;
30
- changed = true;
31
- }
32
- if (host !== void 0 && host !== url.host) {
33
- url.host = host;
34
- changed = true;
35
- }
36
- return changed ? new Request(url.href, request) : request;
37
- }
38
- function firstForwardedValue(request, header) {
39
- const value = request.headers.get(header)?.split(",")[0]?.trim();
40
- return value ? value : void 0;
41
- }
42
- //#endregion
43
- Object.defineProperty(exports, "applyForwardedOrigin", {
44
- enumerable: true,
45
- get: function() {
46
- return applyForwardedOrigin;
47
- }
48
- });