@lovable.dev/mcp-js 2.1.0-rc.0 → 2.1.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 (50) hide show
  1. package/README.md +1 -82
  2. package/dist/{authorize-BC4TM__8.d.cts → authorize-CzyL7nmF.d.cts} +1 -1
  3. package/dist/{authorize-DEsM-zTN.d.ts → authorize-Drz_eJ7O.d.ts} +1 -1
  4. package/dist/{base-BnlJz6TE.d.ts → base-COwtdWE8.d.ts} +2 -2
  5. package/dist/{base-4G2k3bMl.d.cts → base-DD4MCXZ6.d.cts} +2 -2
  6. package/dist/cli/extract-manifest.cjs +1 -1
  7. package/dist/cli/extract-manifest.js +1 -1
  8. package/dist/{cors-D4BjUpgU.js → cors-BaRKDl4r.js} +1 -1
  9. package/dist/{cors-0ZCwmwyK.cjs → cors-D-X0aP4O.cjs} +1 -1
  10. package/dist/errors-Bwd1L0Rf.js +100 -0
  11. package/dist/errors-Cr95rSkB.cjs +123 -0
  12. package/dist/index.cjs +147 -4
  13. package/dist/index.d.cts +4 -12
  14. package/dist/index.d.ts +4 -12
  15. package/dist/index.js +147 -3
  16. package/dist/{io-BEoJ_gb5.js → io-DG83CLKx.js} +2 -3
  17. package/dist/{io-Cz81GsrM.cjs → io-DZD6xmJQ.cjs} +2 -3
  18. package/dist/{io-9jGNgPfl.d.cts → io-Ds5MRSiK.d.cts} +1 -1
  19. package/dist/{io-BLZ8jYW6.d.ts → io-pl5npWDw.d.ts} +1 -1
  20. package/dist/{mcp-Q_rjpR99.cjs → mcp-Bx3LUn5O.cjs} +15 -92
  21. package/dist/{mcp-CuHyVOZK.js → mcp-DcmfehoI.js} +15 -92
  22. package/dist/{package-BAYb-3dX.js → package-BNFIhH0F.js} +1 -1
  23. package/dist/{package-DlouusYQ.cjs → package-CFVl3oIe.cjs} +1 -1
  24. package/dist/protocols/mcp/index.cjs +1 -1
  25. package/dist/protocols/mcp/index.d.cts +3 -3
  26. package/dist/protocols/mcp/index.d.ts +3 -3
  27. package/dist/protocols/mcp/index.js +1 -1
  28. package/dist/protocols/oauth-metadata.cjs +1 -1
  29. package/dist/protocols/oauth-metadata.d.cts +3 -3
  30. package/dist/protocols/oauth-metadata.d.ts +3 -3
  31. package/dist/protocols/oauth-metadata.js +1 -1
  32. package/dist/stacks/supabase/index.cjs +2 -2
  33. package/dist/stacks/supabase/index.d.cts +1 -1
  34. package/dist/stacks/supabase/index.d.ts +1 -1
  35. package/dist/stacks/supabase/index.js +2 -2
  36. package/dist/stacks/supabase/vite.cjs +1 -1
  37. package/dist/stacks/supabase/vite.d.cts +1 -1
  38. package/dist/stacks/supabase/vite.d.ts +1 -1
  39. package/dist/stacks/supabase/vite.js +1 -1
  40. package/dist/stacks/tanstack/index.cjs +2 -2
  41. package/dist/stacks/tanstack/index.d.cts +2 -2
  42. package/dist/stacks/tanstack/index.d.ts +2 -2
  43. package/dist/stacks/tanstack/index.js +2 -2
  44. package/dist/stacks/tanstack/vite.d.cts +1 -1
  45. package/dist/stacks/tanstack/vite.d.ts +1 -1
  46. package/dist/{types-S6J_QTXw.d.cts → types-B3_lX-L1.d.cts} +25 -60
  47. package/dist/{types-S6J_QTXw.d.ts → types-B3_lX-L1.d.ts} +25 -60
  48. package/package.json +2 -2
  49. package/dist/errors-CdrGi5aP.cjs +0 -309
  50. package/dist/errors-DTvfh8lb.js +0 -262
