@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.
- package/dist/authorize-CumVyk7p.d.cts +27 -0
- package/dist/authorize-D6p4-9_D.d.ts +27 -0
- package/dist/base-DCe0kP79.d.cts +29 -0
- package/dist/base-DCe0kP79.d.ts +29 -0
- package/dist/cli/extract-manifest.cjs +116 -201
- package/dist/cli/extract-manifest.d.cts +1 -1
- package/dist/cli/extract-manifest.d.ts +1 -1
- package/dist/cli/extract-manifest.js +117 -156
- package/dist/content-D5LJAHyM.js +12 -0
- package/dist/content-NCYIGgOb.cjs +17 -0
- package/dist/context-BweeEcoA.cjs +56 -0
- package/dist/context-CIpPzN7P.js +51 -0
- package/dist/cors-CSDhBjFd.cjs +913 -0
- package/dist/cors-rWp_tbLZ.js +830 -0
- package/dist/forwarded--h4efJy-.js +43 -0
- package/dist/forwarded-Pi8Hs5Ps.cjs +48 -0
- package/dist/fs-errors-CWNzOV75.cjs +11 -0
- package/dist/fs-errors-PA2t1TIp.js +6 -0
- package/dist/index.cjs +129 -329
- package/dist/index.d.cts +26 -26
- package/dist/index.d.ts +26 -26
- package/dist/index.js +118 -177
- package/dist/{io-D4srzRKc.d.ts → io-CfSPxeBN.d.ts} +6 -4
- package/dist/io-DPYvBqET.d.cts +15 -0
- package/dist/list-tools-B4TTPEl1.d.cts +8 -0
- package/dist/list-tools-CFUX-uo-.cjs +57 -0
- package/dist/list-tools-DVJrjtmH.js +46 -0
- package/dist/list-tools-bh6-eqZM.d.ts +8 -0
- package/dist/logger-2OXtfiIW.js +141 -0
- package/dist/logger-BqPOa_E1.cjs +194 -0
- package/dist/mcp-BNcpj8o7.cjs +128 -0
- package/dist/mcp-Bx3bJHzH.js +123 -0
- package/dist/metadata-path-CAkNcfyY.js +12 -0
- package/dist/metadata-path-zd7NSNoa.cjs +17 -0
- package/dist/package-CgwD4Ywz.js +4 -0
- package/dist/package-DzstF8Ih.cjs +9 -0
- package/dist/paths-IS65L6TA.js +7 -0
- package/dist/paths-OP318a6c.cjs +18 -0
- package/dist/protocols/mcp/index.cjs +3 -750
- package/dist/protocols/mcp/index.d.cts +6 -7
- package/dist/protocols/mcp/index.d.ts +6 -7
- package/dist/protocols/mcp/index.js +2 -12
- package/dist/protocols/oauth-metadata.cjs +48 -539
- package/dist/protocols/oauth-metadata.d.cts +5 -6
- package/dist/protocols/oauth-metadata.d.ts +5 -6
- package/dist/protocols/oauth-metadata.js +52 -10
- package/dist/protocols/rest/index.cjs +5 -843
- package/dist/protocols/rest/index.d.cts +7 -10
- package/dist/protocols/rest/index.d.ts +7 -10
- package/dist/protocols/rest/index.js +3 -16
- package/dist/rest-BRshnow2.js +117 -0
- package/dist/rest-C4ZEGSIV.cjs +122 -0
- package/dist/stacks/supabase/index.cjs +76 -1318
- package/dist/stacks/supabase/index.d.cts +29 -30
- package/dist/stacks/supabase/index.d.ts +29 -30
- package/dist/stacks/supabase/index.js +73 -89
- package/dist/stacks/supabase/vite.cjs +258 -287
- package/dist/stacks/supabase/vite.d.cts +24 -24
- package/dist/stacks/supabase/vite.d.ts +24 -24
- package/dist/stacks/supabase/vite.js +252 -252
- package/dist/stacks/tanstack/index.cjs +42 -1272
- package/dist/stacks/tanstack/index.d.cts +8 -9
- package/dist/stacks/tanstack/index.d.ts +8 -9
- package/dist/stacks/tanstack/index.js +36 -41
- package/dist/stacks/tanstack/vite.cjs +223 -312
- package/dist/stacks/tanstack/vite.d.cts +80 -81
- package/dist/stacks/tanstack/vite.d.ts +80 -81
- package/dist/stacks/tanstack/vite.js +216 -282
- package/dist/types-BYdYYTjk.d.cts +321 -0
- package/dist/types-BYdYYTjk.d.ts +321 -0
- package/package.json +4 -4
- package/dist/authorize-BMeXd_Sh.d.ts +0 -25
- package/dist/base-CM-KCpp6.d.ts +0 -28
- package/dist/chunk-5HVSJCKE.js +0 -114
- package/dist/chunk-6DXGZZA4.js +0 -6
- package/dist/chunk-6QFZYYUV.js +0 -11
- package/dist/chunk-6SZOFKGH.js +0 -58
- package/dist/chunk-H37EB22A.js +0 -125
- package/dist/chunk-IFDWUM7L.js +0 -741
- package/dist/chunk-IXZIFYO6.js +0 -79
- package/dist/chunk-MA5H6PSF.js +0 -46
- package/dist/chunk-TJN33K5U.js +0 -141
- package/dist/chunk-UQK5UO6C.js +0 -26
- package/dist/chunk-XQWJN6DC.js +0 -14
- package/dist/chunk-Y3ZFPEQH.js +0 -8
- package/dist/chunk-ZQXSWTPU.js +0 -6
- package/dist/types-qqrmJ736.d.ts +0 -321
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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 {
|
|
2
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
3
|
-
} from "../../
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
} from "../../
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
} from "../../
|
|
10
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
94
|
-
|
|
95
|
-
};
|
|
78
|
+
//#endregion
|
|
79
|
+
export { createSupabaseHandler };
|