@lovable.dev/mcp-js 3.0.1 → 3.0.3

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 CHANGED
@@ -40,6 +40,8 @@ export default defineConfig({ plugins: [mcpPlugin()] });
40
40
 
41
41
  That's the whole authoring surface. No imperative server construction, no route handlers, no JSON-RPC envelope, no transport instantiation — all wrapped.
42
42
 
43
+ Manifest extraction allows **512 tools** in the evaluated `defineMcp({ tools })` array, including conditional and programmatically generated tools. Above that limit, extraction writes the current manifest and exits with an error; reduce the array to 512 tools or fewer. This is an extraction limit, not a runtime cap: the SDK does not truncate `tools/list`.
44
+
43
45
  `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.
44
46
 
45
47
  ## What the plugin emits
@@ -129,12 +131,14 @@ gates discovery and dispatch, but the operation must still authorize current
129
131
  permissions in its app service or database. Repeating the predicate against the
130
132
  same `ctx.appContext` is not a fresh authorization check.
131
133
 
132
- Modern responses advertise caching policy to clients: static catalogs are
133
- `public` for 24 hours; catalogs containing any `enabled` predicate are `private`
134
- for 12 hours. `private` means a client must not reuse the result across auth
135
- contexts; it does not itself enforce endpoint access. The publish manifest
136
- always contains the complete tool union and marks predicate-bearing entries as
137
- `conditional`, so Lovable can review and display the full API surface.
134
+ Modern `tools/list` and `server/discover` responses advertise `ttlMs: 0` and
135
+ `cacheScope: "private"` for all catalogs. Clients should fetch a fresh result
136
+ rather than reuse a cached response, including after a deployment or permission
137
+ change. These MCP hints do not purge existing client caches or change Lovable's
138
+ internal connector cache. `private` tells clients not to reuse results across
139
+ auth contexts; it does not enforce endpoint access. The publish manifest always contains the
140
+ complete tool union and marks predicate-bearing entries as `conditional`, so
141
+ Lovable can review and display the full API surface.
138
142
 
139
143
  `outputSchema` accepts either the existing object-shape shorthand (`{ value: z.string() }`) or a JSON-Schema-representable Zod schema such as `z.array(z.string())`; `structuredContent` may be any JSON value. The server returns the schema's parsed output, so coercions are reflected in the result; transforms with no truthful JSON Schema are rejected when `defineMcp` runs. Modern clients receive the natural schema and value. The compatibility path wraps non-object schemas and values under `result` for initialization-era clients whose wire format requires an object root.
140
144
 
@@ -4,7 +4,7 @@ const projectRoot = process.argv[2] ?? process.cwd();
4
4
  import("zod/v3").catch((err) => {
5
5
  const message = err instanceof Error ? err.message : String(err);
6
6
  throw new Error(`@lovable.dev/mcp-js requires zod ^3.25 or ^4.0 to extract MCP schemas. Verify the project's zod dependency and package resolution, then try again. Underlying error: ${message}`);
7
- }).then(() => Promise.resolve().then(() => require("../io-7DPnI54n.cjs"))).then(({ runExtract }) => runExtract(projectRoot)).catch((err) => {
7
+ }).then(() => Promise.resolve().then(() => require("../io-BYy5HWlv.cjs"))).then(({ runExtract }) => runExtract(projectRoot)).catch((err) => {
8
8
  console.error(err instanceof Error ? err.message : String(err));
9
9
  process.exit(1);
10
10
  });
@@ -4,7 +4,7 @@ const projectRoot = process.argv[2] ?? process.cwd();
4
4
  import("zod/v3").catch((err) => {
5
5
  const message = err instanceof Error ? err.message : String(err);
6
6
  throw new Error(`@lovable.dev/mcp-js requires zod ^3.25 or ^4.0 to extract MCP schemas. Verify the project's zod dependency and package resolution, then try again. Underlying error: ${message}`);
7
- }).then(() => import("../io-fU7jL_5b.js")).then(({ runExtract }) => runExtract(projectRoot)).catch((err) => {
7
+ }).then(() => import("../io-Cuw_R0J_.js")).then(({ runExtract }) => runExtract(projectRoot)).catch((err) => {
8
8
  console.error(err instanceof Error ? err.message : String(err));
9
9
  process.exit(1);
10
10
  });
