@lovable.dev/mcp-js 0.22.1 → 0.22.2-rc.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 (87) hide show
  1. package/dist/authorize-CumVyk7p.d.cts +27 -0
  2. package/dist/authorize-D6p4-9_D.d.ts +27 -0
  3. package/dist/base-DCe0kP79.d.cts +29 -0
  4. package/dist/base-DCe0kP79.d.ts +29 -0
  5. package/dist/cli/extract-manifest.cjs +116 -201
  6. package/dist/cli/extract-manifest.d.cts +1 -1
  7. package/dist/cli/extract-manifest.d.ts +1 -1
  8. package/dist/cli/extract-manifest.js +117 -156
  9. package/dist/content-D5LJAHyM.js +12 -0
  10. package/dist/content-NCYIGgOb.cjs +17 -0
  11. package/dist/context-BweeEcoA.cjs +56 -0
  12. package/dist/context-CIpPzN7P.js +51 -0
  13. package/dist/cors-CSDhBjFd.cjs +913 -0
  14. package/dist/cors-rWp_tbLZ.js +830 -0
  15. package/dist/forwarded--h4efJy-.js +43 -0
  16. package/dist/forwarded-Pi8Hs5Ps.cjs +48 -0
  17. package/dist/fs-errors-CWNzOV75.cjs +11 -0
  18. package/dist/fs-errors-PA2t1TIp.js +6 -0
  19. package/dist/index.cjs +129 -329
  20. package/dist/index.d.cts +26 -26
  21. package/dist/index.d.ts +26 -26
  22. package/dist/index.js +118 -177
  23. package/dist/{io-D4srzRKc.d.ts → io-CfSPxeBN.d.ts} +6 -4
  24. package/dist/io-DPYvBqET.d.cts +15 -0
  25. package/dist/list-tools-B4TTPEl1.d.cts +8 -0
  26. package/dist/list-tools-CFUX-uo-.cjs +57 -0
  27. package/dist/list-tools-DVJrjtmH.js +46 -0
  28. package/dist/list-tools-bh6-eqZM.d.ts +8 -0
  29. package/dist/logger-2OXtfiIW.js +141 -0
  30. package/dist/logger-BqPOa_E1.cjs +194 -0
  31. package/dist/mcp-BNcpj8o7.cjs +128 -0
  32. package/dist/mcp-Bx3bJHzH.js +123 -0
  33. package/dist/metadata-path-CAkNcfyY.js +12 -0
  34. package/dist/metadata-path-zd7NSNoa.cjs +17 -0
  35. package/dist/package-CgwD4Ywz.js +4 -0
  36. package/dist/package-DzstF8Ih.cjs +9 -0
  37. package/dist/paths-IS65L6TA.js +7 -0
  38. package/dist/paths-OP318a6c.cjs +18 -0
  39. package/dist/protocols/mcp/index.cjs +3 -750
  40. package/dist/protocols/mcp/index.d.cts +6 -7
  41. package/dist/protocols/mcp/index.d.ts +6 -7
  42. package/dist/protocols/mcp/index.js +2 -12
  43. package/dist/protocols/oauth-metadata.cjs +48 -539
  44. package/dist/protocols/oauth-metadata.d.cts +5 -6
  45. package/dist/protocols/oauth-metadata.d.ts +5 -6
  46. package/dist/protocols/oauth-metadata.js +52 -10
  47. package/dist/protocols/rest/index.cjs +5 -843
  48. package/dist/protocols/rest/index.d.cts +7 -10
  49. package/dist/protocols/rest/index.d.ts +7 -10
  50. package/dist/protocols/rest/index.js +3 -16
  51. package/dist/rest-BRshnow2.js +117 -0
  52. package/dist/rest-C4ZEGSIV.cjs +122 -0
  53. package/dist/stacks/supabase/index.cjs +76 -1318
  54. package/dist/stacks/supabase/index.d.cts +29 -30
  55. package/dist/stacks/supabase/index.d.ts +29 -30
  56. package/dist/stacks/supabase/index.js +73 -89
  57. package/dist/stacks/supabase/vite.cjs +258 -287
  58. package/dist/stacks/supabase/vite.d.cts +24 -24
  59. package/dist/stacks/supabase/vite.d.ts +24 -24
  60. package/dist/stacks/supabase/vite.js +252 -252
  61. package/dist/stacks/tanstack/index.cjs +42 -1272
  62. package/dist/stacks/tanstack/index.d.cts +8 -9
  63. package/dist/stacks/tanstack/index.d.ts +8 -9
  64. package/dist/stacks/tanstack/index.js +36 -41
  65. package/dist/stacks/tanstack/vite.cjs +223 -312
  66. package/dist/stacks/tanstack/vite.d.cts +80 -81
  67. package/dist/stacks/tanstack/vite.d.ts +80 -81
  68. package/dist/stacks/tanstack/vite.js +216 -282
  69. package/dist/types-BYdYYTjk.d.cts +321 -0
  70. package/dist/types-BYdYYTjk.d.ts +321 -0
  71. package/package.json +4 -4
  72. package/dist/authorize-BMeXd_Sh.d.ts +0 -25
  73. package/dist/base-CM-KCpp6.d.ts +0 -28
  74. package/dist/chunk-5HVSJCKE.js +0 -114
  75. package/dist/chunk-6DXGZZA4.js +0 -6
  76. package/dist/chunk-6QFZYYUV.js +0 -11
  77. package/dist/chunk-6SZOFKGH.js +0 -58
  78. package/dist/chunk-H37EB22A.js +0 -125
  79. package/dist/chunk-IFDWUM7L.js +0 -741
  80. package/dist/chunk-IXZIFYO6.js +0 -79
  81. package/dist/chunk-MA5H6PSF.js +0 -46
  82. package/dist/chunk-TJN33K5U.js +0 -141
  83. package/dist/chunk-UQK5UO6C.js +0 -26
  84. package/dist/chunk-XQWJN6DC.js +0 -14
  85. package/dist/chunk-Y3ZFPEQH.js +0 -8
  86. package/dist/chunk-ZQXSWTPU.js +0 -6
  87. package/dist/types-qqrmJ736.d.ts +0 -321