@@ -1,8 +1,8 @@
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-0ZCwmwyK.cjs");
3
+ const require_cors = require("../../cors-D-X0aP4O.cjs");
4
4
  const require_metadata_path = require("../../metadata-path-zd7NSNoa.cjs");
5
- const require_mcp = require("../../mcp-Q_rjpR99.cjs");
5
+ const require_mcp = require("../../mcp-Bx3LUn5O.cjs");
6
6
  const require_protocols_oauth_metadata = require("../../protocols/oauth-metadata.cjs");
7
7
  const require_forwarded = require("../../forwarded-B37IdmMX.cjs");
8
8
  const require_paths = require("../../paths-OP318a6c.cjs");
@@ -1,4 +1,4 @@
1
- import { p as McpDefinition } from "../../types-S6J_QTXw.cjs";
1
+ import { d as McpDefinition } from "../../types-B3_lX-L1.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 { p as McpDefinition } from "../../types-S6J_QTXw.js";
1
+ import { d as McpDefinition } from "../../types-B3_lX-L1.js";
2
2
  //#region src/stacks/supabase/handler.d.ts
3
3
  type SupabaseHandler = (request: Request) => Promise<Response>;
4
4
  interface SupabaseHandlerOptions {
@@ -1,7 +1,7 @@
1
1
  import { s as trimTrailingSlash } from "../../logger-Ctv5xUSD.js";
2
- import { c as createRecorderForRuntime, o as assertResourcePathShape } from "../../cors-D4BjUpgU.js";
2
+ import { c as createRecorderForRuntime, o as assertResourcePathShape } from "../../cors-BaRKDl4r.js";
3
3
  import { t as OAUTH_PROTECTED_RESOURCE_METADATA_PATH } from "../../metadata-path-CAkNcfyY.js";
4
- import { t as createMcpProtocolHandler } from "../../mcp-CuHyVOZK.js";
4
+ import { t as createMcpProtocolHandler } from "../../mcp-DcmfehoI.js";
5
5
  import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
6
6
  import { t as applyForwardedOrigin } from "../../forwarded-BBXvFeh6.js";
7
7
  import { n as assertFunctionName, t as FUNCTIONS_MOUNT_PREFIX } from "../../paths-IS65L6TA.js";
@@ -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-DlouusYQ.cjs");
5
+ const require_package = require("../../package-CFVl3oIe.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-9jGNgPfl.cjs";
1
+ import { t as McpPluginApi } from "../../io-Ds5MRSiK.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-BLZ8jYW6.js";
1
+ import { t as McpPluginApi } from "../../io-pl5npWDw.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-BAYb-3dX.js";
1
+ import { t as version } from "../../package-BNFIhH0F.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,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_cors = require("../../cors-0ZCwmwyK.cjs");
3
- const require_mcp = require("../../mcp-Q_rjpR99.cjs");
2
+ const require_cors = require("../../cors-D-X0aP4O.cjs");
3
+ const require_mcp = require("../../mcp-Bx3LUn5O.cjs");
4
4
  const require_protocols_oauth_metadata = require("../../protocols/oauth-metadata.cjs");
5
5
  const require_forwarded = require("../../forwarded-B37IdmMX.cjs");
6
6
  //#region src/stacks/tanstack/handlers.ts
@@ -1,5 +1,5 @@
1
- import { p as McpDefinition } from "../../types-S6J_QTXw.cjs";
2
- import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-BC4TM__8.cjs";
1
+ import { d as McpDefinition } from "../../types-B3_lX-L1.cjs";
2
+ import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-CzyL7nmF.cjs";
3
3
  //#region src/stacks/tanstack/handlers.d.ts
4
4
  interface TanStackRequest extends Request {
5
5
  waitUntil?: ScheduleBackground;
@@ -1,5 +1,5 @@
1
- import { p as McpDefinition } from "../../types-S6J_QTXw.js";
2
- import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-DEsM-zTN.js";
1
+ import { d as McpDefinition } from "../../types-B3_lX-L1.js";
2
+ import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-Drz_eJ7O.js";
3
3
  //#region src/stacks/tanstack/handlers.d.ts
4
4
  interface TanStackRequest extends Request {
5
5
  waitUntil?: ScheduleBackground;
@@ -1,5 +1,5 @@
1
- import { c as createRecorderForRuntime } from "../../cors-D4BjUpgU.js";
2
- import { t as createMcpProtocolHandler } from "../../mcp-CuHyVOZK.js";
1
+ import { c as createRecorderForRuntime } from "../../cors-BaRKDl4r.js";
2
+ import { t as createMcpProtocolHandler } from "../../mcp-DcmfehoI.js";
3
3
  import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
4
4
  import { t as applyForwardedOrigin } from "../../forwarded-BBXvFeh6.js";
5
5
  //#region src/stacks/tanstack/handlers.ts
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-9jGNgPfl.cjs";
1
+ import { t as McpPluginApi } from "../../io-Ds5MRSiK.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-BLZ8jYW6.js";
1
+ import { t as McpPluginApi } from "../../io-pl5npWDw.js";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/tanstack/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -116,11 +116,18 @@ interface ToolRequestContext {
116
116
  client?: McpClientInfo;
117
117
  sendProgress?: (update: ProgressUpdate) => Promise<void>;
118
118
  }
119
- /** Verified caller identity exposed to the app-context factory.
120
- * `getToken()` is the sole bearer escape hatch. */
121
- declare class AuthContext {
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. */
121
+ declare class ToolContext {
122
122
  #private;
123
- constructor(auth: McpAuthContext | undefined);
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>;
124
131
  /** Whether the in-flight tool call carries a verified auth context. */
125
132
  isAuthenticated(): boolean;
126
133
  /** The verified bearer token, or `undefined` when unauthenticated. Pass it to downstream APIs; never return or log it. */
@@ -141,20 +148,6 @@ declare class AuthContext {
141
148
  */
142
149
  getClaims(): JwtClaims | undefined;
143
150
  }
144
- /** The per-request context passed to every tool handler as its second argument. */
145
- declare class ToolContext<TAppContext = undefined> extends AuthContext {
146
- #private;
147
- constructor(auth: McpAuthContext | undefined, request?: ToolRequestContext, appContext?: TAppContext);
148
- /** App-defined context created for this tool call. */
149
- get appContext(): TAppContext;
150
- /** Aborts when the client cancels the request or disconnects. */
151
- get signal(): AbortSignal;
152
- /** What the client declared about itself on this request. Unverified input. */
153
- get client(): McpClientInfo;
154
- /** Send a progress notification for this call. A no-op when the client
155
- * didn't request progress (no `progressToken` on the request). */
156
- progress(update: ProgressUpdate): Promise<void>;
157
- }
158
151
  //#endregion
159
152
  //#region src/metrics/config.d.ts
160
153
  /**
@@ -303,22 +296,18 @@ interface ToolAnnotations {
303
296
  idempotentHint?: boolean;
304
297
  /** Tool interacts with external/unbounded systems (DB, network, third-party APIs). */
305
298
  openWorldHint?: boolean;
299
+ /**
300
+ * Asks the Lovable agent to keep up to 50 KB of this tool's result in context instead of the default 5 KB.
301
+ * Honored for the app's published MCP server; meant for results the agent must read whole.
302
+ */
303
+ largeOutputHint?: boolean;
306
304
  }
307
305
  interface ToolHandlerResult {
308
306
  content?: ToolContent;
309
307
  structuredContent?: JsonValueInput;
310
308
  isError?: boolean;
311
309
  }
312
- /** Inputs available while creating app context for one MCP request. */
313
- interface CreateAppContextInput {
314
- readonly auth: AuthContext;
315
- readonly signal: AbortSignal;
316
- }
317
- /** The restricted surface used to decide whether a tool exists. */
318
- interface ToolVisibilityContext<TAppContext> {
319
- readonly appContext: TAppContext;
320
- }
321
- interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined, TAppContext = undefined> {
310
+ interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined> {
322
311
  readonly name: string;
323
312
  /** Human-readable display name shown to the user in MCP clients. Required. */
324
313
  readonly title: string;
@@ -327,44 +316,22 @@ interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$
327
316
  readonly inputSchema?: TInput;
328
317
  readonly outputSchema?: TOutput;
329
318
  readonly annotations?: ToolAnnotations;
330
- /** Synchronously decide whether this tool exists for the current caller. */
331
- readonly enabled?: (ctx: ToolVisibilityContext<TAppContext>) => boolean;
332
- readonly handler: TInput extends ZodRawShape$1 ? (args: ShapeOutput<TInput>, ctx: ToolContext<TAppContext>) => ToolHandlerResult | Promise<ToolHandlerResult> : (args: Record<string, never> | undefined, ctx: ToolContext<TAppContext>) => ToolHandlerResult | Promise<ToolHandlerResult>;
333
- }
334
- interface AppContextToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined, TAppContext = unknown> extends ToolDefinition<TInput, TOutput, TAppContext> {
335
- readonly requiresAppContext: true;
319
+ readonly handler: TInput extends ZodRawShape$1 ? (args: ShapeOutput<TInput>, ctx: ToolContext) => ToolHandlerResult | Promise<ToolHandlerResult> : (args: Record<string, never> | undefined, ctx: ToolContext) => ToolHandlerResult | Promise<ToolHandlerResult>;
336
320
  }
337
321
  /** Type-erased element of `McpDefinition.tools`; per-tool generic typing
338
322
  * happens at the `defineTool` call site. */
339
- interface AnyToolDefinition<TAppContext = never> {
323
+ interface AnyToolDefinition {
340
324
  readonly name: string;
341
325
  readonly title: string;
342
326
  readonly description: string;
343
327
  readonly inputSchema?: ZodRawShape$1 | undefined;
344
328
  readonly outputSchema?: ZodOutputSchema | undefined;
345
329
  readonly annotations?: ToolAnnotations;
346
- readonly enabled?: (ctx: ToolVisibilityContext<TAppContext>) => boolean;
347
- readonly handler: (args: any, ctx: ToolContext<TAppContext>) => ToolHandlerResult | Promise<ToolHandlerResult>;
330
+ readonly handler: (args: any, ctx: ToolContext) => ToolHandlerResult | Promise<ToolHandlerResult>;
348
331
  }
349
- type StaticToolDefinition = Omit<AnyToolDefinition<undefined>, "enabled"> & {
350
- readonly enabled?: never;
351
- };
352
- type AnyAppContextToolDefinition<TAppContext = unknown> = AnyToolDefinition<TAppContext> & {
353
- readonly requiresAppContext: true;
354
- };
355
- type CreateAppContext<TAppContext> = (input: CreateAppContextInput) => TAppContext | Promise<TAppContext>;
356
- /** Concrete app context requires a factory. `undefined`, `unknown`, and `never`
357
- * remain optional because the SDK uses them for static or type-erased tools. */
358
- type AppContextConfiguration<TAppContext> = [TAppContext] extends [undefined] ? {
359
- readonly createAppContext?: CreateAppContext<TAppContext>;
360
- } : unknown extends TAppContext ? {
361
- readonly createAppContext?: CreateAppContext<TAppContext>;
362
- } : {
363
- readonly createAppContext: CreateAppContext<TAppContext>;
364
- };
365
332
  /** Input shape for `defineMcp(...)`, whose branded `McpDefinition` return type is what
366
333
  * `createMcpProtocolHandler` consumes — the brand forces validation + freeze. */
367
- type McpDefinitionInput<TAppContext = undefined> = {
334
+ interface McpDefinitionInput {
368
335
  readonly name: string;
369
336
  /** Human-readable display name shown to MCP clients. Required. */
370
337
  readonly title: string;
@@ -379,19 +346,17 @@ type McpDefinitionInput<TAppContext = undefined> = {
379
346
  * empty string to opt out.
380
347
  */
381
348
  readonly instructions: string;
382
- readonly tools: readonly (AnyAppContextToolDefinition<TAppContext> | StaticToolDefinition)[];
349
+ readonly tools: readonly AnyToolDefinition[];
383
350
  /**
384
351
  * Usage-metrics emission (runtime telemetry), on by default. `false` opts out;
385
352
  * `{ endpoint, headers }` sends to your own OTLP collector. Self-disables at
386
353
  * runtime without `LOVABLE_API_KEY` on the default Lovable endpoint.
387
354
  */
388
355
  readonly metrics?: MetricsConfig;
389
- } & AppContextConfiguration<TAppContext>;
356
+ }
390
357
  declare const McpDefinitionBrand: unique symbol;
391
- type McpDefinition<TAppContext = unknown> = Omit<McpDefinitionInput<TAppContext>, "createAppContext" | "tools"> & {
392
- readonly createAppContext?: (input: CreateAppContextInput) => TAppContext | Promise<TAppContext>;
393
- readonly tools: readonly AnyToolDefinition[];
358
+ type McpDefinition = McpDefinitionInput & {
394
359
  readonly [McpDefinitionBrand]: never;
395
360
  };
396
361
  //#endregion
397
- export { McpProtocolEra as A, ZodOutputSchema as C, MetricsOptions as D, MetricsConfig as E, ToolContext as M, JwtClaims as N, AuthContext as O, McpAuthConfig as P, ToolVisibilityContext as S, ZodSchema as T, TextContent as _, CreateAppContextInput as a, ToolDefinition as b, EmbeddedTextResource as c, JsonValueInput as d, McpAllowedOrigins as f, ResourceLinkIcon as g, ResourceLink as h, ContentBlock as i, ProgressUpdate as j, McpClientInfo as k, ImageContent as l, McpDefinitionInput as m, AudioContent as n, EmbeddedBlobResource as o, McpDefinition as p, ContentAnnotations as r, EmbeddedResource as s, AppContextToolDefinition as t, JsonValue as u, ToolAnnotations as v, ZodRawShape$1 as w, ToolHandlerResult as x, ToolContent as y };
362
+ 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 };
@@ -116,11 +116,18 @@ interface ToolRequestContext {
116
116
  client?: McpClientInfo;
117
117
  sendProgress?: (update: ProgressUpdate) => Promise<void>;
118
118
  }
119
- /** Verified caller identity exposed to the app-context factory.
120
- * `getToken()` is the sole bearer escape hatch. */
121
- declare class AuthContext {
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. */
121
+ declare class ToolContext {
122
122
  #private;
123
- constructor(auth: McpAuthContext | undefined);
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>;
124
131
  /** Whether the in-flight tool call carries a verified auth context. */
125
132
  isAuthenticated(): boolean;
126
133
  /** The verified bearer token, or `undefined` when unauthenticated. Pass it to downstream APIs; never return or log it. */
@@ -141,20 +148,6 @@ declare class AuthContext {
141
148
  */
142
149
  getClaims(): JwtClaims | undefined;
143
150
  }
144
- /** The per-request context passed to every tool handler as its second argument. */
145
- declare class ToolContext<TAppContext = undefined> extends AuthContext {
146
- #private;
147
- constructor(auth: McpAuthContext | undefined, request?: ToolRequestContext, appContext?: TAppContext);
148
- /** App-defined context created for this tool call. */
149
- get appContext(): TAppContext;
150
- /** Aborts when the client cancels the request or disconnects. */
151
- get signal(): AbortSignal;
152
- /** What the client declared about itself on this request. Unverified input. */
153
- get client(): McpClientInfo;
154
- /** Send a progress notification for this call. A no-op when the client
155
- * didn't request progress (no `progressToken` on the request). */
156
- progress(update: ProgressUpdate): Promise<void>;
157
- }
158
151
  //#endregion
159
152
  //#region src/metrics/config.d.ts
160
153
  /**
@@ -303,22 +296,18 @@ interface ToolAnnotations {
303
296
  idempotentHint?: boolean;
304
297
  /** Tool interacts with external/unbounded systems (DB, network, third-party APIs). */
305
298
  openWorldHint?: boolean;
299
+ /**
300
+ * Asks the Lovable agent to keep up to 50 KB of this tool's result in context instead of the default 5 KB.
301
+ * Honored for the app's published MCP server; meant for results the agent must read whole.
302
+ */
303
+ largeOutputHint?: boolean;
306
304
  }
307
305
  interface ToolHandlerResult {
308
306
  content?: ToolContent;
309
307
  structuredContent?: JsonValueInput;
310
308
  isError?: boolean;
311
309
  }
312
- /** Inputs available while creating app context for one MCP request. */
313
- interface CreateAppContextInput {
314
- readonly auth: AuthContext;
315
- readonly signal: AbortSignal;
316
- }
317
- /** The restricted surface used to decide whether a tool exists. */
318
- interface ToolVisibilityContext<TAppContext> {
319
- readonly appContext: TAppContext;
320
- }
321
- interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined, TAppContext = undefined> {
310
+ interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined> {
322
311
  readonly name: string;
323
312
  /** Human-readable display name shown to the user in MCP clients. Required. */
324
313
  readonly title: string;
@@ -327,44 +316,22 @@ interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$
327
316
  readonly inputSchema?: TInput;
328
317
  readonly outputSchema?: TOutput;
329
318
  readonly annotations?: ToolAnnotations;
330
- /** Synchronously decide whether this tool exists for the current caller. */
331
- readonly enabled?: (ctx: ToolVisibilityContext<TAppContext>) => boolean;
332
- readonly handler: TInput extends ZodRawShape$1 ? (args: ShapeOutput<TInput>, ctx: ToolContext<TAppContext>) => ToolHandlerResult | Promise<ToolHandlerResult> : (args: Record<string, never> | undefined, ctx: ToolContext<TAppContext>) => ToolHandlerResult | Promise<ToolHandlerResult>;
333
- }
334
- interface AppContextToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends ZodOutputSchema | undefined = ZodOutputSchema | undefined, TAppContext = unknown> extends ToolDefinition<TInput, TOutput, TAppContext> {
335
- readonly requiresAppContext: true;
319
+ readonly handler: TInput extends ZodRawShape$1 ? (args: ShapeOutput<TInput>, ctx: ToolContext) => ToolHandlerResult | Promise<ToolHandlerResult> : (args: Record<string, never> | undefined, ctx: ToolContext) => ToolHandlerResult | Promise<ToolHandlerResult>;
336
320
  }
337
321
  /** Type-erased element of `McpDefinition.tools`; per-tool generic typing
338
322
  * happens at the `defineTool` call site. */
339
- interface AnyToolDefinition<TAppContext = never> {
323
+ interface AnyToolDefinition {
340
324
  readonly name: string;
341
325
  readonly title: string;
342
326
  readonly description: string;
343
327
  readonly inputSchema?: ZodRawShape$1 | undefined;
344
328
  readonly outputSchema?: ZodOutputSchema | undefined;
345
329
  readonly annotations?: ToolAnnotations;
346
- readonly enabled?: (ctx: ToolVisibilityContext<TAppContext>) => boolean;
347
- readonly handler: (args: any, ctx: ToolContext<TAppContext>) => ToolHandlerResult | Promise<ToolHandlerResult>;
330
+ readonly handler: (args: any, ctx: ToolContext) => ToolHandlerResult | Promise<ToolHandlerResult>;
348
331
  }
349
- type StaticToolDefinition = Omit<AnyToolDefinition<undefined>, "enabled"> & {
350
- readonly enabled?: never;
351
- };
352
- type AnyAppContextToolDefinition<TAppContext = unknown> = AnyToolDefinition<TAppContext> & {
353
- readonly requiresAppContext: true;
354
- };
355
- type CreateAppContext<TAppContext> = (input: CreateAppContextInput) => TAppContext | Promise<TAppContext>;
356
- /** Concrete app context requires a factory. `undefined`, `unknown`, and `never`
357
- * remain optional because the SDK uses them for static or type-erased tools. */
358
- type AppContextConfiguration<TAppContext> = [TAppContext] extends [undefined] ? {
359
- readonly createAppContext?: CreateAppContext<TAppContext>;
360
- } : unknown extends TAppContext ? {
361
- readonly createAppContext?: CreateAppContext<TAppContext>;
362
- } : {
363
- readonly createAppContext: CreateAppContext<TAppContext>;
364
- };
365
332
  /** Input shape for `defineMcp(...)`, whose branded `McpDefinition` return type is what
366
333
  * `createMcpProtocolHandler` consumes — the brand forces validation + freeze. */
367
- type McpDefinitionInput<TAppContext = undefined> = {
334
+ interface McpDefinitionInput {
368
335
  readonly name: string;
369
336
  /** Human-readable display name shown to MCP clients. Required. */
370
337
  readonly title: string;
@@ -379,19 +346,17 @@ type McpDefinitionInput<TAppContext = undefined> = {
379
346
  * empty string to opt out.
380
347
  */
381
348
  readonly instructions: string;
382
- readonly tools: readonly (AnyAppContextToolDefinition<TAppContext> | StaticToolDefinition)[];
349
+ readonly tools: readonly AnyToolDefinition[];
383
350
  /**
384
351
  * Usage-metrics emission (runtime telemetry), on by default. `false` opts out;
385
352
  * `{ endpoint, headers }` sends to your own OTLP collector. Self-disables at
386
353
  * runtime without `LOVABLE_API_KEY` on the default Lovable endpoint.
387
354
  */
388
355
  readonly metrics?: MetricsConfig;
389
- } & AppContextConfiguration<TAppContext>;
356
+ }
390
357
  declare const McpDefinitionBrand: unique symbol;
391
- type McpDefinition<TAppContext = unknown> = Omit<McpDefinitionInput<TAppContext>, "createAppContext" | "tools"> & {
392
- readonly createAppContext?: (input: CreateAppContextInput) => TAppContext | Promise<TAppContext>;
393
- readonly tools: readonly AnyToolDefinition[];
358
+ type McpDefinition = McpDefinitionInput & {
394
359
  readonly [McpDefinitionBrand]: never;
395
360
  };
396
361
  //#endregion
397
- export { McpProtocolEra as A, ZodOutputSchema as C, MetricsOptions as D, MetricsConfig as E, ToolContext as M, JwtClaims as N, AuthContext as O, McpAuthConfig as P, ToolVisibilityContext as S, ZodSchema as T, TextContent as _, CreateAppContextInput as a, ToolDefinition as b, EmbeddedTextResource as c, JsonValueInput as d, McpAllowedOrigins as f, ResourceLinkIcon as g, ResourceLink as h, ContentBlock as i, ProgressUpdate as j, McpClientInfo as k, ImageContent as l, McpDefinitionInput as m, AudioContent as n, EmbeddedBlobResource as o, McpDefinition as p, ContentAnnotations as r, EmbeddedResource as s, AppContextToolDefinition as t, JsonValue as u, ToolAnnotations as v, ZodRawShape$1 as w, ToolHandlerResult as x, ToolContent as y };
362
+ 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": "2.1.0-rc.0",
3
+ "version": "2.1.0",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },
@@ -108,8 +108,8 @@
108
108
  ],
109
109
  "license": "MIT",
110
110
  "dependencies": {
111
- "@modelcontextprotocol/sdk": "1.28.0",
112
111
  "@modelcontextprotocol/server": "2.0.0",
112
+ "@modelcontextprotocol/sdk": "1.28.0",
113
113
  "esbuild": "^0.27.0",
114
114
  "jose": "^6.2.2"
115
115
  },