@lovable.dev/mcp-js 3.1.1 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +43 -0
  2. package/dist/{authorize-Dt7ll7Ur.d.ts → authorize-DUEaDXjU.d.ts} +1 -1
  3. package/dist/{authorize-BS_In2AW.d.cts → authorize-bDiUiJco.d.cts} +1 -1
  4. package/dist/{base-B7D0KqaY.d.ts → base-CLO7XsxC.d.ts} +1 -1
  5. package/dist/{base-D3TT1Wup.d.cts → base-D2d7lJY5.d.cts} +1 -1
  6. package/dist/cli/extract-manifest.cjs +1 -1
  7. package/dist/cli/extract-manifest.js +1 -1
  8. package/dist/{cors-CEF2VQQ4.cjs → cors-Dk0jvKYK.cjs} +1 -1
  9. package/dist/{cors-DbJgGIwT.js → cors-tLp9UO0k.js} +1 -1
  10. package/dist/{errors-CWxgUZH3.cjs → errors-CLfxIB-l.cjs} +3 -2
  11. package/dist/{errors-ZmYYVYKN.js → errors-CljrUVby.js} +3 -2
  12. package/dist/format-DDzvc92Z.cjs +41 -0
  13. package/dist/format-DKEuO8Tn.js +30 -0
  14. package/dist/hooks-BOdDe251.js +353 -0
  15. package/dist/hooks-xQl3EkDa.cjs +382 -0
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.d.cts +2 -2
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.js +1 -1
  20. package/dist/{io-BvogiiQ1.d.ts → io-CFyHLyvs.d.ts} +1 -1
  21. package/dist/{io-Bn0ErYbG.d.cts → io-DfUvQ-SV.d.cts} +1 -1
  22. package/dist/{io-Cuzga3zO.js → io-U3Nv7y0k.js} +3 -2
  23. package/dist/{io-DvrElu4G.cjs → io-tWj7qb9q.cjs} +7 -6
  24. package/dist/{mcp-BClUdQ3O.cjs → mcp-BMNeCc_-.cjs} +160 -8
  25. package/dist/{mcp-cPwyvSCx.js → mcp-BYSubCtv.js} +161 -9
  26. package/dist/{package-CaoFQDOo.cjs → package-B4OsCEhG.cjs} +1 -1
  27. package/dist/{package-Dvpf79Jm.js → package-DXBX-HJu.js} +1 -1
  28. package/dist/protocols/mcp/index.cjs +1 -1
  29. package/dist/protocols/mcp/index.d.cts +3 -3
  30. package/dist/protocols/mcp/index.d.ts +3 -3
  31. package/dist/protocols/mcp/index.js +1 -1
  32. package/dist/protocols/oauth-metadata.cjs +1 -1
  33. package/dist/protocols/oauth-metadata.d.cts +3 -3
  34. package/dist/protocols/oauth-metadata.d.ts +3 -3
  35. package/dist/protocols/oauth-metadata.js +1 -1
  36. package/dist/stacks/supabase/index.cjs +2 -2
  37. package/dist/stacks/supabase/index.d.cts +1 -1
  38. package/dist/stacks/supabase/index.d.ts +1 -1
  39. package/dist/stacks/supabase/index.js +2 -2
  40. package/dist/stacks/supabase/vite.cjs +40 -18
  41. package/dist/stacks/supabase/vite.d.cts +1 -1
  42. package/dist/stacks/supabase/vite.d.ts +1 -1
  43. package/dist/stacks/supabase/vite.js +34 -12
  44. package/dist/stacks/tanstack/index.cjs +2 -2
  45. package/dist/stacks/tanstack/index.d.cts +2 -2
  46. package/dist/stacks/tanstack/index.d.ts +2 -2
  47. package/dist/stacks/tanstack/index.js +2 -2
  48. package/dist/stacks/tanstack/vite.cjs +22 -22
  49. package/dist/stacks/tanstack/vite.d.cts +1 -1
  50. package/dist/stacks/tanstack/vite.d.ts +1 -1
  51. package/dist/stacks/tanstack/vite.js +14 -14
  52. package/dist/testing/index.d.cts +1 -1
  53. package/dist/testing/index.d.ts +1 -1
  54. package/dist/{types-BX8RawmT.d.ts → types-CAFCH0yK.d.cts} +7 -1
  55. package/dist/{types-BX8RawmT.d.cts → types-CAFCH0yK.d.ts} +7 -1
  56. package/package.json +16 -4
  57. package/skill-imports.d.cts +1 -0
  58. package/skill-imports.d.ts +9 -0
  59. package/dist/supabase-config-DITfH_bn.js +0 -30
  60. package/dist/supabase-config-Dz13d9ze.cjs +0 -41
@@ -2,8 +2,8 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_package = require("../../package-CaoFQDOo.cjs");
6
- const require_supabase_config = require("../../supabase-config-Dz13d9ze.cjs");
5
+ const require_package = require("../../package-B4OsCEhG.cjs");
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");
9
9
  let node_path = require("node:path");