@@ -1,33 +1,32 @@
1
- import { d as McpDefinition } from '../../types-qqrmJ736.js';
2
- import 'zod';
3
-
1
+ import { c as McpDefinition } from "../../types-BYdYYTjk.cjs";
2
+ //#region src/stacks/supabase/handler.d.ts
4
3
  type SupabaseHandler = (request: Request) => Promise<Response>;
5
4
  interface SupabaseHandlerOptions {
6
- /**
7
- * Supabase function directory name (the segment under `supabase/functions/`).
8
- * Used to derive `resourcePath: /functions/v1/<functionName>` so OAuth
9
- * protected-resource metadata binds to the canonical public MCP URL rather
10
- * than the request path the dispatcher was reached through.
11
- *
12
- * Either `functionName` or `resourcePath` is required when OAuth auth is
13
- * configured and `auth.resource` is not pinned.
14
- */
15
- functionName?: string;
16
- /**
17
- * Explicit override for the public MCP route path. Wins over `functionName`
18
- * when both are set. Use when the function is fronted by a custom router or
19
- * a Lovable Cloud–style host that rewrites the public URL.
20
- */
21
- resourcePath?: string;
22
- /**
23
- * Derive the advertised `resource`/metadata host from `X-Forwarded-Host`
24
- * instead of the request `Host`, so a function fronted by a custom-domain
25
- * proxy advertises the public host. Off by default: enable only behind a
26
- * proxy that overwrites the header (an unsanitized one lets a client spoof
27
- * the advertised resource). `X-Forwarded-Proto` is trusted regardless —
28
- * Supabase terminates TLS upstream and forwards over http.
29
- */
30
- trustForwardedHost?: boolean;
5
+ /**
6
+ * Supabase function directory name (the segment under `supabase/functions/`).
7
+ * Used to derive `resourcePath: /functions/v1/<functionName>` so OAuth
8
+ * protected-resource metadata binds to the canonical public MCP URL rather
9
+ * than the request path the dispatcher was reached through.
10
+ *
11
+ * Either `functionName` or `resourcePath` is required when OAuth auth is
12
+ * configured and `auth.resource` is not pinned.
13
+ */
14
+ functionName?: string;
15
+ /**
16
+ * Explicit override for the public MCP route path. Wins over `functionName`
17
+ * when both are set. Use when the function is fronted by a custom router or
18
+ * a Lovable Cloud–style host that rewrites the public URL.
19
+ */
20
+ resourcePath?: string;
21
+ /**
22
+ * Derive the advertised `resource`/metadata host from `X-Forwarded-Host`
23
+ * instead of the request `Host`, so a function fronted by a custom-domain
24
+ * proxy advertises the public host. Off by default: enable only behind a
25
+ * proxy that overwrites the header (an unsanitized one lets a client spoof
26
+ * the advertised resource). `X-Forwarded-Proto` is trusted regardless —
27
+ * Supabase terminates TLS upstream and forwards over http.
28
+ */
29
+ trustForwardedHost?: boolean;
31
30
  }
