@lovable.dev/mcp-js 3.0.5 → 3.1.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.md +61 -1
- package/dist/cli/check-server.cjs +61 -0
- package/dist/cli/check-server.d.cts +1 -0
- package/dist/cli/check-server.d.ts +1 -0
- package/dist/cli/check-server.js +62 -0
- package/dist/cli/extract-manifest.cjs +1 -1
- package/dist/cli/extract-manifest.js +1 -1
- package/dist/{cors-BGAtyAr_.js → cors-Df2tqbzV.js} +1 -1
- package/dist/{cors-COakIjqg.cjs → cors-YjwGFsid.cjs} +1 -1
- package/dist/diagnostic-ClI2_5MW.js +11 -0
- package/dist/diagnostic-DRKjgCsW.d.cts +12 -0
- package/dist/diagnostic-DRKjgCsW.d.ts +12 -0
- package/dist/diagnostic-ol9IE9Dl.cjs +16 -0
- package/dist/{io-NrWvjpmZ.js → io-BoS6dhC0.js} +13 -2
- package/dist/{io-dULHdKny.cjs → io-D_DKGquD.cjs} +16 -5
- package/dist/{mcp-ChLv-MV0.js → mcp-Bm89K_uU.js} +3 -69
- package/dist/{mcp-DTAMXcRF.cjs → mcp-aNWgpVIF.cjs} +5 -71
- package/dist/{package-D8nhrfTR.js → package-C6IcwY5Z.js} +1 -1
- package/dist/{package-KAnnqE79.cjs → package-Cl7NhnV4.cjs} +1 -1
- package/dist/protocols/mcp/index.cjs +1 -1
- package/dist/protocols/mcp/index.js +1 -1
- package/dist/protocols/oauth-metadata.cjs +1 -1
- package/dist/protocols/oauth-metadata.js +1 -1
- package/dist/stacks/supabase/index.cjs +2 -2
- package/dist/stacks/supabase/index.js +2 -2
- package/dist/stacks/supabase/vite.cjs +7 -8
- package/dist/stacks/supabase/vite.js +2 -3
- package/dist/stacks/tanstack/index.cjs +2 -2
- package/dist/stacks/tanstack/index.js +2 -2
- package/dist/stacks/tanstack/vite.cjs +7 -8
- package/dist/stacks/tanstack/vite.js +1 -2
- package/dist/{supabase-config-CakTU8YF.js → supabase-config-DITfH_bn.js} +6 -2
- package/dist/{supabase-config-Dz7dnUv0.cjs → supabase-config-Dz13d9ze.cjs} +12 -2
- package/dist/testing/index.cjs +46 -0
- package/dist/testing/index.d.cts +10 -0
- package/dist/testing/index.d.ts +10 -0
- package/dist/testing/index.js +44 -0
- package/dist/testing/server.cjs +197 -0
- package/dist/testing/server.d.cts +31 -0
- package/dist/testing/server.d.ts +31 -0
- package/dist/testing/server.js +195 -0
- package/dist/tool-result-DcNioyiI.js +70 -0
- package/dist/tool-result-rU-PpNNi.cjs +87 -0
- package/package.json +26 -2
- package/dist/fs-errors-CWNzOV75.cjs +0 -11
- package/dist/fs-errors-PA2t1TIp.js +0 -6
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { t as McpCheckError } from "../diagnostic-ClI2_5MW.js";
|
|
2
|
+
import { Client, SdkError, SdkErrorCode, StreamableHTTPClientTransport } from "@modelcontextprotocol/client";
|
|
3
|
+
import { AjvJsonSchemaValidator } from "@modelcontextprotocol/client/validators/ajv";
|
|
4
|
+
import { isIP } from "node:net";
|
|
5
|
+
//#region src/testing/server.ts
|
|
6
|
+
async function withMcpClient(options, run) {
|
|
7
|
+
let endpoint;
|
|
8
|
+
let headers;
|
|
9
|
+
const version = options.protocolVersion ?? "2026-07-28";
|
|
10
|
+
const timeoutMs = options.timeoutMs ?? 1e4;
|
|
11
|
+
try {
|
|
12
|
+
endpoint = new URL(options.endpoint);
|
|
13
|
+
headers = new Headers(options.headers);
|
|
14
|
+
const host = endpoint.hostname;
|
|
15
|
+
const loopback = host === "localhost" || host === "[::1]" || isIP(host) === 4 && host.startsWith("127.");
|
|
16
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > 2147483647 || !["2025-11-25", "2026-07-28"].includes(version) || !["http:", "https:"].includes(endpoint.protocol) || endpoint.username || endpoint.password || endpoint.hash || endpoint.protocol === "http:" && !loopback && !options.handler && [...headers].length > 0) throw new Error();
|
|
17
|
+
} catch {
|
|
18
|
+
throw new McpCheckError({
|
|
19
|
+
code: "connection.options",
|
|
20
|
+
basis: "package-guarantee",
|
|
21
|
+
message: "Use a valid HTTP(S) endpoint without URL credentials or fragment, a supported protocol and a positive timeout. Remote HTTP with supplied headers is refused."
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const client = new Client({
|
|
25
|
+
name: "mcp-js-tests",
|
|
26
|
+
version: "1"
|
|
27
|
+
}, {
|
|
28
|
+
supportedProtocolVersions: [version],
|
|
29
|
+
versionNegotiation: { mode: version === "2025-11-25" ? "legacy" : { pin: version } },
|
|
30
|
+
capabilities: options.capabilities ?? {},
|
|
31
|
+
inputRequired: { autoFulfill: false },
|
|
32
|
+
listMaxPages: 16
|
|
33
|
+
});
|
|
34
|
+
const transport = new StreamableHTTPClientTransport(endpoint, {
|
|
35
|
+
requestInit: { headers },
|
|
36
|
+
fetch: async (url, init) => {
|
|
37
|
+
const timeout = AbortSignal.timeout(timeoutMs);
|
|
38
|
+
const request = new Request(url, {
|
|
39
|
+
...init,
|
|
40
|
+
redirect: "manual",
|
|
41
|
+
signal: init?.signal ? AbortSignal.any([timeout, init.signal]) : timeout
|
|
42
|
+
});
|
|
43
|
+
if (request.url !== endpoint.href) throw new Error("Test transport refused a different endpoint.");
|
|
44
|
+
let onAbort = () => {};
|
|
45
|
+
let response;
|
|
46
|
+
try {
|
|
47
|
+
response = await Promise.race([options.handler ? options.handler(request) : fetch(request), new Promise((_resolve, reject) => {
|
|
48
|
+
onAbort = () => reject(request.signal.reason);
|
|
49
|
+
if (request.signal.aborted) onAbort();
|
|
50
|
+
else request.signal.addEventListener("abort", onAbort, { once: true });
|
|
51
|
+
})]);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
if (timeout.aborted && error === timeout.reason) throw new SdkError(SdkErrorCode.RequestTimeout, "Request timed out");
|
|
54
|
+
throw error;
|
|
55
|
+
} finally {
|
|
56
|
+
request.signal.removeEventListener("abort", onAbort);
|
|
57
|
+
}
|
|
58
|
+
if (response.status >= 300 && response.status < 400) {
|
|
59
|
+
await response.body?.cancel();
|
|
60
|
+
throw new Error("Test transport refused a redirect. Configure the final endpoint explicitly.");
|
|
61
|
+
}
|
|
62
|
+
return response;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
try {
|
|
66
|
+
await client.connect(transport, { timeout: timeoutMs });
|
|
67
|
+
return await run(client);
|
|
68
|
+
} finally {
|
|
69
|
+
await client.close();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async function checkMcpServer(options) {
|
|
73
|
+
const checks = [];
|
|
74
|
+
const calls = options.calls ?? [];
|
|
75
|
+
const timeout = options.timeoutMs ?? 1e4;
|
|
76
|
+
let nextCall = 0;
|
|
77
|
+
let stage = "server.connect";
|
|
78
|
+
let location;
|
|
79
|
+
const record = (code, message, status = "passed", basis = "protocol-requirement") => {
|
|
80
|
+
checks.push({
|
|
81
|
+
code,
|
|
82
|
+
message,
|
|
83
|
+
status,
|
|
84
|
+
basis,
|
|
85
|
+
location
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
try {
|
|
89
|
+
await withMcpClient(options, async (client) => {
|
|
90
|
+
record(stage, "The official client connected with the configured protocol and caller headers.");
|
|
91
|
+
stage = "server.tools";
|
|
92
|
+
const { tools } = client.getServerCapabilities()?.tools ? await client.listTools(void 0, {
|
|
93
|
+
cacheMode: "bypass",
|
|
94
|
+
timeout
|
|
95
|
+
}) : { tools: [] };
|
|
96
|
+
record(stage, "The official client decoded the tool catalog; the tools capability is optional.");
|
|
97
|
+
const unsupported = /* @__PURE__ */ new Set();
|
|
98
|
+
for (const [index, tool] of tools.entries()) {
|
|
99
|
+
location = `tools[${index}]`;
|
|
100
|
+
stage = "server.schemas";
|
|
101
|
+
for (const schema of [tool.inputSchema, tool.outputSchema]) {
|
|
102
|
+
if (!schema) continue;
|
|
103
|
+
if (typeof schema.$schema === "string" && !/^https?:\/\/json-schema\.org\/(?:draft\/(?:2020-12|2019-09)|draft-0[67])\/schema#?$/.test(schema.$schema)) {
|
|
104
|
+
unsupported.add(tool.name);
|
|
105
|
+
record(stage, "This helper cannot validate the declared schema dialect. Selected calls to this tool and subsequent calls will not run.", "not-tested", "package-guarantee");
|
|
106
|
+
} else new AjvJsonSchemaValidator().getValidator(schema);
|
|
107
|
+
}
|
|
108
|
+
if (!unsupported.has(tool.name)) record(stage, "Advertised schemas compile with the SDK validator.");
|
|
109
|
+
}
|
|
110
|
+
for (; nextCall < calls.length; nextCall++) {
|
|
111
|
+
const call = calls[nextCall];
|
|
112
|
+
location = `calls[${nextCall}]`;
|
|
113
|
+
stage = "tool.call";
|
|
114
|
+
if (unsupported.has(call.name)) break;
|
|
115
|
+
const tool = tools.find((entry) => entry.name === call.name);
|
|
116
|
+
if (!tool) throw new McpCheckError({
|
|
117
|
+
code: "tool.not-found",
|
|
118
|
+
basis: "app-expectation",
|
|
119
|
+
message: "Selected tool was not advertised to this caller. No call was made."
|
|
120
|
+
});
|
|
121
|
+
const { outputSchema, ...definition } = tool;
|
|
122
|
+
const result = await client.callTool({
|
|
123
|
+
name: call.name,
|
|
124
|
+
arguments: call.arguments
|
|
125
|
+
}, {
|
|
126
|
+
toolDefinition: definition,
|
|
127
|
+
timeout
|
|
128
|
+
});
|
|
129
|
+
if (result.isError === true !== (call.isError === true)) throw new McpCheckError({
|
|
130
|
+
code: "result.expected-error",
|
|
131
|
+
basis: "app-expectation",
|
|
132
|
+
message: call.isError ? "Expected an error result." : "Expected a successful result."
|
|
133
|
+
});
|
|
134
|
+
if (!result.isError && outputSchema && (result.structuredContent === void 0 || !new AjvJsonSchemaValidator().getValidator(outputSchema)(result.structuredContent).valid)) throw new McpCheckError({
|
|
135
|
+
code: "result.output-schema",
|
|
136
|
+
basis: "protocol-requirement",
|
|
137
|
+
message: "Successful structuredContent must match the advertised outputSchema."
|
|
138
|
+
});
|
|
139
|
+
record(stage, "The selected call returned the expected success/error result and matched its advertised output schema, if any.");
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
} catch (error) {
|
|
143
|
+
const status = SdkError.isInstance(error) && typeof error.data === "object" && error.data !== null && "status" in error.data ? error.data.status : void 0;
|
|
144
|
+
const sdkCode = status === 401 ? SdkErrorCode.ClientHttpAuthentication : status === 403 ? SdkErrorCode.ClientHttpForbidden : SdkError.isInstance(error) ? error.code : void 0;
|
|
145
|
+
const incomplete = SdkError.isInstance(error) && sdkCode === SdkErrorCode.UnsupportedResultType && error.data !== null && typeof error.data === "object" && "resultType" in error.data && error.data.resultType === "input_required";
|
|
146
|
+
const typed = {
|
|
147
|
+
[SdkErrorCode.ClientHttpAuthentication]: {
|
|
148
|
+
code: "server.unauthorized",
|
|
149
|
+
message: "The endpoint rejected authentication. Check the supplied credentials and audience."
|
|
150
|
+
},
|
|
151
|
+
[SdkErrorCode.ClientHttpForbidden]: {
|
|
152
|
+
code: "server.forbidden",
|
|
153
|
+
message: "The endpoint refused access for this caller."
|
|
154
|
+
},
|
|
155
|
+
[SdkErrorCode.RequestTimeout]: {
|
|
156
|
+
code: "server.timeout",
|
|
157
|
+
message: "The request timed out. Check endpoint availability and the configured timeout."
|
|
158
|
+
},
|
|
159
|
+
[SdkErrorCode.InvalidResult]: {
|
|
160
|
+
code: "result.shape",
|
|
161
|
+
message: "The official client rejected the response shape."
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const known = sdkCode === void 0 ? void 0 : typed[sdkCode];
|
|
165
|
+
const diagnostic = incomplete ? {
|
|
166
|
+
code: "tool.input-required",
|
|
167
|
+
basis: "package-guarantee",
|
|
168
|
+
message: "The selected call requires additional input. No input was supplied and later calls will not run."
|
|
169
|
+
} : error instanceof McpCheckError ? error.diagnostic : {
|
|
170
|
+
code: stage,
|
|
171
|
+
basis: "package-guarantee",
|
|
172
|
+
message: stage === "server.connect" ? "Connection failed. Check endpoint, credentials and protocol support; response details are omitted." : stage === "server.schemas" ? "Schema compilation failed. Check dialect, references and syntax; remote references are not fetched." : "The check could not complete. Inspect this contract in an app test; response details are omitted.",
|
|
173
|
+
...known
|
|
174
|
+
};
|
|
175
|
+
checks.push({
|
|
176
|
+
...diagnostic,
|
|
177
|
+
location,
|
|
178
|
+
status: incomplete ? "not-tested" : "failed"
|
|
179
|
+
});
|
|
180
|
+
if (location === `calls[${nextCall}]`) nextCall++;
|
|
181
|
+
}
|
|
182
|
+
for (; nextCall < calls.length; nextCall++) {
|
|
183
|
+
location = `calls[${nextCall}]`;
|
|
184
|
+
record("tool.call", "Call not run because a prerequisite check or selected call did not complete.", "not-tested", "app-expectation");
|
|
185
|
+
}
|
|
186
|
+
location = void 0;
|
|
187
|
+
record("app.behavior", "Authentication enforcement, business behavior, browser interactions and deployed OAuth require app-owned tests. This is not full MCP conformance.", "not-tested", "app-expectation");
|
|
188
|
+
if (calls.length === 0) record("tool.calls", "No calls selected; input enforcement and result mapping were not exercised.", "not-tested", "app-expectation");
|
|
189
|
+
return {
|
|
190
|
+
checks,
|
|
191
|
+
passed: checks.every((check) => check.status !== "failed")
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
//#endregion
|
|
195
|
+
export { checkMcpServer, withMcpClient };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { n as schemaFromDefinition } from "./schema-JK_1KkOa.js";
|
|
2
|
+
import { getParseErrorMessage, safeParseAsync } from "@modelcontextprotocol/sdk/server/zod-compat.js";
|
|
3
|
+
//#region src/core/tool-result.ts
|
|
4
|
+
function normalizeResourceLinkIcon(icon) {
|
|
5
|
+
if (typeof icon.sizes !== "string") return icon;
|
|
6
|
+
const { sizes, ...rest } = icon;
|
|
7
|
+
const normalized = sizes.trim();
|
|
8
|
+
return normalized === "" ? rest : {
|
|
9
|
+
...rest,
|
|
10
|
+
sizes: normalized.split(/\s+/)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function normalizeToolContent(content) {
|
|
14
|
+
return (content ?? []).map((block) => {
|
|
15
|
+
if (block.type !== "resource_link" || block.icons === void 0) return block;
|
|
16
|
+
return {
|
|
17
|
+
...block,
|
|
18
|
+
icons: block.icons.map(normalizeResourceLinkIcon)
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function outputValidationError(text) {
|
|
23
|
+
return {
|
|
24
|
+
content: [{
|
|
25
|
+
type: "text",
|
|
26
|
+
text
|
|
27
|
+
}],
|
|
28
|
+
isError: true
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function isJsonValue(value, ancestors = /* @__PURE__ */ new Set()) {
|
|
32
|
+
if (value === null || typeof value === "boolean" || typeof value === "string") return true;
|
|
33
|
+
if (typeof value === "number") return Number.isFinite(value);
|
|
34
|
+
if (typeof value !== "object" || ancestors.has(value)) return false;
|
|
35
|
+
const prototype = Object.getPrototypeOf(value);
|
|
36
|
+
if (!Array.isArray(value) && prototype !== Object.prototype && prototype !== null) return false;
|
|
37
|
+
ancestors.add(value);
|
|
38
|
+
const valid = (Array.isArray(value) ? value : Object.values(value).filter((entry) => entry !== void 0)).every((entry) => isJsonValue(entry, ancestors));
|
|
39
|
+
ancestors.delete(value);
|
|
40
|
+
return valid;
|
|
41
|
+
}
|
|
42
|
+
async function finalizeToolResult(tool, result) {
|
|
43
|
+
const content = normalizeToolContent(result.content);
|
|
44
|
+
let structuredContent = result.structuredContent;
|
|
45
|
+
if (tool.outputSchema && !result.isError) {
|
|
46
|
+
if (structuredContent === void 0) return outputValidationError(`Output validation error: Tool ${tool.name} has an output schema but no structured content was provided`);
|
|
47
|
+
try {
|
|
48
|
+
const parsed = await safeParseAsync(schemaFromDefinition(tool.outputSchema, false), structuredContent);
|
|
49
|
+
if (!parsed.success) return outputValidationError(`Output validation error: Invalid structured content for tool ${tool.name}: ${getParseErrorMessage(parsed.error)}`);
|
|
50
|
+
structuredContent = parsed.data;
|
|
51
|
+
} catch {
|
|
52
|
+
return outputValidationError(`Output validation error: Could not validate structured content for tool ${tool.name}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (structuredContent !== void 0 && !isJsonValue(structuredContent)) {
|
|
56
|
+
if (!result.isError) return outputValidationError(`Output validation error: Tool ${tool.name} returned a non-JSON structured value`);
|
|
57
|
+
structuredContent = void 0;
|
|
58
|
+
}
|
|
59
|
+
if (structuredContent !== void 0 && (structuredContent === null || typeof structuredContent !== "object" || Array.isArray(structuredContent)) && !content.some((block) => block.type === "text")) content.push({
|
|
60
|
+
type: "text",
|
|
61
|
+
text: JSON.stringify(structuredContent)
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
content,
|
|
65
|
+
structuredContent,
|
|
66
|
+
isError: result.isError
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { isJsonValue as n, normalizeToolContent as r, finalizeToolResult as t };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
const require_schema = require("./schema-DNMsvJwE.cjs");
|
|
2
|
+
let _modelcontextprotocol_sdk_server_zod_compat_js = require("@modelcontextprotocol/sdk/server/zod-compat.js");
|
|
3
|
+
//#region src/core/tool-result.ts
|
|
4
|
+
function normalizeResourceLinkIcon(icon) {
|
|
5
|
+
if (typeof icon.sizes !== "string") return icon;
|
|
6
|
+
const { sizes, ...rest } = icon;
|
|
7
|
+
const normalized = sizes.trim();
|
|
8
|
+
return normalized === "" ? rest : {
|
|
9
|
+
...rest,
|
|
10
|
+
sizes: normalized.split(/\s+/)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function normalizeToolContent(content) {
|
|
14
|
+
return (content ?? []).map((block) => {
|
|
15
|
+
if (block.type !== "resource_link" || block.icons === void 0) return block;
|
|
16
|
+
return {
|
|
17
|
+
...block,
|
|
18
|
+
icons: block.icons.map(normalizeResourceLinkIcon)
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function outputValidationError(text) {
|
|
23
|
+
return {
|
|
24
|
+
content: [{
|
|
25
|
+
type: "text",
|
|
26
|
+
text
|
|
27
|
+
}],
|
|
28
|
+
isError: true
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function isJsonValue(value, ancestors = /* @__PURE__ */ new Set()) {
|
|
32
|
+
if (value === null || typeof value === "boolean" || typeof value === "string") return true;
|
|
33
|
+
if (typeof value === "number") return Number.isFinite(value);
|
|
34
|
+
if (typeof value !== "object" || ancestors.has(value)) return false;
|
|
35
|
+
const prototype = Object.getPrototypeOf(value);
|
|
36
|
+
if (!Array.isArray(value) && prototype !== Object.prototype && prototype !== null) return false;
|
|
37
|
+
ancestors.add(value);
|
|
38
|
+
const valid = (Array.isArray(value) ? value : Object.values(value).filter((entry) => entry !== void 0)).every((entry) => isJsonValue(entry, ancestors));
|
|
39
|
+
ancestors.delete(value);
|
|
40
|
+
return valid;
|
|
41
|
+
}
|
|
42
|
+
async function finalizeToolResult(tool, result) {
|
|
43
|
+
const content = normalizeToolContent(result.content);
|
|
44
|
+
let structuredContent = result.structuredContent;
|
|
45
|
+
if (tool.outputSchema && !result.isError) {
|
|
46
|
+
if (structuredContent === void 0) return outputValidationError(`Output validation error: Tool ${tool.name} has an output schema but no structured content was provided`);
|
|
47
|
+
try {
|
|
48
|
+
const parsed = await (0, _modelcontextprotocol_sdk_server_zod_compat_js.safeParseAsync)(require_schema.schemaFromDefinition(tool.outputSchema, false), structuredContent);
|
|
49
|
+
if (!parsed.success) return outputValidationError(`Output validation error: Invalid structured content for tool ${tool.name}: ${(0, _modelcontextprotocol_sdk_server_zod_compat_js.getParseErrorMessage)(parsed.error)}`);
|
|
50
|
+
structuredContent = parsed.data;
|
|
51
|
+
} catch {
|
|
52
|
+
return outputValidationError(`Output validation error: Could not validate structured content for tool ${tool.name}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (structuredContent !== void 0 && !isJsonValue(structuredContent)) {
|
|
56
|
+
if (!result.isError) return outputValidationError(`Output validation error: Tool ${tool.name} returned a non-JSON structured value`);
|
|
57
|
+
structuredContent = void 0;
|
|
58
|
+
}
|
|
59
|
+
if (structuredContent !== void 0 && (structuredContent === null || typeof structuredContent !== "object" || Array.isArray(structuredContent)) && !content.some((block) => block.type === "text")) content.push({
|
|
60
|
+
type: "text",
|
|
61
|
+
text: JSON.stringify(structuredContent)
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
content,
|
|
65
|
+
structuredContent,
|
|
66
|
+
isError: result.isError
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
Object.defineProperty(exports, "finalizeToolResult", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function() {
|
|
73
|
+
return finalizeToolResult;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports, "isJsonValue", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function() {
|
|
79
|
+
return isJsonValue;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
Object.defineProperty(exports, "normalizeToolContent", {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get: function() {
|
|
85
|
+
return normalizeToolContent;
|
|
86
|
+
}
|
|
87
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovable.dev/mcp-js",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20"
|
|
6
6
|
},
|
|
@@ -82,6 +82,26 @@
|
|
|
82
82
|
"default": "./dist/stacks/supabase/index.cjs"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
+
"./testing": {
|
|
86
|
+
"import": {
|
|
87
|
+
"types": "./dist/testing/index.d.ts",
|
|
88
|
+
"default": "./dist/testing/index.js"
|
|
89
|
+
},
|
|
90
|
+
"require": {
|
|
91
|
+
"types": "./dist/testing/index.d.cts",
|
|
92
|
+
"default": "./dist/testing/index.cjs"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"./testing/server": {
|
|
96
|
+
"import": {
|
|
97
|
+
"types": "./dist/testing/server.d.ts",
|
|
98
|
+
"default": "./dist/testing/server.js"
|
|
99
|
+
},
|
|
100
|
+
"require": {
|
|
101
|
+
"types": "./dist/testing/server.d.cts",
|
|
102
|
+
"default": "./dist/testing/server.cjs"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
85
105
|
"./stacks/supabase/vite": {
|
|
86
106
|
"import": {
|
|
87
107
|
"types": "./dist/stacks/supabase/vite.d.ts",
|
|
@@ -94,6 +114,7 @@
|
|
|
94
114
|
}
|
|
95
115
|
},
|
|
96
116
|
"bin": {
|
|
117
|
+
"lovable-mcp-check": "./dist/cli/check-server.cjs",
|
|
97
118
|
"lovable-mcp-extract-manifest": "./dist/cli/extract-manifest.cjs"
|
|
98
119
|
},
|
|
99
120
|
"files": [
|
|
@@ -108,6 +129,8 @@
|
|
|
108
129
|
],
|
|
109
130
|
"license": "MIT",
|
|
110
131
|
"dependencies": {
|
|
132
|
+
"@modelcontextprotocol/client": "2.3.0",
|
|
133
|
+
"@modelcontextprotocol/core": "2.3.0",
|
|
111
134
|
"@modelcontextprotocol/server": "2.0.0",
|
|
112
135
|
"@modelcontextprotocol/sdk": "1.28.0",
|
|
113
136
|
"esbuild": "^0.27.0",
|
|
@@ -135,7 +158,8 @@
|
|
|
135
158
|
"format:check": "oxfmt --check src/ tests/",
|
|
136
159
|
"lint": "oxfmt --check src/ tests/ && oxlint -c ../../oxlint.config.ts src/ tests/",
|
|
137
160
|
"lint:fix": "oxfmt --write src/ tests/ && oxlint -c ../../oxlint.config.ts --fix src/ tests/",
|
|
138
|
-
"test": "vitest run --project unit && npm run test:package:zod",
|
|
161
|
+
"test": "vitest run --project unit && npm run test:package:zod && node tests/package/testing-kit.mjs",
|
|
162
|
+
"test:package:testing": "npm run build && node tests/package/testing-kit.mjs",
|
|
139
163
|
"test:package:zod": "npm run build && node tests/package/zod-compat.mjs",
|
|
140
164
|
"test:watch": "vitest --project unit",
|
|
141
165
|
"example:tanstack:install": "bun link && cd example/tanstack && bun install && bun link @lovable.dev/mcp-js",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//#region src/core/fs-errors.ts
|
|
2
|
-
function isFileMissing(err) {
|
|
3
|
-
return typeof err === "object" && err !== null && "code" in err && err.code === "ENOENT";
|
|
4
|
-
}
|
|
5
|
-
//#endregion
|
|
6
|
-
Object.defineProperty(exports, "isFileMissing", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function() {
|
|
9
|
-
return isFileMissing;
|
|
10
|
-
}
|
|
11
|
-
});
|