@lovable.dev/mcp-js 0.22.0 → 0.22.1-rc.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/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-BxwVxCm3.cjs +913 -0
- package/dist/cors-CJRL7tyh.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-Duj1zT0T.js +46 -0
- package/dist/list-tools-_Hh_o_mD.cjs +57 -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--iewDKrV.cjs +128 -0
- package/dist/mcp-CALHyhDi.js +123 -0
- package/dist/metadata-path-CAkNcfyY.js +12 -0
- package/dist/metadata-path-zd7NSNoa.cjs +17 -0
- package/dist/package-CLTXgGyU.cjs +9 -0
- package/dist/package-g7-GHkOW.js +4 -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-BcS3SYjx.cjs +122 -0
- package/dist/rest-Dv9Xq9cV.js +117 -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 +69 -28
- package/dist/authorize-BMeXd_Sh.d.ts +0 -25
- package/dist/base-CM-KCpp6.d.ts +0 -28
- package/dist/chunk-4EHZUUS5.js +0 -141
- package/dist/chunk-6DXGZZA4.js +0 -6
- package/dist/chunk-6KNM7RGD.js +0 -79
- package/dist/chunk-6QFZYYUV.js +0 -11
- package/dist/chunk-EOFPMSND.js +0 -6
- package/dist/chunk-H37EB22A.js +0 -125
- package/dist/chunk-MA5H6PSF.js +0 -46
- package/dist/chunk-P43FIUMZ.js +0 -114
- package/dist/chunk-RK62EMPY.js +0 -741
- package/dist/chunk-RLE4UE63.js +0 -58
- package/dist/chunk-UQK5UO6C.js +0 -26
- package/dist/chunk-XQWJN6DC.js +0 -14
- package/dist/chunk-Y3ZFPEQH.js +0 -8
- package/dist/types-qqrmJ736.d.ts +0 -321
package/dist/chunk-P43FIUMZ.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
extractTextContent
|
|
3
|
-
} from "./chunk-6QFZYYUV.js";
|
|
4
|
-
import {
|
|
5
|
-
ToolContext
|
|
6
|
-
} from "./chunk-MA5H6PSF.js";
|
|
7
|
-
import {
|
|
8
|
-
corsPreflightResponse,
|
|
9
|
-
createNoopRecorder,
|
|
10
|
-
createRequestAuthorizer,
|
|
11
|
-
nowMs,
|
|
12
|
-
withCors
|
|
13
|
-
} from "./chunk-RK62EMPY.js";
|
|
14
|
-
import {
|
|
15
|
-
describeError,
|
|
16
|
-
log
|
|
17
|
-
} from "./chunk-H37EB22A.js";
|
|
18
|
-
|
|
19
|
-
// src/protocols/mcp/protocol.ts
|
|
20
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
21
|
-
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
22
|
-
function adaptToolToSdkCallback(tool, auth, recorder) {
|
|
23
|
-
const endUserId = auth?.principal.sub;
|
|
24
|
-
return async (first) => {
|
|
25
|
-
const args = tool.inputSchema ? first ?? {} : {};
|
|
26
|
-
const start = nowMs();
|
|
27
|
-
let result;
|
|
28
|
-
try {
|
|
29
|
-
result = await tool.handler(args, new ToolContext(auth));
|
|
30
|
-
} catch {
|
|
31
|
-
await recorder.emit({
|
|
32
|
-
tool: tool.name,
|
|
33
|
-
method: "tools/call",
|
|
34
|
-
outcome: "handler_error",
|
|
35
|
-
durationMs: nowMs() - start,
|
|
36
|
-
endUserId
|
|
37
|
-
});
|
|
38
|
-
return { content: [{ type: "text", text: "tool execution failed" }], isError: true };
|
|
39
|
-
}
|
|
40
|
-
if (result == null) {
|
|
41
|
-
await recorder.emit({
|
|
42
|
-
tool: tool.name,
|
|
43
|
-
method: "tools/call",
|
|
44
|
-
outcome: "handler_error",
|
|
45
|
-
durationMs: nowMs() - start,
|
|
46
|
-
endUserId
|
|
47
|
-
});
|
|
48
|
-
return { content: [{ type: "text", text: `tool "${tool.name}" returned no result` }], isError: true };
|
|
49
|
-
}
|
|
50
|
-
await recorder.emit({
|
|
51
|
-
tool: tool.name,
|
|
52
|
-
method: "tools/call",
|
|
53
|
-
outcome: result.isError ? "tool_error" : "ok",
|
|
54
|
-
durationMs: nowMs() - start,
|
|
55
|
-
errorText: result.isError ? extractTextContent(result.content) : void 0,
|
|
56
|
-
endUserId
|
|
57
|
-
});
|
|
58
|
-
return { content: result.content ?? [], structuredContent: result.structuredContent, isError: result.isError };
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
function createMcpProtocolHandler(mcp, options = {}) {
|
|
62
|
-
const authorizer = createRequestAuthorizer(mcp, options);
|
|
63
|
-
const handle = async (request, recorder) => {
|
|
64
|
-
const authResult = await authorizer.authorize(request, recorder);
|
|
65
|
-
if (!authResult.ok)
|
|
66
|
-
return authResult.response;
|
|
67
|
-
try {
|
|
68
|
-
const server = new McpServer(
|
|
69
|
-
{ name: mcp.name, version: mcp.version, title: mcp.title },
|
|
70
|
-
{ instructions: mcp.instructions }
|
|
71
|
-
);
|
|
72
|
-
for (const tool of mcp.tools) {
|
|
73
|
-
server.registerTool(
|
|
74
|
-
tool.name,
|
|
75
|
-
{
|
|
76
|
-
title: tool.title,
|
|
77
|
-
description: tool.description,
|
|
78
|
-
inputSchema: tool.inputSchema,
|
|
79
|
-
outputSchema: tool.outputSchema,
|
|
80
|
-
annotations: tool.annotations
|
|
81
|
-
},
|
|
82
|
-
adaptToolToSdkCallback(tool, authResult.auth, recorder)
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
86
|
-
sessionIdGenerator: void 0
|
|
87
|
-
});
|
|
88
|
-
await server.connect(transport);
|
|
89
|
-
return await transport.handleRequest(request);
|
|
90
|
-
} catch (err) {
|
|
91
|
-
await recorder.emit({
|
|
92
|
-
tool: null,
|
|
93
|
-
method: "transport",
|
|
94
|
-
outcome: "transport_error",
|
|
95
|
-
durationMs: 0,
|
|
96
|
-
endUserId: authResult.auth?.principal.sub
|
|
97
|
-
});
|
|
98
|
-
log.error("mcp.transport_error", { ...describeError(err), outcome: "500 internal error" });
|
|
99
|
-
return Response.json(
|
|
100
|
-
{ jsonrpc: "2.0", id: null, error: { code: -32603, message: "internal error" } },
|
|
101
|
-
{ status: 500 }
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
return async (request, recorder = createNoopRecorder()) => {
|
|
106
|
-
if (request.method === "OPTIONS")
|
|
107
|
-
return corsPreflightResponse("GET, POST, DELETE, OPTIONS");
|
|
108
|
-
return withCors(await handle(request, recorder));
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export {
|
|
113
|
-
createMcpProtocolHandler
|
|
114
|
-
};
|