32
31
  /**
33
32
  * Build a single Web-Standard handler that serves the full MCP surface from
@@ -44,5 +43,5 @@ interface SupabaseHandlerOptions {
44
43
  * The same OAuth bearer gate protects every dispatch target.
45
44
  */
46
45
  declare function createSupabaseHandler(mcp: McpDefinition, options?: SupabaseHandlerOptions): SupabaseHandler;
47
-
48
- export { type SupabaseHandler, type SupabaseHandlerOptions, createSupabaseHandler };
46
+ //#endregion
47
+ export { type SupabaseHandler, type SupabaseHandlerOptions, createSupabaseHandler };
@@ -1,33 +1,32 @@
1
- import { d as McpDefinition } from '../../types-qqrmJ736.js';
2
- import 'zod';
3
-
1
+ import { c as McpDefinition } from "../../types-BYdYYTjk.js";
2
+ //#region src/stacks/supabase/handler.d.ts
4
3
  type SupabaseHandler = (request: Request) => Promise<Response>;
5
4
  interface SupabaseHandlerOptions {
6
- /**
7
- * Supabase function directory name (the segment under `supabase/functions/`).
8
- * Used to derive `resourcePath: /functions/v1/<functionName>` so OAuth
9
- * protected-resource metadata binds to the canonical public MCP URL rather
10
- * than the request path the dispatcher was reached through.
11
- *
12
- * Either `functionName` or `resourcePath` is required when OAuth auth is
13
- * configured and `auth.resource` is not pinned.
14
- */
15
- functionName?: string;
16
- /**
17
- * Explicit override for the public MCP route path. Wins over `functionName`
18
- * when both are set. Use when the function is fronted by a custom router or
19
- * a Lovable Cloud–style host that rewrites the public URL.
20
- */
21
- resourcePath?: string;
22
- /**
23
- * Derive the advertised `resource`/metadata host from `X-Forwarded-Host`
24
- * instead of the request `Host`, so a function fronted by a custom-domain
25
- * proxy advertises the public host. Off by default: enable only behind a
26
- * proxy that overwrites the header (an unsanitized one lets a client spoof
27
- * the advertised resource). `X-Forwarded-Proto` is trusted regardless —
28
- * Supabase terminates TLS upstream and forwards over http.
29
- */
30
- trustForwardedHost?: boolean;
5
+ /**
6
+ * Supabase function directory name (the segment under `supabase/functions/`).
7
+ * Used to derive `resourcePath: /functions/v1/<functionName>` so OAuth
8
+ * protected-resource metadata binds to the canonical public MCP URL rather
9
+ * than the request path the dispatcher was reached through.
10
+ *
11
+ * Either `functionName` or `resourcePath` is required when OAuth auth is
12
+ * configured and `auth.resource` is not pinned.
13
+ */
14
+ functionName?: string;
15
+ /**
16
+ * Explicit override for the public MCP route path. Wins over `functionName`
17
+ * when both are set. Use when the function is fronted by a custom router or
18
+ * a Lovable Cloud–style host that rewrites the public URL.
19
+ */
20
+ resourcePath?: string;
21
+ /**
22
+ * Derive the advertised `resource`/metadata host from `X-Forwarded-Host`
23
+ * instead of the request `Host`, so a function fronted by a custom-domain
24
+ * proxy advertises the public host. Off by default: enable only behind a
25
+ * proxy that overwrites the header (an unsanitized one lets a client spoof
26
+ * the advertised resource). `X-Forwarded-Proto` is trusted regardless —
27
+ * Supabase terminates TLS upstream and forwards over http.
28
+ */
29
+ trustForwardedHost?: boolean;
31
30
  }
32
31
  /**
33
32
  * Build a single Web-Standard handler that serves the full MCP surface from
@@ -44,5 +43,5 @@ interface SupabaseHandlerOptions {
44
43
  * The same OAuth bearer gate protects every dispatch target.
45
44
  */
46
45
  declare function createSupabaseHandler(mcp: McpDefinition, options?: SupabaseHandlerOptions): SupabaseHandler;
