@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.
- package/README.md +1 -82
- package/dist/{authorize-BC4TM__8.d.cts → authorize-CzyL7nmF.d.cts} +1 -1
- package/dist/{authorize-DEsM-zTN.d.ts → authorize-Drz_eJ7O.d.ts} +1 -1
- package/dist/{base-BnlJz6TE.d.ts → base-COwtdWE8.d.ts} +2 -2
- package/dist/{base-4G2k3bMl.d.cts → base-DD4MCXZ6.d.cts} +2 -2
- package/dist/cli/extract-manifest.cjs +1 -1
- package/dist/cli/extract-manifest.js +1 -1
- package/dist/{cors-D4BjUpgU.js → cors-BaRKDl4r.js} +1 -1
- package/dist/{cors-0ZCwmwyK.cjs → cors-D-X0aP4O.cjs} +1 -1
- package/dist/errors-Bwd1L0Rf.js +100 -0
- package/dist/errors-Cr95rSkB.cjs +123 -0
- package/dist/index.cjs +147 -4
- package/dist/index.d.cts +4 -12
- package/dist/index.d.ts +4 -12
- package/dist/index.js +147 -3
- package/dist/{io-BEoJ_gb5.js → io-DG83CLKx.js} +2 -3
- package/dist/{io-Cz81GsrM.cjs → io-DZD6xmJQ.cjs} +2 -3
- package/dist/{io-9jGNgPfl.d.cts → io-Ds5MRSiK.d.cts} +1 -1
- package/dist/{io-BLZ8jYW6.d.ts → io-pl5npWDw.d.ts} +1 -1
- package/dist/{mcp-Q_rjpR99.cjs → mcp-Bx3LUn5O.cjs} +15 -92
- package/dist/{mcp-CuHyVOZK.js → mcp-DcmfehoI.js} +15 -92
- package/dist/{package-BAYb-3dX.js → package-BNFIhH0F.js} +1 -1
- package/dist/{package-DlouusYQ.cjs → package-CFVl3oIe.cjs} +1 -1
- package/dist/protocols/mcp/index.cjs +1 -1
- package/dist/protocols/mcp/index.d.cts +3 -3
- package/dist/protocols/mcp/index.d.ts +3 -3
- package/dist/protocols/mcp/index.js +1 -1
- package/dist/protocols/oauth-metadata.cjs +1 -1
- package/dist/protocols/oauth-metadata.d.cts +3 -3
- package/dist/protocols/oauth-metadata.d.ts +3 -3
- package/dist/protocols/oauth-metadata.js +1 -1
- package/dist/stacks/supabase/index.cjs +2 -2
- package/dist/stacks/supabase/index.d.cts +1 -1
- package/dist/stacks/supabase/index.d.ts +1 -1
- package/dist/stacks/supabase/index.js +2 -2
- package/dist/stacks/supabase/vite.cjs +1 -1
- package/dist/stacks/supabase/vite.d.cts +1 -1
- package/dist/stacks/supabase/vite.d.ts +1 -1
- package/dist/stacks/supabase/vite.js +1 -1
- package/dist/stacks/tanstack/index.cjs +2 -2
- package/dist/stacks/tanstack/index.d.cts +2 -2
- package/dist/stacks/tanstack/index.d.ts +2 -2
- package/dist/stacks/tanstack/index.js +2 -2
- package/dist/stacks/tanstack/vite.d.cts +1 -1
- package/dist/stacks/tanstack/vite.d.ts +1 -1
- package/dist/{types-S6J_QTXw.d.cts → types-B3_lX-L1.d.cts} +25 -60
- package/dist/{types-S6J_QTXw.d.ts → types-B3_lX-L1.d.ts} +25 -60
- package/package.json +2 -2
- package/dist/errors-CdrGi5aP.cjs +0 -309
- 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-
|
|
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-
|
|
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 {
|
|
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 {
|
|
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-
|
|
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-
|
|
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-
|
|
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 version } from "../../package-
|
|
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-
|
|
3
|
-
const require_mcp = require("../../mcp-
|
|
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 {
|
|
2
|
-
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-
|
|
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 {
|
|
2
|
-
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-
|
|
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-
|
|
2
|
-
import { t as createMcpProtocolHandler } from "../../mcp-
|
|
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
|
|
@@ -116,11 +116,18 @@ interface ToolRequestContext {
|
|
|
116
116
|
client?: McpClientInfo;
|
|
117
117
|
sendProgress?: (update: ProgressUpdate) => Promise<void>;
|
|
118
118
|
}
|
|
119
|
-
/**
|
|
120
|
-
* `getToken()` is the sole bearer escape hatch. */
|
|
121
|
-
declare class
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
}
|
|
356
|
+
}
|
|
390
357
|
declare const McpDefinitionBrand: unique symbol;
|
|
391
|
-
type McpDefinition
|
|
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 {
|
|
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
|
-
/**
|
|
120
|
-
* `getToken()` is the sole bearer escape hatch. */
|
|
121
|
-
declare class
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
}
|
|
356
|
+
}
|
|
390
357
|
declare const McpDefinitionBrand: unique symbol;
|
|
391
|
-
type McpDefinition
|
|
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 {
|
|
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
|
|
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
|
},
|