@lovable.dev/mcp-js 3.3.0 → 3.3.1
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 +4 -0
- package/dist/{authorize-DxnyFNHv.d.ts → authorize-BV62MDan.d.ts} +1 -1
- package/dist/{authorize-r6jB-Gl2.d.cts → authorize-CoaAw6wg.d.cts} +1 -1
- package/dist/{base-ff0LwIA2.d.ts → base-Cx0spfMk.d.ts} +1 -1
- package/dist/{base-CzPzbI3q.d.cts → base-CzWe8AD1.d.cts} +1 -1
- package/dist/cli/extract-manifest.cjs +1 -1
- package/dist/cli/extract-manifest.js +1 -1
- package/dist/{cors-Bjo6NPjV.cjs → cors-3HjrsmEW.cjs} +1 -1
- package/dist/{cors-COjc9O73.js → cors-CNNmKKIg.js} +1 -1
- package/dist/{errors-DSHt3Jqs.cjs → errors-C97I7VOC.cjs} +10 -0
- package/dist/{errors-D0UPHnG3.js → errors-CIpFAb6i.js} +10 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{io-Dzy5Bu6h.cjs → io-CaBSlPwS.cjs} +1 -1
- package/dist/{io-DTz7efSK.js → io-CahnhUhA.js} +1 -1
- package/dist/{io-CQ60Nc2J.d.ts → io-D7cpdBJO.d.ts} +1 -1
- package/dist/{io-DnRCu_HX.d.cts → io-DC-Y6R61.d.cts} +1 -1
- package/dist/{mcp-DIR9MCwQ.js → mcp-DC8AoD18.js} +11 -6
- package/dist/{mcp-Buu1riaY.cjs → mcp-DlWLIwX9.cjs} +10 -5
- package/dist/{package-DL4uNmL0.cjs → package-B488glmj.cjs} +1 -1
- package/dist/{package-DV8zBoEy.js → package-CukfP_vq.js} +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/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/{types-BtoYHhdt.d.ts → types-z7T5bBIU.d.cts} +4 -0
- package/dist/{types-BtoYHhdt.d.cts → types-z7T5bBIU.d.ts} +4 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -46,6 +46,10 @@ Manifest extraction allows **512 tools** in the evaluated `defineMcp({ tools })`
|
|
|
46
46
|
|
|
47
47
|
`inputSchema` is closed: a `tools/call` carrying an argument key the schema does not declare fails in-band (`isError: true`, naming the key) instead of silently dropping it, and `tools/list` advertises `additionalProperties: false`. Set `strict: false` on a tool to accept and drop unknown keys instead.
|
|
48
48
|
|
|
49
|
+
MCP POST bodies default to **1 MiB** and tool arguments to **10,000 combined object members and array elements**. Larger bodies receive HTTP `413`; arguments over the element limit return a tool error before the handler runs. These defaults apply to both protocol eras, including Skills and app-context requests.
|
|
50
|
+
|
|
51
|
+
For tools that need larger inputs, set `limits` in `defineMcp`, for example `limits: { maxRequestBodySize: 4 * 1024 * 1024, maxToolInputElements: 50_000 }`. `maxRequestBodySize` is measured in bytes. Each override must be a positive safe integer; zero, fractional values, `NaN` and `Infinity` are rejected when the server is declared. Omitted fields keep their defaults. Hosting-provider limits still apply.
|
|
52
|
+
|
|
49
53
|
## Task workflows as skills
|
|
50
54
|
|
|
51
55
|
**Experimental:** Skills support follows the developing [MCP Skills extension](https://modelcontextprotocol.io/extensions/skills). Client support varies, and the integration may change as the specification evolves.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as McpProtocolEra } from "./types-
|
|
1
|
+
import { N as McpProtocolEra } from "./types-z7T5bBIU.js";
|
|
2
2
|
//#region src/metrics/impl/base.d.ts
|
|
3
3
|
type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "app_context_error" | "auth_challenge" | "auth_token_expired" | "auth_token_invalid" | "auth_insufficient_scope" | "auth_unexpected_error" | "origin_rejected" | "auth_discovery_config_error" | "auth_discovery_unreachable" | "auth_jwks_config_error" | "auth_jwks_unreachable";
|
|
4
4
|
/** One recorded MCP call. Carries no arguments or response payloads — only the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as McpProtocolEra } from "./types-
|
|
1
|
+
import { N as McpProtocolEra } from "./types-z7T5bBIU.cjs";
|
|
2
2
|
//#region src/metrics/impl/base.d.ts
|
|
3
3
|
type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "app_context_error" | "auth_challenge" | "auth_token_expired" | "auth_token_invalid" | "auth_insufficient_scope" | "auth_unexpected_error" | "origin_rejected" | "auth_discovery_config_error" | "auth_discovery_unreachable" | "auth_jwks_config_error" | "auth_jwks_unreachable";
|
|
4
4
|
/** One recorded MCP call. Carries no arguments or response payloads — only the
|
|
@@ -7,7 +7,7 @@ import("zod/v3").catch((err) => {
|
|
|
7
7
|
}).then(() => import("vite").catch((err) => {
|
|
8
8
|
const message = err instanceof Error ? err.message : String(err);
|
|
9
9
|
throw new Error(`@lovable.dev/mcp-js requires vite >=5.0.0 <9.0.0 for manifest extraction. Install a compatible Vite version in the project (for example, npm install -D vite@^7) and include dev dependencies when running this command. Underlying error: ${message}`);
|
|
10
|
-
})).then(() => Promise.resolve().then(() => require("../io-
|
|
10
|
+
})).then(() => Promise.resolve().then(() => require("../io-CaBSlPwS.cjs"))).then(({ runExtract }) => runExtract(projectRoot)).catch((err) => {
|
|
11
11
|
console.error(err instanceof Error ? err.message : String(err));
|
|
12
12
|
process.exit(1);
|
|
13
13
|
});
|
|
@@ -7,7 +7,7 @@ import("zod/v3").catch((err) => {
|
|
|
7
7
|
}).then(() => import("vite").catch((err) => {
|
|
8
8
|
const message = err instanceof Error ? err.message : String(err);
|
|
9
9
|
throw new Error(`@lovable.dev/mcp-js requires vite >=5.0.0 <9.0.0 for manifest extraction. Install a compatible Vite version in the project (for example, npm install -D vite@^7) and include dev dependencies when running this command. Underlying error: ${message}`);
|
|
10
|
-
})).then(() => import("../io-
|
|
10
|
+
})).then(() => import("../io-CahnhUhA.js")).then(({ runExtract }) => runExtract(projectRoot)).catch((err) => {
|
|
11
11
|
console.error(err instanceof Error ? err.message : String(err));
|
|
12
12
|
process.exit(1);
|
|
13
13
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_logger = require("./logger-C-Hdu57K.cjs");
|
|
2
|
-
const require_package = require("./package-
|
|
2
|
+
const require_package = require("./package-B488glmj.cjs");
|
|
3
3
|
require("./metadata-path-zd7NSNoa.cjs");
|
|
4
4
|
let jose = require("jose");
|
|
5
5
|
//#region src/core/http.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as log, n as applyLogLevelFromEnv, o as parseSafeUrl, r as describeError, s as trimTrailingSlash, t as LOG_LEVEL_ENV_VAR, u as resolveMetricsConfig } from "./logger-CpLgYbCG.js";
|
|
2
|
-
import { t as version } from "./package-
|
|
2
|
+
import { t as version } from "./package-CukfP_vq.js";
|
|
3
3
|
import "./metadata-path-CAkNcfyY.js";
|
|
4
4
|
import { createLocalJWKSet, decodeProtectedHeader, errors, jwtVerify } from "jose";
|
|
5
5
|
//#region src/core/http.ts
|
|
@@ -16,6 +16,14 @@ function assertAppContextConfiguration(mcp) {
|
|
|
16
16
|
if (mcp.createAppContext && !mcp.auth) throw new Error(`@lovable.dev/mcp-js: createAppContext requires auth`);
|
|
17
17
|
if (!mcp.createAppContext && mcp.tools.some((tool) => tool.enabled || toolRequiresAppContext(tool))) throw new Error(`@lovable.dev/mcp-js: app-context or conditional tools require createAppContext`);
|
|
18
18
|
}
|
|
19
|
+
function assertLimits(limits) {
|
|
20
|
+
if (limits === void 0) return;
|
|
21
|
+
if (limits === null || typeof limits !== "object" || Array.isArray(limits)) throw new TypeError("@lovable.dev/mcp-js: limits must be an object");
|
|
22
|
+
for (const name of ["maxRequestBodySize", "maxToolInputElements"]) {
|
|
23
|
+
const value = limits[name];
|
|
24
|
+
if (value !== void 0 && (!Number.isSafeInteger(value) || value <= 0)) throw new TypeError(`@lovable.dev/mcp-js: limits.${name} must be a positive safe integer`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
19
27
|
function assertNonEmptyString(label, value) {
|
|
20
28
|
if (value.trim() === "") throw new Error(`@lovable.dev/mcp-js: ${label} must not be empty`);
|
|
21
29
|
if (value !== value.trim()) throw new Error(`@lovable.dev/mcp-js: ${label} must not have leading or trailing whitespace`);
|
|
@@ -141,9 +149,11 @@ function defineMcp(def) {
|
|
|
141
149
|
assertAppContextConfiguration(def);
|
|
142
150
|
if (def.auth) assertOAuthConfig(def.auth);
|
|
143
151
|
assertAllowedOrigins(def.allowedOrigins);
|
|
152
|
+
assertLimits(def.limits);
|
|
144
153
|
assertToolSchemas(def);
|
|
145
154
|
require_logger.resolveMetricsConfig(def.metrics);
|
|
146
155
|
freezeAuth(def.auth);
|
|
156
|
+
if (def.limits) Object.freeze(def.limits);
|
|
147
157
|
if (Array.isArray(def.allowedOrigins)) Object.freeze(def.allowedOrigins);
|
|
148
158
|
Object.freeze(def.tools);
|
|
149
159
|
for (const tool of def.tools) Object.freeze(tool);
|
|
@@ -16,6 +16,14 @@ function assertAppContextConfiguration(mcp) {
|
|
|
16
16
|
if (mcp.createAppContext && !mcp.auth) throw new Error(`@lovable.dev/mcp-js: createAppContext requires auth`);
|
|
17
17
|
if (!mcp.createAppContext && mcp.tools.some((tool) => tool.enabled || toolRequiresAppContext(tool))) throw new Error(`@lovable.dev/mcp-js: app-context or conditional tools require createAppContext`);
|
|
18
18
|
}
|
|
19
|
+
function assertLimits(limits) {
|
|
20
|
+
if (limits === void 0) return;
|
|
21
|
+
if (limits === null || typeof limits !== "object" || Array.isArray(limits)) throw new TypeError("@lovable.dev/mcp-js: limits must be an object");
|
|
22
|
+
for (const name of ["maxRequestBodySize", "maxToolInputElements"]) {
|
|
23
|
+
const value = limits[name];
|
|
24
|
+
if (value !== void 0 && (!Number.isSafeInteger(value) || value <= 0)) throw new TypeError(`@lovable.dev/mcp-js: limits.${name} must be a positive safe integer`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
19
27
|
function assertNonEmptyString(label, value) {
|
|
20
28
|
if (value.trim() === "") throw new Error(`@lovable.dev/mcp-js: ${label} must not be empty`);
|
|
21
29
|
if (value !== value.trim()) throw new Error(`@lovable.dev/mcp-js: ${label} must not have leading or trailing whitespace`);
|
|
@@ -141,9 +149,11 @@ function defineMcp(def) {
|
|
|
141
149
|
assertAppContextConfiguration(def);
|
|
142
150
|
if (def.auth) assertOAuthConfig(def.auth);
|
|
143
151
|
assertAllowedOrigins(def.allowedOrigins);
|
|
152
|
+
assertLimits(def.limits);
|
|
144
153
|
assertToolSchemas(def);
|
|
145
154
|
resolveMetricsConfig(def.metrics);
|
|
146
155
|
freezeAuth(def.auth);
|
|
156
|
+
if (def.limits) Object.freeze(def.limits);
|
|
147
157
|
if (Array.isArray(def.allowedOrigins)) Object.freeze(def.allowedOrigins);
|
|
148
158
|
Object.freeze(def.tools);
|
|
149
159
|
for (const tool of def.tools) Object.freeze(tool);
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_logger = require("./logger-C-Hdu57K.cjs");
|
|
3
|
-
const require_errors = require("./errors-
|
|
3
|
+
const require_errors = require("./errors-C97I7VOC.cjs");
|
|
4
4
|
//#region src/auth/config.ts
|
|
5
5
|
function frozenArray(value) {
|
|
6
6
|
return value === void 0 ? void 0 : Object.freeze([...value]);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as MetricsOptions, C as ToolHandlerResult, D as ZodSchema, E as ZodRawShape, F as ToolContext, I as JwtClaims, L as McpAuthConfig, M as McpClientInfo, N as McpProtocolEra, O as Skill, P as ProgressUpdate, S as ToolDefinition, T as ZodOutputSchema, _ as ResourceLink, a as ContentAnnotations, b as ToolAnnotations, c as EmbeddedBlobResource, d as ImageContent, f as JsonValue, g as McpDefinitionInput, h as McpDefinition, i as ConditionalSkill, j as AuthContext, k as MetricsConfig, l as EmbeddedResource, m as McpAllowedOrigins, n as AppContextToolDefinitionInput, o as ContentBlock, p as JsonValueInput, r as AudioContent, s as CreateAppContextInput, t as AppContextToolDefinition, u as EmbeddedTextResource, v as ResourceLinkIcon, w as ToolVisibilityContext, x as ToolContent, y as TextContent } from "./types-
|
|
1
|
+
import { A as MetricsOptions, C as ToolHandlerResult, D as ZodSchema, E as ZodRawShape, F as ToolContext, I as JwtClaims, L as McpAuthConfig, M as McpClientInfo, N as McpProtocolEra, O as Skill, P as ProgressUpdate, S as ToolDefinition, T as ZodOutputSchema, _ as ResourceLink, a as ContentAnnotations, b as ToolAnnotations, c as EmbeddedBlobResource, d as ImageContent, f as JsonValue, g as McpDefinitionInput, h as McpDefinition, i as ConditionalSkill, j as AuthContext, k as MetricsConfig, l as EmbeddedResource, m as McpAllowedOrigins, n as AppContextToolDefinitionInput, o as ContentBlock, p as JsonValueInput, r as AudioContent, s as CreateAppContextInput, t as AppContextToolDefinition, u as EmbeddedTextResource, v as ResourceLinkIcon, w as ToolVisibilityContext, x as ToolContent, y as TextContent } from "./types-z7T5bBIU.cjs";
|
|
2
2
|
//#region src/core/define.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Declare a single MCP tool. Import the result into your MCP definition's
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as MetricsOptions, C as ToolHandlerResult, D as ZodSchema, E as ZodRawShape, F as ToolContext, I as JwtClaims, L as McpAuthConfig, M as McpClientInfo, N as McpProtocolEra, O as Skill, P as ProgressUpdate, S as ToolDefinition, T as ZodOutputSchema, _ as ResourceLink, a as ContentAnnotations, b as ToolAnnotations, c as EmbeddedBlobResource, d as ImageContent, f as JsonValue, g as McpDefinitionInput, h as McpDefinition, i as ConditionalSkill, j as AuthContext, k as MetricsConfig, l as EmbeddedResource, m as McpAllowedOrigins, n as AppContextToolDefinitionInput, o as ContentBlock, p as JsonValueInput, r as AudioContent, s as CreateAppContextInput, t as AppContextToolDefinition, u as EmbeddedTextResource, v as ResourceLinkIcon, w as ToolVisibilityContext, x as ToolContent, y as TextContent } from "./types-
|
|
1
|
+
import { A as MetricsOptions, C as ToolHandlerResult, D as ZodSchema, E as ZodRawShape, F as ToolContext, I as JwtClaims, L as McpAuthConfig, M as McpClientInfo, N as McpProtocolEra, O as Skill, P as ProgressUpdate, S as ToolDefinition, T as ZodOutputSchema, _ as ResourceLink, a as ContentAnnotations, b as ToolAnnotations, c as EmbeddedBlobResource, d as ImageContent, f as JsonValue, g as McpDefinitionInput, h as McpDefinition, i as ConditionalSkill, j as AuthContext, k as MetricsConfig, l as EmbeddedResource, m as McpAllowedOrigins, n as AppContextToolDefinitionInput, o as ContentBlock, p as JsonValueInput, r as AudioContent, s as CreateAppContextInput, t as AppContextToolDefinition, u as EmbeddedTextResource, v as ResourceLinkIcon, w as ToolVisibilityContext, x as ToolContent, y as TextContent } from "./types-z7T5bBIU.js";
|
|
2
2
|
//#region src/core/define.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Declare a single MCP tool. Import the result into your MCP definition's
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as setLogLevel } from "./logger-CpLgYbCG.js";
|
|
2
|
-
import { a as ToolContext, i as AuthContext, o as defineMcp, s as defineTool, t as ToolError } from "./errors-
|
|
2
|
+
import { a as ToolContext, i as AuthContext, o as defineMcp, s as defineTool, t as ToolError } from "./errors-CIpFAb6i.js";
|
|
3
3
|
//#region src/auth/config.ts
|
|
4
4
|
function frozenArray(value) {
|
|
5
5
|
return value === void 0 ? void 0 : Object.freeze([...value]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_schema = require("./schema-DNMsvJwE.cjs");
|
|
2
|
-
const require_package = require("./package-
|
|
2
|
+
const require_package = require("./package-B488glmj.cjs");
|
|
3
3
|
const require_hooks = require("./hooks-xQl3EkDa.cjs");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
let node_path = require("node:path");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as jsonSchemaFromDefinition } from "./schema-JK_1KkOa.js";
|
|
2
|
-
import { t as version } from "./package-
|
|
2
|
+
import { t as version } from "./package-CukfP_vq.js";
|
|
3
3
|
import { a as isFileMissing, i as readSupabaseProjectRef, r as skillImportVitePlugin } from "./hooks-BOdDe251.js";
|
|
4
4
|
import { lstatSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { dirname, resolve } from "node:path";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { i as log, r as describeError } from "./logger-CpLgYbCG.js";
|
|
2
2
|
import { n as schemaFromDefinition, t as jsonSchemaFromDefinition } from "./schema-JK_1KkOa.js";
|
|
3
|
-
import { a as ToolContext, c as toolRequiresAppContext, i as AuthContext, n as errorSummary, r as resolveToolErrorMessage } from "./errors-
|
|
4
|
-
import { d as nowMs, i as normalizeHttpMethod, l as emitBeforeResponse, n as createRequestAuthorizer, p as finalizeWireResponse, t as evaluateCors, u as createNoopRecorder } from "./cors-
|
|
3
|
+
import { a as ToolContext, c as toolRequiresAppContext, i as AuthContext, n as errorSummary, r as resolveToolErrorMessage } from "./errors-CIpFAb6i.js";
|
|
4
|
+
import { d as nowMs, i as normalizeHttpMethod, l as emitBeforeResponse, n as createRequestAuthorizer, p as finalizeWireResponse, t as evaluateCors, u as createNoopRecorder } from "./cors-CNNmKKIg.js";
|
|
5
5
|
import { t as finalizeToolResult } from "./tool-result-DcNioyiI.js";
|
|
6
6
|
import { safeParseAsync } from "@modelcontextprotocol/sdk/server/zod-compat.js";
|
|
7
|
-
import { CLIENT_CAPABILITIES_META_KEY, CLIENT_INFO_META_KEY, McpServer, ProtocolError, ProtocolErrorCode, createMcpHandler } from "@modelcontextprotocol/server";
|
|
7
|
+
import { CLIENT_CAPABILITIES_META_KEY, CLIENT_INFO_META_KEY, McpServer, ProtocolError, ProtocolErrorCode, createMcpHandler, readRequestBody } from "@modelcontextprotocol/server";
|
|
8
8
|
//#region src/core/content.ts
|
|
9
9
|
/** Join the text of a result's `type: "text"` blocks into one string, dropping
|
|
10
10
|
* binary/resource blocks. Used to surface a `tool_error` message in the local
|
|
@@ -144,9 +144,11 @@ async function withAppContextError(run) {
|
|
|
144
144
|
throw new AppContextError(cause);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
async function classifyRequest(request) {
|
|
147
|
+
async function classifyRequest(request, maxRequestBodySize) {
|
|
148
148
|
try {
|
|
149
|
-
const
|
|
149
|
+
const body = await readRequestBody(request.clone(), maxRequestBodySize);
|
|
150
|
+
if (body.tooLarge) return { operations: NO_OPERATIONS };
|
|
151
|
+
const parsedBody = JSON.parse(body.text);
|
|
150
152
|
const calledTools = /* @__PURE__ */ new Set();
|
|
151
153
|
return {
|
|
152
154
|
operations: {
|
|
@@ -414,6 +416,7 @@ async function buildServer(mcp, auth, recorder, era, signal, operations, skills)
|
|
|
414
416
|
version: mcp.version,
|
|
415
417
|
title: mcp.title
|
|
416
418
|
}, {
|
|
419
|
+
maxToolInputElements: mcp.limits?.maxToolInputElements ?? 1e4,
|
|
417
420
|
instructions: preparedSkills ? composeInstructions(mcp.instructions, preparedSkills, skills.declared) : mcp.instructions,
|
|
418
421
|
capabilities: skills ? {
|
|
419
422
|
tools: { listChanged: false },
|
|
@@ -472,6 +475,7 @@ async function buildServer(mcp, auth, recorder, era, signal, operations, skills)
|
|
|
472
475
|
*/
|
|
473
476
|
function createMcpProtocolHandler(mcp, options = {}) {
|
|
474
477
|
const authorizer = createRequestAuthorizer(mcp, options);
|
|
478
|
+
const maxRequestBodySize = mcp.limits?.maxRequestBodySize ?? 1024 * 1024;
|
|
475
479
|
const hasSkills = mcp.skills !== void 0 && mcp.skills.length > 0;
|
|
476
480
|
const preparedSkills = mcp.skills?.length && mcp.skills.every((entry) => !("skill" in entry)) ? prepareSkills(mcp.name, mcp.skills) : void 0;
|
|
477
481
|
const handle = async (request, authResult, recorder) => {
|
|
@@ -491,7 +495,7 @@ function createMcpProtocolHandler(mcp, options = {}) {
|
|
|
491
495
|
});
|
|
492
496
|
};
|
|
493
497
|
try {
|
|
494
|
-
const classified = mcp.createAppContext || hasSkills ? await classifyRequest(request) : void 0;
|
|
498
|
+
const classified = mcp.createAppContext || hasSkills ? await classifyRequest(request, maxRequestBodySize) : void 0;
|
|
495
499
|
const operations = mcp.createAppContext ? classified?.operations : void 0;
|
|
496
500
|
const skills = hasSkills ? {
|
|
497
501
|
prepared: preparedSkills,
|
|
@@ -499,6 +503,7 @@ function createMcpProtocolHandler(mcp, options = {}) {
|
|
|
499
503
|
} : void 0;
|
|
500
504
|
const response = await createMcpHandler(({ era, requestInfo }) => buildServer(mcp, authResult.auth, recorder, era, requestInfo?.signal ?? request.signal, operations, skills), {
|
|
501
505
|
legacy: "stateless",
|
|
506
|
+
maxRequestBodySize,
|
|
502
507
|
maxSubscriptions: 0,
|
|
503
508
|
onerror: (error) => {
|
|
504
509
|
protocolError = error;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_schema = require("./schema-DNMsvJwE.cjs");
|
|
2
2
|
const require_logger = require("./logger-C-Hdu57K.cjs");
|
|
3
|
-
const require_errors = require("./errors-
|
|
4
|
-
const require_cors = require("./cors-
|
|
3
|
+
const require_errors = require("./errors-C97I7VOC.cjs");
|
|
4
|
+
const require_cors = require("./cors-3HjrsmEW.cjs");
|
|
5
5
|
const require_tool_result = require("./tool-result-rU-PpNNi.cjs");
|
|
6
6
|
let _modelcontextprotocol_sdk_server_zod_compat_js = require("@modelcontextprotocol/sdk/server/zod-compat.js");
|
|
7
7
|
let _modelcontextprotocol_server = require("@modelcontextprotocol/server");
|
|
@@ -144,9 +144,11 @@ async function withAppContextError(run) {
|
|
|
144
144
|
throw new AppContextError(cause);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
async function classifyRequest(request) {
|
|
147
|
+
async function classifyRequest(request, maxRequestBodySize) {
|
|
148
148
|
try {
|
|
149
|
-
const
|
|
149
|
+
const body = await (0, _modelcontextprotocol_server.readRequestBody)(request.clone(), maxRequestBodySize);
|
|
150
|
+
if (body.tooLarge) return { operations: NO_OPERATIONS };
|
|
151
|
+
const parsedBody = JSON.parse(body.text);
|
|
150
152
|
const calledTools = /* @__PURE__ */ new Set();
|
|
151
153
|
return {
|
|
152
154
|
operations: {
|
|
@@ -414,6 +416,7 @@ async function buildServer(mcp, auth, recorder, era, signal, operations, skills)
|
|
|
414
416
|
version: mcp.version,
|
|
415
417
|
title: mcp.title
|
|
416
418
|
}, {
|
|
419
|
+
maxToolInputElements: mcp.limits?.maxToolInputElements ?? 1e4,
|
|
417
420
|
instructions: preparedSkills ? composeInstructions(mcp.instructions, preparedSkills, skills.declared) : mcp.instructions,
|
|
418
421
|
capabilities: skills ? {
|
|
419
422
|
tools: { listChanged: false },
|
|
@@ -472,6 +475,7 @@ async function buildServer(mcp, auth, recorder, era, signal, operations, skills)
|
|
|
472
475
|
*/
|
|
473
476
|
function createMcpProtocolHandler(mcp, options = {}) {
|
|
474
477
|
const authorizer = require_cors.createRequestAuthorizer(mcp, options);
|
|
478
|
+
const maxRequestBodySize = mcp.limits?.maxRequestBodySize ?? 1024 * 1024;
|
|
475
479
|
const hasSkills = mcp.skills !== void 0 && mcp.skills.length > 0;
|
|
476
480
|
const preparedSkills = mcp.skills?.length && mcp.skills.every((entry) => !("skill" in entry)) ? prepareSkills(mcp.name, mcp.skills) : void 0;
|
|
477
481
|
const handle = async (request, authResult, recorder) => {
|
|
@@ -491,7 +495,7 @@ function createMcpProtocolHandler(mcp, options = {}) {
|
|
|
491
495
|
});
|
|
492
496
|
};
|
|
493
497
|
try {
|
|
494
|
-
const classified = mcp.createAppContext || hasSkills ? await classifyRequest(request) : void 0;
|
|
498
|
+
const classified = mcp.createAppContext || hasSkills ? await classifyRequest(request, maxRequestBodySize) : void 0;
|
|
495
499
|
const operations = mcp.createAppContext ? classified?.operations : void 0;
|
|
496
500
|
const skills = hasSkills ? {
|
|
497
501
|
prepared: preparedSkills,
|
|
@@ -499,6 +503,7 @@ function createMcpProtocolHandler(mcp, options = {}) {
|
|
|
499
503
|
} : void 0;
|
|
500
504
|
const response = await (0, _modelcontextprotocol_server.createMcpHandler)(({ era, requestInfo }) => buildServer(mcp, authResult.auth, recorder, era, requestInfo?.signal ?? request.signal, operations, skills), {
|
|
501
505
|
legacy: "stateless",
|
|
506
|
+
maxRequestBodySize,
|
|
502
507
|
maxSubscriptions: 0,
|
|
503
508
|
onerror: (error) => {
|
|
504
509
|
protocolError = error;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h as McpDefinition } from "../../types-
|
|
2
|
-
import { t as MetricsRecorder } from "../../base-
|
|
3
|
-
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-
|
|
1
|
+
import { h as McpDefinition } from "../../types-z7T5bBIU.cjs";
|
|
2
|
+
import { t as MetricsRecorder } from "../../base-CzWe8AD1.cjs";
|
|
3
|
+
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-CoaAw6wg.cjs";
|
|
4
4
|
//#region src/protocols/mcp/protocol.d.ts
|
|
5
5
|
type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder, scheduleBackground?: ScheduleBackground) => Promise<Response>;
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h as McpDefinition } from "../../types-
|
|
2
|
-
import { t as MetricsRecorder } from "../../base-
|
|
3
|
-
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-
|
|
1
|
+
import { h as McpDefinition } from "../../types-z7T5bBIU.js";
|
|
2
|
+
import { t as MetricsRecorder } from "../../base-Cx0spfMk.js";
|
|
3
|
+
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-BV62MDan.js";
|
|
4
4
|
//#region src/protocols/mcp/protocol.d.ts
|
|
5
5
|
type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder, scheduleBackground?: ScheduleBackground) => Promise<Response>;
|
|
6
6
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createMcpProtocolHandler } from "../../mcp-
|
|
1
|
+
import { t as createMcpProtocolHandler } from "../../mcp-DC8AoD18.js";
|
|
2
2
|
export { createMcpProtocolHandler };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_logger = require("../logger-C-Hdu57K.cjs");
|
|
3
|
-
const require_cors = require("../cors-
|
|
3
|
+
const require_cors = require("../cors-3HjrsmEW.cjs");
|
|
4
4
|
//#region src/protocols/oauth-metadata.ts
|
|
5
5
|
function notFound() {
|
|
6
6
|
return new Response(JSON.stringify({ error: "not found" }), {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h as McpDefinition } from "../types-
|
|
2
|
-
import { t as MetricsRecorder } from "../base-
|
|
3
|
-
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../authorize-
|
|
1
|
+
import { h as McpDefinition } from "../types-z7T5bBIU.cjs";
|
|
2
|
+
import { t as MetricsRecorder } from "../base-CzWe8AD1.cjs";
|
|
3
|
+
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../authorize-CoaAw6wg.cjs";
|
|
4
4
|
//#region src/protocols/oauth-metadata.d.ts
|
|
5
5
|
type OAuthProtectedResourceMetadataHandler = (request: Request, recorder?: MetricsRecorder, scheduleBackground?: ScheduleBackground) => Promise<Response>;
|
|
6
6
|
declare function createOAuthProtectedResourceMetadataHandler(mcp: McpDefinition, options?: McpRuntimeOptions): OAuthProtectedResourceMetadataHandler;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h as McpDefinition } from "../types-
|
|
2
|
-
import { t as MetricsRecorder } from "../base-
|
|
3
|
-
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../authorize-
|
|
1
|
+
import { h as McpDefinition } from "../types-z7T5bBIU.js";
|
|
2
|
+
import { t as MetricsRecorder } from "../base-Cx0spfMk.js";
|
|
3
|
+
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../authorize-BV62MDan.js";
|
|
4
4
|
//#region src/protocols/oauth-metadata.d.ts
|
|
5
5
|
type OAuthProtectedResourceMetadataHandler = (request: Request, recorder?: MetricsRecorder, scheduleBackground?: ScheduleBackground) => Promise<Response>;
|
|
6
6
|
declare function createOAuthProtectedResourceMetadataHandler(mcp: McpDefinition, options?: McpRuntimeOptions): OAuthProtectedResourceMetadataHandler;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as log, r as describeError } from "../logger-CpLgYbCG.js";
|
|
2
|
-
import { a as oauthConfigurationErrorResponse, f as JSON_HEADERS, i as normalizeHttpMethod, l as emitBeforeResponse, m as methodNotAllowed, p as finalizeWireResponse, r as getOAuthRuntime, s as resolveProtectedResource, t as evaluateCors, u as createNoopRecorder } from "../cors-
|
|
2
|
+
import { a as oauthConfigurationErrorResponse, f as JSON_HEADERS, i as normalizeHttpMethod, l as emitBeforeResponse, m as methodNotAllowed, p as finalizeWireResponse, r as getOAuthRuntime, s as resolveProtectedResource, t as evaluateCors, u as createNoopRecorder } from "../cors-CNNmKKIg.js";
|
|
3
3
|
//#region src/protocols/oauth-metadata.ts
|
|
4
4
|
function notFound() {
|
|
5
5
|
return new Response(JSON.stringify({ error: "not found" }), {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_logger = require("../../logger-C-Hdu57K.cjs");
|
|
3
|
-
const require_cors = require("../../cors-
|
|
3
|
+
const require_cors = require("../../cors-3HjrsmEW.cjs");
|
|
4
4
|
const require_metadata_path = require("../../metadata-path-zd7NSNoa.cjs");
|
|
5
|
-
const require_mcp = require("../../mcp-
|
|
5
|
+
const require_mcp = require("../../mcp-DlWLIwX9.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 { h as McpDefinition } from "../../types-
|
|
1
|
+
import { h as McpDefinition } from "../../types-z7T5bBIU.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 { h as McpDefinition } from "../../types-
|
|
1
|
+
import { h as McpDefinition } from "../../types-z7T5bBIU.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-CpLgYbCG.js";
|
|
2
|
-
import { c as createRecorderForRuntime, o as assertResourcePathShape } from "../../cors-
|
|
2
|
+
import { c as createRecorderForRuntime, o as assertResourcePathShape } from "../../cors-CNNmKKIg.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-DC8AoD18.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-B488glmj.cjs");
|
|
6
6
|
const require_hooks = require("../../hooks-xQl3EkDa.cjs");
|
|
7
7
|
const require_paths = require("../../paths-OP318a6c.cjs");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as version } from "../../package-
|
|
1
|
+
import { t as version } from "../../package-CukfP_vq.js";
|
|
2
2
|
import { a as isFileMissing, i as readSupabaseProjectRef, n as skillImportEsbuildPlugin, t as isSkillImportInput } from "../../hooks-BOdDe251.js";
|
|
3
3
|
import { n as assertFunctionName, t as FUNCTIONS_MOUNT_PREFIX } from "../../paths-IS65L6TA.js";
|
|
4
4
|
import { lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, unlinkSync, writeFileSync } from "node:fs";
|
|
@@ -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-3HjrsmEW.cjs");
|
|
3
|
+
const require_mcp = require("../../mcp-DlWLIwX9.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 { h as McpDefinition } from "../../types-
|
|
2
|
-
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-
|
|
1
|
+
import { h as McpDefinition } from "../../types-z7T5bBIU.cjs";
|
|
2
|
+
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-CoaAw6wg.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 { h as McpDefinition } from "../../types-
|
|
2
|
-
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-
|
|
1
|
+
import { h as McpDefinition } from "../../types-z7T5bBIU.js";
|
|
2
|
+
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-BV62MDan.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-CNNmKKIg.js";
|
|
2
|
+
import { t as createMcpProtocolHandler } from "../../mcp-DC8AoD18.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
|
package/dist/testing/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as ZodOutputSchema } from "../types-
|
|
1
|
+
import { T as ZodOutputSchema } from "../types-z7T5bBIU.cjs";
|
|
2
2
|
import { n as McpCheckError, t as Diagnostic } from "../diagnostic-DRKjgCsW.cjs";
|
|
3
3
|
//#region src/testing/result.d.ts
|
|
4
4
|
interface ToolResultExpectation {
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as ZodOutputSchema } from "../types-
|
|
1
|
+
import { T as ZodOutputSchema } from "../types-z7T5bBIU.js";
|
|
2
2
|
import { n as McpCheckError, t as Diagnostic } from "../diagnostic-DRKjgCsW.js";
|
|
3
3
|
//#region src/testing/result.d.ts
|
|
4
4
|
interface ToolResultExpectation {
|
|
@@ -398,6 +398,10 @@ type McpDefinitionInput<TAppContext = undefined> = {
|
|
|
398
398
|
readonly auth?: McpAuthConfig;
|
|
399
399
|
/** Cross-origin browser access. Omit to allow only same-origin and non-browser requests. */
|
|
400
400
|
readonly allowedOrigins?: McpAllowedOrigins;
|
|
401
|
+
readonly limits?: {
|
|
402
|
+
readonly maxRequestBodySize?: number;
|
|
403
|
+
readonly maxToolInputElements?: number;
|
|
404
|
+
};
|
|
401
405
|
/**
|
|
402
406
|
* Server-level prose the LLM reads as context for all tools on this server.
|
|
403
407
|
* Required for the same reason `ToolDefinition.description` is — optional
|
|
@@ -398,6 +398,10 @@ type McpDefinitionInput<TAppContext = undefined> = {
|
|
|
398
398
|
readonly auth?: McpAuthConfig;
|
|
399
399
|
/** Cross-origin browser access. Omit to allow only same-origin and non-browser requests. */
|
|
400
400
|
readonly allowedOrigins?: McpAllowedOrigins;
|
|
401
|
+
readonly limits?: {
|
|
402
|
+
readonly maxRequestBodySize?: number;
|
|
403
|
+
readonly maxToolInputElements?: number;
|
|
404
|
+
};
|
|
401
405
|
/**
|
|
402
406
|
* Server-level prose the LLM reads as context for all tools on this server.
|
|
403
407
|
* Required for the same reason `ToolDefinition.description` is — optional
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovable.dev/mcp-js",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20"
|
|
6
6
|
},
|
|
@@ -139,10 +139,10 @@
|
|
|
139
139
|
],
|
|
140
140
|
"license": "MIT",
|
|
141
141
|
"dependencies": {
|
|
142
|
-
"@modelcontextprotocol/client": "2.3.
|
|
142
|
+
"@modelcontextprotocol/client": "2.3.1",
|
|
143
143
|
"@modelcontextprotocol/core": "2.3.0",
|
|
144
|
-
"@modelcontextprotocol/server": "2.
|
|
145
|
-
"@modelcontextprotocol/sdk": "1.
|
|
144
|
+
"@modelcontextprotocol/server": "~2.3.1",
|
|
145
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
146
146
|
"esbuild": "^0.27.0",
|
|
147
147
|
"jose": "^6.2.2",
|
|
148
148
|
"js-yaml": "^4.3.2"
|