47
-
48
- export { type SupabaseHandler, type SupabaseHandlerOptions, createSupabaseHandler };
46
+ //#endregion
47
+ export { type SupabaseHandler, type SupabaseHandlerOptions, createSupabaseHandler };
@@ -1,95 +1,79 @@
1
- import {
2
- applyForwardedOrigin
3
- } from "../../chunk-UQK5UO6C.js";
4
- import {
5
- createMcpProtocolHandler
6
- } from "../../chunk-5HVSJCKE.js";
7
- import {
8
- createOAuthProtectedResourceMetadataHandler
9
- } from "../../chunk-IXZIFYO6.js";
10
- import {
11
- createInvokeToolHandler
12
- } from "../../chunk-TJN33K5U.js";
13
- import {
14
- createListToolsHandler
15
- } from "../../chunk-6SZOFKGH.js";
16
- import "../../chunk-6QFZYYUV.js";
17
- import "../../chunk-MA5H6PSF.js";
18
- import {
19
- assertResourcePathShape,
20
- createRecorderForRuntime
21
- } from "../../chunk-IFDWUM7L.js";
22
- import {
23
- trimTrailingSlash
24
- } from "../../chunk-H37EB22A.js";
25
- import {
26
- OAUTH_PROTECTED_RESOURCE_METADATA_PATH
27
- } from "../../chunk-6DXGZZA4.js";
28
- import {
29
- FUNCTIONS_MOUNT_PREFIX,
30
- assertFunctionName
31
- } from "../../chunk-XQWJN6DC.js";
32
- import "../../chunk-ZQXSWTPU.js";
33
-
34
- // src/stacks/supabase/handler.ts
1
+ import { s as trimTrailingSlash } from "../../logger-2OXtfiIW.js";
2
+ import { l as createRecorderForRuntime, s as assertResourcePathShape } from "../../cors-rWp_tbLZ.js";
3
+ import { t as OAUTH_PROTECTED_RESOURCE_METADATA_PATH } from "../../metadata-path-CAkNcfyY.js";
4
+ import { t as createMcpProtocolHandler } from "../../mcp-Bx3bJHzH.js";
5
+ import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
6
+ import { n as createListToolsHandler } from "../../list-tools-DVJrjtmH.js";
7
+ import { t as createInvokeToolHandler } from "../../rest-BRshnow2.js";
8
+ import { t as applyForwardedOrigin } from "../../forwarded--h4efJy-.js";
9
+ import { n as assertFunctionName, t as FUNCTIONS_MOUNT_PREFIX } from "../../paths-IS65L6TA.js";
10
+ //#region src/stacks/supabase/handler.ts
35
11
  function deriveResourcePath(options) {
36
- if (options.resourcePath !== void 0)
37
- return options.resourcePath;
38
- if (options.functionName === void 0)
39
- return void 0;
40
- assertFunctionName(options.functionName);
41
- return `${FUNCTIONS_MOUNT_PREFIX}${options.functionName}`;
12
+ if (options.resourcePath !== void 0) return options.resourcePath;
13
+ if (options.functionName === void 0) return void 0;
14
+ assertFunctionName(options.functionName);
15
+ return `${FUNCTIONS_MOUNT_PREFIX}${options.functionName}`;
42
16
  }
43
17
  function dispatchFor(pathname) {
44
- const path = pathname.length > 1 ? pathname.replace(/\/+$/, "") : pathname;
45
- if (path.endsWith(OAUTH_PROTECTED_RESOURCE_METADATA_PATH)) {
46
- return { kind: "metadata" };
47
- }
48
- if (path.endsWith("/.mcp/list-tools")) {
49
- return { kind: "list-tools" };
50
- }
51
- const invokeMatch = /\/\.mcp\/invoke-tool\/([^/]+)$/.exec(path);
52
- if (invokeMatch) {
53
- let toolName;
54
- try {
55
- toolName = decodeURIComponent(invokeMatch[1]);
56
- } catch {
57
- return { kind: "mcp" };
58
- }
59
- return { kind: "invoke-tool", toolName };
60
- }
61
- return { kind: "mcp" };
18
+ const path = pathname.length > 1 ? pathname.replace(/\/+$/, "") : pathname;
19
+ if (path.endsWith("/.well-known/oauth-protected-resource")) return { kind: "metadata" };
20
+ if (path.endsWith("/.mcp/list-tools")) return { kind: "list-tools" };
21
+ const invokeMatch = /\/\.mcp\/invoke-tool\/([^/]+)$/.exec(path);
22
+ if (invokeMatch) {
23
+ let toolName;
24
+ try {
25
+ toolName = decodeURIComponent(invokeMatch[1]);
26
+ } catch {
27
+ return { kind: "mcp" };
28
+ }
29
+ return {
30
+ kind: "invoke-tool",
31
+ toolName
32
+ };
33
+ }
34
+ return { kind: "mcp" };
62
35
  }
