@lovable.dev/mcp-js 0.21.0-rc.1 → 0.21.0-rc.2
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/{base-RSqYamjy.d.ts → base-DTtaX5Rf.d.ts} +1 -1
- package/dist/{chunk-KKAXS2RA.js → chunk-4H3Y2KYT.js} +1 -1
- package/dist/{chunk-KI5LOYRQ.js → chunk-7TVARTF4.js} +1 -1
- package/dist/{chunk-D32HYMP7.js → chunk-IRCVDFWG.js} +16 -11
- package/dist/{chunk-V6LIWJJB.js → chunk-OIRVEGPQ.js} +1 -1
- package/dist/{chunk-ZFPENIDM.js → chunk-WOKM6B6H.js} +1 -1
- package/dist/{chunk-MYVH5NU2.js → chunk-YE6N7XLA.js} +1 -1
- package/dist/cli/extract-manifest.cjs +1 -1
- package/dist/cli/extract-manifest.js +3 -3
- package/dist/protocols/mcp/index.cjs +15 -10
- package/dist/protocols/mcp/index.d.cts +1 -1
- package/dist/protocols/mcp/index.d.ts +1 -1
- package/dist/protocols/mcp/index.js +3 -3
- package/dist/protocols/oauth-metadata.cjs +11 -6
- package/dist/protocols/oauth-metadata.js +3 -3
- package/dist/protocols/rest/index.cjs +15 -10
- package/dist/protocols/rest/index.d.cts +1 -1
- package/dist/protocols/rest/index.d.ts +1 -1
- package/dist/protocols/rest/index.js +4 -4
- package/dist/stacks/supabase/index.cjs +16 -11
- package/dist/stacks/supabase/index.js +6 -6
- package/dist/stacks/supabase/vite.cjs +1 -1
- package/dist/stacks/supabase/vite.js +1 -1
- package/dist/stacks/tanstack/index.cjs +16 -11
- package/dist/stacks/tanstack/index.js +6 -6
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "
|
|
1
|
+
type InvocationOutcome = "ok" | "tool_error" | "handler_error" | "transport_error" | "auth_discovery_config_error" | "auth_discovery_unreachable" | "auth_jwks_config_error" | "auth_jwks_unreachable";
|
|
2
2
|
/** One recorded MCP call. Carries no arguments or response payloads — only the
|
|
3
3
|
* tool name, the JSON-RPC method, the result class, timing, and byte sizes. */
|
|
4
4
|
interface InvocationRecord {
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-6DXGZZA4.js";
|
|
14
14
|
import {
|
|
15
15
|
version
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-OIRVEGPQ.js";
|
|
17
17
|
|
|
18
18
|
// src/core/http.ts
|
|
19
19
|
var JSON_HEADERS = { "Content-Type": "application/json" };
|
|
@@ -284,14 +284,16 @@ function cachedPromise(load, label) {
|
|
|
284
284
|
|
|
285
285
|
// src/auth/discovery.ts
|
|
286
286
|
var OAuthConfigurationError = class extends Error {
|
|
287
|
-
constructor(message) {
|
|
287
|
+
constructor(message, stage) {
|
|
288
288
|
super(message);
|
|
289
|
+
this.stage = stage;
|
|
289
290
|
this.name = "OAuthConfigurationError";
|
|
290
291
|
}
|
|
291
292
|
};
|
|
292
293
|
var OAuthUpstreamUnreachableError = class extends Error {
|
|
293
|
-
constructor(message) {
|
|
294
|
+
constructor(message, stage) {
|
|
294
295
|
super(message);
|
|
296
|
+
this.stage = stage;
|
|
295
297
|
this.name = "OAuthUpstreamUnreachableError";
|
|
296
298
|
}
|
|
297
299
|
};
|
|
@@ -381,14 +383,14 @@ async function fetchIssuerOAuthServerMetadata(issuer) {
|
|
|
381
383
|
...describeError(err),
|
|
382
384
|
outcome: "503 authorization server unreachable"
|
|
383
385
|
});
|
|
384
|
-
throw new OAuthUpstreamUnreachableError(message);
|
|
386
|
+
throw new OAuthUpstreamUnreachableError(message, "discovery");
|
|
385
387
|
}
|
|
386
388
|
log.error("oauth.discovery.config_error", {
|
|
387
389
|
issuer,
|
|
388
390
|
...describeError(err),
|
|
389
391
|
outcome: "500 oauth configuration error"
|
|
390
392
|
});
|
|
391
|
-
throw new OAuthConfigurationError(message);
|
|
393
|
+
throw new OAuthConfigurationError(message, "discovery");
|
|
392
394
|
}
|
|
393
395
|
}
|
|
394
396
|
function createOAuthDiscoveryResolver(auth) {
|
|
@@ -459,7 +461,10 @@ async function fetchVerificationKeySet(jwksUri) {
|
|
|
459
461
|
response = await fetch(jwksUri, { signal: AbortSignal.timeout(JWKS_FETCH_TIMEOUT_MS), redirect: "manual" });
|
|
460
462
|
} catch (err) {
|
|
461
463
|
log.error("oauth.jwks.unreachable", { ...describeError(err), outcome: "503 authorization server unreachable" });
|
|
462
|
-
throw new OAuthUpstreamUnreachableError(
|
|
464
|
+
throw new OAuthUpstreamUnreachableError(
|
|
465
|
+
`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
466
|
+
"jwks"
|
|
467
|
+
);
|
|
463
468
|
}
|
|
464
469
|
try {
|
|
465
470
|
if (!response.ok)
|
|
@@ -468,7 +473,7 @@ async function fetchVerificationKeySet(jwksUri) {
|
|
|
468
473
|
return createLocalJWKSet(json);
|
|
469
474
|
} catch (err) {
|
|
470
475
|
log.error("oauth.jwks.fetch_failed", { ...describeError(err), outcome: "500 oauth configuration error" });
|
|
471
|
-
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}
|
|
476
|
+
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`, "jwks");
|
|
472
477
|
}
|
|
473
478
|
}
|
|
474
479
|
function assertAccessTokenTyp(token, allowed) {
|
|
@@ -681,21 +686,21 @@ function createRequestAuthorizer(mcp, options = {}) {
|
|
|
681
686
|
return { ok: true, auth };
|
|
682
687
|
} catch (err) {
|
|
683
688
|
if (err instanceof OAuthUpstreamUnreachableError) {
|
|
684
|
-
log.error("auth.upstream_unreachable", { ...describeError(err), outcome: "503" });
|
|
689
|
+
log.error("auth.upstream_unreachable", { ...describeError(err), stage: err.stage, outcome: "503" });
|
|
685
690
|
await recorder?.emit({
|
|
686
691
|
tool: null,
|
|
687
692
|
method: "authorize",
|
|
688
|
-
outcome: "
|
|
693
|
+
outcome: err.stage === "jwks" ? "auth_jwks_unreachable" : "auth_discovery_unreachable",
|
|
689
694
|
durationMs: nowMs() - startedAt
|
|
690
695
|
});
|
|
691
696
|
return { ok: false, response: oauthUpstreamUnreachableResponse() };
|
|
692
697
|
}
|
|
693
698
|
if (err instanceof OAuthConfigurationError) {
|
|
694
|
-
log.error("auth.config_error", { ...describeError(err), outcome: "500" });
|
|
699
|
+
log.error("auth.config_error", { ...describeError(err), stage: err.stage, outcome: "500" });
|
|
695
700
|
await recorder?.emit({
|
|
696
701
|
tool: null,
|
|
697
702
|
method: "authorize",
|
|
698
|
-
outcome: "
|
|
703
|
+
outcome: err.stage === "jwks" ? "auth_jwks_config_error" : "auth_discovery_config_error",
|
|
699
704
|
durationMs: nowMs() - startedAt
|
|
700
705
|
});
|
|
701
706
|
return { ok: false, response: oauthConfigurationErrorResponse() };
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
methodNotAllowed,
|
|
11
11
|
nowMs,
|
|
12
12
|
withCors
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-IRCVDFWG.js";
|
|
14
14
|
|
|
15
15
|
// src/protocols/rest/invoke-tool.ts
|
|
16
16
|
import { getParseErrorMessage, objectFromShape, safeParseAsync } from "@modelcontextprotocol/sdk/server/zod-compat.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
buildMcpListing
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-YE6N7XLA.js";
|
|
5
|
+
import "../chunk-IRCVDFWG.js";
|
|
6
6
|
import "../chunk-H37EB22A.js";
|
|
7
7
|
import "../chunk-6DXGZZA4.js";
|
|
8
8
|
import {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "../chunk-Y3ZFPEQH.js";
|
|
11
11
|
import {
|
|
12
12
|
version
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-OIRVEGPQ.js";
|
|
14
14
|
|
|
15
15
|
// src/manifest/io.ts
|
|
16
16
|
import { randomUUID } from "crypto";
|
|
@@ -148,14 +148,16 @@ function parseSafeUrl(subject, raw, ErrorClass = Error) {
|
|
|
148
148
|
|
|
149
149
|
// src/auth/discovery.ts
|
|
150
150
|
var OAuthConfigurationError = class extends Error {
|
|
151
|
-
constructor(message) {
|
|
151
|
+
constructor(message, stage) {
|
|
152
152
|
super(message);
|
|
153
|
+
this.stage = stage;
|
|
153
154
|
this.name = "OAuthConfigurationError";
|
|
154
155
|
}
|
|
155
156
|
};
|
|
156
157
|
var OAuthUpstreamUnreachableError = class extends Error {
|
|
157
|
-
constructor(message) {
|
|
158
|
+
constructor(message, stage) {
|
|
158
159
|
super(message);
|
|
160
|
+
this.stage = stage;
|
|
159
161
|
this.name = "OAuthUpstreamUnreachableError";
|
|
160
162
|
}
|
|
161
163
|
};
|
|
@@ -245,14 +247,14 @@ async function fetchIssuerOAuthServerMetadata(issuer) {
|
|
|
245
247
|
...describeError(err),
|
|
246
248
|
outcome: "503 authorization server unreachable"
|
|
247
249
|
});
|
|
248
|
-
throw new OAuthUpstreamUnreachableError(message);
|
|
250
|
+
throw new OAuthUpstreamUnreachableError(message, "discovery");
|
|
249
251
|
}
|
|
250
252
|
log.error("oauth.discovery.config_error", {
|
|
251
253
|
issuer,
|
|
252
254
|
...describeError(err),
|
|
253
255
|
outcome: "500 oauth configuration error"
|
|
254
256
|
});
|
|
255
|
-
throw new OAuthConfigurationError(message);
|
|
257
|
+
throw new OAuthConfigurationError(message, "discovery");
|
|
256
258
|
}
|
|
257
259
|
}
|
|
258
260
|
function createOAuthDiscoveryResolver(auth) {
|
|
@@ -350,7 +352,10 @@ async function fetchVerificationKeySet(jwksUri) {
|
|
|
350
352
|
response = await fetch(jwksUri, { signal: AbortSignal.timeout(JWKS_FETCH_TIMEOUT_MS), redirect: "manual" });
|
|
351
353
|
} catch (err) {
|
|
352
354
|
log.error("oauth.jwks.unreachable", { ...describeError(err), outcome: "503 authorization server unreachable" });
|
|
353
|
-
throw new OAuthUpstreamUnreachableError(
|
|
355
|
+
throw new OAuthUpstreamUnreachableError(
|
|
356
|
+
`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
357
|
+
"jwks"
|
|
358
|
+
);
|
|
354
359
|
}
|
|
355
360
|
try {
|
|
356
361
|
if (!response.ok)
|
|
@@ -359,7 +364,7 @@ async function fetchVerificationKeySet(jwksUri) {
|
|
|
359
364
|
return (0, import_jose.createLocalJWKSet)(json);
|
|
360
365
|
} catch (err) {
|
|
361
366
|
log.error("oauth.jwks.fetch_failed", { ...describeError(err), outcome: "500 oauth configuration error" });
|
|
362
|
-
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}
|
|
367
|
+
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`, "jwks");
|
|
363
368
|
}
|
|
364
369
|
}
|
|
365
370
|
function assertAccessTokenTyp(token, allowed) {
|
|
@@ -564,21 +569,21 @@ function createRequestAuthorizer(mcp, options = {}) {
|
|
|
564
569
|
return { ok: true, auth };
|
|
565
570
|
} catch (err) {
|
|
566
571
|
if (err instanceof OAuthUpstreamUnreachableError) {
|
|
567
|
-
log.error("auth.upstream_unreachable", { ...describeError(err), outcome: "503" });
|
|
572
|
+
log.error("auth.upstream_unreachable", { ...describeError(err), stage: err.stage, outcome: "503" });
|
|
568
573
|
await recorder?.emit({
|
|
569
574
|
tool: null,
|
|
570
575
|
method: "authorize",
|
|
571
|
-
outcome: "
|
|
576
|
+
outcome: err.stage === "jwks" ? "auth_jwks_unreachable" : "auth_discovery_unreachable",
|
|
572
577
|
durationMs: nowMs() - startedAt
|
|
573
578
|
});
|
|
574
579
|
return { ok: false, response: oauthUpstreamUnreachableResponse() };
|
|
575
580
|
}
|
|
576
581
|
if (err instanceof OAuthConfigurationError) {
|
|
577
|
-
log.error("auth.config_error", { ...describeError(err), outcome: "500" });
|
|
582
|
+
log.error("auth.config_error", { ...describeError(err), stage: err.stage, outcome: "500" });
|
|
578
583
|
await recorder?.emit({
|
|
579
584
|
tool: null,
|
|
580
585
|
method: "authorize",
|
|
581
|
-
outcome: "
|
|
586
|
+
outcome: err.stage === "jwks" ? "auth_jwks_config_error" : "auth_discovery_config_error",
|
|
582
587
|
durationMs: nowMs() - startedAt
|
|
583
588
|
});
|
|
584
589
|
return { ok: false, response: oauthConfigurationErrorResponse() };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as McpRuntimeOptions } from '../../authorize-BMeXd_Sh.js';
|
|
2
2
|
import { d as McpDefinition } from '../../types-CPkhCRxc.js';
|
|
3
|
-
import { M as MetricsRecorder } from '../../base-
|
|
3
|
+
import { M as MetricsRecorder } from '../../base-DTtaX5Rf.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
6
6
|
type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as McpRuntimeOptions } from '../../authorize-BMeXd_Sh.js';
|
|
2
2
|
import { d as McpDefinition } from '../../types-CPkhCRxc.js';
|
|
3
|
-
import { M as MetricsRecorder } from '../../base-
|
|
3
|
+
import { M as MetricsRecorder } from '../../base-DTtaX5Rf.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
6
6
|
type McpProtocolHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createMcpProtocolHandler
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-4H3Y2KYT.js";
|
|
4
4
|
import "../../chunk-MA5H6PSF.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-IRCVDFWG.js";
|
|
6
6
|
import "../../chunk-H37EB22A.js";
|
|
7
7
|
import "../../chunk-6DXGZZA4.js";
|
|
8
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-OIRVEGPQ.js";
|
|
9
9
|
export {
|
|
10
10
|
createMcpProtocolHandler
|
|
11
11
|
};
|
|
@@ -143,14 +143,16 @@ function parseSafeUrl(subject, raw, ErrorClass = Error) {
|
|
|
143
143
|
|
|
144
144
|
// src/auth/discovery.ts
|
|
145
145
|
var OAuthConfigurationError = class extends Error {
|
|
146
|
-
constructor(message) {
|
|
146
|
+
constructor(message, stage) {
|
|
147
147
|
super(message);
|
|
148
|
+
this.stage = stage;
|
|
148
149
|
this.name = "OAuthConfigurationError";
|
|
149
150
|
}
|
|
150
151
|
};
|
|
151
152
|
var OAuthUpstreamUnreachableError = class extends Error {
|
|
152
|
-
constructor(message) {
|
|
153
|
+
constructor(message, stage) {
|
|
153
154
|
super(message);
|
|
155
|
+
this.stage = stage;
|
|
154
156
|
this.name = "OAuthUpstreamUnreachableError";
|
|
155
157
|
}
|
|
156
158
|
};
|
|
@@ -240,14 +242,14 @@ async function fetchIssuerOAuthServerMetadata(issuer) {
|
|
|
240
242
|
...describeError(err),
|
|
241
243
|
outcome: "503 authorization server unreachable"
|
|
242
244
|
});
|
|
243
|
-
throw new OAuthUpstreamUnreachableError(message);
|
|
245
|
+
throw new OAuthUpstreamUnreachableError(message, "discovery");
|
|
244
246
|
}
|
|
245
247
|
log.error("oauth.discovery.config_error", {
|
|
246
248
|
issuer,
|
|
247
249
|
...describeError(err),
|
|
248
250
|
outcome: "500 oauth configuration error"
|
|
249
251
|
});
|
|
250
|
-
throw new OAuthConfigurationError(message);
|
|
252
|
+
throw new OAuthConfigurationError(message, "discovery");
|
|
251
253
|
}
|
|
252
254
|
}
|
|
253
255
|
function createOAuthDiscoveryResolver(auth) {
|
|
@@ -342,7 +344,10 @@ async function fetchVerificationKeySet(jwksUri) {
|
|
|
342
344
|
response = await fetch(jwksUri, { signal: AbortSignal.timeout(JWKS_FETCH_TIMEOUT_MS), redirect: "manual" });
|
|
343
345
|
} catch (err) {
|
|
344
346
|
log.error("oauth.jwks.unreachable", { ...describeError(err), outcome: "503 authorization server unreachable" });
|
|
345
|
-
throw new OAuthUpstreamUnreachableError(
|
|
347
|
+
throw new OAuthUpstreamUnreachableError(
|
|
348
|
+
`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
349
|
+
"jwks"
|
|
350
|
+
);
|
|
346
351
|
}
|
|
347
352
|
try {
|
|
348
353
|
if (!response.ok)
|
|
@@ -351,7 +356,7 @@ async function fetchVerificationKeySet(jwksUri) {
|
|
|
351
356
|
return (0, import_jose.createLocalJWKSet)(json);
|
|
352
357
|
} catch (err) {
|
|
353
358
|
log.error("oauth.jwks.fetch_failed", { ...describeError(err), outcome: "500 oauth configuration error" });
|
|
354
|
-
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}
|
|
359
|
+
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`, "jwks");
|
|
355
360
|
}
|
|
356
361
|
}
|
|
357
362
|
function assertAccessTokenTyp(token, allowed) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createOAuthProtectedResourceMetadataHandler
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-7TVARTF4.js";
|
|
4
|
+
import "../chunk-IRCVDFWG.js";
|
|
5
5
|
import "../chunk-H37EB22A.js";
|
|
6
6
|
import "../chunk-6DXGZZA4.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-OIRVEGPQ.js";
|
|
8
8
|
export {
|
|
9
9
|
createOAuthProtectedResourceMetadataHandler
|
|
10
10
|
};
|
|
@@ -158,14 +158,16 @@ function parseSafeUrl(subject, raw, ErrorClass = Error) {
|
|
|
158
158
|
|
|
159
159
|
// src/auth/discovery.ts
|
|
160
160
|
var OAuthConfigurationError = class extends Error {
|
|
161
|
-
constructor(message) {
|
|
161
|
+
constructor(message, stage) {
|
|
162
162
|
super(message);
|
|
163
|
+
this.stage = stage;
|
|
163
164
|
this.name = "OAuthConfigurationError";
|
|
164
165
|
}
|
|
165
166
|
};
|
|
166
167
|
var OAuthUpstreamUnreachableError = class extends Error {
|
|
167
|
-
constructor(message) {
|
|
168
|
+
constructor(message, stage) {
|
|
168
169
|
super(message);
|
|
170
|
+
this.stage = stage;
|
|
169
171
|
this.name = "OAuthUpstreamUnreachableError";
|
|
170
172
|
}
|
|
171
173
|
};
|
|
@@ -255,14 +257,14 @@ async function fetchIssuerOAuthServerMetadata(issuer) {
|
|
|
255
257
|
...describeError(err),
|
|
256
258
|
outcome: "503 authorization server unreachable"
|
|
257
259
|
});
|
|
258
|
-
throw new OAuthUpstreamUnreachableError(message);
|
|
260
|
+
throw new OAuthUpstreamUnreachableError(message, "discovery");
|
|
259
261
|
}
|
|
260
262
|
log.error("oauth.discovery.config_error", {
|
|
261
263
|
issuer,
|
|
262
264
|
...describeError(err),
|
|
263
265
|
outcome: "500 oauth configuration error"
|
|
264
266
|
});
|
|
265
|
-
throw new OAuthConfigurationError(message);
|
|
267
|
+
throw new OAuthConfigurationError(message, "discovery");
|
|
266
268
|
}
|
|
267
269
|
}
|
|
268
270
|
function createOAuthDiscoveryResolver(auth) {
|
|
@@ -360,7 +362,10 @@ async function fetchVerificationKeySet(jwksUri) {
|
|
|
360
362
|
response = await fetch(jwksUri, { signal: AbortSignal.timeout(JWKS_FETCH_TIMEOUT_MS), redirect: "manual" });
|
|
361
363
|
} catch (err) {
|
|
362
364
|
log.error("oauth.jwks.unreachable", { ...describeError(err), outcome: "503 authorization server unreachable" });
|
|
363
|
-
throw new OAuthUpstreamUnreachableError(
|
|
365
|
+
throw new OAuthUpstreamUnreachableError(
|
|
366
|
+
`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
367
|
+
"jwks"
|
|
368
|
+
);
|
|
364
369
|
}
|
|
365
370
|
try {
|
|
366
371
|
if (!response.ok)
|
|
@@ -369,7 +374,7 @@ async function fetchVerificationKeySet(jwksUri) {
|
|
|
369
374
|
return (0, import_jose.createLocalJWKSet)(json);
|
|
370
375
|
} catch (err) {
|
|
371
376
|
log.error("oauth.jwks.fetch_failed", { ...describeError(err), outcome: "500 oauth configuration error" });
|
|
372
|
-
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}
|
|
377
|
+
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`, "jwks");
|
|
373
378
|
}
|
|
374
379
|
}
|
|
375
380
|
function assertAccessTokenTyp(token, allowed) {
|
|
@@ -582,21 +587,21 @@ function createRequestAuthorizer(mcp, options = {}) {
|
|
|
582
587
|
return { ok: true, auth };
|
|
583
588
|
} catch (err) {
|
|
584
589
|
if (err instanceof OAuthUpstreamUnreachableError) {
|
|
585
|
-
log.error("auth.upstream_unreachable", { ...describeError(err), outcome: "503" });
|
|
590
|
+
log.error("auth.upstream_unreachable", { ...describeError(err), stage: err.stage, outcome: "503" });
|
|
586
591
|
await recorder?.emit({
|
|
587
592
|
tool: null,
|
|
588
593
|
method: "authorize",
|
|
589
|
-
outcome: "
|
|
594
|
+
outcome: err.stage === "jwks" ? "auth_jwks_unreachable" : "auth_discovery_unreachable",
|
|
590
595
|
durationMs: nowMs() - startedAt
|
|
591
596
|
});
|
|
592
597
|
return { ok: false, response: oauthUpstreamUnreachableResponse() };
|
|
593
598
|
}
|
|
594
599
|
if (err instanceof OAuthConfigurationError) {
|
|
595
|
-
log.error("auth.config_error", { ...describeError(err), outcome: "500" });
|
|
600
|
+
log.error("auth.config_error", { ...describeError(err), stage: err.stage, outcome: "500" });
|
|
596
601
|
await recorder?.emit({
|
|
597
602
|
tool: null,
|
|
598
603
|
method: "authorize",
|
|
599
|
-
outcome: "
|
|
604
|
+
outcome: err.stage === "jwks" ? "auth_jwks_config_error" : "auth_discovery_config_error",
|
|
600
605
|
durationMs: nowMs() - startedAt
|
|
601
606
|
});
|
|
602
607
|
return { ok: false, response: oauthConfigurationErrorResponse() };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as McpRuntimeOptions } from '../../authorize-BMeXd_Sh.js';
|
|
2
2
|
import { d as McpDefinition } from '../../types-CPkhCRxc.js';
|
|
3
|
-
import { M as MetricsRecorder } from '../../base-
|
|
3
|
+
import { M as MetricsRecorder } from '../../base-DTtaX5Rf.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
6
6
|
type RestListToolsHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as McpRuntimeOptions } from '../../authorize-BMeXd_Sh.js';
|
|
2
2
|
import { d as McpDefinition } from '../../types-CPkhCRxc.js';
|
|
3
|
-
import { M as MetricsRecorder } from '../../base-
|
|
3
|
+
import { M as MetricsRecorder } from '../../base-DTtaX5Rf.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
6
6
|
type RestListToolsHandler = (request: Request, recorder?: MetricsRecorder) => Promise<Response>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createInvokeToolHandler
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-WOKM6B6H.js";
|
|
4
4
|
import {
|
|
5
5
|
createListToolsHandler
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-YE6N7XLA.js";
|
|
7
7
|
import "../../chunk-MA5H6PSF.js";
|
|
8
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-IRCVDFWG.js";
|
|
9
9
|
import "../../chunk-H37EB22A.js";
|
|
10
10
|
import "../../chunk-6DXGZZA4.js";
|
|
11
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-OIRVEGPQ.js";
|
|
12
12
|
export {
|
|
13
13
|
createInvokeToolHandler,
|
|
14
14
|
createListToolsHandler
|
|
@@ -174,7 +174,7 @@ function describeError(err) {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
// package.json
|
|
177
|
-
var version = "0.21.0-rc.
|
|
177
|
+
var version = "0.21.0-rc.2";
|
|
178
178
|
|
|
179
179
|
// src/metrics/otlp.ts
|
|
180
180
|
var SCOPE_NAME = "@lovable.dev/mcp-js";
|
|
@@ -440,14 +440,16 @@ function parseSafeUrl(subject, raw, ErrorClass = Error) {
|
|
|
440
440
|
|
|
441
441
|
// src/auth/discovery.ts
|
|
442
442
|
var OAuthConfigurationError = class extends Error {
|
|
443
|
-
constructor(message) {
|
|
443
|
+
constructor(message, stage) {
|
|
444
444
|
super(message);
|
|
445
|
+
this.stage = stage;
|
|
445
446
|
this.name = "OAuthConfigurationError";
|
|
446
447
|
}
|
|
447
448
|
};
|
|
448
449
|
var OAuthUpstreamUnreachableError = class extends Error {
|
|
449
|
-
constructor(message) {
|
|
450
|
+
constructor(message, stage) {
|
|
450
451
|
super(message);
|
|
452
|
+
this.stage = stage;
|
|
451
453
|
this.name = "OAuthUpstreamUnreachableError";
|
|
452
454
|
}
|
|
453
455
|
};
|
|
@@ -537,14 +539,14 @@ async function fetchIssuerOAuthServerMetadata(issuer) {
|
|
|
537
539
|
...describeError(err),
|
|
538
540
|
outcome: "503 authorization server unreachable"
|
|
539
541
|
});
|
|
540
|
-
throw new OAuthUpstreamUnreachableError(message);
|
|
542
|
+
throw new OAuthUpstreamUnreachableError(message, "discovery");
|
|
541
543
|
}
|
|
542
544
|
log.error("oauth.discovery.config_error", {
|
|
543
545
|
issuer,
|
|
544
546
|
...describeError(err),
|
|
545
547
|
outcome: "500 oauth configuration error"
|
|
546
548
|
});
|
|
547
|
-
throw new OAuthConfigurationError(message);
|
|
549
|
+
throw new OAuthConfigurationError(message, "discovery");
|
|
548
550
|
}
|
|
549
551
|
}
|
|
550
552
|
function createOAuthDiscoveryResolver(auth) {
|
|
@@ -615,7 +617,10 @@ async function fetchVerificationKeySet(jwksUri) {
|
|
|
615
617
|
response = await fetch(jwksUri, { signal: AbortSignal.timeout(JWKS_FETCH_TIMEOUT_MS), redirect: "manual" });
|
|
616
618
|
} catch (err) {
|
|
617
619
|
log.error("oauth.jwks.unreachable", { ...describeError(err), outcome: "503 authorization server unreachable" });
|
|
618
|
-
throw new OAuthUpstreamUnreachableError(
|
|
620
|
+
throw new OAuthUpstreamUnreachableError(
|
|
621
|
+
`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
622
|
+
"jwks"
|
|
623
|
+
);
|
|
619
624
|
}
|
|
620
625
|
try {
|
|
621
626
|
if (!response.ok)
|
|
@@ -624,7 +629,7 @@ async function fetchVerificationKeySet(jwksUri) {
|
|
|
624
629
|
return (0, import_jose.createLocalJWKSet)(json);
|
|
625
630
|
} catch (err) {
|
|
626
631
|
log.error("oauth.jwks.fetch_failed", { ...describeError(err), outcome: "500 oauth configuration error" });
|
|
627
|
-
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}
|
|
632
|
+
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`, "jwks");
|
|
628
633
|
}
|
|
629
634
|
}
|
|
630
635
|
function assertAccessTokenTyp(token, allowed) {
|
|
@@ -837,21 +842,21 @@ function createRequestAuthorizer(mcp, options = {}) {
|
|
|
837
842
|
return { ok: true, auth };
|
|
838
843
|
} catch (err) {
|
|
839
844
|
if (err instanceof OAuthUpstreamUnreachableError) {
|
|
840
|
-
log.error("auth.upstream_unreachable", { ...describeError(err), outcome: "503" });
|
|
845
|
+
log.error("auth.upstream_unreachable", { ...describeError(err), stage: err.stage, outcome: "503" });
|
|
841
846
|
await recorder?.emit({
|
|
842
847
|
tool: null,
|
|
843
848
|
method: "authorize",
|
|
844
|
-
outcome: "
|
|
849
|
+
outcome: err.stage === "jwks" ? "auth_jwks_unreachable" : "auth_discovery_unreachable",
|
|
845
850
|
durationMs: nowMs() - startedAt
|
|
846
851
|
});
|
|
847
852
|
return { ok: false, response: oauthUpstreamUnreachableResponse() };
|
|
848
853
|
}
|
|
849
854
|
if (err instanceof OAuthConfigurationError) {
|
|
850
|
-
log.error("auth.config_error", { ...describeError(err), outcome: "500" });
|
|
855
|
+
log.error("auth.config_error", { ...describeError(err), stage: err.stage, outcome: "500" });
|
|
851
856
|
await recorder?.emit({
|
|
852
857
|
tool: null,
|
|
853
858
|
method: "authorize",
|
|
854
|
-
outcome: "
|
|
859
|
+
outcome: err.stage === "jwks" ? "auth_jwks_config_error" : "auth_discovery_config_error",
|
|
855
860
|
durationMs: nowMs() - startedAt
|
|
856
861
|
});
|
|
857
862
|
return { ok: false, response: oauthConfigurationErrorResponse() };
|
|
@@ -3,21 +3,21 @@ import {
|
|
|
3
3
|
} from "../../chunk-UQK5UO6C.js";
|
|
4
4
|
import {
|
|
5
5
|
createMcpProtocolHandler
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-4H3Y2KYT.js";
|
|
7
7
|
import {
|
|
8
8
|
createOAuthProtectedResourceMetadataHandler
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-7TVARTF4.js";
|
|
10
10
|
import {
|
|
11
11
|
createInvokeToolHandler
|
|
12
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-WOKM6B6H.js";
|
|
13
13
|
import {
|
|
14
14
|
createListToolsHandler
|
|
15
|
-
} from "../../chunk-
|
|
15
|
+
} from "../../chunk-YE6N7XLA.js";
|
|
16
16
|
import "../../chunk-MA5H6PSF.js";
|
|
17
17
|
import {
|
|
18
18
|
assertResourcePathShape,
|
|
19
19
|
createRecorderForRuntime
|
|
20
|
-
} from "../../chunk-
|
|
20
|
+
} from "../../chunk-IRCVDFWG.js";
|
|
21
21
|
import {
|
|
22
22
|
trimTrailingSlash
|
|
23
23
|
} from "../../chunk-H37EB22A.js";
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
FUNCTIONS_MOUNT_PREFIX,
|
|
29
29
|
assertFunctionName
|
|
30
30
|
} from "../../chunk-XQWJN6DC.js";
|
|
31
|
-
import "../../chunk-
|
|
31
|
+
import "../../chunk-OIRVEGPQ.js";
|
|
32
32
|
|
|
33
33
|
// src/stacks/supabase/handler.ts
|
|
34
34
|
function deriveResourcePath(options) {
|
|
@@ -129,7 +129,7 @@ function describeError(err) {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
// package.json
|
|
132
|
-
var version = "0.21.0-rc.
|
|
132
|
+
var version = "0.21.0-rc.2";
|
|
133
133
|
|
|
134
134
|
// src/metrics/otlp.ts
|
|
135
135
|
var SCOPE_NAME = "@lovable.dev/mcp-js";
|
|
@@ -416,14 +416,16 @@ function parseSafeUrl(subject, raw, ErrorClass = Error) {
|
|
|
416
416
|
|
|
417
417
|
// src/auth/discovery.ts
|
|
418
418
|
var OAuthConfigurationError = class extends Error {
|
|
419
|
-
constructor(message) {
|
|
419
|
+
constructor(message, stage) {
|
|
420
420
|
super(message);
|
|
421
|
+
this.stage = stage;
|
|
421
422
|
this.name = "OAuthConfigurationError";
|
|
422
423
|
}
|
|
423
424
|
};
|
|
424
425
|
var OAuthUpstreamUnreachableError = class extends Error {
|
|
425
|
-
constructor(message) {
|
|
426
|
+
constructor(message, stage) {
|
|
426
427
|
super(message);
|
|
428
|
+
this.stage = stage;
|
|
427
429
|
this.name = "OAuthUpstreamUnreachableError";
|
|
428
430
|
}
|
|
429
431
|
};
|
|
@@ -513,14 +515,14 @@ async function fetchIssuerOAuthServerMetadata(issuer) {
|
|
|
513
515
|
...describeError(err),
|
|
514
516
|
outcome: "503 authorization server unreachable"
|
|
515
517
|
});
|
|
516
|
-
throw new OAuthUpstreamUnreachableError(message);
|
|
518
|
+
throw new OAuthUpstreamUnreachableError(message, "discovery");
|
|
517
519
|
}
|
|
518
520
|
log.error("oauth.discovery.config_error", {
|
|
519
521
|
issuer,
|
|
520
522
|
...describeError(err),
|
|
521
523
|
outcome: "500 oauth configuration error"
|
|
522
524
|
});
|
|
523
|
-
throw new OAuthConfigurationError(message);
|
|
525
|
+
throw new OAuthConfigurationError(message, "discovery");
|
|
524
526
|
}
|
|
525
527
|
}
|
|
526
528
|
function createOAuthDiscoveryResolver(auth) {
|
|
@@ -618,7 +620,10 @@ async function fetchVerificationKeySet(jwksUri) {
|
|
|
618
620
|
response = await fetch(jwksUri, { signal: AbortSignal.timeout(JWKS_FETCH_TIMEOUT_MS), redirect: "manual" });
|
|
619
621
|
} catch (err) {
|
|
620
622
|
log.error("oauth.jwks.unreachable", { ...describeError(err), outcome: "503 authorization server unreachable" });
|
|
621
|
-
throw new OAuthUpstreamUnreachableError(
|
|
623
|
+
throw new OAuthUpstreamUnreachableError(
|
|
624
|
+
`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
625
|
+
"jwks"
|
|
626
|
+
);
|
|
622
627
|
}
|
|
623
628
|
try {
|
|
624
629
|
if (!response.ok)
|
|
@@ -627,7 +632,7 @@ async function fetchVerificationKeySet(jwksUri) {
|
|
|
627
632
|
return (0, import_jose.createLocalJWKSet)(json);
|
|
628
633
|
} catch (err) {
|
|
629
634
|
log.error("oauth.jwks.fetch_failed", { ...describeError(err), outcome: "500 oauth configuration error" });
|
|
630
|
-
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}
|
|
635
|
+
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`, "jwks");
|
|
631
636
|
}
|
|
632
637
|
}
|
|
633
638
|
function assertAccessTokenTyp(token, allowed) {
|
|
@@ -840,21 +845,21 @@ function createRequestAuthorizer(mcp, options = {}) {
|
|
|
840
845
|
return { ok: true, auth };
|
|
841
846
|
} catch (err) {
|
|
842
847
|
if (err instanceof OAuthUpstreamUnreachableError) {
|
|
843
|
-
log.error("auth.upstream_unreachable", { ...describeError(err), outcome: "503" });
|
|
848
|
+
log.error("auth.upstream_unreachable", { ...describeError(err), stage: err.stage, outcome: "503" });
|
|
844
849
|
await recorder?.emit({
|
|
845
850
|
tool: null,
|
|
846
851
|
method: "authorize",
|
|
847
|
-
outcome: "
|
|
852
|
+
outcome: err.stage === "jwks" ? "auth_jwks_unreachable" : "auth_discovery_unreachable",
|
|
848
853
|
durationMs: nowMs() - startedAt
|
|
849
854
|
});
|
|
850
855
|
return { ok: false, response: oauthUpstreamUnreachableResponse() };
|
|
851
856
|
}
|
|
852
857
|
if (err instanceof OAuthConfigurationError) {
|
|
853
|
-
log.error("auth.config_error", { ...describeError(err), outcome: "500" });
|
|
858
|
+
log.error("auth.config_error", { ...describeError(err), stage: err.stage, outcome: "500" });
|
|
854
859
|
await recorder?.emit({
|
|
855
860
|
tool: null,
|
|
856
861
|
method: "authorize",
|
|
857
|
-
outcome: "
|
|
862
|
+
outcome: err.stage === "jwks" ? "auth_jwks_config_error" : "auth_discovery_config_error",
|
|
858
863
|
durationMs: nowMs() - startedAt
|
|
859
864
|
});
|
|
860
865
|
return { ok: false, response: oauthConfigurationErrorResponse() };
|
|
@@ -3,23 +3,23 @@ import {
|
|
|
3
3
|
} from "../../chunk-UQK5UO6C.js";
|
|
4
4
|
import {
|
|
5
5
|
createMcpProtocolHandler
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-4H3Y2KYT.js";
|
|
7
7
|
import {
|
|
8
8
|
createOAuthProtectedResourceMetadataHandler
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-7TVARTF4.js";
|
|
10
10
|
import {
|
|
11
11
|
createInvokeToolHandler
|
|
12
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-WOKM6B6H.js";
|
|
13
13
|
import {
|
|
14
14
|
createListToolsHandler
|
|
15
|
-
} from "../../chunk-
|
|
15
|
+
} from "../../chunk-YE6N7XLA.js";
|
|
16
16
|
import "../../chunk-MA5H6PSF.js";
|
|
17
17
|
import {
|
|
18
18
|
createRecorderForRuntime
|
|
19
|
-
} from "../../chunk-
|
|
19
|
+
} from "../../chunk-IRCVDFWG.js";
|
|
20
20
|
import "../../chunk-H37EB22A.js";
|
|
21
21
|
import "../../chunk-6DXGZZA4.js";
|
|
22
|
-
import "../../chunk-
|
|
22
|
+
import "../../chunk-OIRVEGPQ.js";
|
|
23
23
|
|
|
24
24
|
// src/stacks/tanstack/handlers.ts
|
|
25
25
|
var STACK = "tanstack";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovable.dev/mcp-js",
|
|
3
|
-
"version": "0.21.0-rc.
|
|
3
|
+
"version": "0.21.0-rc.2",
|
|
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": {
|