@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.
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-BxwVxCm3.cjs +913 -0
  14. package/dist/cors-CJRL7tyh.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-Duj1zT0T.js +46 -0
  27. package/dist/list-tools-_Hh_o_mD.cjs +57 -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--iewDKrV.cjs +128 -0
  32. package/dist/mcp-CALHyhDi.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-CLTXgGyU.cjs +9 -0
  36. package/dist/package-g7-GHkOW.js +4 -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-BcS3SYjx.cjs +122 -0
  52. package/dist/rest-Dv9Xq9cV.js +117 -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 +69 -28
  72. package/dist/authorize-BMeXd_Sh.d.ts +0 -25
  73. package/dist/base-CM-KCpp6.d.ts +0 -28
  74. package/dist/chunk-4EHZUUS5.js +0 -141
  75. package/dist/chunk-6DXGZZA4.js +0 -6
  76. package/dist/chunk-6KNM7RGD.js +0 -79
  77. package/dist/chunk-6QFZYYUV.js +0 -11
  78. package/dist/chunk-EOFPMSND.js +0 -6
  79. package/dist/chunk-H37EB22A.js +0 -125
  80. package/dist/chunk-MA5H6PSF.js +0 -46
  81. package/dist/chunk-P43FIUMZ.js +0 -114
  82. package/dist/chunk-RK62EMPY.js +0 -741
  83. package/dist/chunk-RLE4UE63.js +0 -58
  84. package/dist/chunk-UQK5UO6C.js +0 -26
  85. package/dist/chunk-XQWJN6DC.js +0 -14
  86. package/dist/chunk-Y3ZFPEQH.js +0 -8
  87. package/dist/types-qqrmJ736.d.ts +0 -321
@@ -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
- };