36
+ /**
37
+ * Build a single Web-Standard handler that serves the full MCP surface from
38
+ * one Supabase Edge Function. The returned handler dispatches by URL suffix:
39
+ *
40
+ * | Suffix | Target |
41
+ * | --- | --- |
42
+ * | `/.well-known/oauth-protected-resource` | RFC 9728 metadata |
43
+ * | `/.mcp/list-tools` | REST tool catalog |
44
+ * | `/.mcp/invoke-tool/<tool>` | REST tool dispatcher |
45
+ * | (anything else) | MCP streamable-HTTP protocol |
46
+ *
47
+ * Pass the handler to `Deno.serve(...)` in the emitted function entry.
48
+ * The same OAuth bearer gate protects every dispatch target.
49
+ */
63
50
  function createSupabaseHandler(mcp, options = {}) {
64
- const resourcePath = deriveResourcePath(options);
65
- if (resourcePath !== void 0)
66
- assertResourcePathShape(resourcePath);
67
- const servesOwnPrm = !(mcp.auth?.type === "oauth" && mcp.auth.protectedResourceMetadataUrl !== void 0);
68
- const metadataPath = resourcePath === void 0 || !servesOwnPrm ? void 0 : `${trimTrailingSlash(resourcePath)}${OAUTH_PROTECTED_RESOURCE_METADATA_PATH}`;
69
- const runtimeOptions = resourcePath === void 0 ? {} : { resourcePath, ...metadataPath ? { metadataPath } : {} };
70
- const mcpHandler = createMcpProtocolHandler(mcp, runtimeOptions);
71
- const listToolsHandler = createListToolsHandler(mcp, runtimeOptions);
72
- const invokeToolHandler = createInvokeToolHandler(mcp, runtimeOptions);
73
- const metadataHandler = createOAuthProtectedResourceMetadataHandler(mcp, runtimeOptions);
74
- return async (request) => {
75
- const req = applyForwardedOrigin(request, {
76
- trustForwardedProto: true,
77
- trustForwardedHost: options.trustForwardedHost
78
- });
79
- const recorder = createRecorderForRuntime(mcp, { stack: "supabase" });
80
- const target = dispatchFor(new URL(req.url).pathname);
81
- switch (target.kind) {
82
- case "metadata":
83
- return metadataHandler(req);
84
- case "list-tools":
85
- return listToolsHandler(req, recorder);
86
- case "invoke-tool":
87
- return invokeToolHandler(req, target.toolName, recorder);
88
- case "mcp":
89
- return mcpHandler(req, recorder);
90
- }
91
- };
51
+ const resourcePath = deriveResourcePath(options);
52
+ if (resourcePath !== void 0) assertResourcePathShape(resourcePath);
53
+ const servesOwnPrm = !(mcp.auth?.type === "oauth" && mcp.auth.protectedResourceMetadataUrl !== void 0);
54
+ const metadataPath = resourcePath === void 0 || !servesOwnPrm ? void 0 : `${trimTrailingSlash(resourcePath)}${OAUTH_PROTECTED_RESOURCE_METADATA_PATH}`;
55
+ const runtimeOptions = resourcePath === void 0 ? {} : {
56
+ resourcePath,
57
+ ...metadataPath ? { metadataPath } : {}
58
+ };
59
+ const mcpHandler = createMcpProtocolHandler(mcp, runtimeOptions);
60
+ const listToolsHandler = createListToolsHandler(mcp, runtimeOptions);
61
+ const invokeToolHandler = createInvokeToolHandler(mcp, runtimeOptions);
62
+ const metadataHandler = createOAuthProtectedResourceMetadataHandler(mcp, runtimeOptions);
63
+ return async (request) => {
64
+ const req = applyForwardedOrigin(request, {
65
+ trustForwardedProto: true,
66
+ trustForwardedHost: options.trustForwardedHost
67
+ });
68
+ const recorder = createRecorderForRuntime(mcp, { stack: "supabase" });
69
+ const target = dispatchFor(new URL(req.url).pathname);
70
+ switch (target.kind) {
71
+ case "metadata": return metadataHandler(req);
72
+ case "list-tools": return listToolsHandler(req, recorder);
73
+ case "invoke-tool": return invokeToolHandler(req, target.toolName, recorder);
74
+ case "mcp": return mcpHandler(req, recorder);
75
+ }
76
+ };
92
77
  }
93
- export {
94
- createSupabaseHandler
95
- };
78
+ //#endregion
79
+ export { createSupabaseHandler };