@@ -16,7 +16,7 @@ function fileExists(path) {
16
16
  (0, node_fs.lstatSync)(path);
17
17
  return true;
18
18
  } catch (err) {
19
- if (require_supabase_config.isFileMissing(err)) return false;
19
+ if (require_hooks.isFileMissing(err)) return false;
20
20
  throw err;
21
21
  }
22
22
  }
@@ -36,7 +36,7 @@ function writeIfChanged(file, content, ownershipCheck) {
36
36
  try {
37
37
  existing = (0, node_fs.readFileSync)(file, "utf8");
38
38
  } catch (err) {
39
- if (!require_supabase_config.isFileMissing(err)) throw err;
39
+ if (!require_hooks.isFileMissing(err)) throw err;
40
40
  }
41
41
  if (existing !== void 0) {
42
42
  if (!ownershipCheck(existing)) throw new Error(`@lovable.dev/mcp-js: refusing to overwrite user-authored file at ${file}. Delete it or move it first.`);
@@ -145,11 +145,15 @@ function importMetaEnvDefines(inlineEnv) {
145
145
  for (const [key, value] of Object.entries(env)) if (/^[A-Za-z_$][\w$]*$/.test(key)) defines[`import.meta.env.${key}`] = JSON.stringify(value);
146
146
  return defines;
147
147
  }
148
- async function bundleFunctionEntry(projectRoot, mcpEntryAbs, functionName, inlineEnv, aliases) {
148
+ async function bundleFunctionEntry(projectRoot, mcpEntryAbs, functionName, options) {
149
149
  const versions = readProjectDependencyVersions(projectRoot);
150
+ const aliases = options.aliases ?? [];
151
+ const wrapper = `import mcp from ${JSON.stringify(mcpEntryAbs)};\nimport { createSupabaseHandler } from "@lovable.dev/mcp-js/stacks/supabase";\nDeno.serve(createSupabaseHandler(mcp, { functionName: ${JSON.stringify(functionName)} }));\n`;
152
+ const skillFiles = [];
153
+ const skillDirs = [];
150
154
  const result = await (0, esbuild.build)({
151
155
  stdin: {
152
- contents: `import mcp from ${JSON.stringify(mcpEntryAbs)};\nimport { createSupabaseHandler } from "@lovable.dev/mcp-js/stacks/supabase";\nDeno.serve(createSupabaseHandler(mcp, { functionName: ${JSON.stringify(functionName)} }));\n`,
156
+ contents: wrapper,
153
157
  resolveDir: projectRoot,
154
158
  sourcefile: "lovable-mcp-supabase-entry.ts",
155
159
  loader: "ts"
@@ -162,18 +166,24 @@ async function bundleFunctionEntry(projectRoot, mcpEntryAbs, functionName, inlin
162
166
  target: "esnext",
163
167
  absWorkingDir: projectRoot,
164
168
  logLevel: "silent",
165
- define: importMetaEnvDefines(inlineEnv),
169
+ define: importMetaEnvDefines(options.inlineEnv),
166
170
  plugins: [
171
+ require_hooks.skillImportEsbuildPlugin((compilation) => {
172
+ skillFiles.push(...compilation.watchFiles);
173
+ skillDirs.push(...compilation.watchDirs);
174
+ console.info(compilation.report);
175
+ }, options.onSkillDirectory),
167
176
  ...aliases.length > 0 ? [resolveViteAliases(aliases)] : [],
168
177
  rejectFrontendImages(projectRoot),
169
178
  externalizeBareAsNpm(versions)
170
179
  ]
171
180
  });
172
181
  const out = result.outputFiles[0]?.text ?? "";
173
- const inputs = Object.keys(result.metafile?.inputs ?? {}).filter((p) => !p.startsWith("<") && !p.startsWith("npm:")).map((p) => (0, node_path.resolve)(projectRoot, p));
182
+ const inputs = Object.keys(result.metafile?.inputs ?? {}).filter((p) => !p.startsWith("<") && !p.startsWith("npm:") && !require_hooks.isSkillImportInput(p)).map((p) => (0, node_path.resolve)(projectRoot, p)).concat(skillFiles);
174
183
  return {
175
184
  code: `${GENERATED_BANNER}\n// supabase function: ${functionName}\n// Bundled from ${(0, node_path.relative)(projectRoot, mcpEntryAbs).split(node_path.sep).join("/")} by @lovable.dev/mcp-js.\n` + out,
176
- inputs
185
+ inputs,
186
+ skillDirs
177
187
  };
178
188
  }
179
189
  function resolvePaths(options) {
@@ -212,13 +222,14 @@ async function syncSupabaseFunction(options) {
212
222
  inputs: []
213
223
  };
214
224
  }
215
- const { code, inputs } = await bundleFunctionEntry(projectRoot, paths.mcpEntryAbs, functionName, options.inlineEnv, options.aliases ?? []);
225
+ const { code, inputs, skillDirs } = await bundleFunctionEntry(projectRoot, paths.mcpEntryAbs, functionName, options);
216
226
  if (writeIfChanged(paths.functionEntry, code, hasGeneratedBanner)) written.push(paths.functionEntry);
217
227
  cleanupOrphans(paths.functionDir, /* @__PURE__ */ new Set([paths.functionEntry]), removed);
218
228
  return {
219
229
  written,
220
230
  removed,
221
- inputs
231
+ inputs,
232
+ skillDirs
222
233
  };
223
234
  }
224
235
  function cleanupOrphans(functionDir, expected, removed) {
@@ -226,7 +237,7 @@ function cleanupOrphans(functionDir, expected, removed) {
226
237
  try {
227
238
  entries = (0, node_fs.readdirSync)(functionDir);
228
239
  } catch (err) {
229
- if (require_supabase_config.isFileMissing(err)) return;
240
+ if (require_hooks.isFileMissing(err)) return;
230
241
  throw err;
231
242
  }
232
243
  for (const entry of entries) {
@@ -236,14 +247,14 @@ function cleanupOrphans(functionDir, expected, removed) {
236
247
  try {
237
248
  content = (0, node_fs.readFileSync)(full, "utf8");
238
249
  } catch (err) {
239
- if (require_supabase_config.isFileMissing(err) || err.code === "EISDIR") continue;
250
+ if (require_hooks.isFileMissing(err) || err.code === "EISDIR") continue;
240
251
  throw err;
241
252
  }
242
253
  if (hasGeneratedBanner(content) || hasGeneratedJsonMarker(content)) try {
243
254
  (0, node_fs.unlinkSync)(full);
244
255
  removed.push(full);
245
256
  } catch (err) {
246
- if (!require_supabase_config.isFileMissing(err)) throw err;
257
+ if (!require_hooks.isFileMissing(err)) throw err;
247
258
  }
248
259
  }
249
260
  }
@@ -262,7 +273,7 @@ function productionImportMetaEnv(config) {
262
273
  SSR: false
263
274
  };
264
275
  if (!env.VITE_SUPABASE_PROJECT_ID) {
265
- const ref = require_supabase_config.readSupabaseProjectRef(config.root);
276
+ const ref = require_hooks.readSupabaseProjectRef(config.root);
266
277
  if (ref) env.VITE_SUPABASE_PROJECT_ID = ref;
267
278
  }
268
279
  return env;
@@ -300,16 +311,24 @@ function mcpPlugin(options = {}) {
300
311
  let inlineEnv = {};
301
312
  let aliases = [];
302
313
  let watchedInputs = /* @__PURE__ */ new Set();
314
+ let watchedSkillDirs = [];
315
+ let devServer;
303
316
  const regenerate = async () => {
304
- const { inputs } = await syncSupabaseFunction({
317
+ const { inputs, skillDirs } = await syncSupabaseFunction({
305
318
  projectRoot,
306
319
  mcpEntry: mcpEntryOption,
307
320
  functionsDir: functionsDirOption,
308
321
  functionName,
309
322
  inlineEnv,
310
- aliases
323
+ aliases,
324
+ onSkillDirectory(directory) {
325
+ const normalized = normalizePath(directory);
326
+ if (!watchedSkillDirs.includes(normalized)) watchedSkillDirs.push(normalized);
327
+ devServer?.watcher.add(directory);
328
+ }
311
329
  });
312
330
  watchedInputs = new Set(inputs.map(normalizePath));
331
+ watchedSkillDirs = (skillDirs ?? []).map(normalizePath);
313
332
  };
314
333
  return {
315
334
  name: "@lovable.dev/mcp-js/supabase",
@@ -330,9 +349,12 @@ function mcpPlugin(options = {}) {
330
349
  await regenerate();
331
350
  },
332
351
  configureServer(server) {
352
+ devServer = server;
353
+ server.watcher.add(watchedSkillDirs);
333
354
  const onChange = (file) => {
334
355
  const norm = normalizePath(file);
335
- if (norm !== normalizePath(mcpEntryAbs) && !watchedInputs.has(norm)) return;
356
+ const inSkillDir = watchedSkillDirs.some((dir) => norm.startsWith(`${dir}/`));
357
+ if (norm !== normalizePath(mcpEntryAbs) && !watchedInputs.has(norm) && !inSkillDir) return;
336
358
  regenerate().catch((err) => {
337
359
  const message = `[@lovable.dev/mcp-js] failed to regenerate the Supabase function: ${err instanceof Error ? err.message : String(err)}`;
338
360
  if (server.config?.logger?.error) server.config.logger.error(message);
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-Bn0ErYbG.cjs";
1
+ import { t as McpPluginApi } from "../../io-DfUvQ-SV.cjs";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/supabase/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-BvogiiQ1.js";
1
+ import { t as McpPluginApi } from "../../io-CFyHLyvs.js";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/supabase/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -1,5 +1,5 @@
1
- import { t as version } from "../../package-Dvpf79Jm.js";
2
- import { n as isFileMissing, t as readSupabaseProjectRef } from "../../supabase-config-DITfH_bn.js";
1
+ import { t as version } from "../../package-DXBX-HJu.js";
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";
5
5
  import { dirname, join, relative, resolve, sep } from "node:path";
@@ -141,11 +141,15 @@ function importMetaEnvDefines(inlineEnv) {
141
141
  for (const [key, value] of Object.entries(env)) if (/^[A-Za-z_$][\w$]*$/.test(key)) defines[`import.meta.env.${key}`] = JSON.stringify(value);
142
142
  return defines;
143
143
  }
144
- async function bundleFunctionEntry(projectRoot, mcpEntryAbs, functionName, inlineEnv, aliases) {
144
+ async function bundleFunctionEntry(projectRoot, mcpEntryAbs, functionName, options) {
145
145
  const versions = readProjectDependencyVersions(projectRoot);
146
+ const aliases = options.aliases ?? [];
147
+ const wrapper = `import mcp from ${JSON.stringify(mcpEntryAbs)};\nimport { createSupabaseHandler } from "@lovable.dev/mcp-js/stacks/supabase";\nDeno.serve(createSupabaseHandler(mcp, { functionName: ${JSON.stringify(functionName)} }));\n`;
148
+ const skillFiles = [];
149
+ const skillDirs = [];
146
150
  const result = await build({
147
151
  stdin: {
148
- contents: `import mcp from ${JSON.stringify(mcpEntryAbs)};\nimport { createSupabaseHandler } from "@lovable.dev/mcp-js/stacks/supabase";\nDeno.serve(createSupabaseHandler(mcp, { functionName: ${JSON.stringify(functionName)} }));\n`,
152
+ contents: wrapper,
149
153
  resolveDir: projectRoot,
150
154
  sourcefile: "lovable-mcp-supabase-entry.ts",
151
155
  loader: "ts"
@@ -158,18 +162,24 @@ async function bundleFunctionEntry(projectRoot, mcpEntryAbs, functionName, inlin
158
162
  target: "esnext",
159
163
  absWorkingDir: projectRoot,
160
164
  logLevel: "silent",
161
- define: importMetaEnvDefines(inlineEnv),
165
+ define: importMetaEnvDefines(options.inlineEnv),
162
166
  plugins: [
167
+ skillImportEsbuildPlugin((compilation) => {
168
+ skillFiles.push(...compilation.watchFiles);
169
+ skillDirs.push(...compilation.watchDirs);
170
+ console.info(compilation.report);
171
+ }, options.onSkillDirectory),
163
172
  ...aliases.length > 0 ? [resolveViteAliases(aliases)] : [],
164
173
  rejectFrontendImages(projectRoot),
165
174
  externalizeBareAsNpm(versions)
166
175
  ]
167
176
  });
168
177
  const out = result.outputFiles[0]?.text ?? "";
169
- const inputs = Object.keys(result.metafile?.inputs ?? {}).filter((p) => !p.startsWith("<") && !p.startsWith("npm:")).map((p) => resolve(projectRoot, p));
178
+ const inputs = Object.keys(result.metafile?.inputs ?? {}).filter((p) => !p.startsWith("<") && !p.startsWith("npm:") && !isSkillImportInput(p)).map((p) => resolve(projectRoot, p)).concat(skillFiles);
170
179
  return {
171
180
  code: `${GENERATED_BANNER}\n// supabase function: ${functionName}\n// Bundled from ${relative(projectRoot, mcpEntryAbs).split(sep).join("/")} by @lovable.dev/mcp-js.\n` + out,
172
- inputs
181
+ inputs,
182
+ skillDirs
173
183
  };
174
184
  }
175
185
  function resolvePaths(options) {
@@ -208,13 +218,14 @@ async function syncSupabaseFunction(options) {
208
218
  inputs: []
209
219
  };
210
220
  }
211
- const { code, inputs } = await bundleFunctionEntry(projectRoot, paths.mcpEntryAbs, functionName, options.inlineEnv, options.aliases ?? []);
221
+ const { code, inputs, skillDirs } = await bundleFunctionEntry(projectRoot, paths.mcpEntryAbs, functionName, options);
212
222
  if (writeIfChanged(paths.functionEntry, code, hasGeneratedBanner)) written.push(paths.functionEntry);
213
223
  cleanupOrphans(paths.functionDir, /* @__PURE__ */ new Set([paths.functionEntry]), removed);
214
224
  return {
215
225
  written,
216
226
  removed,
217
- inputs
227
+ inputs,
228
+ skillDirs
218
229
  };
219
230
  }
220
231
  function cleanupOrphans(functionDir, expected, removed) {
@@ -296,16 +307,24 @@ function mcpPlugin(options = {}) {
296
307
  let inlineEnv = {};
297
308
  let aliases = [];
298
309
  let watchedInputs = /* @__PURE__ */ new Set();
310
+ let watchedSkillDirs = [];
311
+ let devServer;
299
312
  const regenerate = async () => {
300
- const { inputs } = await syncSupabaseFunction({
313
+ const { inputs, skillDirs } = await syncSupabaseFunction({
301
314
  projectRoot,
302
315
  mcpEntry: mcpEntryOption,
303
316
  functionsDir: functionsDirOption,
304
317
  functionName,
305
318
  inlineEnv,
306
- aliases
319
+ aliases,
320
+ onSkillDirectory(directory) {
321
+ const normalized = normalizePath(directory);
322
+ if (!watchedSkillDirs.includes(normalized)) watchedSkillDirs.push(normalized);
323
+ devServer?.watcher.add(directory);
324
+ }
307
325
  });
308
326
  watchedInputs = new Set(inputs.map(normalizePath));
327
+ watchedSkillDirs = (skillDirs ?? []).map(normalizePath);
309
328
  };
310
329
  return {
311
330
  name: "@lovable.dev/mcp-js/supabase",
@@ -326,9 +345,12 @@ function mcpPlugin(options = {}) {
326
345
  await regenerate();
327
346
  },
328
347
  configureServer(server) {
348
+ devServer = server;
349
+ server.watcher.add(watchedSkillDirs);
329
350
  const onChange = (file) => {
330
351
  const norm = normalizePath(file);
331
- if (norm !== normalizePath(mcpEntryAbs) && !watchedInputs.has(norm)) return;
352
+ const inSkillDir = watchedSkillDirs.some((dir) => norm.startsWith(`${dir}/`));
353
+ if (norm !== normalizePath(mcpEntryAbs) && !watchedInputs.has(norm) && !inSkillDir) return;
332
354
  regenerate().catch((err) => {
333
355
  const message = `[@lovable.dev/mcp-js] failed to regenerate the Supabase function: ${err instanceof Error ? err.message : String(err)}`;
334
356
  if (server.config?.logger?.error) server.config.logger.error(message);
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_cors = require("../../cors-CEF2VQQ4.cjs");
3
- const require_mcp = require("../../mcp-BClUdQ3O.cjs");
2
+ const require_cors = require("../../cors-Dk0jvKYK.cjs");
3
+ const require_mcp = require("../../mcp-BMNeCc_-.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 { m as McpDefinition } from "../../types-BX8RawmT.cjs";
2
- import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-BS_In2AW.cjs";
1
+ import { m as McpDefinition } from "../../types-CAFCH0yK.cjs";
2
+ import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-bDiUiJco.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 { m as McpDefinition } from "../../types-BX8RawmT.js";
2
- import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-Dt7ll7Ur.js";
1
+ import { m as McpDefinition } from "../../types-CAFCH0yK.js";
2
+ import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-DUEaDXjU.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-DbJgGIwT.js";
2
- import { t as createMcpProtocolHandler } from "../../mcp-cPwyvSCx.js";
1
+ import { c as createRecorderForRuntime } from "../../cors-tLp9UO0k.js";
2
+ import { t as createMcpProtocolHandler } from "../../mcp-BYSubCtv.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
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../metadata-path-zd7NSNoa.cjs");
6
- const require_supabase_config = require("../../supabase-config-Dz13d9ze.cjs");
6
+ const require_hooks = require("../../hooks-xQl3EkDa.cjs");
7
7
  let node_fs = require("node:fs");
8
8
  let node_path = require("node:path");
9
9
  let vite = require("vite");
@@ -107,7 +107,7 @@ function writeIfChanged(file, content) {
107
107
  try {
108
108
  existing = (0, node_fs.readFileSync)(file, "utf8");
109
109
  } catch (err) {
110
- if (!require_supabase_config.isFileMissing(err)) throw err;
110
+ if (!require_hooks.isFileMissing(err)) throw err;
111
111
  }
112
112
  if (existing !== void 0) {
113
113
  if (!hasGeneratedBanner(existing)) throw new Error(`@lovable.dev/mcp-js: refusing to overwrite user-authored route at ${file}. Delete it or move it first.`);
@@ -121,7 +121,7 @@ function fileStartsWithBanner(file) {
121
121
  try {
122
122
  return hasGeneratedBanner((0, node_fs.readFileSync)(file, "utf8"));
123
123
  } catch (err) {
124
- if (require_supabase_config.isFileMissing(err)) return false;
124
+ if (require_hooks.isFileMissing(err)) return false;
125
125
  throw err;
126
126
  }
127
127
  }
@@ -132,7 +132,7 @@ function findAdoptedFiles(routesDir) {
132
132
  try {
133
133
  entries = (0, node_fs.readdirSync)(dir);
134
134
  } catch (err) {
135
- if (require_supabase_config.isFileMissing(err)) return;
135
+ if (require_hooks.isFileMissing(err)) return;
136
136
  throw err;
137
137
  }
138
138
  for (const entry of entries) {
@@ -141,7 +141,7 @@ function findAdoptedFiles(routesDir) {
141
141
  try {
142
142
  stat = (0, node_fs.lstatSync)(full);
143
143
  } catch (err) {
144
- if (require_supabase_config.isFileMissing(err)) continue;
144
+ if (require_hooks.isFileMissing(err)) continue;
145
145
  throw err;
146
146
  }
147
147
  if (stat.isDirectory()) visit(full);
@@ -188,7 +188,7 @@ function mcpPlugin(options = {}) {
188
188
  try {
189
189
  (0, node_fs.lstatSync)(mcpEntry);
190
190
  } catch (err) {
191
- if (!require_supabase_config.isFileMissing(err)) throw err;
191
+ if (!require_hooks.isFileMissing(err)) throw err;
192
192
  mcpEntryExists = false;
193
193
  }
194
194
  const expected = /* @__PURE__ */ new Set();
@@ -197,7 +197,7 @@ function mcpPlugin(options = {}) {
197
197
  try {
198
198
  sitemapSource = (0, node_fs.readFileSync)(sitemapFile, "utf8");
199
199
  } catch (err) {
200
- if (!require_supabase_config.isFileMissing(err)) throw err;
200
+ if (!require_hooks.isFileMissing(err)) throw err;
201
201
  }
202
202
  const hasSitemapInventory = /^\s*export\s+const\s+sitemapRouteInventoryVersion\s*=\s*1\s*(?:;|$)/m.test(sitemapSource);
203
203
  const routes = [{
@@ -219,10 +219,23 @@ function mcpPlugin(options = {}) {
219
219
  for (const file of findAdoptedFiles(routesDir)) if (!expected.has(file)) try {
220
220
  (0, node_fs.unlinkSync)(file);
221
221
  } catch (err) {
222
- if (!require_supabase_config.isFileMissing(err)) throw err;
222
+ if (!require_hooks.isFileMissing(err)) throw err;
223
223
  }
224
224
  };
225
225
  return {
226
+ ...require_hooks.skillImportVitePlugin({ onServer(server) {
227
+ const onChange = (file) => {
228
+ if (normalizePath(file) === normalizePath(mcpEntry) || normalizePath(file) === normalizePath(sitemapFile)) regenerate();
229
+ };
230
+ server.watcher.on("add", onChange);
231
+ server.watcher.on("change", onChange);
232
+ server.watcher.on("unlink", onChange);
233
+ server.watcher.once("close", () => {
234
+ server.watcher.off("add", onChange);
235
+ server.watcher.off("change", onChange);
236
+ server.watcher.off("unlink", onChange);
237
+ });
238
+ } }),
226
239
  name: "@lovable.dev/mcp-js",
227
240
  api: {
228
241
  get mcpEntry() {
@@ -235,7 +248,7 @@ function mcpPlugin(options = {}) {
235
248
  config(userConfig, { mode }) {
236
249
  const root = userConfig.root ? (0, node_path.resolve)(userConfig.root) : process.cwd();
237
250
  if ((0, vite.loadEnv)(mode, typeof userConfig.envDir === "string" ? (0, node_path.resolve)(root, userConfig.envDir) : root, userConfig.envPrefix ?? "VITE_")[SUPABASE_PROJECT_REF_ENV]) return;
238
- const ref = require_supabase_config.readSupabaseProjectRef(root);
251
+ const ref = require_hooks.readSupabaseProjectRef(root);
239
252
  if (!ref) return;
240
253
  return { define: { [`import.meta.env.${SUPABASE_PROJECT_REF_ENV}`]: JSON.stringify(ref) } };
241
254
  },
@@ -246,19 +259,6 @@ function mcpPlugin(options = {}) {
246
259
  ({routesDir, mcpRouteFile, metadataRouteFile} = resolveAllRoutes(projectRoot, routesDirOption, routeFileName, metadataUrlPath));
247
260
  regenerate();
248
261
  },
249
- configureServer(server) {
250
- const onChange = (file) => {
251
- if (normalizePath(file) === normalizePath(mcpEntry) || normalizePath(file) === normalizePath(sitemapFile)) regenerate();
252
- };
253
- server.watcher.on("add", onChange);
254
- server.watcher.on("change", onChange);
255
- server.watcher.on("unlink", onChange);
256
- server.watcher.once("close", () => {
257
- server.watcher.off("add", onChange);
258
- server.watcher.off("change", onChange);
259
- server.watcher.off("unlink", onChange);
260
- });
261
- },
262
262
  buildStart() {
263
263
  regenerate();
264
264
  }
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-Bn0ErYbG.cjs";
1
+ import { t as McpPluginApi } from "../../io-DfUvQ-SV.cjs";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/tanstack/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -1,4 +1,4 @@
1
- import { t as McpPluginApi } from "../../io-BvogiiQ1.js";
1
+ import { t as McpPluginApi } from "../../io-CFyHLyvs.js";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/stacks/tanstack/vite.d.ts
4
4
  interface McpPluginOptions {
@@ -1,5 +1,5 @@
1
1
  import "../../metadata-path-CAkNcfyY.js";
2
- import { n as isFileMissing, t as readSupabaseProjectRef } from "../../supabase-config-DITfH_bn.js";
2
+ import { a as isFileMissing, i as readSupabaseProjectRef, r as skillImportVitePlugin } from "../../hooks-BOdDe251.js";
3
3
  import { lstatSync, mkdirSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
4
4
  import { dirname, join, relative, resolve, sep } from "node:path";
5
5
  import { loadEnv } from "vite";
@@ -219,6 +219,19 @@ function mcpPlugin(options = {}) {
219
219
  }
220
220
  };
221
221
  return {
222
+ ...skillImportVitePlugin({ onServer(server) {
223
+ const onChange = (file) => {
224
+ if (normalizePath(file) === normalizePath(mcpEntry) || normalizePath(file) === normalizePath(sitemapFile)) regenerate();
225
+ };
226
+ server.watcher.on("add", onChange);
227
+ server.watcher.on("change", onChange);
228
+ server.watcher.on("unlink", onChange);
229
+ server.watcher.once("close", () => {
230
+ server.watcher.off("add", onChange);
231
+ server.watcher.off("change", onChange);
232
+ server.watcher.off("unlink", onChange);
233
+ });
234
+ } }),
222
235
  name: "@lovable.dev/mcp-js",
223
236
  api: {
224
237
  get mcpEntry() {
@@ -242,19 +255,6 @@ function mcpPlugin(options = {}) {
242
255
  ({routesDir, mcpRouteFile, metadataRouteFile} = resolveAllRoutes(projectRoot, routesDirOption, routeFileName, metadataUrlPath));
243
256
  regenerate();
244
257
  },
245
- configureServer(server) {
246
- const onChange = (file) => {
247
- if (normalizePath(file) === normalizePath(mcpEntry) || normalizePath(file) === normalizePath(sitemapFile)) regenerate();
248
- };
249
- server.watcher.on("add", onChange);
250
- server.watcher.on("change", onChange);
251
- server.watcher.on("unlink", onChange);
252
- server.watcher.once("close", () => {
253
- server.watcher.off("add", onChange);
254
- server.watcher.off("change", onChange);
255
- server.watcher.off("unlink", onChange);
256
- });
257
- },
258
258
  buildStart() {
259
259
  regenerate();
260
260
  }
@@ -1,4 +1,4 @@
1
- import { w as ZodOutputSchema } from "../types-BX8RawmT.cjs";
1
+ import { w as ZodOutputSchema } from "../types-CAFCH0yK.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 {
@@ -1,4 +1,4 @@
1
- import { w as ZodOutputSchema } from "../types-BX8RawmT.js";
1
+ import { w as ZodOutputSchema } from "../types-CAFCH0yK.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 {
@@ -180,6 +180,11 @@ interface MetricsOptions {
180
180
  /** Either the bare on/off toggle or the full options object. */
181
181
  type MetricsConfig = boolean | MetricsOptions;
182
182
  //#endregion
183
+ //#region src/skills/format.d.ts
184
+ interface Skill {
185
+ readonly __skill: never;
186
+ }
187
+ //#endregion
183
188
  //#region src/core/types.d.ts
184
189
  /**
185
190
  * Any zod schema. Aliased to zod's `ZodType` (no generics) — non-deprecated
@@ -396,6 +401,7 @@ type McpDefinitionInput<TAppContext = undefined> = {
396
401
  */
397
402
  readonly instructions: string;
398
403
  readonly tools: readonly (AnyAppContextToolDefinition<TAppContext> | StaticToolDefinition)[];
404
+ readonly skills?: readonly Skill[];
399
405
  /**
400
406
  * Usage-metrics emission (runtime telemetry), on by default. `false` opts out;
401
407
  * `{ endpoint, headers }` sends to your own OTLP collector. Self-disables at
@@ -410,4 +416,4 @@ type McpDefinition<TAppContext = unknown> = Omit<McpDefinitionInput<TAppContext>
410
416
  readonly [McpDefinitionBrand]: never;
411
417
  };
412
418
  //#endregion
413
- export { McpClientInfo as A, ToolVisibilityContext as C, MetricsConfig as D, ZodSchema as E, McpAuthConfig as F, ProgressUpdate as M, ToolContext as N, MetricsOptions as O, JwtClaims as P, ToolHandlerResult as S, ZodRawShape$1 as T, ResourceLinkIcon as _, ContentBlock as a, ToolContent as b, EmbeddedResource as c, JsonValue as d, JsonValueInput as f, ResourceLink as g, McpDefinitionInput as h, ContentAnnotations as i, McpProtocolEra as j, AuthContext as k, EmbeddedTextResource as l, McpDefinition as m, AppContextToolDefinitionInput as n, CreateAppContextInput as o, McpAllowedOrigins as p, AudioContent as r, EmbeddedBlobResource as s, AppContextToolDefinition as t, ImageContent as u, TextContent as v, ZodOutputSchema as w, ToolDefinition as x, ToolAnnotations as y };
419
+ export { AuthContext as A, ToolVisibilityContext as C, Skill as D, ZodSchema as E, JwtClaims as F, McpAuthConfig as I, McpProtocolEra as M, ProgressUpdate as N, MetricsConfig as O, ToolContext as P, ToolHandlerResult as S, ZodRawShape$1 as T, ResourceLinkIcon as _, ContentBlock as a, ToolContent as b, EmbeddedResource as c, JsonValue as d, JsonValueInput as f, ResourceLink as g, McpDefinitionInput as h, ContentAnnotations as i, McpClientInfo as j, MetricsOptions as k, EmbeddedTextResource as l, McpDefinition as m, AppContextToolDefinitionInput as n, CreateAppContextInput as o, McpAllowedOrigins as p, AudioContent as r, EmbeddedBlobResource as s, AppContextToolDefinition as t, ImageContent as u, TextContent as v, ZodOutputSchema as w, ToolDefinition as x, ToolAnnotations as y };
@@ -180,6 +180,11 @@ interface MetricsOptions {
180
180
  /** Either the bare on/off toggle or the full options object. */
181
181
  type MetricsConfig = boolean | MetricsOptions;
182
182
  //#endregion
183
+ //#region src/skills/format.d.ts
184
+ interface Skill {
185
+ readonly __skill: never;
186
+ }
187
+ //#endregion
183
188
  //#region src/core/types.d.ts
184
189
  /**
185
190
  * Any zod schema. Aliased to zod's `ZodType` (no generics) — non-deprecated
@@ -396,6 +401,7 @@ type McpDefinitionInput<TAppContext = undefined> = {
396
401
  */
397
402
  readonly instructions: string;
398
403
  readonly tools: readonly (AnyAppContextToolDefinition<TAppContext> | StaticToolDefinition)[];
404
+ readonly skills?: readonly Skill[];
399
405
  /**
400
406
  * Usage-metrics emission (runtime telemetry), on by default. `false` opts out;
401
407
  * `{ endpoint, headers }` sends to your own OTLP collector. Self-disables at
@@ -410,4 +416,4 @@ type McpDefinition<TAppContext = unknown> = Omit<McpDefinitionInput<TAppContext>
410
416
  readonly [McpDefinitionBrand]: never;
411
417
  };
412
418
  //#endregion
413
- export { McpClientInfo as A, ToolVisibilityContext as C, MetricsConfig as D, ZodSchema as E, McpAuthConfig as F, ProgressUpdate as M, ToolContext as N, MetricsOptions as O, JwtClaims as P, ToolHandlerResult as S, ZodRawShape$1 as T, ResourceLinkIcon as _, ContentBlock as a, ToolContent as b, EmbeddedResource as c, JsonValue as d, JsonValueInput as f, ResourceLink as g, McpDefinitionInput as h, ContentAnnotations as i, McpProtocolEra as j, AuthContext as k, EmbeddedTextResource as l, McpDefinition as m, AppContextToolDefinitionInput as n, CreateAppContextInput as o, McpAllowedOrigins as p, AudioContent as r, EmbeddedBlobResource as s, AppContextToolDefinition as t, ImageContent as u, TextContent as v, ZodOutputSchema as w, ToolDefinition as x, ToolAnnotations as y };
419
+ export { AuthContext as A, ToolVisibilityContext as C, Skill as D, ZodSchema as E, JwtClaims as F, McpAuthConfig as I, McpProtocolEra as M, ProgressUpdate as N, MetricsConfig as O, ToolContext as P, ToolHandlerResult as S, ZodRawShape$1 as T, ResourceLinkIcon as _, ContentBlock as a, ToolContent as b, EmbeddedResource as c, JsonValue as d, JsonValueInput as f, ResourceLink as g, McpDefinitionInput as h, ContentAnnotations as i, McpClientInfo as j, MetricsOptions as k, EmbeddedTextResource as l, McpDefinition as m, AppContextToolDefinitionInput as n, CreateAppContextInput as o, McpAllowedOrigins as p, AudioContent as r, EmbeddedBlobResource as s, AppContextToolDefinition as t, ImageContent as u, TextContent as v, ZodOutputSchema as w, ToolDefinition as x, ToolAnnotations as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/mcp-js",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },
@@ -22,6 +22,14 @@
22
22
  "module": "./dist/index.js",
23
23
  "types": "./dist/index.d.ts",
24
24
  "exports": {
25
+ "./skill-imports": {
26
+ "import": {
27
+ "types": "./skill-imports.d.ts"
28
+ },
29
+ "require": {
30
+ "types": "./skill-imports.d.cts"
31
+ }
32
+ },
25
33
  ".": {
26
34
  "import": {
27
35
  "types": "./dist/index.d.ts",
@@ -118,7 +126,9 @@
118
126
  "lovable-mcp-extract-manifest": "./dist/cli/extract-manifest.cjs"
119
127
  },
120
128
  "files": [
121
- "dist"
129
+ "dist",
130
+ "skill-imports.d.ts",
131
+ "skill-imports.d.cts"
122
132
  ],
123
133
  "keywords": [
124
134
  "mcp",
@@ -134,7 +144,8 @@
134
144
  "@modelcontextprotocol/server": "2.0.0",
135
145
  "@modelcontextprotocol/sdk": "1.28.0",
136
146
  "esbuild": "^0.27.0",
137
- "jose": "^6.2.2"
147
+ "jose": "^6.2.2",
148
+ "js-yaml": "^4.3.2"
138
149
  },
139
150
  "peerDependencies": {
140
151
  "vite": ">=5.0.0 <9.0.0",
@@ -147,7 +158,8 @@
147
158
  "typescript": "7.0.2",
148
159
  "vite": "^7.3.1",
149
160
  "vitest": "^4.1.5",
150
- "zod": "^4.1.13"
161
+ "zod": "^4.1.13",
162
+ "@types/js-yaml": "^4.0.9"
151
163
  },
152
164
  "scripts": {
153
165
  "build": "tsdown",
@@ -0,0 +1 @@
1
+ /// <reference path="./skill-imports.d.ts" />
@@ -0,0 +1,9 @@
1
+ declare module "*?skill" {
2
+ const skill: import("@lovable.dev/mcp-js").Skill;
3
+ export default skill;
4
+ }
5
+
6
+ declare module "*&skill" {
7
+ const skill: import("@lovable.dev/mcp-js").Skill;
8
+ export default skill;
9
+ }