@lovable.dev/mcp-js 3.3.1 → 3.5.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/README.internal.md +38 -12
- package/README.md +140 -12
- package/dist/THIRD_PARTY_NOTICES +75 -0
- package/dist/apps-CWG3rGhB.js +132 -0
- package/dist/apps-DyoDrwfi.cjs +185 -0
- package/dist/{authorize-CoaAw6wg.d.cts → authorize--W1XtwdB.d.cts} +1 -1
- package/dist/{authorize-BV62MDan.d.ts → authorize-DpNYioXM.d.ts} +1 -1
- package/dist/{base-Cx0spfMk.d.ts → base-Ce9JYirF.d.ts} +1 -1
- package/dist/{base-CzWe8AD1.d.cts → base-qEX8YVcD.d.cts} +1 -1
- package/dist/cli/check-server.cjs +1 -1
- package/dist/cli/check-server.js +1 -1
- package/dist/cli/extract-manifest.cjs +1 -1
- package/dist/cli/extract-manifest.js +1 -1
- package/dist/{cors-3HjrsmEW.cjs → cors-B_Oui5La.cjs} +1 -1
- package/dist/{cors-CNNmKKIg.js → cors-D83r8WUF.js} +1 -1
- package/dist/dist-CIu-UFye.js +6738 -0
- package/dist/dist-CqY2qXpc.cjs +6738 -0
- package/dist/{errors-CIpFAb6i.js → errors-CfaxXr2T.js} +15 -2
- package/dist/{errors-C97I7VOC.cjs → errors-xJ_7Su1K.cjs} +20 -1
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +2 -2
- package/dist/{io-D7cpdBJO.d.ts → io-BEpyfk4G.d.ts} +1 -1
- package/dist/{io-CaBSlPwS.cjs → io-CUnV4kTL.cjs} +12 -2
- package/dist/{io-DC-Y6R61.d.cts → io-Di5ljvZY.d.cts} +1 -1
- package/dist/{io-CahnhUhA.js → io-STpVLkbi.js} +13 -3
- package/dist/{mcp-DC8AoD18.js → mcp-BgIFUoo1.js} +110 -49
- package/dist/{mcp-DlWLIwX9.cjs → mcp-DpI0wwnW.cjs} +110 -49
- package/dist/mcp-app.d.ts +4 -0
- package/dist/{package-B488glmj.cjs → package-CuCho6-k.cjs} +1 -1
- package/dist/{package-CukfP_vq.js → package-Cz6Z5F_X.js} +1 -1
- package/dist/protocols/mcp/index.cjs +1 -1
- package/dist/protocols/mcp/index.d.cts +3 -3
- package/dist/protocols/mcp/index.d.ts +3 -3
- package/dist/protocols/mcp/index.js +1 -1
- package/dist/protocols/oauth-metadata.cjs +1 -1
- package/dist/protocols/oauth-metadata.d.cts +3 -3
- package/dist/protocols/oauth-metadata.d.ts +3 -3
- package/dist/protocols/oauth-metadata.js +1 -1
- package/dist/src-D7RtXSV0.cjs +311 -0
- package/dist/src-sWQwyLwS.js +310 -0
- package/dist/stacks/supabase/index.cjs +2 -2
- package/dist/stacks/supabase/index.d.cts +1 -1
- package/dist/stacks/supabase/index.d.ts +1 -1
- package/dist/stacks/supabase/index.js +2 -2
- package/dist/stacks/supabase/vite.cjs +10 -1
- package/dist/stacks/supabase/vite.d.cts +1 -1
- package/dist/stacks/supabase/vite.d.ts +1 -1
- package/dist/stacks/supabase/vite.js +21 -12
- package/dist/stacks/tanstack/index.cjs +33 -2
- package/dist/stacks/tanstack/index.d.cts +7 -4
- package/dist/stacks/tanstack/index.d.ts +7 -4
- package/dist/stacks/tanstack/index.js +33 -2
- package/dist/stacks/tanstack/vite.cjs +995 -15
- package/dist/stacks/tanstack/vite.d.cts +1 -1
- package/dist/stacks/tanstack/vite.d.ts +1 -1
- package/dist/stacks/tanstack/vite.js +1001 -21
- package/dist/testing/browser/LICENSE.ext-apps +218 -0
- package/dist/testing/browser/host.ts +151 -0
- package/dist/testing/browser/sandbox.ts +137 -0
- package/dist/testing/browser.cjs +382 -0
- package/dist/testing/browser.d.cts +46 -0
- package/dist/testing/browser.d.ts +46 -0
- package/dist/testing/browser.js +381 -0
- package/dist/testing/index.cjs +2 -1
- package/dist/testing/index.d.cts +2 -1
- package/dist/testing/index.d.ts +2 -1
- package/dist/testing/index.js +2 -1
- package/dist/testing/server.cjs +36 -0
- package/dist/testing/server.d.cts +6 -2
- package/dist/testing/server.d.ts +6 -2
- package/dist/testing/server.js +36 -1
- package/dist/{tool-result-DcNioyiI.js → tool-result-BG-HsSQu.js} +8 -1
- package/dist/{tool-result-rU-PpNNi.cjs → tool-result-BQcr7VV-.cjs} +8 -1
- package/dist/{types-z7T5bBIU.d.cts → types-B_dVw-zM.d.cts} +55 -1
- package/dist/{types-z7T5bBIU.d.ts → types-B_dVw-zM.d.ts} +55 -1
- package/package.json +66 -25
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/estree-walker/3.0.3/f149906e2d585666ae890c5dd2fceac84a9263c116ae67fb226fe4bb380de7c4/node_modules/estree-walker/src/walker.js
|
|
2
|
+
/**
|
|
3
|
+
* @typedef { import('estree').Node} Node
|
|
4
|
+
* @typedef {{
|
|
5
|
+
* skip: () => void;
|
|
6
|
+
* remove: () => void;
|
|
7
|
+
* replace: (node: Node) => void;
|
|
8
|
+
* }} WalkerContext
|
|
9
|
+
*/
|
|
10
|
+
var WalkerBase = class {
|
|
11
|
+
constructor() {
|
|
12
|
+
/** @type {boolean} */
|
|
13
|
+
this.should_skip = false;
|
|
14
|
+
/** @type {boolean} */
|
|
15
|
+
this.should_remove = false;
|
|
16
|
+
/** @type {Node | null} */
|
|
17
|
+
this.replacement = null;
|
|
18
|
+
/** @type {WalkerContext} */
|
|
19
|
+
this.context = {
|
|
20
|
+
skip: () => this.should_skip = true,
|
|
21
|
+
remove: () => this.should_remove = true,
|
|
22
|
+
replace: (node) => this.replacement = node
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @template {Node} Parent
|
|
27
|
+
* @param {Parent | null | undefined} parent
|
|
28
|
+
* @param {keyof Parent | null | undefined} prop
|
|
29
|
+
* @param {number | null | undefined} index
|
|
30
|
+
* @param {Node} node
|
|
31
|
+
*/
|
|
32
|
+
replace(parent, prop, index, node) {
|
|
33
|
+
if (parent && prop) if (index != null)
|
|
34
|
+
/** @type {Array<Node>} */ parent[prop][index] = node;
|
|
35
|
+
else
|
|
36
|
+
/** @type {Node} */ parent[prop] = node;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @template {Node} Parent
|
|
40
|
+
* @param {Parent | null | undefined} parent
|
|
41
|
+
* @param {keyof Parent | null | undefined} prop
|
|
42
|
+
* @param {number | null | undefined} index
|
|
43
|
+
*/
|
|
44
|
+
remove(parent, prop, index) {
|
|
45
|
+
if (parent && prop) if (index !== null && index !== void 0)
|
|
46
|
+
/** @type {Array<Node>} */ parent[prop].splice(index, 1);
|
|
47
|
+
else delete parent[prop];
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/estree-walker/3.0.3/f149906e2d585666ae890c5dd2fceac84a9263c116ae67fb226fe4bb380de7c4/node_modules/estree-walker/src/sync.js
|
|
52
|
+
/**
|
|
53
|
+
* @typedef { import('estree').Node} Node
|
|
54
|
+
* @typedef { import('./walker.js').WalkerContext} WalkerContext
|
|
55
|
+
* @typedef {(
|
|
56
|
+
* this: WalkerContext,
|
|
57
|
+
* node: Node,
|
|
58
|
+
* parent: Node | null,
|
|
59
|
+
* key: string | number | symbol | null | undefined,
|
|
60
|
+
* index: number | null | undefined
|
|
61
|
+
* ) => void} SyncHandler
|
|
62
|
+
*/
|
|
63
|
+
var SyncWalker = class extends WalkerBase {
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @param {SyncHandler} [enter]
|
|
67
|
+
* @param {SyncHandler} [leave]
|
|
68
|
+
*/
|
|
69
|
+
constructor(enter, leave) {
|
|
70
|
+
super();
|
|
71
|
+
/** @type {boolean} */
|
|
72
|
+
this.should_skip = false;
|
|
73
|
+
/** @type {boolean} */
|
|
74
|
+
this.should_remove = false;
|
|
75
|
+
/** @type {Node | null} */
|
|
76
|
+
this.replacement = null;
|
|
77
|
+
/** @type {WalkerContext} */
|
|
78
|
+
this.context = {
|
|
79
|
+
skip: () => this.should_skip = true,
|
|
80
|
+
remove: () => this.should_remove = true,
|
|
81
|
+
replace: (node) => this.replacement = node
|
|
82
|
+
};
|
|
83
|
+
/** @type {SyncHandler | undefined} */
|
|
84
|
+
this.enter = enter;
|
|
85
|
+
/** @type {SyncHandler | undefined} */
|
|
86
|
+
this.leave = leave;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @template {Node} Parent
|
|
90
|
+
* @param {Node} node
|
|
91
|
+
* @param {Parent | null} parent
|
|
92
|
+
* @param {keyof Parent} [prop]
|
|
93
|
+
* @param {number | null} [index]
|
|
94
|
+
* @returns {Node | null}
|
|
95
|
+
*/
|
|
96
|
+
visit(node, parent, prop, index) {
|
|
97
|
+
if (node) {
|
|
98
|
+
if (this.enter) {
|
|
99
|
+
const _should_skip = this.should_skip;
|
|
100
|
+
const _should_remove = this.should_remove;
|
|
101
|
+
const _replacement = this.replacement;
|
|
102
|
+
this.should_skip = false;
|
|
103
|
+
this.should_remove = false;
|
|
104
|
+
this.replacement = null;
|
|
105
|
+
this.enter.call(this.context, node, parent, prop, index);
|
|
106
|
+
if (this.replacement) {
|
|
107
|
+
node = this.replacement;
|
|
108
|
+
this.replace(parent, prop, index, node);
|
|
109
|
+
}
|
|
110
|
+
if (this.should_remove) this.remove(parent, prop, index);
|
|
111
|
+
const skipped = this.should_skip;
|
|
112
|
+
const removed = this.should_remove;
|
|
113
|
+
this.should_skip = _should_skip;
|
|
114
|
+
this.should_remove = _should_remove;
|
|
115
|
+
this.replacement = _replacement;
|
|
116
|
+
if (skipped) return node;
|
|
117
|
+
if (removed) return null;
|
|
118
|
+
}
|
|
119
|
+
/** @type {keyof Node} */
|
|
120
|
+
let key;
|
|
121
|
+
for (key in node) {
|
|
122
|
+
/** @type {unknown} */
|
|
123
|
+
const value = node[key];
|
|
124
|
+
if (value && typeof value === "object") {
|
|
125
|
+
if (Array.isArray(value)) {
|
|
126
|
+
const nodes = value;
|
|
127
|
+
for (let i = 0; i < nodes.length; i += 1) {
|
|
128
|
+
const item = nodes[i];
|
|
129
|
+
if (isNode$1(item)) {
|
|
130
|
+
if (!this.visit(item, node, key, i)) i--;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
} else if (isNode$1(value)) this.visit(value, node, key, null);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (this.leave) {
|
|
137
|
+
const _replacement = this.replacement;
|
|
138
|
+
const _should_remove = this.should_remove;
|
|
139
|
+
this.replacement = null;
|
|
140
|
+
this.should_remove = false;
|
|
141
|
+
this.leave.call(this.context, node, parent, prop, index);
|
|
142
|
+
if (this.replacement) {
|
|
143
|
+
node = this.replacement;
|
|
144
|
+
this.replace(parent, prop, index, node);
|
|
145
|
+
}
|
|
146
|
+
if (this.should_remove) this.remove(parent, prop, index);
|
|
147
|
+
const removed = this.should_remove;
|
|
148
|
+
this.replacement = _replacement;
|
|
149
|
+
this.should_remove = _should_remove;
|
|
150
|
+
if (removed) return null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return node;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Ducktype a node.
|
|
158
|
+
*
|
|
159
|
+
* @param {unknown} value
|
|
160
|
+
* @returns {value is Node}
|
|
161
|
+
*/
|
|
162
|
+
function isNode$1(value) {
|
|
163
|
+
return value !== null && typeof value === "object" && "type" in value && typeof value.type === "string";
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/estree-walker/3.0.3/f149906e2d585666ae890c5dd2fceac84a9263c116ae67fb226fe4bb380de7c4/node_modules/estree-walker/src/async.js
|
|
167
|
+
/**
|
|
168
|
+
* @typedef { import('estree').Node} Node
|
|
169
|
+
* @typedef { import('./walker.js').WalkerContext} WalkerContext
|
|
170
|
+
* @typedef {(
|
|
171
|
+
* this: WalkerContext,
|
|
172
|
+
* node: Node,
|
|
173
|
+
* parent: Node | null,
|
|
174
|
+
* key: string | number | symbol | null | undefined,
|
|
175
|
+
* index: number | null | undefined
|
|
176
|
+
* ) => Promise<void>} AsyncHandler
|
|
177
|
+
*/
|
|
178
|
+
var AsyncWalker = class extends WalkerBase {
|
|
179
|
+
/**
|
|
180
|
+
*
|
|
181
|
+
* @param {AsyncHandler} [enter]
|
|
182
|
+
* @param {AsyncHandler} [leave]
|
|
183
|
+
*/
|
|
184
|
+
constructor(enter, leave) {
|
|
185
|
+
super();
|
|
186
|
+
/** @type {boolean} */
|
|
187
|
+
this.should_skip = false;
|
|
188
|
+
/** @type {boolean} */
|
|
189
|
+
this.should_remove = false;
|
|
190
|
+
/** @type {Node | null} */
|
|
191
|
+
this.replacement = null;
|
|
192
|
+
/** @type {WalkerContext} */
|
|
193
|
+
this.context = {
|
|
194
|
+
skip: () => this.should_skip = true,
|
|
195
|
+
remove: () => this.should_remove = true,
|
|
196
|
+
replace: (node) => this.replacement = node
|
|
197
|
+
};
|
|
198
|
+
/** @type {AsyncHandler | undefined} */
|
|
199
|
+
this.enter = enter;
|
|
200
|
+
/** @type {AsyncHandler | undefined} */
|
|
201
|
+
this.leave = leave;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* @template {Node} Parent
|
|
205
|
+
* @param {Node} node
|
|
206
|
+
* @param {Parent | null} parent
|
|
207
|
+
* @param {keyof Parent} [prop]
|
|
208
|
+
* @param {number | null} [index]
|
|
209
|
+
* @returns {Promise<Node | null>}
|
|
210
|
+
*/
|
|
211
|
+
async visit(node, parent, prop, index) {
|
|
212
|
+
if (node) {
|
|
213
|
+
if (this.enter) {
|
|
214
|
+
const _should_skip = this.should_skip;
|
|
215
|
+
const _should_remove = this.should_remove;
|
|
216
|
+
const _replacement = this.replacement;
|
|
217
|
+
this.should_skip = false;
|
|
218
|
+
this.should_remove = false;
|
|
219
|
+
this.replacement = null;
|
|
220
|
+
await this.enter.call(this.context, node, parent, prop, index);
|
|
221
|
+
if (this.replacement) {
|
|
222
|
+
node = this.replacement;
|
|
223
|
+
this.replace(parent, prop, index, node);
|
|
224
|
+
}
|
|
225
|
+
if (this.should_remove) this.remove(parent, prop, index);
|
|
226
|
+
const skipped = this.should_skip;
|
|
227
|
+
const removed = this.should_remove;
|
|
228
|
+
this.should_skip = _should_skip;
|
|
229
|
+
this.should_remove = _should_remove;
|
|
230
|
+
this.replacement = _replacement;
|
|
231
|
+
if (skipped) return node;
|
|
232
|
+
if (removed) return null;
|
|
233
|
+
}
|
|
234
|
+
/** @type {keyof Node} */
|
|
235
|
+
let key;
|
|
236
|
+
for (key in node) {
|
|
237
|
+
/** @type {unknown} */
|
|
238
|
+
const value = node[key];
|
|
239
|
+
if (value && typeof value === "object") {
|
|
240
|
+
if (Array.isArray(value)) {
|
|
241
|
+
const nodes = value;
|
|
242
|
+
for (let i = 0; i < nodes.length; i += 1) {
|
|
243
|
+
const item = nodes[i];
|
|
244
|
+
if (isNode(item)) {
|
|
245
|
+
if (!await this.visit(item, node, key, i)) i--;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
} else if (isNode(value)) await this.visit(value, node, key, null);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (this.leave) {
|
|
252
|
+
const _replacement = this.replacement;
|
|
253
|
+
const _should_remove = this.should_remove;
|
|
254
|
+
this.replacement = null;
|
|
255
|
+
this.should_remove = false;
|
|
256
|
+
await this.leave.call(this.context, node, parent, prop, index);
|
|
257
|
+
if (this.replacement) {
|
|
258
|
+
node = this.replacement;
|
|
259
|
+
this.replace(parent, prop, index, node);
|
|
260
|
+
}
|
|
261
|
+
if (this.should_remove) this.remove(parent, prop, index);
|
|
262
|
+
const removed = this.should_remove;
|
|
263
|
+
this.replacement = _replacement;
|
|
264
|
+
this.should_remove = _should_remove;
|
|
265
|
+
if (removed) return null;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return node;
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Ducktype a node.
|
|
273
|
+
*
|
|
274
|
+
* @param {unknown} value
|
|
275
|
+
* @returns {value is Node}
|
|
276
|
+
*/
|
|
277
|
+
function isNode(value) {
|
|
278
|
+
return value !== null && typeof value === "object" && "type" in value && typeof value.type === "string";
|
|
279
|
+
}
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/estree-walker/3.0.3/f149906e2d585666ae890c5dd2fceac84a9263c116ae67fb226fe4bb380de7c4/node_modules/estree-walker/src/index.js
|
|
282
|
+
/**
|
|
283
|
+
* @typedef {import('estree').Node} Node
|
|
284
|
+
* @typedef {import('./sync.js').SyncHandler} SyncHandler
|
|
285
|
+
* @typedef {import('./async.js').AsyncHandler} AsyncHandler
|
|
286
|
+
*/
|
|
287
|
+
/**
|
|
288
|
+
* @param {Node} ast
|
|
289
|
+
* @param {{
|
|
290
|
+
* enter?: SyncHandler
|
|
291
|
+
* leave?: SyncHandler
|
|
292
|
+
* }} walker
|
|
293
|
+
* @returns {Node | null}
|
|
294
|
+
*/
|
|
295
|
+
function walk(ast, { enter, leave }) {
|
|
296
|
+
return new SyncWalker(enter, leave).visit(ast, null);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* @param {Node} ast
|
|
300
|
+
* @param {{
|
|
301
|
+
* enter?: AsyncHandler
|
|
302
|
+
* leave?: AsyncHandler
|
|
303
|
+
* }} walker
|
|
304
|
+
* @returns {Promise<Node | null>}
|
|
305
|
+
*/
|
|
306
|
+
async function asyncWalk(ast, { enter, leave }) {
|
|
307
|
+
return await new AsyncWalker(enter, leave).visit(ast, null);
|
|
308
|
+
}
|
|
309
|
+
//#endregion
|
|
310
|
+
export { asyncWalk, walk };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_logger = require("../../logger-C-Hdu57K.cjs");
|
|
3
|
-
const require_cors = require("../../cors-
|
|
3
|
+
const require_cors = require("../../cors-B_Oui5La.cjs");
|
|
4
4
|
const require_metadata_path = require("../../metadata-path-zd7NSNoa.cjs");
|
|
5
|
-
const require_mcp = require("../../mcp-
|
|
5
|
+
const require_mcp = require("../../mcp-DpI0wwnW.cjs");
|
|
6
6
|
const require_protocols_oauth_metadata = require("../../protocols/oauth-metadata.cjs");
|
|
7
7
|
const require_forwarded = require("../../forwarded-B37IdmMX.cjs");
|
|
8
8
|
const require_paths = require("../../paths-OP318a6c.cjs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { y as McpDefinition } from "../../types-B_dVw-zM.cjs";
|
|
2
2
|
//#region src/stacks/supabase/handler.d.ts
|
|
3
3
|
type SupabaseHandler = (request: Request) => Promise<Response>;
|
|
4
4
|
interface SupabaseHandlerOptions {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { y as McpDefinition } from "../../types-B_dVw-zM.js";
|
|
2
2
|
//#region src/stacks/supabase/handler.d.ts
|
|
3
3
|
type SupabaseHandler = (request: Request) => Promise<Response>;
|
|
4
4
|
interface SupabaseHandlerOptions {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { s as trimTrailingSlash } from "../../logger-CpLgYbCG.js";
|
|
2
|
-
import { c as createRecorderForRuntime, o as assertResourcePathShape } from "../../cors-
|
|
2
|
+
import { c as createRecorderForRuntime, o as assertResourcePathShape } from "../../cors-D83r8WUF.js";
|
|
3
3
|
import { t as OAUTH_PROTECTED_RESOURCE_METADATA_PATH } from "../../metadata-path-CAkNcfyY.js";
|
|
4
|
-
import { t as createMcpProtocolHandler } from "../../mcp-
|
|
4
|
+
import { t as createMcpProtocolHandler } from "../../mcp-BgIFUoo1.js";
|
|
5
5
|
import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
|
|
6
6
|
import { t as applyForwardedOrigin } from "../../forwarded-BBXvFeh6.js";
|
|
7
7
|
import { n as assertFunctionName, t as FUNCTIONS_MOUNT_PREFIX } from "../../paths-IS65L6TA.js";
|
|
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_package = require("../../package-
|
|
5
|
+
const require_package = require("../../package-CuCho6-k.cjs");
|
|
6
6
|
const require_hooks = require("../../hooks-xQl3EkDa.cjs");
|
|
7
7
|
const require_paths = require("../../paths-OP318a6c.cjs");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
@@ -120,6 +120,14 @@ function applyViteAliases(importee, aliases) {
|
|
|
120
120
|
if (find.test(importee)) return importee.replace(find, replacement);
|
|
121
121
|
} else if (importee === find || importee.startsWith(find + "/")) return replacement + importee.slice(find.length);
|
|
122
122
|
}
|
|
123
|
+
function rejectMcpAppImports() {
|
|
124
|
+
return {
|
|
125
|
+
name: "lovable-mcp-reject-mcp-app",
|
|
126
|
+
setup(pluginBuild) {
|
|
127
|
+
pluginBuild.onResolve({ filter: /\?mcp-app$/ }, (args) => ({ errors: [{ text: `MCP Apps are not supported on the Supabase stack (${JSON.stringify(args.path)}). Remove the \`ui\` option and the import, or host this MCP server on the TanStack stack.` }] }));
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
123
131
|
function resolveViteAliases(aliases) {
|
|
124
132
|
return {
|
|
125
133
|
name: "lovable-mcp-resolve-vite-aliases",
|
|
@@ -168,6 +176,7 @@ async function bundleFunctionEntry(projectRoot, mcpEntryAbs, functionName, optio
|
|
|
168
176
|
logLevel: "silent",
|
|
169
177
|
define: importMetaEnvDefines(options.inlineEnv),
|
|
170
178
|
plugins: [
|
|
179
|
+
rejectMcpAppImports(),
|
|
171
180
|
require_hooks.skillImportEsbuildPlugin((compilation) => {
|
|
172
181
|
skillFiles.push(...compilation.watchFiles);
|
|
173
182
|
skillDirs.push(...compilation.watchDirs);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as version } from "../../package-
|
|
1
|
+
import { t as version$1 } from "../../package-Cz6Z5F_X.js";
|
|
2
2
|
import { a as isFileMissing, i as readSupabaseProjectRef, n as skillImportEsbuildPlugin, t as isSkillImportInput } from "../../hooks-BOdDe251.js";
|
|
3
3
|
import { n as assertFunctionName, t as FUNCTIONS_MOUNT_PREFIX } from "../../paths-IS65L6TA.js";
|
|
4
4
|
import { lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
6
6
|
import { loadEnv } from "vite";
|
|
7
|
-
import { build } from "esbuild";
|
|
7
|
+
import { build as build$1 } from "esbuild";
|
|
8
8
|
const GENERATED_BANNER = "// AUTO-GENERATED by @lovable.dev/mcp-js — do not edit. Regenerated by the Vite plugin.\n// To take ownership, delete this banner line; the plugin then leaves the file alone.";
|
|
9
9
|
const GENERATED_JSON_MARKER_KEY = "_lovableMcpGenerated";
|
|
10
10
|
function fileExists(path) {
|
|
@@ -57,10 +57,10 @@ function readProjectDependencyVersions(projectRoot) {
|
|
|
57
57
|
function npmSpecifierFor(bare, versions) {
|
|
58
58
|
const pkg = bare.startsWith("@") ? bare.split("/").slice(0, 2).join("/") : bare.split("/")[0];
|
|
59
59
|
const subpath = bare.slice(pkg.length);
|
|
60
|
-
if (pkg === "@lovable.dev/mcp-js") return `npm:${pkg}@${version}${subpath}`;
|
|
60
|
+
if (pkg === "@lovable.dev/mcp-js") return `npm:${pkg}@${version$1}${subpath}`;
|
|
61
61
|
const range = versions[pkg];
|
|
62
|
-
const version
|
|
63
|
-
return version
|
|
62
|
+
const version = range && /^[\dv^~>=]|^latest$/.test(range) ? range : void 0;
|
|
63
|
+
return version ? `npm:${pkg}@${version}${subpath}` : `npm:${pkg}${subpath}`;
|
|
64
64
|
}
|
|
65
65
|
function externalizeBareAsNpm(versions) {
|
|
66
66
|
return {
|
|
@@ -116,6 +116,14 @@ function applyViteAliases(importee, aliases) {
|
|
|
116
116
|
if (find.test(importee)) return importee.replace(find, replacement);
|
|
117
117
|
} else if (importee === find || importee.startsWith(find + "/")) return replacement + importee.slice(find.length);
|
|
118
118
|
}
|
|
119
|
+
function rejectMcpAppImports() {
|
|
120
|
+
return {
|
|
121
|
+
name: "lovable-mcp-reject-mcp-app",
|
|
122
|
+
setup(pluginBuild) {
|
|
123
|
+
pluginBuild.onResolve({ filter: /\?mcp-app$/ }, (args) => ({ errors: [{ text: `MCP Apps are not supported on the Supabase stack (${JSON.stringify(args.path)}). Remove the \`ui\` option and the import, or host this MCP server on the TanStack stack.` }] }));
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
119
127
|
function resolveViteAliases(aliases) {
|
|
120
128
|
return {
|
|
121
129
|
name: "lovable-mcp-resolve-vite-aliases",
|
|
@@ -147,7 +155,7 @@ async function bundleFunctionEntry(projectRoot, mcpEntryAbs, functionName, optio
|
|
|
147
155
|
const wrapper = `import mcp from ${JSON.stringify(mcpEntryAbs)};\nimport { createSupabaseHandler } from "@lovable.dev/mcp-js/stacks/supabase";\nDeno.serve(createSupabaseHandler(mcp, { functionName: ${JSON.stringify(functionName)} }));\n`;
|
|
148
156
|
const skillFiles = [];
|
|
149
157
|
const skillDirs = [];
|
|
150
|
-
const result = await build({
|
|
158
|
+
const result = await build$1({
|
|
151
159
|
stdin: {
|
|
152
160
|
contents: wrapper,
|
|
153
161
|
resolveDir: projectRoot,
|
|
@@ -164,6 +172,7 @@ async function bundleFunctionEntry(projectRoot, mcpEntryAbs, functionName, optio
|
|
|
164
172
|
logLevel: "silent",
|
|
165
173
|
define: importMetaEnvDefines(options.inlineEnv),
|
|
166
174
|
plugins: [
|
|
175
|
+
rejectMcpAppImports(),
|
|
167
176
|
skillImportEsbuildPlugin((compilation) => {
|
|
168
177
|
skillFiles.push(...compilation.watchFiles);
|
|
169
178
|
skillDirs.push(...compilation.watchDirs);
|
|
@@ -256,7 +265,7 @@ function cleanupOrphans(functionDir, expected, removed) {
|
|
|
256
265
|
}
|
|
257
266
|
//#endregion
|
|
258
267
|
//#region src/stacks/supabase/vite.ts
|
|
259
|
-
function normalizePath(p) {
|
|
268
|
+
function normalizePath$1(p) {
|
|
260
269
|
return p.split(sep).join("/");
|
|
261
270
|
}
|
|
262
271
|
function productionImportMetaEnv(config) {
|
|
@@ -318,13 +327,13 @@ function mcpPlugin(options = {}) {
|
|
|
318
327
|
inlineEnv,
|
|
319
328
|
aliases,
|
|
320
329
|
onSkillDirectory(directory) {
|
|
321
|
-
const normalized = normalizePath(directory);
|
|
330
|
+
const normalized = normalizePath$1(directory);
|
|
322
331
|
if (!watchedSkillDirs.includes(normalized)) watchedSkillDirs.push(normalized);
|
|
323
332
|
devServer?.watcher.add(directory);
|
|
324
333
|
}
|
|
325
334
|
});
|
|
326
|
-
watchedInputs = new Set(inputs.map(normalizePath));
|
|
327
|
-
watchedSkillDirs = (skillDirs ?? []).map(normalizePath);
|
|
335
|
+
watchedInputs = new Set(inputs.map(normalizePath$1));
|
|
336
|
+
watchedSkillDirs = (skillDirs ?? []).map(normalizePath$1);
|
|
328
337
|
};
|
|
329
338
|
return {
|
|
330
339
|
name: "@lovable.dev/mcp-js/supabase",
|
|
@@ -348,9 +357,9 @@ function mcpPlugin(options = {}) {
|
|
|
348
357
|
devServer = server;
|
|
349
358
|
server.watcher.add(watchedSkillDirs);
|
|
350
359
|
const onChange = (file) => {
|
|
351
|
-
const norm = normalizePath(file);
|
|
360
|
+
const norm = normalizePath$1(file);
|
|
352
361
|
const inSkillDir = watchedSkillDirs.some((dir) => norm.startsWith(`${dir}/`));
|
|
353
|
-
if (norm !== normalizePath(mcpEntryAbs) && !watchedInputs.has(norm) && !inSkillDir) return;
|
|
362
|
+
if (norm !== normalizePath$1(mcpEntryAbs) && !watchedInputs.has(norm) && !inSkillDir) return;
|
|
354
363
|
regenerate().catch((err) => {
|
|
355
364
|
const message = `[@lovable.dev/mcp-js] failed to regenerate the Supabase function: ${err instanceof Error ? err.message : String(err)}`;
|
|
356
365
|
if (server.config?.logger?.error) server.config.logger.error(message);
|
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
2
|
+
const require_logger = require("../../logger-C-Hdu57K.cjs");
|
|
3
|
+
const require_cors = require("../../cors-B_Oui5La.cjs");
|
|
4
|
+
const require_mcp = require("../../mcp-DpI0wwnW.cjs");
|
|
4
5
|
const require_protocols_oauth_metadata = require("../../protocols/oauth-metadata.cjs");
|
|
5
6
|
const require_forwarded = require("../../forwarded-B37IdmMX.cjs");
|
|
6
7
|
//#region src/stacks/tanstack/handlers.ts
|
|
7
8
|
const STACK = "tanstack";
|
|
9
|
+
function resolveHandler(source, create, errorResponse) {
|
|
10
|
+
let cached;
|
|
11
|
+
return async (ctx) => {
|
|
12
|
+
let handler;
|
|
13
|
+
try {
|
|
14
|
+
const { default: mcp } = await source();
|
|
15
|
+
if (cached?.mcp !== mcp) cached = {
|
|
16
|
+
mcp,
|
|
17
|
+
handler: create(mcp)
|
|
18
|
+
};
|
|
19
|
+
handler = cached.handler;
|
|
20
|
+
} catch {
|
|
21
|
+
require_logger.log.error("mcp.route_load_error", { outcome: "500 internal error" });
|
|
22
|
+
return require_cors.finalizeWireResponse(ctx.request, errorResponse());
|
|
23
|
+
}
|
|
24
|
+
return handler(ctx);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
8
27
|
function getScheduleBackground(request) {
|
|
9
28
|
const waitUntil = request.waitUntil;
|
|
10
29
|
if (typeof waitUntil !== "function") return void 0;
|
|
@@ -15,6 +34,17 @@ function getScheduleBackground(request) {
|
|
|
15
34
|
* (`POST /mcp`). Assignable directly to a route's `ANY` handler.
|
|
16
35
|
*/
|
|
17
36
|
function createTanStackMcpHandler(mcp, options = {}) {
|
|
37
|
+
if (typeof mcp === "function") return resolveHandler(mcp, (definition) => createTanStackMcpHandler(definition, options), () => Response.json({
|
|
38
|
+
jsonrpc: "2.0",
|
|
39
|
+
id: null,
|
|
40
|
+
error: {
|
|
41
|
+
code: -32603,
|
|
42
|
+
message: "internal error"
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
status: 500,
|
|
46
|
+
headers: { "Cache-Control": "no-store" }
|
|
47
|
+
}));
|
|
18
48
|
const handler = require_mcp.createMcpProtocolHandler(mcp, options);
|
|
19
49
|
return ({ request }) => handler(require_forwarded.applyForwardedOrigin(request, options), require_cors.createRecorderForRuntime(mcp, { stack: STACK }), getScheduleBackground(request));
|
|
20
50
|
}
|
|
@@ -23,6 +53,7 @@ function createTanStackMcpHandler(mcp, options = {}) {
|
|
|
23
53
|
* When the MCP definition has no OAuth auth config the handler returns 404.
|
|
24
54
|
*/
|
|
25
55
|
function createTanStackOAuthProtectedResourceMetadataHandler(mcp, options = {}) {
|
|
56
|
+
if (typeof mcp === "function") return resolveHandler(mcp, (definition) => createTanStackOAuthProtectedResourceMetadataHandler(definition, options), require_cors.oauthConfigurationErrorResponse);
|
|
26
57
|
const handler = require_protocols_oauth_metadata.createOAuthProtectedResourceMetadataHandler(mcp, options);
|
|
27
58
|
return ({ request }) => handler(require_forwarded.applyForwardedOrigin(request, options), require_cors.createRecorderForRuntime(mcp, { stack: STACK }), getScheduleBackground(request));
|
|
28
59
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize
|
|
1
|
+
import { y as McpDefinition } from "../../types-B_dVw-zM.cjs";
|
|
2
|
+
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize--W1XtwdB.cjs";
|
|
3
3
|
//#region src/stacks/tanstack/handlers.d.ts
|
|
4
4
|
interface TanStackRequest extends Request {
|
|
5
5
|
waitUntil?: ScheduleBackground;
|
|
@@ -9,15 +9,18 @@ interface TanStackRouteCtx {
|
|
|
9
9
|
}
|
|
10
10
|
type TanStackMcpHandler = (ctx: TanStackRouteCtx) => Promise<Response>;
|
|
11
11
|
type TanStackOAuthProtectedResourceMetadataHandler = (ctx: TanStackRouteCtx) => Promise<Response>;
|
|
12
|
+
type McpSource = McpDefinition | (() => Promise<{
|
|
13
|
+
default: McpDefinition;
|
|
14
|
+
}>);
|
|
12
15
|
/**
|
|
13
16
|
* Build a TanStack Start handler for the MCP protocol endpoint
|
|
14
17
|
* (`POST /mcp`). Assignable directly to a route's `ANY` handler.
|
|
15
18
|
*/
|
|
16
|
-
declare function createTanStackMcpHandler(mcp:
|
|
19
|
+
declare function createTanStackMcpHandler(mcp: McpSource, options?: McpRuntimeOptions): TanStackMcpHandler;
|
|
17
20
|
/**
|
|
18
21
|
* Build a TanStack Start handler for `GET /.well-known/oauth-protected-resource`.
|
|
19
22
|
* When the MCP definition has no OAuth auth config the handler returns 404.
|
|
20
23
|
*/
|
|
21
|
-
declare function createTanStackOAuthProtectedResourceMetadataHandler(mcp:
|
|
24
|
+
declare function createTanStackOAuthProtectedResourceMetadataHandler(mcp: McpSource, options?: McpRuntimeOptions): TanStackOAuthProtectedResourceMetadataHandler;
|
|
22
25
|
//#endregion
|
|
23
26
|
export { type TanStackMcpHandler, type TanStackOAuthProtectedResourceMetadataHandler, createTanStackMcpHandler, createTanStackOAuthProtectedResourceMetadataHandler };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-
|
|
1
|
+
import { y as McpDefinition } from "../../types-B_dVw-zM.js";
|
|
2
|
+
import { n as ScheduleBackground, t as McpRuntimeOptions } from "../../authorize-DpNYioXM.js";
|
|
3
3
|
//#region src/stacks/tanstack/handlers.d.ts
|
|
4
4
|
interface TanStackRequest extends Request {
|
|
5
5
|
waitUntil?: ScheduleBackground;
|
|
@@ -9,15 +9,18 @@ interface TanStackRouteCtx {
|
|
|
9
9
|
}
|
|
10
10
|
type TanStackMcpHandler = (ctx: TanStackRouteCtx) => Promise<Response>;
|
|
11
11
|
type TanStackOAuthProtectedResourceMetadataHandler = (ctx: TanStackRouteCtx) => Promise<Response>;
|
|
12
|
+
type McpSource = McpDefinition | (() => Promise<{
|
|
13
|
+
default: McpDefinition;
|
|
14
|
+
}>);
|
|
12
15
|
/**
|
|
13
16
|
* Build a TanStack Start handler for the MCP protocol endpoint
|
|
14
17
|
* (`POST /mcp`). Assignable directly to a route's `ANY` handler.
|
|
15
18
|
*/
|
|
16
|
-
declare function createTanStackMcpHandler(mcp:
|
|
19
|
+
declare function createTanStackMcpHandler(mcp: McpSource, options?: McpRuntimeOptions): TanStackMcpHandler;
|
|
17
20
|
/**
|
|
18
21
|
* Build a TanStack Start handler for `GET /.well-known/oauth-protected-resource`.
|
|
19
22
|
* When the MCP definition has no OAuth auth config the handler returns 404.
|
|
20
23
|
*/
|
|
21
|
-
declare function createTanStackOAuthProtectedResourceMetadataHandler(mcp:
|
|
24
|
+
declare function createTanStackOAuthProtectedResourceMetadataHandler(mcp: McpSource, options?: McpRuntimeOptions): TanStackOAuthProtectedResourceMetadataHandler;
|
|
22
25
|
//#endregion
|
|
23
26
|
export { type TanStackMcpHandler, type TanStackOAuthProtectedResourceMetadataHandler, createTanStackMcpHandler, createTanStackOAuthProtectedResourceMetadataHandler };
|
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { i as log } from "../../logger-CpLgYbCG.js";
|
|
2
|
+
import { a as oauthConfigurationErrorResponse, c as createRecorderForRuntime, p as finalizeWireResponse } from "../../cors-D83r8WUF.js";
|
|
3
|
+
import { t as createMcpProtocolHandler } from "../../mcp-BgIFUoo1.js";
|
|
3
4
|
import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
|
|
4
5
|
import { t as applyForwardedOrigin } from "../../forwarded-BBXvFeh6.js";
|
|
5
6
|
//#region src/stacks/tanstack/handlers.ts
|
|
6
7
|
const STACK = "tanstack";
|
|
8
|
+
function resolveHandler(source, create, errorResponse) {
|
|
9
|
+
let cached;
|
|
10
|
+
return async (ctx) => {
|
|
11
|
+
let handler;
|
|
12
|
+
try {
|
|
13
|
+
const { default: mcp } = await source();
|
|
14
|
+
if (cached?.mcp !== mcp) cached = {
|
|
15
|
+
mcp,
|
|
16
|
+
handler: create(mcp)
|
|
17
|
+
};
|
|
18
|
+
handler = cached.handler;
|
|
19
|
+
} catch {
|
|
20
|
+
log.error("mcp.route_load_error", { outcome: "500 internal error" });
|
|
21
|
+
return finalizeWireResponse(ctx.request, errorResponse());
|
|
22
|
+
}
|
|
23
|
+
return handler(ctx);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
7
26
|
function getScheduleBackground(request) {
|
|
8
27
|
const waitUntil = request.waitUntil;
|
|
9
28
|
if (typeof waitUntil !== "function") return void 0;
|
|
@@ -14,6 +33,17 @@ function getScheduleBackground(request) {
|
|
|
14
33
|
* (`POST /mcp`). Assignable directly to a route's `ANY` handler.
|
|
15
34
|
*/
|
|
16
35
|
function createTanStackMcpHandler(mcp, options = {}) {
|
|
36
|
+
if (typeof mcp === "function") return resolveHandler(mcp, (definition) => createTanStackMcpHandler(definition, options), () => Response.json({
|
|
37
|
+
jsonrpc: "2.0",
|
|
38
|
+
id: null,
|
|
39
|
+
error: {
|
|
40
|
+
code: -32603,
|
|
41
|
+
message: "internal error"
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
status: 500,
|
|
45
|
+
headers: { "Cache-Control": "no-store" }
|
|
46
|
+
}));
|
|
17
47
|
const handler = createMcpProtocolHandler(mcp, options);
|
|
18
48
|
return ({ request }) => handler(applyForwardedOrigin(request, options), createRecorderForRuntime(mcp, { stack: STACK }), getScheduleBackground(request));
|
|
19
49
|
}
|
|
@@ -22,6 +52,7 @@ function createTanStackMcpHandler(mcp, options = {}) {
|
|
|
22
52
|
* When the MCP definition has no OAuth auth config the handler returns 404.
|
|
23
53
|
*/
|
|
24
54
|
function createTanStackOAuthProtectedResourceMetadataHandler(mcp, options = {}) {
|
|
55
|
+
if (typeof mcp === "function") return resolveHandler(mcp, (definition) => createTanStackOAuthProtectedResourceMetadataHandler(definition, options), oauthConfigurationErrorResponse);
|
|
25
56
|
const handler = createOAuthProtectedResourceMetadataHandler(mcp, options);
|
|
26
57
|
return ({ request }) => handler(applyForwardedOrigin(request, options), createRecorderForRuntime(mcp, { stack: STACK }), getScheduleBackground(request));
|
|
27
58
|
}
|