@lovable.dev/mcp-js 0.23.0 → 0.25.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/dist/{authorize-CumVyk7p.d.cts → authorize-D3zzoTAG.d.cts} +1 -1
- package/dist/{authorize-D6p4-9_D.d.ts → authorize-Y6Jm8GhR.d.ts} +1 -1
- package/dist/{base-DCe0kP79.d.cts → base-D-dYxK8t.d.cts} +1 -1
- package/dist/{base-DCe0kP79.d.ts → base-D-dYxK8t.d.ts} +1 -1
- package/dist/cli/extract-manifest.cjs +2 -2
- package/dist/cli/extract-manifest.js +2 -2
- package/dist/{cors-BXcpNLm9.js → cors-1Iz86PSf.js} +89 -16
- package/dist/{cors-CDnoIzo6.cjs → cors-DW1p9Uzw.cjs} +89 -16
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{io-DPYvBqET.d.cts → io-BlJ298VF.d.cts} +1 -1
- package/dist/{io-CfSPxeBN.d.ts → io-CSsqm26s.d.ts} +1 -1
- package/dist/{list-tools-DChR_9Q2.cjs → list-tools-DBidJV3L.cjs} +1 -1
- package/dist/{list-tools-bh6-eqZM.d.ts → list-tools-DKz6nJQ6.d.ts} +3 -3
- package/dist/{list-tools-ChLj1G6z.js → list-tools-DjzEigXr.js} +1 -1
- package/dist/{list-tools-B4TTPEl1.d.cts → list-tools-Dk-QKfqy.d.cts} +3 -3
- package/dist/{logger-2OXtfiIW.js → logger-3-kwsF-5.js} +4 -3
- package/dist/{logger-BqPOa_E1.cjs → logger-BSKbuM66.cjs} +9 -2
- package/dist/{mcp-BiyuOOzg.js → mcp-CoVt8EO9.js} +2 -2
- package/dist/{mcp-C_SCcw5F.cjs → mcp-DSo7xlpz.cjs} +2 -2
- package/dist/{package-T7npsn7f.js → package-CUrmd7C5.js} +1 -1
- package/dist/{package-DlVwsYdc.cjs → package-Wvf1u2OZ.cjs} +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 +2 -2
- package/dist/protocols/oauth-metadata.d.cts +2 -2
- package/dist/protocols/oauth-metadata.d.ts +2 -2
- package/dist/protocols/oauth-metadata.js +2 -2
- package/dist/protocols/rest/index.cjs +2 -2
- package/dist/protocols/rest/index.d.cts +4 -4
- package/dist/protocols/rest/index.d.ts +4 -4
- package/dist/protocols/rest/index.js +2 -2
- package/dist/{rest-DSfFaL-p.cjs → rest-CvdOnTsb.cjs} +2 -2
- package/dist/{rest-DdHrbXrU.js → rest-DdQMWvF4.js} +2 -2
- package/dist/stacks/supabase/index.cjs +5 -5
- package/dist/stacks/supabase/index.d.cts +1 -1
- package/dist/stacks/supabase/index.d.ts +1 -1
- package/dist/stacks/supabase/index.js +5 -5
- package/dist/stacks/supabase/vite.cjs +1 -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 +1 -1
- package/dist/stacks/tanstack/index.cjs +4 -4
- package/dist/stacks/tanstack/index.d.cts +2 -2
- package/dist/stacks/tanstack/index.d.ts +2 -2
- package/dist/stacks/tanstack/index.js +4 -4
- package/dist/stacks/tanstack/vite.d.cts +1 -1
- package/dist/stacks/tanstack/vite.d.ts +1 -1
- package/dist/{types-BYdYYTjk.d.cts → types-C0Wgm9zp.d.cts} +1 -1
- package/dist/{types-BYdYYTjk.d.ts → types-C0Wgm9zp.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/metrics/impl/base.d.ts
|
|
2
|
-
type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "
|
|
2
|
+
type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "auth_discovery_config_error" | "auth_discovery_unreachable" | "auth_jwks_config_error" | "auth_jwks_unreachable";
|
|
3
3
|
/** One recorded MCP call. Carries no arguments or response payloads — only the
|
|
4
4
|
* tool name, the JSON-RPC method, the result class, timing, and byte sizes.
|
|
5
5
|
* `errorText` is the sole exception: it is logged locally for debugging and
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/metrics/impl/base.d.ts
|
|
2
|
-
type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "
|
|
2
|
+
type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "auth_discovery_config_error" | "auth_discovery_unreachable" | "auth_jwks_config_error" | "auth_jwks_unreachable";
|
|
3
3
|
/** One recorded MCP call. Carries no arguments or response payloads — only the
|
|
4
4
|
* tool name, the JSON-RPC method, the result class, timing, and byte sizes.
|
|
5
5
|
* `errorText` is the sole exception: it is logged locally for debugging and
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const require_package = require("../package-
|
|
3
|
-
const require_list_tools = require("../list-tools-
|
|
2
|
+
const require_package = require("../package-Wvf1u2OZ.cjs");
|
|
3
|
+
const require_list_tools = require("../list-tools-DBidJV3L.cjs");
|
|
4
4
|
const require_fs_errors = require("../fs-errors-CWNzOV75.cjs");
|
|
5
5
|
let node_fs = require("node:fs");
|
|
6
6
|
let node_path = require("node:path");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as version } from "../package-
|
|
3
|
-
import { t as buildMcpListing } from "../list-tools-
|
|
2
|
+
import { t as version } from "../package-CUrmd7C5.js";
|
|
3
|
+
import { t as buildMcpListing } from "../list-tools-DjzEigXr.js";
|
|
4
4
|
import { t as isFileMissing } from "../fs-errors-PA2t1TIp.js";
|
|
5
5
|
import { lstatSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { dirname, resolve } from "node:path";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as version } from "./package-
|
|
1
|
+
import { i as log, n as applyLogLevelFromEnv, o as parseSafeUrl, r as describeError, s as trimTrailingSlash, t as LOG_LEVEL_ENV_VAR, u as resolveMetricsConfig } from "./logger-3-kwsF-5.js";
|
|
2
|
+
import { t as version } from "./package-CUrmd7C5.js";
|
|
3
3
|
import "./metadata-path-CAkNcfyY.js";
|
|
4
4
|
import { createLocalJWKSet, decodeProtectedHeader, jwtVerify } from "jose";
|
|
5
5
|
//#region src/core/http.ts
|
|
@@ -133,7 +133,7 @@ var BaseMetricRecorder = class {
|
|
|
133
133
|
this.server = server;
|
|
134
134
|
this.deps = deps;
|
|
135
135
|
this.doFetch = deps.fetch ?? (typeof globalThis.fetch === "function" ? globalThis.fetch.bind(globalThis) : void 0);
|
|
136
|
-
this.usesLovableEndpoint = config.endpoint ===
|
|
136
|
+
this.usesLovableEndpoint = config.endpoint === "https://api.lovable.dev/internal/v1/app-mcp-usage" || config.endpoint === "https://api.lovable.dev/v1/app-mcp-usage";
|
|
137
137
|
const headers = {};
|
|
138
138
|
if (!this.usesLovableEndpoint) {
|
|
139
139
|
for (const [key, value] of Object.entries(config.headers)) if (key.toLowerCase() !== "content-type") headers[key] = value;
|
|
@@ -315,11 +315,28 @@ function cachedPromise(load, label) {
|
|
|
315
315
|
//#endregion
|
|
316
316
|
//#region src/auth/discovery.ts
|
|
317
317
|
var OAuthConfigurationError = class extends Error {
|
|
318
|
-
|
|
318
|
+
stage;
|
|
319
|
+
constructor(message, stage) {
|
|
319
320
|
super(message);
|
|
321
|
+
this.stage = stage;
|
|
320
322
|
this.name = "OAuthConfigurationError";
|
|
321
323
|
}
|
|
322
324
|
};
|
|
325
|
+
/** The AS never answered at the network layer — an upstream outage, not a misconfiguration. */
|
|
326
|
+
var OAuthUpstreamUnreachableError = class extends Error {
|
|
327
|
+
stage;
|
|
328
|
+
constructor(message, stage) {
|
|
329
|
+
super(message);
|
|
330
|
+
this.stage = stage;
|
|
331
|
+
this.name = "OAuthUpstreamUnreachableError";
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
var MetadataUnreachableError = class extends Error {
|
|
335
|
+
constructor(message) {
|
|
336
|
+
super(message);
|
|
337
|
+
this.name = "MetadataUnreachableError";
|
|
338
|
+
}
|
|
339
|
+
};
|
|
323
340
|
const METADATA_FETCH_TIMEOUT_MS = 5e3;
|
|
324
341
|
function issuerPath(url) {
|
|
325
342
|
const path = trimTrailingSlash(url.pathname);
|
|
@@ -346,25 +363,35 @@ async function fetchFirstValidOAuthServerMetadata(metadataUrls, expectedIssuer)
|
|
|
346
363
|
for (const url of metadataUrls) try {
|
|
347
364
|
return await fetchOAuthServerMetadata(url, expectedIssuer);
|
|
348
365
|
} catch (err) {
|
|
366
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
349
367
|
log.debug("oauth.discovery.attempt_failed", {
|
|
350
368
|
url,
|
|
351
|
-
...describeError(
|
|
369
|
+
...describeError(error)
|
|
352
370
|
});
|
|
353
|
-
errors.push(
|
|
371
|
+
errors.push(error);
|
|
354
372
|
}
|
|
373
|
+
const unreachable = errors.some((e) => e instanceof MetadataUnreachableError);
|
|
374
|
+
const detail = errors.map((e) => e.message).join("; ");
|
|
355
375
|
log.error("oauth.discovery.exhausted", {
|
|
356
376
|
expectedIssuer,
|
|
357
377
|
urlsTried: metadataUrls,
|
|
358
|
-
errors
|
|
378
|
+
errors: detail,
|
|
379
|
+
unreachable
|
|
359
380
|
});
|
|
360
|
-
|
|
381
|
+
const message = `failed to discover OAuth server metadata (${detail})`;
|
|
382
|
+
throw unreachable ? new MetadataUnreachableError(message) : new Error(message);
|
|
361
383
|
}
|
|
362
384
|
async function fetchOAuthServerMetadata(url, expectedIssuer) {
|
|
363
385
|
log.debug("oauth.discovery.fetch", { url });
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
386
|
+
let response;
|
|
387
|
+
try {
|
|
388
|
+
response = await fetch(url, {
|
|
389
|
+
signal: AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS),
|
|
390
|
+
redirect: "manual"
|
|
391
|
+
});
|
|
392
|
+
} catch (err) {
|
|
393
|
+
throw new MetadataUnreachableError(err instanceof Error ? err.message : String(err));
|
|
394
|
+
}
|
|
368
395
|
if (!response.ok) throw new Error(String(response.status));
|
|
369
396
|
const json = await response.json();
|
|
370
397
|
if (typeof json.issuer !== "string") throw new Error("missing issuer");
|
|
@@ -388,12 +415,21 @@ async function fetchIssuerOAuthServerMetadata(issuer) {
|
|
|
388
415
|
try {
|
|
389
416
|
return await fetchFirstValidOAuthServerMetadata(oauthMetadataUrlsForIssuer(issuer), issuer);
|
|
390
417
|
} catch (err) {
|
|
418
|
+
const message = `OAuth issuer discovery failed: ${err instanceof Error ? err.message : String(err)}`;
|
|
419
|
+
if (err instanceof MetadataUnreachableError) {
|
|
420
|
+
log.error("oauth.discovery.unreachable", {
|
|
421
|
+
issuer,
|
|
422
|
+
...describeError(err),
|
|
423
|
+
outcome: "503 authorization server unreachable"
|
|
424
|
+
});
|
|
425
|
+
throw new OAuthUpstreamUnreachableError(message, "discovery");
|
|
426
|
+
}
|
|
391
427
|
log.error("oauth.discovery.config_error", {
|
|
392
428
|
issuer,
|
|
393
429
|
...describeError(err),
|
|
394
430
|
outcome: "500 oauth configuration error"
|
|
395
431
|
});
|
|
396
|
-
throw new OAuthConfigurationError(
|
|
432
|
+
throw new OAuthConfigurationError(message, "discovery");
|
|
397
433
|
}
|
|
398
434
|
}
|
|
399
435
|
/** Metadata and token verification share issuer/JWKS discovery, but transient failures must not poison the runtime. */
|
|
@@ -507,11 +543,20 @@ function tokenHeaderFields(token) {
|
|
|
507
543
|
}
|
|
508
544
|
}
|
|
509
545
|
async function fetchVerificationKeySet(jwksUri) {
|
|
546
|
+
let response;
|
|
510
547
|
try {
|
|
511
|
-
|
|
548
|
+
response = await fetch(jwksUri, {
|
|
512
549
|
signal: AbortSignal.timeout(JWKS_FETCH_TIMEOUT_MS),
|
|
513
550
|
redirect: "manual"
|
|
514
551
|
});
|
|
552
|
+
} catch (err) {
|
|
553
|
+
log.error("oauth.jwks.unreachable", {
|
|
554
|
+
...describeError(err),
|
|
555
|
+
outcome: "503 authorization server unreachable"
|
|
556
|
+
});
|
|
557
|
+
throw new OAuthUpstreamUnreachableError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`, "jwks");
|
|
558
|
+
}
|
|
559
|
+
try {
|
|
515
560
|
if (!response.ok) throw new Error(`JWKS endpoint returned ${response.status}`);
|
|
516
561
|
return createLocalJWKSet(await response.json());
|
|
517
562
|
} catch (err) {
|
|
@@ -519,7 +564,7 @@ async function fetchVerificationKeySet(jwksUri) {
|
|
|
519
564
|
...describeError(err),
|
|
520
565
|
outcome: "500 oauth configuration error"
|
|
521
566
|
});
|
|
522
|
-
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}
|
|
567
|
+
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`, "jwks");
|
|
523
568
|
}
|
|
524
569
|
}
|
|
525
570
|
function assertAccessTokenTyp(token, allowed) {
|
|
@@ -695,6 +740,16 @@ function oauthConfigurationErrorResponse() {
|
|
|
695
740
|
}
|
|
696
741
|
});
|
|
697
742
|
}
|
|
743
|
+
function oauthUpstreamUnreachableResponse() {
|
|
744
|
+
return new Response(JSON.stringify({ error: "authorization server unreachable" }), {
|
|
745
|
+
status: 503,
|
|
746
|
+
headers: {
|
|
747
|
+
...JSON_HEADERS,
|
|
748
|
+
"Cache-Control": "no-store",
|
|
749
|
+
"Retry-After": "30"
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
}
|
|
698
753
|
function parseBearerToken(request) {
|
|
699
754
|
const header = request.headers.get("Authorization");
|
|
700
755
|
if (!header) return void 0;
|
|
@@ -768,15 +823,33 @@ function createRequestAuthorizer(mcp, options = {}) {
|
|
|
768
823
|
auth
|
|
769
824
|
};
|
|
770
825
|
} catch (err) {
|
|
826
|
+
if (err instanceof OAuthUpstreamUnreachableError) {
|
|
827
|
+
log.error("auth.upstream_unreachable", {
|
|
828
|
+
...describeError(err),
|
|
829
|
+
stage: err.stage,
|
|
830
|
+
outcome: "503"
|
|
831
|
+
});
|
|
832
|
+
await recorder?.emit({
|
|
833
|
+
tool: null,
|
|
834
|
+
method: "authorize",
|
|
835
|
+
outcome: err.stage === "jwks" ? "auth_jwks_unreachable" : "auth_discovery_unreachable",
|
|
836
|
+
durationMs: nowMs() - startedAt
|
|
837
|
+
});
|
|
838
|
+
return {
|
|
839
|
+
ok: false,
|
|
840
|
+
response: oauthUpstreamUnreachableResponse()
|
|
841
|
+
};
|
|
842
|
+
}
|
|
771
843
|
if (err instanceof OAuthConfigurationError) {
|
|
772
844
|
log.error("auth.config_error", {
|
|
773
845
|
...describeError(err),
|
|
846
|
+
stage: err.stage,
|
|
774
847
|
outcome: "500"
|
|
775
848
|
});
|
|
776
849
|
await recorder?.emit({
|
|
777
850
|
tool: null,
|
|
778
851
|
method: "authorize",
|
|
779
|
-
outcome: "
|
|
852
|
+
outcome: err.stage === "jwks" ? "auth_jwks_config_error" : "auth_discovery_config_error",
|
|
780
853
|
durationMs: nowMs() - startedAt
|
|
781
854
|
});
|
|
782
855
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_logger = require("./logger-
|
|
2
|
-
const require_package = require("./package-
|
|
1
|
+
const require_logger = require("./logger-BSKbuM66.cjs");
|
|
2
|
+
const require_package = require("./package-Wvf1u2OZ.cjs");
|
|
3
3
|
require("./metadata-path-zd7NSNoa.cjs");
|
|
4
4
|
let jose = require("jose");
|
|
5
5
|
//#region src/core/http.ts
|
|
@@ -133,7 +133,7 @@ var BaseMetricRecorder = class {
|
|
|
133
133
|
this.server = server;
|
|
134
134
|
this.deps = deps;
|
|
135
135
|
this.doFetch = deps.fetch ?? (typeof globalThis.fetch === "function" ? globalThis.fetch.bind(globalThis) : void 0);
|
|
136
|
-
this.usesLovableEndpoint = config.endpoint ===
|
|
136
|
+
this.usesLovableEndpoint = config.endpoint === "https://api.lovable.dev/internal/v1/app-mcp-usage" || config.endpoint === "https://api.lovable.dev/v1/app-mcp-usage";
|
|
137
137
|
const headers = {};
|
|
138
138
|
if (!this.usesLovableEndpoint) {
|
|
139
139
|
for (const [key, value] of Object.entries(config.headers)) if (key.toLowerCase() !== "content-type") headers[key] = value;
|
|
@@ -315,11 +315,28 @@ function cachedPromise(load, label) {
|
|
|
315
315
|
//#endregion
|
|
316
316
|
//#region src/auth/discovery.ts
|
|
317
317
|
var OAuthConfigurationError = class extends Error {
|
|
318
|
-
|
|
318
|
+
stage;
|
|
319
|
+
constructor(message, stage) {
|
|
319
320
|
super(message);
|
|
321
|
+
this.stage = stage;
|
|
320
322
|
this.name = "OAuthConfigurationError";
|
|
321
323
|
}
|
|
322
324
|
};
|
|
325
|
+
/** The AS never answered at the network layer — an upstream outage, not a misconfiguration. */
|
|
326
|
+
var OAuthUpstreamUnreachableError = class extends Error {
|
|
327
|
+
stage;
|
|
328
|
+
constructor(message, stage) {
|
|
329
|
+
super(message);
|
|
330
|
+
this.stage = stage;
|
|
331
|
+
this.name = "OAuthUpstreamUnreachableError";
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
var MetadataUnreachableError = class extends Error {
|
|
335
|
+
constructor(message) {
|
|
336
|
+
super(message);
|
|
337
|
+
this.name = "MetadataUnreachableError";
|
|
338
|
+
}
|
|
339
|
+
};
|
|
323
340
|
const METADATA_FETCH_TIMEOUT_MS = 5e3;
|
|
324
341
|
function issuerPath(url) {
|
|
325
342
|
const path = require_logger.trimTrailingSlash(url.pathname);
|
|
@@ -346,25 +363,35 @@ async function fetchFirstValidOAuthServerMetadata(metadataUrls, expectedIssuer)
|
|
|
346
363
|
for (const url of metadataUrls) try {
|
|
347
364
|
return await fetchOAuthServerMetadata(url, expectedIssuer);
|
|
348
365
|
} catch (err) {
|
|
366
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
349
367
|
require_logger.log.debug("oauth.discovery.attempt_failed", {
|
|
350
368
|
url,
|
|
351
|
-
...require_logger.describeError(
|
|
369
|
+
...require_logger.describeError(error)
|
|
352
370
|
});
|
|
353
|
-
errors.push(
|
|
371
|
+
errors.push(error);
|
|
354
372
|
}
|
|
373
|
+
const unreachable = errors.some((e) => e instanceof MetadataUnreachableError);
|
|
374
|
+
const detail = errors.map((e) => e.message).join("; ");
|
|
355
375
|
require_logger.log.error("oauth.discovery.exhausted", {
|
|
356
376
|
expectedIssuer,
|
|
357
377
|
urlsTried: metadataUrls,
|
|
358
|
-
errors
|
|
378
|
+
errors: detail,
|
|
379
|
+
unreachable
|
|
359
380
|
});
|
|
360
|
-
|
|
381
|
+
const message = `failed to discover OAuth server metadata (${detail})`;
|
|
382
|
+
throw unreachable ? new MetadataUnreachableError(message) : new Error(message);
|
|
361
383
|
}
|
|
362
384
|
async function fetchOAuthServerMetadata(url, expectedIssuer) {
|
|
363
385
|
require_logger.log.debug("oauth.discovery.fetch", { url });
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
386
|
+
let response;
|
|
387
|
+
try {
|
|
388
|
+
response = await fetch(url, {
|
|
389
|
+
signal: AbortSignal.timeout(METADATA_FETCH_TIMEOUT_MS),
|
|
390
|
+
redirect: "manual"
|
|
391
|
+
});
|
|
392
|
+
} catch (err) {
|
|
393
|
+
throw new MetadataUnreachableError(err instanceof Error ? err.message : String(err));
|
|
394
|
+
}
|
|
368
395
|
if (!response.ok) throw new Error(String(response.status));
|
|
369
396
|
const json = await response.json();
|
|
370
397
|
if (typeof json.issuer !== "string") throw new Error("missing issuer");
|
|
@@ -388,12 +415,21 @@ async function fetchIssuerOAuthServerMetadata(issuer) {
|
|
|
388
415
|
try {
|
|
389
416
|
return await fetchFirstValidOAuthServerMetadata(oauthMetadataUrlsForIssuer(issuer), issuer);
|
|
390
417
|
} catch (err) {
|
|
418
|
+
const message = `OAuth issuer discovery failed: ${err instanceof Error ? err.message : String(err)}`;
|
|
419
|
+
if (err instanceof MetadataUnreachableError) {
|
|
420
|
+
require_logger.log.error("oauth.discovery.unreachable", {
|
|
421
|
+
issuer,
|
|
422
|
+
...require_logger.describeError(err),
|
|
423
|
+
outcome: "503 authorization server unreachable"
|
|
424
|
+
});
|
|
425
|
+
throw new OAuthUpstreamUnreachableError(message, "discovery");
|
|
426
|
+
}
|
|
391
427
|
require_logger.log.error("oauth.discovery.config_error", {
|
|
392
428
|
issuer,
|
|
393
429
|
...require_logger.describeError(err),
|
|
394
430
|
outcome: "500 oauth configuration error"
|
|
395
431
|
});
|
|
396
|
-
throw new OAuthConfigurationError(
|
|
432
|
+
throw new OAuthConfigurationError(message, "discovery");
|
|
397
433
|
}
|
|
398
434
|
}
|
|
399
435
|
/** Metadata and token verification share issuer/JWKS discovery, but transient failures must not poison the runtime. */
|
|
@@ -507,11 +543,20 @@ function tokenHeaderFields(token) {
|
|
|
507
543
|
}
|
|
508
544
|
}
|
|
509
545
|
async function fetchVerificationKeySet(jwksUri) {
|
|
546
|
+
let response;
|
|
510
547
|
try {
|
|
511
|
-
|
|
548
|
+
response = await fetch(jwksUri, {
|
|
512
549
|
signal: AbortSignal.timeout(JWKS_FETCH_TIMEOUT_MS),
|
|
513
550
|
redirect: "manual"
|
|
514
551
|
});
|
|
552
|
+
} catch (err) {
|
|
553
|
+
require_logger.log.error("oauth.jwks.unreachable", {
|
|
554
|
+
...require_logger.describeError(err),
|
|
555
|
+
outcome: "503 authorization server unreachable"
|
|
556
|
+
});
|
|
557
|
+
throw new OAuthUpstreamUnreachableError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`, "jwks");
|
|
558
|
+
}
|
|
559
|
+
try {
|
|
515
560
|
if (!response.ok) throw new Error(`JWKS endpoint returned ${response.status}`);
|
|
516
561
|
return (0, jose.createLocalJWKSet)(await response.json());
|
|
517
562
|
} catch (err) {
|
|
@@ -519,7 +564,7 @@ async function fetchVerificationKeySet(jwksUri) {
|
|
|
519
564
|
...require_logger.describeError(err),
|
|
520
565
|
outcome: "500 oauth configuration error"
|
|
521
566
|
});
|
|
522
|
-
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}
|
|
567
|
+
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`, "jwks");
|
|
523
568
|
}
|
|
524
569
|
}
|
|
525
570
|
function assertAccessTokenTyp(token, allowed) {
|
|
@@ -695,6 +740,16 @@ function oauthConfigurationErrorResponse() {
|
|
|
695
740
|
}
|
|
696
741
|
});
|
|
697
742
|
}
|
|
743
|
+
function oauthUpstreamUnreachableResponse() {
|
|
744
|
+
return new Response(JSON.stringify({ error: "authorization server unreachable" }), {
|
|
745
|
+
status: 503,
|
|
746
|
+
headers: {
|
|
747
|
+
...JSON_HEADERS,
|
|
748
|
+
"Cache-Control": "no-store",
|
|
749
|
+
"Retry-After": "30"
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
}
|
|
698
753
|
function parseBearerToken(request) {
|
|
699
754
|
const header = request.headers.get("Authorization");
|
|
700
755
|
if (!header) return void 0;
|
|
@@ -768,15 +823,33 @@ function createRequestAuthorizer(mcp, options = {}) {
|
|
|
768
823
|
auth
|
|
769
824
|
};
|
|
770
825
|
} catch (err) {
|
|
826
|
+
if (err instanceof OAuthUpstreamUnreachableError) {
|
|
827
|
+
require_logger.log.error("auth.upstream_unreachable", {
|
|
828
|
+
...require_logger.describeError(err),
|
|
829
|
+
stage: err.stage,
|
|
830
|
+
outcome: "503"
|
|
831
|
+
});
|
|
832
|
+
await recorder?.emit({
|
|
833
|
+
tool: null,
|
|
834
|
+
method: "authorize",
|
|
835
|
+
outcome: err.stage === "jwks" ? "auth_jwks_unreachable" : "auth_discovery_unreachable",
|
|
836
|
+
durationMs: nowMs() - startedAt
|
|
837
|
+
});
|
|
838
|
+
return {
|
|
839
|
+
ok: false,
|
|
840
|
+
response: oauthUpstreamUnreachableResponse()
|
|
841
|
+
};
|
|
842
|
+
}
|
|
771
843
|
if (err instanceof OAuthConfigurationError) {
|
|
772
844
|
require_logger.log.error("auth.config_error", {
|
|
773
845
|
...require_logger.describeError(err),
|
|
846
|
+
stage: err.stage,
|
|
774
847
|
outcome: "500"
|
|
775
848
|
});
|
|
776
849
|
await recorder?.emit({
|
|
777
850
|
tool: null,
|
|
778
851
|
method: "authorize",
|
|
779
|
-
outcome: "
|
|
852
|
+
outcome: err.stage === "jwks" ? "auth_jwks_config_error" : "auth_discovery_config_error",
|
|
780
853
|
durationMs: nowMs() - startedAt
|
|
781
854
|
});
|
|
782
855
|
return {
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_logger = require("./logger-
|
|
2
|
+
const require_logger = require("./logger-BSKbuM66.cjs");
|
|
3
3
|
const require_context = require("./context-BweeEcoA.cjs");
|
|
4
4
|
//#region src/core/define.ts
|
|
5
5
|
function assertUniqueNames(mcp) {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as McpAuthConfig, S as JwtClaims, _ as ZodRawShape, a as EmbeddedResource, b as MetricsOptions, c as McpDefinition, d as ResourceLinkIcon, f as TextContent, g as ToolHandlerResult, h as ToolDefinition, i as EmbeddedBlobResource, l as McpDefinitionInput, m as ToolContent, n as ContentAnnotations, o as EmbeddedTextResource, p as ToolAnnotations, r as ContentBlock, s as ImageContent, t as AudioContent, u as ResourceLink, v as ZodSchema, x as ToolContext, y as MetricsConfig } from "./types-
|
|
1
|
+
import { C as McpAuthConfig, S as JwtClaims, _ as ZodRawShape, a as EmbeddedResource, b as MetricsOptions, c as McpDefinition, d as ResourceLinkIcon, f as TextContent, g as ToolHandlerResult, h as ToolDefinition, i as EmbeddedBlobResource, l as McpDefinitionInput, m as ToolContent, n as ContentAnnotations, o as EmbeddedTextResource, p as ToolAnnotations, r as ContentBlock, s as ImageContent, t as AudioContent, u as ResourceLink, v as ZodSchema, x as ToolContext, y as MetricsConfig } from "./types-C0Wgm9zp.cjs";
|
|
2
2
|
//#region src/core/define.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Declare a single MCP tool. Import the result into your MCP definition's
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as McpAuthConfig, S as JwtClaims, _ as ZodRawShape, a as EmbeddedResource, b as MetricsOptions, c as McpDefinition, d as ResourceLinkIcon, f as TextContent, g as ToolHandlerResult, h as ToolDefinition, i as EmbeddedBlobResource, l as McpDefinitionInput, m as ToolContent, n as ContentAnnotations, o as EmbeddedTextResource, p as ToolAnnotations, r as ContentBlock, s as ImageContent, t as AudioContent, u as ResourceLink, v as ZodSchema, x as ToolContext, y as MetricsConfig } from "./types-
|
|
1
|
+
import { C as McpAuthConfig, S as JwtClaims, _ as ZodRawShape, a as EmbeddedResource, b as MetricsOptions, c as McpDefinition, d as ResourceLinkIcon, f as TextContent, g as ToolHandlerResult, h as ToolDefinition, i as EmbeddedBlobResource, l as McpDefinitionInput, m as ToolContent, n as ContentAnnotations, o as EmbeddedTextResource, p as ToolAnnotations, r as ContentBlock, s as ImageContent, t as AudioContent, u as ResourceLink, v as ZodSchema, x as ToolContext, y as MetricsConfig } from "./types-C0Wgm9zp.js";
|
|
2
2
|
//#region src/core/define.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Declare a single MCP tool. Import the result into your MCP definition's
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as setLogLevel,
|
|
1
|
+
import { a as setLogLevel, o as parseSafeUrl, s as trimTrailingSlash, u as resolveMetricsConfig } from "./logger-3-kwsF-5.js";
|
|
2
2
|
import { t as ToolContext } from "./context-CIpPzN7P.js";
|
|
3
3
|
//#region src/core/define.ts
|
|
4
4
|
function assertUniqueNames(mcp) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_cors = require("./cors-
|
|
1
|
+
const require_cors = require("./cors-DW1p9Uzw.cjs");
|
|
2
2
|
let _modelcontextprotocol_sdk_server_zod_compat_js = require("@modelcontextprotocol/sdk/server/zod-compat.js");
|
|
3
3
|
let _modelcontextprotocol_sdk_server_zod_json_schema_compat_js = require("@modelcontextprotocol/sdk/server/zod-json-schema-compat.js");
|
|
4
4
|
//#region src/protocols/rest/list-tools.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as McpDefinition } from "./types-
|
|
2
|
-
import { t as MetricsRecorder } from "./base-
|
|
3
|
-
import { t as McpRuntimeOptions } from "./authorize-
|
|
1
|
+
import { c as McpDefinition } from "./types-C0Wgm9zp.js";
|
|
2
|
+
import { t as MetricsRecorder } from "./base-D-dYxK8t.js";
|
|
3
|
+
import { t as McpRuntimeOptions } from "./authorize-Y6Jm8GhR.js";
|
|
4
4
|
//#region src/protocols/rest/list-tools.d.ts
|
|
5
5
|
type RestListToolsHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
|
|
6
6
|
declare function createListToolsHandler(mcp: McpDefinition, options?: McpRuntimeOptions): RestListToolsHandler;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as createRequestAuthorizer, m as methodNotAllowed, n as withCors, p as headResponse, r as assertRestResourceBinding, t as corsPreflightResponse, u as createNoopRecorder } from "./cors-
|
|
1
|
+
import { i as createRequestAuthorizer, m as methodNotAllowed, n as withCors, p as headResponse, r as assertRestResourceBinding, t as corsPreflightResponse, u as createNoopRecorder } from "./cors-1Iz86PSf.js";
|
|
2
2
|
import { objectFromShape } from "@modelcontextprotocol/sdk/server/zod-compat.js";
|
|
3
3
|
import { toJsonSchemaCompat } from "@modelcontextprotocol/sdk/server/zod-json-schema-compat.js";
|
|
4
4
|
//#region src/protocols/rest/list-tools.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as McpDefinition } from "./types-
|
|
2
|
-
import { t as MetricsRecorder } from "./base-
|
|
3
|
-
import { t as McpRuntimeOptions } from "./authorize-
|
|
1
|
+
import { c as McpDefinition } from "./types-C0Wgm9zp.cjs";
|
|
2
|
+
import { t as MetricsRecorder } from "./base-D-dYxK8t.cjs";
|
|
3
|
+
import { t as McpRuntimeOptions } from "./authorize-D3zzoTAG.cjs";
|
|
4
4
|
//#region src/protocols/rest/list-tools.d.ts
|
|
5
5
|
type RestListToolsHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
|
|
6
6
|
declare function createListToolsHandler(mcp: McpDefinition, options?: McpRuntimeOptions): RestListToolsHandler;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
//#region src/metrics/config.ts
|
|
2
|
-
const DEFAULT_METRICS_ENDPOINT = "https://api.lovable.dev/v1/app-mcp-usage";
|
|
2
|
+
const DEFAULT_METRICS_ENDPOINT = "https://api.lovable.dev/internal/v1/app-mcp-usage";
|
|
3
|
+
const LEGACY_METRICS_ENDPOINT = "https://api.lovable.dev/v1/app-mcp-usage";
|
|
3
4
|
const METRICS_API_KEY_ENV_VAR = "LOVABLE_API_KEY";
|
|
4
5
|
/**
|
|
5
6
|
* Validate the ingest endpoint at plugin-construction time so a malformed URL
|
|
@@ -21,7 +22,7 @@ function assertMetricsEndpoint(endpoint) {
|
|
|
21
22
|
*/
|
|
22
23
|
function resolveMetricsConfig(config = true) {
|
|
23
24
|
const options = typeof config === "boolean" ? { enabled: config } : config;
|
|
24
|
-
const endpoint = options.endpoint ?? "https://api.lovable.dev/v1/app-mcp-usage";
|
|
25
|
+
const endpoint = options.endpoint ?? "https://api.lovable.dev/internal/v1/app-mcp-usage";
|
|
25
26
|
assertMetricsEndpoint(endpoint);
|
|
26
27
|
return Object.freeze({
|
|
27
28
|
enabled: options.enabled ?? true,
|
|
@@ -138,4 +139,4 @@ function describeError(err) {
|
|
|
138
139
|
return { value: String(err) };
|
|
139
140
|
}
|
|
140
141
|
//#endregion
|
|
141
|
-
export { setLogLevel as a, DEFAULT_METRICS_ENDPOINT as c, log as i,
|
|
142
|
+
export { setLogLevel as a, DEFAULT_METRICS_ENDPOINT as c, log as i, LEGACY_METRICS_ENDPOINT as l, applyLogLevelFromEnv as n, parseSafeUrl as o, describeError as r, trimTrailingSlash as s, LOG_LEVEL_ENV_VAR as t, resolveMetricsConfig as u };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
//#region src/metrics/config.ts
|
|
2
|
-
const DEFAULT_METRICS_ENDPOINT = "https://api.lovable.dev/v1/app-mcp-usage";
|
|
2
|
+
const DEFAULT_METRICS_ENDPOINT = "https://api.lovable.dev/internal/v1/app-mcp-usage";
|
|
3
|
+
const LEGACY_METRICS_ENDPOINT = "https://api.lovable.dev/v1/app-mcp-usage";
|
|
3
4
|
const METRICS_API_KEY_ENV_VAR = "LOVABLE_API_KEY";
|
|
4
5
|
/**
|
|
5
6
|
* Validate the ingest endpoint at plugin-construction time so a malformed URL
|
|
@@ -21,7 +22,7 @@ function assertMetricsEndpoint(endpoint) {
|
|
|
21
22
|
*/
|
|
22
23
|
function resolveMetricsConfig(config = true) {
|
|
23
24
|
const options = typeof config === "boolean" ? { enabled: config } : config;
|
|
24
|
-
const endpoint = options.endpoint ?? "https://api.lovable.dev/v1/app-mcp-usage";
|
|
25
|
+
const endpoint = options.endpoint ?? "https://api.lovable.dev/internal/v1/app-mcp-usage";
|
|
25
26
|
assertMetricsEndpoint(endpoint);
|
|
26
27
|
return Object.freeze({
|
|
27
28
|
enabled: options.enabled ?? true,
|
|
@@ -144,6 +145,12 @@ Object.defineProperty(exports, "DEFAULT_METRICS_ENDPOINT", {
|
|
|
144
145
|
return DEFAULT_METRICS_ENDPOINT;
|
|
145
146
|
}
|
|
146
147
|
});
|
|
148
|
+
Object.defineProperty(exports, "LEGACY_METRICS_ENDPOINT", {
|
|
149
|
+
enumerable: true,
|
|
150
|
+
get: function() {
|
|
151
|
+
return LEGACY_METRICS_ENDPOINT;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
147
154
|
Object.defineProperty(exports, "LOG_LEVEL_ENV_VAR", {
|
|
148
155
|
enumerable: true,
|
|
149
156
|
get: function() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as log, r as describeError } from "./logger-
|
|
1
|
+
import { i as log, r as describeError } from "./logger-3-kwsF-5.js";
|
|
2
2
|
import { t as ToolContext } from "./context-CIpPzN7P.js";
|
|
3
|
-
import { d as nowMs, i as createRequestAuthorizer, n as withCors, t as corsPreflightResponse, u as createNoopRecorder } from "./cors-
|
|
3
|
+
import { d as nowMs, i as createRequestAuthorizer, n as withCors, t as corsPreflightResponse, u as createNoopRecorder } from "./cors-1Iz86PSf.js";
|
|
4
4
|
import { t as extractTextContent } from "./content-D5LJAHyM.js";
|
|
5
5
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
6
|
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_logger = require("./logger-
|
|
1
|
+
const require_logger = require("./logger-BSKbuM66.cjs");
|
|
2
2
|
const require_context = require("./context-BweeEcoA.cjs");
|
|
3
|
-
const require_cors = require("./cors-
|
|
3
|
+
const require_cors = require("./cors-DW1p9Uzw.cjs");
|
|
4
4
|
const require_content = require("./content-NCYIGgOb.cjs");
|
|
5
5
|
let _modelcontextprotocol_sdk_server_mcp_js = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
6
6
|
let _modelcontextprotocol_sdk_server_webStandardStreamableHttp_js = require("@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as McpDefinition } from "../../types-
|
|
2
|
-
import { t as MetricsRecorder } from "../../base-
|
|
3
|
-
import { t as McpRuntimeOptions } from "../../authorize-
|
|
1
|
+
import { c as McpDefinition } from "../../types-C0Wgm9zp.cjs";
|
|
2
|
+
import { t as MetricsRecorder } from "../../base-D-dYxK8t.cjs";
|
|
3
|
+
import { t as McpRuntimeOptions } from "../../authorize-D3zzoTAG.cjs";
|
|
4
4
|
//#region src/protocols/mcp/protocol.d.ts
|
|
5
5
|
type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as McpDefinition } from "../../types-
|
|
2
|
-
import { t as MetricsRecorder } from "../../base-
|
|
3
|
-
import { t as McpRuntimeOptions } from "../../authorize-
|
|
1
|
+
import { c as McpDefinition } from "../../types-C0Wgm9zp.js";
|
|
2
|
+
import { t as MetricsRecorder } from "../../base-D-dYxK8t.js";
|
|
3
|
+
import { t as McpRuntimeOptions } from "../../authorize-Y6Jm8GhR.js";
|
|
4
4
|
//#region src/protocols/mcp/protocol.d.ts
|
|
5
5
|
type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
|
|
6
6
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createMcpProtocolHandler } from "../../mcp-
|
|
1
|
+
import { t as createMcpProtocolHandler } from "../../mcp-CoVt8EO9.js";
|
|
2
2
|
export { createMcpProtocolHandler };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_logger = require("../logger-
|
|
3
|
-
const require_cors = require("../cors-
|
|
2
|
+
const require_logger = require("../logger-BSKbuM66.cjs");
|
|
3
|
+
const require_cors = require("../cors-DW1p9Uzw.cjs");
|
|
4
4
|
//#region src/protocols/oauth-metadata.ts
|
|
5
5
|
function notFound() {
|
|
6
6
|
return require_cors.withCors(new Response(JSON.stringify({ error: "not found" }), {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as McpDefinition } from "../types-
|
|
2
|
-
import { t as McpRuntimeOptions } from "../authorize-
|
|
1
|
+
import { c as McpDefinition } from "../types-C0Wgm9zp.cjs";
|
|
2
|
+
import { t as McpRuntimeOptions } from "../authorize-D3zzoTAG.cjs";
|
|
3
3
|
//#region src/protocols/oauth-metadata.d.ts
|
|
4
4
|
type OAuthProtectedResourceMetadataHandler = (request: Request) => Promise<Response>;
|
|
5
5
|
declare function createOAuthProtectedResourceMetadataHandler(mcp: McpDefinition, options?: McpRuntimeOptions): OAuthProtectedResourceMetadataHandler;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as McpDefinition } from "../types-
|
|
2
|
-
import { t as McpRuntimeOptions } from "../authorize-
|
|
1
|
+
import { c as McpDefinition } from "../types-C0Wgm9zp.js";
|
|
2
|
+
import { t as McpRuntimeOptions } from "../authorize-Y6Jm8GhR.js";
|
|
3
3
|
//#region src/protocols/oauth-metadata.d.ts
|
|
4
4
|
type OAuthProtectedResourceMetadataHandler = (request: Request) => Promise<Response>;
|
|
5
5
|
declare function createOAuthProtectedResourceMetadataHandler(mcp: McpDefinition, options?: McpRuntimeOptions): OAuthProtectedResourceMetadataHandler;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as log, r as describeError } from "../logger-
|
|
2
|
-
import { a as getOAuthRuntime, c as resolveProtectedResource, f as JSON_HEADERS, m as methodNotAllowed, n as withCors, o as oauthConfigurationErrorResponse, p as headResponse, t as corsPreflightResponse } from "../cors-
|
|
1
|
+
import { i as log, r as describeError } from "../logger-3-kwsF-5.js";
|
|
2
|
+
import { a as getOAuthRuntime, c as resolveProtectedResource, f as JSON_HEADERS, m as methodNotAllowed, n as withCors, o as oauthConfigurationErrorResponse, p as headResponse, t as corsPreflightResponse } from "../cors-1Iz86PSf.js";
|
|
3
3
|
//#region src/protocols/oauth-metadata.ts
|
|
4
4
|
function notFound() {
|
|
5
5
|
return withCors(new Response(JSON.stringify({ error: "not found" }), {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_list_tools = require("../../list-tools-
|
|
3
|
-
const require_rest = require("../../rest-
|
|
2
|
+
const require_list_tools = require("../../list-tools-DBidJV3L.cjs");
|
|
3
|
+
const require_rest = require("../../rest-CvdOnTsb.cjs");
|
|
4
4
|
exports.createInvokeToolHandler = require_rest.createInvokeToolHandler;
|
|
5
5
|
exports.createListToolsHandler = require_list_tools.createListToolsHandler;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as McpDefinition } from "../../types-
|
|
2
|
-
import { t as MetricsRecorder } from "../../base-
|
|
3
|
-
import { t as McpRuntimeOptions } from "../../authorize-
|
|
4
|
-
import { n as createListToolsHandler, t as RestListToolsHandler } from "../../list-tools-
|
|
1
|
+
import { c as McpDefinition } from "../../types-C0Wgm9zp.cjs";
|
|
2
|
+
import { t as MetricsRecorder } from "../../base-D-dYxK8t.cjs";
|
|
3
|
+
import { t as McpRuntimeOptions } from "../../authorize-D3zzoTAG.cjs";
|
|
4
|
+
import { n as createListToolsHandler, t as RestListToolsHandler } from "../../list-tools-Dk-QKfqy.cjs";
|
|
5
5
|
//#region src/protocols/rest/invoke-tool.d.ts
|
|
6
6
|
type RestInvokeToolHandler = (request: Request, toolName: string, recorder?: MetricsRecorder) => Promise<Response>;
|
|
7
7
|
declare function createInvokeToolHandler(mcp: McpDefinition, options?: McpRuntimeOptions): RestInvokeToolHandler;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as McpDefinition } from "../../types-
|
|
2
|
-
import { t as MetricsRecorder } from "../../base-
|
|
3
|
-
import { t as McpRuntimeOptions } from "../../authorize-
|
|
4
|
-
import { n as createListToolsHandler, t as RestListToolsHandler } from "../../list-tools-
|
|
1
|
+
import { c as McpDefinition } from "../../types-C0Wgm9zp.js";
|
|
2
|
+
import { t as MetricsRecorder } from "../../base-D-dYxK8t.js";
|
|
3
|
+
import { t as McpRuntimeOptions } from "../../authorize-Y6Jm8GhR.js";
|
|
4
|
+
import { n as createListToolsHandler, t as RestListToolsHandler } from "../../list-tools-DKz6nJQ6.js";
|
|
5
5
|
//#region src/protocols/rest/invoke-tool.d.ts
|
|
6
6
|
type RestInvokeToolHandler = (request: Request, toolName: string, recorder?: MetricsRecorder) => Promise<Response>;
|
|
7
7
|
declare function createInvokeToolHandler(mcp: McpDefinition, options?: McpRuntimeOptions): RestInvokeToolHandler;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as createListToolsHandler } from "../../list-tools-
|
|
2
|
-
import { t as createInvokeToolHandler } from "../../rest-
|
|
1
|
+
import { n as createListToolsHandler } from "../../list-tools-DjzEigXr.js";
|
|
2
|
+
import { t as createInvokeToolHandler } from "../../rest-DdQMWvF4.js";
|
|
3
3
|
export { createInvokeToolHandler, createListToolsHandler };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_context = require("./context-BweeEcoA.cjs");
|
|
2
|
-
const require_cors = require("./cors-
|
|
2
|
+
const require_cors = require("./cors-DW1p9Uzw.cjs");
|
|
3
3
|
const require_content = require("./content-NCYIGgOb.cjs");
|
|
4
|
-
require("./list-tools-
|
|
4
|
+
require("./list-tools-DBidJV3L.cjs");
|
|
5
5
|
let _modelcontextprotocol_sdk_server_zod_compat_js = require("@modelcontextprotocol/sdk/server/zod-compat.js");
|
|
6
6
|
//#region src/protocols/rest/invoke-tool.ts
|
|
7
7
|
const MAX_REFLECTED_TOOL_NAME = 256;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as ToolContext } from "./context-CIpPzN7P.js";
|
|
2
|
-
import { d as nowMs, f as JSON_HEADERS, i as createRequestAuthorizer, m as methodNotAllowed, n as withCors, r as assertRestResourceBinding, t as corsPreflightResponse, u as createNoopRecorder } from "./cors-
|
|
2
|
+
import { d as nowMs, f as JSON_HEADERS, i as createRequestAuthorizer, m as methodNotAllowed, n as withCors, r as assertRestResourceBinding, t as corsPreflightResponse, u as createNoopRecorder } from "./cors-1Iz86PSf.js";
|
|
3
3
|
import { t as extractTextContent } from "./content-D5LJAHyM.js";
|
|
4
|
-
import "./list-tools-
|
|
4
|
+
import "./list-tools-DjzEigXr.js";
|
|
5
5
|
import { getParseErrorMessage, objectFromShape, safeParseAsync } from "@modelcontextprotocol/sdk/server/zod-compat.js";
|
|
6
6
|
//#region src/protocols/rest/invoke-tool.ts
|
|
7
7
|
const MAX_REFLECTED_TOOL_NAME = 256;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_logger = require("../../logger-
|
|
3
|
-
const require_cors = require("../../cors-
|
|
2
|
+
const require_logger = require("../../logger-BSKbuM66.cjs");
|
|
3
|
+
const require_cors = require("../../cors-DW1p9Uzw.cjs");
|
|
4
4
|
const require_metadata_path = require("../../metadata-path-zd7NSNoa.cjs");
|
|
5
|
-
const require_mcp = require("../../mcp-
|
|
5
|
+
const require_mcp = require("../../mcp-DSo7xlpz.cjs");
|
|
6
6
|
const require_protocols_oauth_metadata = require("../../protocols/oauth-metadata.cjs");
|
|
7
|
-
const require_list_tools = require("../../list-tools-
|
|
8
|
-
const require_rest = require("../../rest-
|
|
7
|
+
const require_list_tools = require("../../list-tools-DBidJV3L.cjs");
|
|
8
|
+
const require_rest = require("../../rest-CvdOnTsb.cjs");
|
|
9
9
|
const require_forwarded = require("../../forwarded-Pi8Hs5Ps.cjs");
|
|
10
10
|
const require_paths = require("../../paths-OP318a6c.cjs");
|
|
11
11
|
//#region src/stacks/supabase/handler.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as McpDefinition } from "../../types-
|
|
1
|
+
import { c as McpDefinition } from "../../types-C0Wgm9zp.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 { c as McpDefinition } from "../../types-
|
|
1
|
+
import { c as McpDefinition } from "../../types-C0Wgm9zp.js";
|
|
2
2
|
//#region src/stacks/supabase/handler.d.ts
|
|
3
3
|
type SupabaseHandler = (request: Request) => Promise<Response>;
|
|
4
4
|
interface SupabaseHandlerOptions {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { s as trimTrailingSlash } from "../../logger-
|
|
2
|
-
import { l as createRecorderForRuntime, s as assertResourcePathShape } from "../../cors-
|
|
1
|
+
import { s as trimTrailingSlash } from "../../logger-3-kwsF-5.js";
|
|
2
|
+
import { l as createRecorderForRuntime, s as assertResourcePathShape } from "../../cors-1Iz86PSf.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-CoVt8EO9.js";
|
|
5
5
|
import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
|
|
6
|
-
import { n as createListToolsHandler } from "../../list-tools-
|
|
7
|
-
import { t as createInvokeToolHandler } from "../../rest-
|
|
6
|
+
import { n as createListToolsHandler } from "../../list-tools-DjzEigXr.js";
|
|
7
|
+
import { t as createInvokeToolHandler } from "../../rest-DdQMWvF4.js";
|
|
8
8
|
import { t as applyForwardedOrigin } from "../../forwarded--h4efJy-.js";
|
|
9
9
|
import { n as assertFunctionName, t as FUNCTIONS_MOUNT_PREFIX } from "../../paths-IS65L6TA.js";
|
|
10
10
|
//#region src/stacks/supabase/handler.ts
|
|
@@ -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-Wvf1u2OZ.cjs");
|
|
6
6
|
const require_fs_errors = require("../../fs-errors-CWNzOV75.cjs");
|
|
7
7
|
const require_supabase_config = require("../../supabase-config-Dz7dnUv0.cjs");
|
|
8
8
|
const require_paths = require("../../paths-OP318a6c.cjs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as version } from "../../package-
|
|
1
|
+
import { t as version } from "../../package-CUrmd7C5.js";
|
|
2
2
|
import { t as isFileMissing } from "../../fs-errors-PA2t1TIp.js";
|
|
3
3
|
import { t as readSupabaseProjectRef } from "../../supabase-config-CakTU8YF.js";
|
|
4
4
|
import { n as assertFunctionName, t as FUNCTIONS_MOUNT_PREFIX } from "../../paths-IS65L6TA.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_cors = require("../../cors-
|
|
3
|
-
const require_mcp = require("../../mcp-
|
|
2
|
+
const require_cors = require("../../cors-DW1p9Uzw.cjs");
|
|
3
|
+
const require_mcp = require("../../mcp-DSo7xlpz.cjs");
|
|
4
4
|
const require_protocols_oauth_metadata = require("../../protocols/oauth-metadata.cjs");
|
|
5
|
-
const require_list_tools = require("../../list-tools-
|
|
6
|
-
const require_rest = require("../../rest-
|
|
5
|
+
const require_list_tools = require("../../list-tools-DBidJV3L.cjs");
|
|
6
|
+
const require_rest = require("../../rest-CvdOnTsb.cjs");
|
|
7
7
|
const require_forwarded = require("../../forwarded-Pi8Hs5Ps.cjs");
|
|
8
8
|
//#region src/stacks/tanstack/handlers.ts
|
|
9
9
|
const STACK = "tanstack";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as McpDefinition } from "../../types-
|
|
2
|
-
import { t as McpRuntimeOptions } from "../../authorize-
|
|
1
|
+
import { c as McpDefinition } from "../../types-C0Wgm9zp.cjs";
|
|
2
|
+
import { t as McpRuntimeOptions } from "../../authorize-D3zzoTAG.cjs";
|
|
3
3
|
//#region src/stacks/tanstack/handlers.d.ts
|
|
4
4
|
interface TanStackRouteCtx {
|
|
5
5
|
request: Request;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as McpDefinition } from "../../types-
|
|
2
|
-
import { t as McpRuntimeOptions } from "../../authorize-
|
|
1
|
+
import { c as McpDefinition } from "../../types-C0Wgm9zp.js";
|
|
2
|
+
import { t as McpRuntimeOptions } from "../../authorize-Y6Jm8GhR.js";
|
|
3
3
|
//#region src/stacks/tanstack/handlers.d.ts
|
|
4
4
|
interface TanStackRouteCtx {
|
|
5
5
|
request: Request;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { l as createRecorderForRuntime } from "../../cors-
|
|
2
|
-
import { t as createMcpProtocolHandler } from "../../mcp-
|
|
1
|
+
import { l as createRecorderForRuntime } from "../../cors-1Iz86PSf.js";
|
|
2
|
+
import { t as createMcpProtocolHandler } from "../../mcp-CoVt8EO9.js";
|
|
3
3
|
import { createOAuthProtectedResourceMetadataHandler } from "../../protocols/oauth-metadata.js";
|
|
4
|
-
import { n as createListToolsHandler } from "../../list-tools-
|
|
5
|
-
import { t as createInvokeToolHandler } from "../../rest-
|
|
4
|
+
import { n as createListToolsHandler } from "../../list-tools-DjzEigXr.js";
|
|
5
|
+
import { t as createInvokeToolHandler } from "../../rest-DdQMWvF4.js";
|
|
6
6
|
import { t as applyForwardedOrigin } from "../../forwarded--h4efJy-.js";
|
|
7
7
|
//#region src/stacks/tanstack/handlers.ts
|
|
8
8
|
const STACK = "tanstack";
|
|
@@ -128,7 +128,7 @@ interface MetricsOptions {
|
|
|
128
128
|
enabled?: boolean;
|
|
129
129
|
/** OTLP/HTTP (JSON) logs URL to POST each invocation to — the default Lovable
|
|
130
130
|
* route or any OTLP collector. Must be an absolute http(s) URL.
|
|
131
|
-
* @default "https://api.lovable.dev/v1/app-mcp-usage" */
|
|
131
|
+
* @default "https://api.lovable.dev/internal/v1/app-mcp-usage" */
|
|
132
132
|
endpoint?: string;
|
|
133
133
|
/** Extra request headers — e.g. the auth token for a private OTLP collector.
|
|
134
134
|
* Sent verbatim with every request (and baked into the build output, so source
|
|
@@ -128,7 +128,7 @@ interface MetricsOptions {
|
|
|
128
128
|
enabled?: boolean;
|
|
129
129
|
/** OTLP/HTTP (JSON) logs URL to POST each invocation to — the default Lovable
|
|
130
130
|
* route or any OTLP collector. Must be an absolute http(s) URL.
|
|
131
|
-
* @default "https://api.lovable.dev/v1/app-mcp-usage" */
|
|
131
|
+
* @default "https://api.lovable.dev/internal/v1/app-mcp-usage" */
|
|
132
132
|
endpoint?: string;
|
|
133
133
|
/** Extra request headers — e.g. the auth token for a private OTLP collector.
|
|
134
134
|
* Sent verbatim with every request (and baked into the build output, so source
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovable.dev/mcp-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
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": {
|