@@ -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-CUo8SJrc.js";
2
+ import { t as version } from "./package-B-0dIwph.js";
3
3
  import "./metadata-path-CAkNcfyY.js";
4
4
  import { createLocalJWKSet, decodeProtectedHeader, errors, jwtVerify } from "jose";
5
5
  //#region src/core/http.ts
@@ -1,5 +1,5 @@
1
1
  const require_logger = require("./logger-C-Hdu57K.cjs");
2
- const require_package = require("./package-BHn7J4Pg.cjs");
2
+ const require_package = require("./package-DII8Hq9q.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
  const require_schema = require("./schema-DNMsvJwE.cjs");
2
- const require_package = require("./package-BHn7J4Pg.cjs");
2
+ const require_package = require("./package-DII8Hq9q.cjs");
3
3
  const require_fs_errors = require("./fs-errors-CWNzOV75.cjs");
4
4
  let node_fs = require("node:fs");
5
5
  let node_path = require("node:path");
@@ -94,6 +94,7 @@ async function produceViaSsr(projectRoot, alias, ssr, entryAbs, urlPath) {
94
94
  }
95
95
  //#endregion
96
96
  //#region src/manifest/io.ts
97
+ const MAX_MANIFEST_TOOLS = 512;
97
98
  const MCP_PLUGIN_NAME_PREFIX = "@lovable.dev/mcp-js";
98
99
  const DEFAULT_MCP_ENTRY = "src/lib/mcp/index.ts";
99
100
  const DEFAULT_MCP_PATH = "/mcp";
@@ -137,7 +138,9 @@ async function syncManifest(manifestFile, entryAbs, urlPath, produce) {
137
138
  removeManifest(manifestFile);
138
139
  return;
139
140
  }
140
- writeManifestIfChanged(manifestFile, await produce(entryAbs, urlPath));
141
+ const manifest = await produce(entryAbs, urlPath);
142
+ writeManifestIfChanged(manifestFile, manifest);
143
+ if (manifest.mcp.tools.length > MAX_MANIFEST_TOOLS) throw new Error(`@lovable.dev/mcp-js: ${entryAbs} declares ${manifest.mcp.tools.length} tools, exceeding the App MCP manifest limit of ${MAX_MANIFEST_TOOLS}. Reduce defineMcp({ tools }) to ${MAX_MANIFEST_TOOLS} tools or fewer and extract the manifest again.`);
141
144
  }
