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

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-BDv7pyfD.cjs → authorize-CKMlIxm9.cjs} +33 -90
  4. package/dist/{authorize-DNUlPT7k.d.ts → authorize-CqYsQYfa.d.ts} +1 -1
  5. package/dist/{authorize-9hTTG-qJ.d.cts → authorize-DIYS7zBP.d.cts} +1 -1
  6. package/dist/{cors-kKiIJSyL.js → authorize-b3VqTC_7.js} +28 -79
  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-BLs6_g8i.js +174 -0
  20. package/dist/mcp-DtHM-41c.cjs +179 -0
  21. package/dist/{package-2ZppkCKf.js → package-DMs4EVwG.js} +1 -1
  22. package/dist/{package-DAQNwT8T.cjs → package-Xk8p8Q_E.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-Bnrwxbuj.js +0 -25
  53. package/dist/forwarded-OdBzzCMF.cjs +0 -30
  54. package/dist/mcp-BSNdmnJl.cjs +0 -353
  55. package/dist/mcp-GT9WU7nd.js +0 -348
  56. package/dist/schema-CW1jKvio.js +0 -65
  57. package/dist/schema-D3vClxb7.cjs +0 -76
@@ -85,49 +85,16 @@ 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";
91
- /** What the client declared about itself on the in-flight request. Unverified
92
- * client input a hint, never an authorization signal (use the auth accessors). */
93
- interface McpClientInfo {
94
- /** Protocol era of the in-flight request. */
95
- protocol: McpProtocolEra;
96
- /** Client name/version from the request envelope (`2026-07-28` era only). */
97
- info?: {
98
- name: string;
99
- version: string;
100
- title?: string;
101
- };
102
- /** Client capabilities from the request envelope (`2026-07-28` era only). */
103
- capabilities?: Record<string, unknown>;
104
- /** Extension declarations (`capabilities.extensions`), keyed by extension id. */
105
- extensions?: Record<string, Record<string, unknown>>;
106
- }
107
- /** A progress notification payload. `progress` should increase monotonically. */
108
- interface ProgressUpdate {
109
- progress: number;
110
- total?: number;
111
- message?: string;
112
- }
113
- /** Per-request runtime surface threaded into `ToolContext` by the protocol layer. */
114
- interface ToolRequestContext {
115
- signal?: AbortSignal;
116
- client?: McpClientInfo;
117
- sendProgress?: (update: ProgressUpdate) => Promise<void>;
118
- }
119
- /** The per-request context passed to every tool handler as its second argument. The
120
- * auth context lives in a private field so the accessors are the only way out; `getToken()` is the sole bearer escape hatch. */
88
+ /**
89
+ * The auth surface passed to every tool handler as its second argument. It wraps
90
+ * the verified per-request auth context in a private field, so the context — and
91
+ * the bearer token inside it can't be read, enumerated, spread, or
92
+ * `JSON.stringify`'d off the instance; the accessors below are the only way out.
93
+ * `getToken()` is the single intentional escape hatch for the raw bearer.
94
+ */
121
95
  declare class ToolContext {
122
96
  #private;
123
- constructor(auth: McpAuthContext | undefined, request?: ToolRequestContext);
124
- /** Aborts when the client cancels the request or disconnects. */
125
- get signal(): AbortSignal;
126
- /** What the client declared about itself on this request. Unverified input. */
127
- get client(): McpClientInfo;
128
- /** Send a progress notification for this call. A no-op when the client
129
- * didn't request progress (no `progressToken` on the request). */
130
- progress(update: ProgressUpdate): Promise<void>;
97
+ constructor(auth: McpAuthContext | undefined);
131
98
  /** Whether the in-flight tool call carries a verified auth context. */
132
99
  isAuthenticated(): boolean;
133
100
  /** The verified bearer token, or `undefined` when unauthenticated. Pass it to downstream APIs; never return or log it. */
@@ -181,10 +148,11 @@ type MetricsConfig = boolean | MetricsOptions;
181
148
  * `inputSchema`, use `ZodRawShape`.
182
149
  */
183
150
  type ZodSchema = ZodType;
184
- /** A raw zod shape (`{ text: z.string() }`) — the format `defineTool`'s
185
- * `inputSchema` expects and the object shorthand accepted by `outputSchema`. */
151
+ /**
152
+ * A raw zod shape (`{ text: z.string(), n: z.number() }`) — the format
153
+ * `defineTool`'s `inputSchema`/`outputSchema` expects.
154
+ */
186
155
  type ZodRawShape$1 = ZodRawShape;
187
- type ZodOutputSchema = ZodSchema | ZodRawShape$1;
188
156
  /**
189
157
  * Infer the parsed-output type of a zod raw shape — given
190
158
  * `{ text: ZodString, n: ZodNumber }`, produces `{ text: string, n: number }`.
@@ -249,8 +217,8 @@ type EmbeddedResource = EmbeddedTextResource | EmbeddedBlobResource;
249
217
  interface ResourceLinkIcon {
250
218
  src: string;
251
219
  mimeType?: string;
252
- /** Array per MCP 2026-07-28; legacy space-separated strings remain accepted. */
253
- sizes?: string | string[];
220
+ /** Space-separated dimension string, HTML `<link sizes>` convention (e.g. `"16x16 32x32"`). */
221
+ sizes?: string;
254
222
  theme?: "light" | "dark";
255
223
  }
256
224
  interface ResourceLink extends ContentBlockBase {
@@ -273,15 +241,6 @@ type ContentBlock = TextContent | ImageContent | AudioContent | EmbeddedResource
273
241
  * the tool returns to the caller.
274
242
  */
275
243
  type ToolContent = ContentBlock[];
276
- type JsonValue = null | boolean | number | string | JsonValue[] | {
277
- [key: string]: JsonValue;
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
- };
284
- type McpAllowedOrigins = "any" | readonly string[];
285
244
  /**
286
245
  * Per-tool client hints (not enforcement). `annotations.title` is
287
246
  * intentionally omitted — use `ToolDefinition.title`, which the MCP
@@ -299,10 +258,10 @@ interface ToolAnnotations {
299
258
  }
300
259
  interface ToolHandlerResult {
301
260
  content?: ToolContent;
302
- structuredContent?: JsonValueInput;
261
+ structuredContent?: Record<string, unknown>;
303
262
  isError?: boolean;
304
263
  }
305
- interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined> {
264
+ interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined> {
306
265
  readonly name: string;
307
266
  /** Human-readable display name shown to the user in MCP clients. Required. */
308
267
  readonly title: string;
@@ -313,27 +272,32 @@ interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$
313
272
  readonly annotations?: ToolAnnotations;
314
273
  readonly handler: TInput extends ZodRawShape$1 ? (args: ShapeOutput<TInput>, ctx: ToolContext) => ToolHandlerResult | Promise<ToolHandlerResult> : (args: Record<string, never> | undefined, ctx: ToolContext) => ToolHandlerResult | Promise<ToolHandlerResult>;
315
274
  }
316
- /** Type-erased element of `McpDefinition.tools`; per-tool generic typing
317
- * happens at the `defineTool` call site. */
275
+ /**
276
+ * Type-erased element of `McpDefinition.tools`. Per-tool generic typing
277
+ * happens at the `defineTool` call site; see README §6 for the rationale.
278
+ */
318
279
  interface AnyToolDefinition {
319
280
  readonly name: string;
320
281
  readonly title: string;
321
282
  readonly description: string;
322
283
  readonly inputSchema?: ZodRawShape$1;
323
- readonly outputSchema?: ZodOutputSchema;
284
+ readonly outputSchema?: ZodRawShape$1;
324
285
  readonly annotations?: ToolAnnotations;
325
286
  readonly handler: (args: any, ctx: ToolContext) => ToolHandlerResult | Promise<ToolHandlerResult>;
326
287
  }
327
- /** Input shape for `defineMcp(...)`, whose branded `McpDefinition` return type is what
328
- * `createMcpProtocolHandler` consumes the brand forces validation + freeze. */
288
+ /**
289
+ * Fields a caller supplies when constructing an MCP definition. Pass this
290
+ * shape to `defineMcp(...)` — its return type is the branded `McpDefinition`,
291
+ * which is the type every internal factory (`createInvokeToolHandler`,
292
+ * `createMcpProtocolHandler`, …) consumes. The brand forces consumers
293
+ * through `defineMcp`'s `assertUniqueNames` + freeze.
294
+ */
329
295
  interface McpDefinitionInput {
330
296
  readonly name: string;
331
297
  /** Human-readable display name shown to MCP clients. Required. */
332
298
  readonly title: string;
333
299
  readonly version: string;
334
300
  readonly auth?: McpAuthConfig;
335
- /** Cross-origin browser access. Omit to allow only same-origin and non-browser requests. */
336
- readonly allowedOrigins?: McpAllowedOrigins;
337
301
  /**
338
302
  * Server-level prose the LLM reads as context for all tools on this server.
339
303
  * Required for the same reason `ToolDefinition.description` is — optional
@@ -354,4 +318,4 @@ type McpDefinition = McpDefinitionInput & {
354
318
  readonly [McpDefinitionBrand]: never;
355
319
  };
356
320
  //#endregion
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 };
321
+ export { McpAuthConfig as C, JwtClaims as S, ZodRawShape$1 as _, EmbeddedResource as a, MetricsOptions as b, McpDefinition as c, ResourceLinkIcon as d, TextContent as f, ToolHandlerResult as g, ToolDefinition as h, EmbeddedBlobResource as i, McpDefinitionInput as l, ToolContent as m, ContentAnnotations as n, EmbeddedTextResource as o, ToolAnnotations as p, ContentBlock as r, ImageContent as s, AudioContent as t, ResourceLink as u, ZodSchema as v, ToolContext as x, MetricsConfig as y };
@@ -85,49 +85,16 @@ 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";
91
- /** What the client declared about itself on the in-flight request. Unverified
92
- * client input a hint, never an authorization signal (use the auth accessors). */
93
- interface McpClientInfo {
94
- /** Protocol era of the in-flight request. */
95
- protocol: McpProtocolEra;
96
- /** Client name/version from the request envelope (`2026-07-28` era only). */
97
- info?: {
98
- name: string;
99
- version: string;
100
- title?: string;
101
- };
102
- /** Client capabilities from the request envelope (`2026-07-28` era only). */
103
- capabilities?: Record<string, unknown>;
104
- /** Extension declarations (`capabilities.extensions`), keyed by extension id. */
105
- extensions?: Record<string, Record<string, unknown>>;
106
- }
107
- /** A progress notification payload. `progress` should increase monotonically. */
108
- interface ProgressUpdate {
109
- progress: number;
110
- total?: number;
111
- message?: string;
112
- }
113
- /** Per-request runtime surface threaded into `ToolContext` by the protocol layer. */
114
- interface ToolRequestContext {
115
- signal?: AbortSignal;
116
- client?: McpClientInfo;
117
- sendProgress?: (update: ProgressUpdate) => Promise<void>;
118
- }
119
- /** The per-request context passed to every tool handler as its second argument. The
120
- * auth context lives in a private field so the accessors are the only way out; `getToken()` is the sole bearer escape hatch. */
88
+ /**
89
+ * The auth surface passed to every tool handler as its second argument. It wraps
90
+ * the verified per-request auth context in a private field, so the context — and
91
+ * the bearer token inside it can't be read, enumerated, spread, or
92
+ * `JSON.stringify`'d off the instance; the accessors below are the only way out.
93
+ * `getToken()` is the single intentional escape hatch for the raw bearer.
94
+ */
121
95
  declare class ToolContext {
122
96
  #private;
123
- constructor(auth: McpAuthContext | undefined, request?: ToolRequestContext);
124
- /** Aborts when the client cancels the request or disconnects. */
125
- get signal(): AbortSignal;
126
- /** What the client declared about itself on this request. Unverified input. */
127
- get client(): McpClientInfo;
128
- /** Send a progress notification for this call. A no-op when the client
129
- * didn't request progress (no `progressToken` on the request). */
130
- progress(update: ProgressUpdate): Promise<void>;
97
+ constructor(auth: McpAuthContext | undefined);
131
98
  /** Whether the in-flight tool call carries a verified auth context. */
132
99
  isAuthenticated(): boolean;
133
100
  /** The verified bearer token, or `undefined` when unauthenticated. Pass it to downstream APIs; never return or log it. */
@@ -181,10 +148,11 @@ type MetricsConfig = boolean | MetricsOptions;
181
148
  * `inputSchema`, use `ZodRawShape`.
182
149
  */
183
150
  type ZodSchema = ZodType;
184
- /** A raw zod shape (`{ text: z.string() }`) — the format `defineTool`'s
185
- * `inputSchema` expects and the object shorthand accepted by `outputSchema`. */
151
+ /**
152
+ * A raw zod shape (`{ text: z.string(), n: z.number() }`) — the format
153
+ * `defineTool`'s `inputSchema`/`outputSchema` expects.
154
+ */
186
155
  type ZodRawShape$1 = ZodRawShape;
187
- type ZodOutputSchema = ZodSchema | ZodRawShape$1;
188
156
  /**
189
157
  * Infer the parsed-output type of a zod raw shape — given
190
158
  * `{ text: ZodString, n: ZodNumber }`, produces `{ text: string, n: number }`.
@@ -249,8 +217,8 @@ type EmbeddedResource = EmbeddedTextResource | EmbeddedBlobResource;
249
217
  interface ResourceLinkIcon {
250
218
  src: string;
251
219
  mimeType?: string;
252
- /** Array per MCP 2026-07-28; legacy space-separated strings remain accepted. */
253
- sizes?: string | string[];
220
+ /** Space-separated dimension string, HTML `<link sizes>` convention (e.g. `"16x16 32x32"`). */
221
+ sizes?: string;
254
222
  theme?: "light" | "dark";
255
223
  }
256
224
  interface ResourceLink extends ContentBlockBase {
@@ -273,15 +241,6 @@ type ContentBlock = TextContent | ImageContent | AudioContent | EmbeddedResource
273
241
  * the tool returns to the caller.
274
242
  */
275
243
  type ToolContent = ContentBlock[];
276
- type JsonValue = null | boolean | number | string | JsonValue[] | {
277
- [key: string]: JsonValue;
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
- };
284
- type McpAllowedOrigins = "any" | readonly string[];
285
244
  /**
286
245
  * Per-tool client hints (not enforcement). `annotations.title` is
287
246
  * intentionally omitted — use `ToolDefinition.title`, which the MCP
@@ -299,10 +258,10 @@ interface ToolAnnotations {
299
258
  }
300
259
  interface ToolHandlerResult {
301
260
  content?: ToolContent;
302
- structuredContent?: JsonValueInput;
261
+ structuredContent?: Record<string, unknown>;
303
262
  isError?: boolean;
304
263
  }
305
- interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined> {
264
+ interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined> {
306
265
  readonly name: string;
307
266
  /** Human-readable display name shown to the user in MCP clients. Required. */
308
267
  readonly title: string;
@@ -313,27 +272,32 @@ interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$
313
272
  readonly annotations?: ToolAnnotations;
314
273
  readonly handler: TInput extends ZodRawShape$1 ? (args: ShapeOutput<TInput>, ctx: ToolContext) => ToolHandlerResult | Promise<ToolHandlerResult> : (args: Record<string, never> | undefined, ctx: ToolContext) => ToolHandlerResult | Promise<ToolHandlerResult>;
315
274
  }
316
- /** Type-erased element of `McpDefinition.tools`; per-tool generic typing
317
- * happens at the `defineTool` call site. */
275
+ /**
276
+ * Type-erased element of `McpDefinition.tools`. Per-tool generic typing
277
+ * happens at the `defineTool` call site; see README §6 for the rationale.
278
+ */
318
279
  interface AnyToolDefinition {
319
280
  readonly name: string;
320
281
  readonly title: string;
321
282
  readonly description: string;
322
283
  readonly inputSchema?: ZodRawShape$1;
323
- readonly outputSchema?: ZodOutputSchema;
284
+ readonly outputSchema?: ZodRawShape$1;
324
285
  readonly annotations?: ToolAnnotations;
325
286
  readonly handler: (args: any, ctx: ToolContext) => ToolHandlerResult | Promise<ToolHandlerResult>;
326
287
  }
327
- /** Input shape for `defineMcp(...)`, whose branded `McpDefinition` return type is what
328
- * `createMcpProtocolHandler` consumes the brand forces validation + freeze. */
288
+ /**
289
+ * Fields a caller supplies when constructing an MCP definition. Pass this
290
+ * shape to `defineMcp(...)` — its return type is the branded `McpDefinition`,
291
+ * which is the type every internal factory (`createInvokeToolHandler`,
292
+ * `createMcpProtocolHandler`, …) consumes. The brand forces consumers
293
+ * through `defineMcp`'s `assertUniqueNames` + freeze.
294
+ */
329
295
  interface McpDefinitionInput {
330
296
  readonly name: string;
331
297
  /** Human-readable display name shown to MCP clients. Required. */
332
298
  readonly title: string;
333
299
  readonly version: string;
334
300
  readonly auth?: McpAuthConfig;
335
- /** Cross-origin browser access. Omit to allow only same-origin and non-browser requests. */
336
- readonly allowedOrigins?: McpAllowedOrigins;
337
301
  /**
338
302
  * Server-level prose the LLM reads as context for all tools on this server.
339
303
  * Required for the same reason `ToolDefinition.description` is — optional
@@ -354,4 +318,4 @@ type McpDefinition = McpDefinitionInput & {
354
318
  readonly [McpDefinitionBrand]: never;
355
319
  };
356
320
  //#endregion
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 };
321
+ export { McpAuthConfig as C, JwtClaims as S, ZodRawShape$1 as _, EmbeddedResource as a, MetricsOptions as b, McpDefinition as c, ResourceLinkIcon as d, TextContent as f, ToolHandlerResult as g, ToolDefinition as h, EmbeddedBlobResource as i, McpDefinitionInput as l, ToolContent as m, ContentAnnotations as n, EmbeddedTextResource as o, ToolAnnotations as p, ContentBlock as r, ImageContent as s, AudioContent as t, ResourceLink as u, ZodSchema as v, ToolContext as x, MetricsConfig as y };
package/package.json CHANGED
@@ -1,9 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/mcp-js",
3
- "version": "0.29.0-rc.3",
4
- "engines": {
5
- "node": ">=20"
6
- },
3
+ "version": "0.29.0-rc.4",
7
4
  "description": "Author MCP servers for Lovable apps. Declare tools with defineTool, register them in defineMcp, and a framework adapter (TanStack or Supabase Edge Functions) emits the route(s) at build time.",
8
5
  "type": "module",
9
6
  "repository": {
@@ -109,7 +106,6 @@
109
106
  "license": "MIT",
110
107
  "dependencies": {
111
108
  "@modelcontextprotocol/sdk": "1.28.0",
112
- "@modelcontextprotocol/server": "2.0.0",
113
109
  "esbuild": "^0.27.0",
114
110
  "jose": "^6.2.2"
115
111
  },
@@ -1,36 +0,0 @@
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 };
@@ -1,36 +0,0 @@
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,25 +0,0 @@
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 };
@@ -1,30 +0,0 @@
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
- });