@lovable.dev/mcp-js 0.10.0 → 0.10.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/dist/{chunk-4XJ2R3DD.js → chunk-D6KB4Q7R.js} +1 -1
- package/dist/cli/extract-manifest.cjs +1 -1
- package/dist/cli/extract-manifest.js +1 -1
- package/dist/stacks/supabase/index.cjs +16 -5
- package/dist/stacks/supabase/index.js +16 -5
- package/dist/stacks/supabase/vite.cjs +1 -1
- package/dist/stacks/supabase/vite.js +1 -1
- package/package.json +1 -1
|
@@ -908,6 +908,16 @@ function dispatchFor(pathname) {
|
|
|
908
908
|
}
|
|
909
909
|
return { kind: "mcp" };
|
|
910
910
|
}
|
|
911
|
+
function applyForwardedProto(request) {
|
|
912
|
+
const proto = request.headers.get("x-forwarded-proto")?.split(",")[0]?.trim();
|
|
913
|
+
if (!proto)
|
|
914
|
+
return request;
|
|
915
|
+
const url = new URL(request.url);
|
|
916
|
+
if (`${proto}:` === url.protocol)
|
|
917
|
+
return request;
|
|
918
|
+
url.protocol = `${proto}:`;
|
|
919
|
+
return new Request(url.href, request);
|
|
920
|
+
}
|
|
911
921
|
function createSupabaseHandler(mcp, options = {}) {
|
|
912
922
|
const resourcePath = deriveResourcePath(options);
|
|
913
923
|
if (resourcePath !== void 0)
|
|
@@ -920,16 +930,17 @@ function createSupabaseHandler(mcp, options = {}) {
|
|
|
920
930
|
const invokeToolHandler = createInvokeToolHandler(mcp, runtimeOptions);
|
|
921
931
|
const metadataHandler = createOAuthProtectedResourceMetadataHandler(mcp, runtimeOptions);
|
|
922
932
|
return async (request) => {
|
|
923
|
-
const
|
|
933
|
+
const req = applyForwardedProto(request);
|
|
934
|
+
const target = dispatchFor(new URL(req.url).pathname);
|
|
924
935
|
switch (target.kind) {
|
|
925
936
|
case "metadata":
|
|
926
|
-
return metadataHandler(
|
|
937
|
+
return metadataHandler(req);
|
|
927
938
|
case "list-tools":
|
|
928
|
-
return listToolsHandler(
|
|
939
|
+
return listToolsHandler(req);
|
|
929
940
|
case "invoke-tool":
|
|
930
|
-
return invokeToolHandler(
|
|
941
|
+
return invokeToolHandler(req, target.toolName);
|
|
931
942
|
case "mcp":
|
|
932
|
-
return mcpHandler(
|
|
943
|
+
return mcpHandler(req);
|
|
933
944
|
}
|
|
934
945
|
};
|
|
935
946
|
}
|
|
@@ -54,6 +54,16 @@ function dispatchFor(pathname) {
|
|
|
54
54
|
}
|
|
55
55
|
return { kind: "mcp" };
|
|
56
56
|
}
|
|
57
|
+
function applyForwardedProto(request) {
|
|
58
|
+
const proto = request.headers.get("x-forwarded-proto")?.split(",")[0]?.trim();
|
|
59
|
+
if (!proto)
|
|
60
|
+
return request;
|
|
61
|
+
const url = new URL(request.url);
|
|
62
|
+
if (`${proto}:` === url.protocol)
|
|
63
|
+
return request;
|
|
64
|
+
url.protocol = `${proto}:`;
|
|
65
|
+
return new Request(url.href, request);
|
|
66
|
+
}
|
|
57
67
|
function createSupabaseHandler(mcp, options = {}) {
|
|
58
68
|
const resourcePath = deriveResourcePath(options);
|
|
59
69
|
if (resourcePath !== void 0)
|
|
@@ -66,16 +76,17 @@ function createSupabaseHandler(mcp, options = {}) {
|
|
|
66
76
|
const invokeToolHandler = createInvokeToolHandler(mcp, runtimeOptions);
|
|
67
77
|
const metadataHandler = createOAuthProtectedResourceMetadataHandler(mcp, runtimeOptions);
|
|
68
78
|
return async (request) => {
|
|
69
|
-
const
|
|
79
|
+
const req = applyForwardedProto(request);
|
|
80
|
+
const target = dispatchFor(new URL(req.url).pathname);
|
|
70
81
|
switch (target.kind) {
|
|
71
82
|
case "metadata":
|
|
72
|
-
return metadataHandler(
|
|
83
|
+
return metadataHandler(req);
|
|
73
84
|
case "list-tools":
|
|
74
|
-
return listToolsHandler(
|
|
85
|
+
return listToolsHandler(req);
|
|
75
86
|
case "invoke-tool":
|
|
76
|
-
return invokeToolHandler(
|
|
87
|
+
return invokeToolHandler(req, target.toolName);
|
|
77
88
|
case "mcp":
|
|
78
|
-
return mcpHandler(
|
|
89
|
+
return mcpHandler(req);
|
|
79
90
|
}
|
|
80
91
|
};
|
|
81
92
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovable.dev/mcp-js",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Author MCP servers for Lovable apps. Declare tools with defineTool, register them in defineMcp, and a framework adapter (TanStack or Supabase Edge Functions) emits the route(s) at build time.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|