@lovable.dev/mcp-js 0.30.0-rc.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.internal.md +3 -3
- package/README.md +2 -25
- package/dist/{cors-5P69YRDK.js → authorize-9wHgaqeQ.js} +28 -79
- package/dist/{authorize-DNUlPT7k.d.ts → authorize-CqYsQYfa.d.ts} +1 -1
- package/dist/{cors-DIQIXIHY.cjs → authorize-DBk5GkN_.cjs} +33 -90
- package/dist/{authorize-9hTTG-qJ.d.cts → authorize-DIYS7zBP.d.cts} +1 -1
- package/dist/cli/extract-manifest.cjs +12 -7
- package/dist/cli/extract-manifest.js +12 -7
- package/dist/{errors-Cr95rSkB.cjs → errors-CN6Da8iz.cjs} +8 -23
- package/dist/{errors-Bwd1L0Rf.js → errors-DSe96Ffd.js} +8 -23
- package/dist/forwarded-Bhwcj22u.cjs +48 -0
- package/dist/forwarded-BlLF3dfc.js +43 -0
- package/dist/index.cjs +1 -38
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -38
- package/dist/{io-D_5cuaEL.d.ts → io-DP3icuxa.d.ts} +1 -1
- package/dist/{io-CDV3mud0.d.cts → io-Dx0nPc1-.d.cts} +1 -1
- package/dist/mcp-BDsG9I0t.js +174 -0
- package/dist/mcp-CS1MF39p.cjs +179 -0
- package/dist/{package-ZFJI6B7S.js → package-CLhOKbJP.js} +1 -1
- package/dist/{package-QViIguII.cjs → package-C_8WAZRS.cjs} +1 -1
- package/dist/protocols/mcp/index.cjs +1 -1
- package/dist/protocols/mcp/index.d.cts +33 -3
- package/dist/protocols/mcp/index.d.ts +33 -3
- package/dist/protocols/mcp/index.js +1 -1
- package/dist/protocols/oauth-metadata.cjs +10 -27
- package/dist/protocols/oauth-metadata.d.cts +3 -4
- package/dist/protocols/oauth-metadata.d.ts +3 -4
- package/dist/protocols/oauth-metadata.js +4 -21
- package/dist/stacks/supabase/index.cjs +6 -6
- package/dist/stacks/supabase/index.d.cts +1 -1
- package/dist/stacks/supabase/index.d.ts +1 -1
- package/dist/stacks/supabase/index.js +4 -4
- 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 +5 -5
- package/dist/stacks/tanstack/index.d.cts +2 -2
- package/dist/stacks/tanstack/index.d.ts +2 -2
- package/dist/stacks/tanstack/index.js +4 -4
- package/dist/stacks/tanstack/vite.cjs +4 -8
- package/dist/stacks/tanstack/vite.d.cts +1 -4
- package/dist/stacks/tanstack/vite.d.ts +1 -4
- package/dist/stacks/tanstack/vite.js +4 -8
- package/dist/{types-3CZPz364.d.cts → types-C0Wgm9zp.d.cts} +29 -65
- package/dist/{types-3CZPz364.d.ts → types-C0Wgm9zp.d.ts} +29 -65
- package/package.json +1 -5
- package/dist/base-7cq6HCPO.d.ts +0 -36
- package/dist/base-CHNFFrMG.d.cts +0 -36
- package/dist/forwarded-DG83ubwT.js +0 -26
- package/dist/forwarded-zNAIofM2.cjs +0 -31
- package/dist/mcp-Cb5SavFT.js +0 -348
- package/dist/mcp-Dq6dXUKT.cjs +0 -353
- package/dist/schema-CW1jKvio.js +0 -65
- 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
|
-
/**
|
|
89
|
-
*
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*
|
|
93
|
-
|
|
94
|
-
|
|
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
|
|
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
|
-
/**
|
|
185
|
-
*
|
|
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
|
-
/**
|
|
253
|
-
sizes?: 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?:
|
|
261
|
+
structuredContent?: Record<string, unknown>;
|
|
303
262
|
isError?: boolean;
|
|
304
263
|
}
|
|
305
|
-
interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends
|
|
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
|
-
/**
|
|
317
|
-
*
|
|
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?:
|
|
284
|
+
readonly outputSchema?: ZodRawShape$1;
|
|
324
285
|
readonly annotations?: ToolAnnotations;
|
|
325
286
|
readonly handler: (args: any, ctx: ToolContext) => ToolHandlerResult | Promise<ToolHandlerResult>;
|
|
326
287
|
}
|
|
327
|
-
/**
|
|
328
|
-
*
|
|
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
|
|
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
|
-
/**
|
|
89
|
-
*
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*
|
|
93
|
-
|
|
94
|
-
|
|
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
|
|
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
|
-
/**
|
|
185
|
-
*
|
|
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
|
-
/**
|
|
253
|
-
sizes?: 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?:
|
|
261
|
+
structuredContent?: Record<string, unknown>;
|
|
303
262
|
isError?: boolean;
|
|
304
263
|
}
|
|
305
|
-
interface ToolDefinition<TInput extends ZodRawShape$1 | undefined = ZodRawShape$1 | undefined, TOutput extends
|
|
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
|
-
/**
|
|
317
|
-
*
|
|
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?:
|
|
284
|
+
readonly outputSchema?: ZodRawShape$1;
|
|
324
285
|
readonly annotations?: ToolAnnotations;
|
|
325
286
|
readonly handler: (args: any, ctx: ToolContext) => ToolHandlerResult | Promise<ToolHandlerResult>;
|
|
326
287
|
}
|
|
327
|
-
/**
|
|
328
|
-
*
|
|
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
|
|
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": "
|
|
4
|
-
"engines": {
|
|
5
|
-
"node": ">=20"
|
|
6
|
-
},
|
|
3
|
+
"version": "1.0.0",
|
|
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
|
},
|
package/dist/base-7cq6HCPO.d.ts
DELETED
|
@@ -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 };
|
package/dist/base-CHNFFrMG.d.cts
DELETED
|
@@ -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,26 +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
|
-
if (url.host !== host) url.port = "";
|
|
17
|
-
changed = true;
|
|
18
|
-
}
|
|
19
|
-
return changed ? new Request(url.href, request) : request;
|
|
20
|
-
}
|
|
21
|
-
function firstForwardedValue(request, header) {
|
|
22
|
-
const value = request.headers.get(header)?.split(",")[0]?.trim();
|
|
23
|
-
return value ? value : void 0;
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
export { applyForwardedOrigin as t };
|
|
@@ -1,31 +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
|
-
if (url.host !== host) url.port = "";
|
|
17
|
-
changed = true;
|
|
18
|
-
}
|
|
19
|
-
return changed ? new Request(url.href, request) : request;
|
|
20
|
-
}
|
|
21
|
-
function firstForwardedValue(request, header) {
|
|
22
|
-
const value = request.headers.get(header)?.split(",")[0]?.trim();
|
|
23
|
-
return value ? value : void 0;
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
Object.defineProperty(exports, "applyForwardedOrigin", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function() {
|
|
29
|
-
return applyForwardedOrigin;
|
|
30
|
-
}
|
|
31
|
-
});
|