142
145
  async function runExtract(projectRoot) {
143
146
  const resolved = await (0, vite.resolveConfig)({
@@ -1,5 +1,5 @@
1
1
  import { t as jsonSchemaFromDefinition } from "./schema-JK_1KkOa.js";
2
- import { t as version } from "./package-CUo8SJrc.js";
2
+ import { t as version } from "./package-B-0dIwph.js";
3
3
  import { t as isFileMissing } from "./fs-errors-PA2t1TIp.js";
4
4
  import { lstatSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
5
5
  import { dirname, resolve } from "node:path";
@@ -94,6 +94,7 @@ async function produceViaSsr(projectRoot, alias, ssr, entryAbs, urlPath) {
94
94
  }
95
95
  //#endregion
96
96
  //#region src/manifest/io.ts
97
+ const MAX_MANIFEST_TOOLS = 512;
97
98
  const MCP_PLUGIN_NAME_PREFIX = "@lovable.dev/mcp-js";
98
99
  const DEFAULT_MCP_ENTRY = "src/lib/mcp/index.ts";
99
100
  const DEFAULT_MCP_PATH = "/mcp";
@@ -137,7 +138,9 @@ async function syncManifest(manifestFile, entryAbs, urlPath, produce) {
137
138
  removeManifest(manifestFile);
138
139
  return;
139
140
  }
140
- writeManifestIfChanged(manifestFile, await produce(entryAbs, urlPath));
141
+ const manifest = await produce(entryAbs, urlPath);
142
+ writeManifestIfChanged(manifestFile, manifest);
143
+ if (manifest.mcp.tools.length > MAX_MANIFEST_TOOLS) throw new Error(`@lovable.dev/mcp-js: ${entryAbs} declares ${manifest.mcp.tools.length} tools, exceeding the App MCP manifest limit of ${MAX_MANIFEST_TOOLS}. Reduce defineMcp({ tools }) to ${MAX_MANIFEST_TOOLS} tools or fewer and extract the manifest again.`);
141
144
  }
142
145
  async function runExtract(projectRoot) {
143
146
  const resolved = await resolveConfig({
@@ -1,7 +1,7 @@
1
1
  const require_schema = require("./schema-DNMsvJwE.cjs");
2
2
  const require_logger = require("./logger-C-Hdu57K.cjs");
3
3
  const require_errors = require("./errors-CWxgUZH3.cjs");
4
- const require_cors = require("./cors-DzuZ13bx.cjs");
4
+ const require_cors = require("./cors-CjC7s921.cjs");
5
5
  let _modelcontextprotocol_sdk_server_zod_compat_js = require("@modelcontextprotocol/sdk/server/zod-compat.js");
6
6
  let _modelcontextprotocol_server = require("@modelcontextprotocol/server");
7
7
  //#region src/core/content.ts
@@ -117,7 +117,6 @@ function createGatedHandler(gate) {
117
117
  //#endregion
118
118
  //#region src/protocols/mcp/protocol.ts
119
119
  const MODERN_PROTOCOL_VERSION = "2026-07-28";
120
- const HOUR_MS = 3600 * 1e3;
121
120
  const NO_OPERATIONS = {
122
121
  listTools: false,
123
122
  calledTools: /* @__PURE__ */ new Set()
@@ -328,13 +327,6 @@ async function buildServer(mcp, auth, recorder, era, signal, operations) {
328
327
  signal
329
328
  })) : void 0;
330
329
  const visibilityContext = Object.freeze({ appContext });
331
- const cacheHint = hasConditionalTools ? {
332
- cacheScope: "private",
333
- ttlMs: 12 * HOUR_MS
334
- } : {
335
- cacheScope: "public",
336
- ttlMs: 24 * HOUR_MS
337
- };
338
330
  const server = new _modelcontextprotocol_server.McpServer({
339
331
  name: mcp.name,
340
332
  version: mcp.version,
@@ -343,8 +335,14 @@ async function buildServer(mcp, auth, recorder, era, signal, operations) {
343
335
  instructions: mcp.instructions,
344
336
  capabilities: { tools: { listChanged: false } },
345
337
  cacheHints: {
346
- "tools/list": cacheHint,
347
- "server/discover": cacheHint
338
+ "tools/list": {
339
+ ttlMs: 0,
340
+ cacheScope: "private"
341
+ },
342
+ "server/discover": {
343
+ ttlMs: 0,
344
+ cacheScope: "private"
345
+ }
348
346
  }
349
347
  });
350
348
  for (const tool of selectedTools) {
@@ -1,7 +1,7 @@
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
3
  import { a as ToolContext, c as toolRequiresAppContext, i as AuthContext, n as errorSummary, r as resolveToolErrorMessage } from "./errors-ZmYYVYKN.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-3sn21pgu.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-C3rhIeQf.js";
5
5
  import { getParseErrorMessage, safeParseAsync } from "@modelcontextprotocol/sdk/server/zod-compat.js";
6
6
  import { CLIENT_CAPABILITIES_META_KEY, CLIENT_INFO_META_KEY, McpServer, createMcpHandler } from "@modelcontextprotocol/server";
7
7
  //#region src/core/content.ts
@@ -117,7 +117,6 @@ function createGatedHandler(gate) {
117
117
  //#endregion
118
118
  //#region src/protocols/mcp/protocol.ts
119
119
  const MODERN_PROTOCOL_VERSION = "2026-07-28";
120
- const HOUR_MS = 3600 * 1e3;
121
120
  const NO_OPERATIONS = {
122
121
  listTools: false,
123
122
  calledTools: /* @__PURE__ */ new Set()
@@ -328,13 +327,6 @@ async function buildServer(mcp, auth, recorder, era, signal, operations) {
328
327
  signal
329
328
  })) : void 0;
330
329
  const visibilityContext = Object.freeze({ appContext });
331
- const cacheHint = hasConditionalTools ? {
332
- cacheScope: "private",
333
- ttlMs: 12 * HOUR_MS
334
- } : {
335
- cacheScope: "public",
336
- ttlMs: 24 * HOUR_MS
337
- };
338
330
  const server = new McpServer({
339
331
  name: mcp.name,
340
332
  version: mcp.version,
@@ -343,8 +335,14 @@ async function buildServer(mcp, auth, recorder, era, signal, operations) {
343
335
  instructions: mcp.instructions,
344
336
  capabilities: { tools: { listChanged: false } },
345
337
  cacheHints: {
346
- "tools/list": cacheHint,
347
- "server/discover": cacheHint
338
+ "tools/list": {
339
+ ttlMs: 0,
340
+ cacheScope: "private"
341
+ },
342
+ "server/discover": {
343
+ ttlMs: 0,
344
+ cacheScope: "private"
345
+ }
348
346
  }
349
347
  });
350
348
  for (const tool of selectedTools) {
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "3.0.1";
2
+ var version = "3.0.3";
3
3
  //#endregion
4
4
  export { version as t };
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "3.0.1";
2
+ var version = "3.0.3";
3
3
  //#endregion
4
4
  Object.defineProperty(exports, "version", {
5
5
  enumerable: true,
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_mcp = require("../../mcp-DA6eRKkS.cjs");
2
+ const require_mcp = require("../../mcp-cQodaBEG.cjs");
3
3
  exports.createMcpProtocolHandler = require_mcp.createMcpProtocolHandler;
@@ -1,2 +1,2 @@
1
- import { t as createMcpProtocolHandler } from "../../mcp-CrZ8y7EG.js";
1
+ import { t as createMcpProtocolHandler } from "../../mcp-eV_i6X1q.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-DzuZ13bx.cjs");
3
+ const require_cors = require("../cors-CjC7s921.cjs");
4
4
  //#region src/protocols/oauth-metadata.ts
5
5
  function notFound() {
6
6
  return new Response(JSON.stringify({ error: "not found" }), {
@@ -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-3sn21pgu.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-C3rhIeQf.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-DzuZ13bx.cjs");
3
+ const require_cors = require("../../cors-CjC7s921.cjs");
4
4
  const require_metadata_path = require("../../metadata-path-zd7NSNoa.cjs");
5
- const require_mcp = require("../../mcp-DA6eRKkS.cjs");
5
+ const require_mcp = require("../../mcp-cQodaBEG.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,7 +1,7 @@
1
1
  import { s as trimTrailingSlash } from "../../logger-CpLgYbCG.js";
2
- import { c as createRecorderForRuntime, o as assertResourcePathShape } from "../../cors-3sn21pgu.js";
2
+ import { c as createRecorderForRuntime, o as assertResourcePathShape } from "../../cors-C3rhIeQf.js";
3
3
  import { t as OAUTH_PROTECTED_RESOURCE_METADATA_PATH } from "../../metadata-path-CAkNcfyY.js";
4
- import { t as createMcpProtocolHandler } from "../../mcp-CrZ8y7EG.js";
4
+ import { t as createMcpProtocolHandler } from "../../mcp-eV_i6X1q.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-BHn7J4Pg.cjs");
5
+ const require_package = require("../../package-DII8Hq9q.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-CUo8SJrc.js";
1
+ import { t as version } from "../../package-B-0dIwph.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-DzuZ13bx.cjs");
3
- const require_mcp = require("../../mcp-DA6eRKkS.cjs");
2
+ const require_cors = require("../../cors-CjC7s921.cjs");
3
+ const require_mcp = require("../../mcp-cQodaBEG.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 { c as createRecorderForRuntime } from "../../cors-3sn21pgu.js";
2
- import { t as createMcpProtocolHandler } from "../../mcp-CrZ8y7EG.js";
1
+ import { c as createRecorderForRuntime } from "../../cors-C3rhIeQf.js";
2
+ import { t as createMcpProtocolHandler } from "../../mcp-eV_i6X1q.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/mcp-js",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },