@lovable.dev/mcp-js 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-G5GWSV5D.js → chunk-3XPKR4G6.js} +1 -1
- package/dist/{chunk-NTXHOUK6.js → chunk-HRMLGCXV.js} +15 -13
- package/dist/{chunk-53M2X7FU.js → chunk-LMT6RXUF.js} +1 -1
- package/dist/{chunk-722HKLIU.js → chunk-W7F6JRDB.js} +1 -1
- package/dist/protocols/mcp/index.cjs +14 -12
- package/dist/protocols/mcp/index.js +2 -2
- package/dist/protocols/oauth-metadata.cjs +14 -12
- package/dist/protocols/oauth-metadata.js +2 -2
- package/dist/protocols/rest/index.cjs +14 -12
- package/dist/protocols/rest/index.js +2 -2
- package/dist/stacks/tanstack/index.cjs +14 -12
- package/dist/stacks/tanstack/index.js +4 -4
- package/package.json +1 -1
|
@@ -170,7 +170,7 @@ function createOAuthDiscoveryResolver(auth) {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
// src/auth/verifier.ts
|
|
173
|
-
import {
|
|
173
|
+
import { createLocalJWKSet, decodeProtectedHeader, jwtVerify } from "jose";
|
|
174
174
|
|
|
175
175
|
// src/auth/claims.ts
|
|
176
176
|
function readString(value) {
|
|
@@ -190,6 +190,7 @@ function stringClaim(claims, name) {
|
|
|
190
190
|
// src/auth/verifier.ts
|
|
191
191
|
var DEFAULT_JWT_ALGORITHMS = ["RS256", "RS384", "RS512", "ES256", "ES384", "ES512", "EdDSA"];
|
|
192
192
|
var DEFAULT_CLOCK_TOLERANCE_SECONDS = 30;
|
|
193
|
+
var JWKS_FETCH_TIMEOUT_MS = 5e3;
|
|
193
194
|
var OAuthTokenError = class extends Error {
|
|
194
195
|
constructor(status, oauthError, message) {
|
|
195
196
|
super(message);
|
|
@@ -209,12 +210,17 @@ function tokenHeaderFields(token) {
|
|
|
209
210
|
return { tokenLength: token.length };
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
|
-
function
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
213
|
+
async function fetchVerificationKeySet(jwksUri) {
|
|
214
|
+
try {
|
|
215
|
+
const response = await fetch(jwksUri, { signal: AbortSignal.timeout(JWKS_FETCH_TIMEOUT_MS), redirect: "manual" });
|
|
216
|
+
if (!response.ok)
|
|
217
|
+
throw new Error(`JWKS endpoint returned ${response.status}`);
|
|
218
|
+
const json = await response.json();
|
|
219
|
+
return createLocalJWKSet(json);
|
|
220
|
+
} catch (err) {
|
|
221
|
+
log.error("oauth.jwks.fetch_failed", { ...describeError(err), outcome: "500 oauth configuration error" });
|
|
222
|
+
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
223
|
+
}
|
|
218
224
|
}
|
|
219
225
|
async function verifyJwtClaims(token, keySet, issuer, audience, auth) {
|
|
220
226
|
try {
|
|
@@ -229,10 +235,6 @@ async function verifyJwtClaims(token, keySet, issuer, audience, auth) {
|
|
|
229
235
|
});
|
|
230
236
|
return payload;
|
|
231
237
|
} catch (err) {
|
|
232
|
-
if (isJwksFetchFailure(err)) {
|
|
233
|
-
log.error("oauth.jwks.fetch_failed", { ...describeError(err), outcome: "500 oauth configuration error" });
|
|
234
|
-
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
235
|
-
}
|
|
236
238
|
log.debug("oauth.verify.rejected", { ...describeError(err), outcome: "401 invalid_token" });
|
|
237
239
|
throw err;
|
|
238
240
|
}
|
|
@@ -277,8 +279,8 @@ function createOAuthTokenVerifier(auth, discovery) {
|
|
|
277
279
|
const acceptedAudiences = resolveAcceptedAudiences(auth, resource);
|
|
278
280
|
log.debug("oauth.verify.start", { issuer, acceptedAudiences, resource, ...tokenHeaderFields(token) });
|
|
279
281
|
const jwksUri = await discovery.resolveJwksUri();
|
|
280
|
-
log.debug("oauth.jwks.
|
|
281
|
-
const keySet =
|
|
282
|
+
log.debug("oauth.jwks.fetch", { jwksUri });
|
|
283
|
+
const keySet = await fetchVerificationKeySet(jwksUri);
|
|
282
284
|
const claims = await verifyJwtClaims(token, keySet, issuer, acceptedAudiences, auth);
|
|
283
285
|
assertNonEmptySubject(claims);
|
|
284
286
|
const context = buildMcpAuthContext({ token, claims, issuer, resource, acceptedAudiences });
|
|
@@ -281,6 +281,7 @@ function stringClaim(claims, name) {
|
|
|
281
281
|
// src/auth/verifier.ts
|
|
282
282
|
var DEFAULT_JWT_ALGORITHMS = ["RS256", "RS384", "RS512", "ES256", "ES384", "ES512", "EdDSA"];
|
|
283
283
|
var DEFAULT_CLOCK_TOLERANCE_SECONDS = 30;
|
|
284
|
+
var JWKS_FETCH_TIMEOUT_MS = 5e3;
|
|
284
285
|
var OAuthTokenError = class extends Error {
|
|
285
286
|
constructor(status, oauthError, message) {
|
|
286
287
|
super(message);
|
|
@@ -300,12 +301,17 @@ function tokenHeaderFields(token) {
|
|
|
300
301
|
return { tokenLength: token.length };
|
|
301
302
|
}
|
|
302
303
|
}
|
|
303
|
-
function
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
304
|
+
async function fetchVerificationKeySet(jwksUri) {
|
|
305
|
+
try {
|
|
306
|
+
const response = await fetch(jwksUri, { signal: AbortSignal.timeout(JWKS_FETCH_TIMEOUT_MS), redirect: "manual" });
|
|
307
|
+
if (!response.ok)
|
|
308
|
+
throw new Error(`JWKS endpoint returned ${response.status}`);
|
|
309
|
+
const json = await response.json();
|
|
310
|
+
return (0, import_jose.createLocalJWKSet)(json);
|
|
311
|
+
} catch (err) {
|
|
312
|
+
log.error("oauth.jwks.fetch_failed", { ...describeError(err), outcome: "500 oauth configuration error" });
|
|
313
|
+
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
314
|
+
}
|
|
309
315
|
}
|
|
310
316
|
async function verifyJwtClaims(token, keySet, issuer, audience, auth) {
|
|
311
317
|
try {
|
|
@@ -320,10 +326,6 @@ async function verifyJwtClaims(token, keySet, issuer, audience, auth) {
|
|
|
320
326
|
});
|
|
321
327
|
return payload;
|
|
322
328
|
} catch (err) {
|
|
323
|
-
if (isJwksFetchFailure(err)) {
|
|
324
|
-
log.error("oauth.jwks.fetch_failed", { ...describeError(err), outcome: "500 oauth configuration error" });
|
|
325
|
-
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
326
|
-
}
|
|
327
329
|
log.debug("oauth.verify.rejected", { ...describeError(err), outcome: "401 invalid_token" });
|
|
328
330
|
throw err;
|
|
329
331
|
}
|
|
@@ -368,8 +370,8 @@ function createOAuthTokenVerifier(auth, discovery) {
|
|
|
368
370
|
const acceptedAudiences = resolveAcceptedAudiences(auth, resource);
|
|
369
371
|
log.debug("oauth.verify.start", { issuer, acceptedAudiences, resource, ...tokenHeaderFields(token) });
|
|
370
372
|
const jwksUri = await discovery.resolveJwksUri();
|
|
371
|
-
log.debug("oauth.jwks.
|
|
372
|
-
const keySet =
|
|
373
|
+
log.debug("oauth.jwks.fetch", { jwksUri });
|
|
374
|
+
const keySet = await fetchVerificationKeySet(jwksUri);
|
|
373
375
|
const claims = await verifyJwtClaims(token, keySet, issuer, acceptedAudiences, auth);
|
|
374
376
|
assertNonEmptySubject(claims);
|
|
375
377
|
const context = buildMcpAuthContext({ token, claims, issuer, resource, acceptedAudiences });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createMcpProtocolHandler
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-3XPKR4G6.js";
|
|
4
4
|
import "../../chunk-MA5H6PSF.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-HRMLGCXV.js";
|
|
6
6
|
import "../../chunk-QC3DXQTH.js";
|
|
7
7
|
import "../../chunk-6DXGZZA4.js";
|
|
8
8
|
export {
|
|
@@ -283,6 +283,7 @@ function stringClaim(claims, name) {
|
|
|
283
283
|
// src/auth/verifier.ts
|
|
284
284
|
var DEFAULT_JWT_ALGORITHMS = ["RS256", "RS384", "RS512", "ES256", "ES384", "ES512", "EdDSA"];
|
|
285
285
|
var DEFAULT_CLOCK_TOLERANCE_SECONDS = 30;
|
|
286
|
+
var JWKS_FETCH_TIMEOUT_MS = 5e3;
|
|
286
287
|
var OAuthTokenError = class extends Error {
|
|
287
288
|
constructor(status, oauthError, message) {
|
|
288
289
|
super(message);
|
|
@@ -302,12 +303,17 @@ function tokenHeaderFields(token) {
|
|
|
302
303
|
return { tokenLength: token.length };
|
|
303
304
|
}
|
|
304
305
|
}
|
|
305
|
-
function
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
306
|
+
async function fetchVerificationKeySet(jwksUri) {
|
|
307
|
+
try {
|
|
308
|
+
const response = await fetch(jwksUri, { signal: AbortSignal.timeout(JWKS_FETCH_TIMEOUT_MS), redirect: "manual" });
|
|
309
|
+
if (!response.ok)
|
|
310
|
+
throw new Error(`JWKS endpoint returned ${response.status}`);
|
|
311
|
+
const json = await response.json();
|
|
312
|
+
return (0, import_jose.createLocalJWKSet)(json);
|
|
313
|
+
} catch (err) {
|
|
314
|
+
log.error("oauth.jwks.fetch_failed", { ...describeError(err), outcome: "500 oauth configuration error" });
|
|
315
|
+
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
316
|
+
}
|
|
311
317
|
}
|
|
312
318
|
async function verifyJwtClaims(token, keySet, issuer, audience, auth) {
|
|
313
319
|
try {
|
|
@@ -322,10 +328,6 @@ async function verifyJwtClaims(token, keySet, issuer, audience, auth) {
|
|
|
322
328
|
});
|
|
323
329
|
return payload;
|
|
324
330
|
} catch (err) {
|
|
325
|
-
if (isJwksFetchFailure(err)) {
|
|
326
|
-
log.error("oauth.jwks.fetch_failed", { ...describeError(err), outcome: "500 oauth configuration error" });
|
|
327
|
-
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
328
|
-
}
|
|
329
331
|
log.debug("oauth.verify.rejected", { ...describeError(err), outcome: "401 invalid_token" });
|
|
330
332
|
throw err;
|
|
331
333
|
}
|
|
@@ -370,8 +372,8 @@ function createOAuthTokenVerifier(auth, discovery) {
|
|
|
370
372
|
const acceptedAudiences = resolveAcceptedAudiences(auth, resource);
|
|
371
373
|
log.debug("oauth.verify.start", { issuer, acceptedAudiences, resource, ...tokenHeaderFields(token) });
|
|
372
374
|
const jwksUri = await discovery.resolveJwksUri();
|
|
373
|
-
log.debug("oauth.jwks.
|
|
374
|
-
const keySet =
|
|
375
|
+
log.debug("oauth.jwks.fetch", { jwksUri });
|
|
376
|
+
const keySet = await fetchVerificationKeySet(jwksUri);
|
|
375
377
|
const claims = await verifyJwtClaims(token, keySet, issuer, acceptedAudiences, auth);
|
|
376
378
|
assertNonEmptySubject(claims);
|
|
377
379
|
const context = buildMcpAuthContext({ token, claims, issuer, resource, acceptedAudiences });
|
|
@@ -291,6 +291,7 @@ function stringClaim(claims, name) {
|
|
|
291
291
|
// src/auth/verifier.ts
|
|
292
292
|
var DEFAULT_JWT_ALGORITHMS = ["RS256", "RS384", "RS512", "ES256", "ES384", "ES512", "EdDSA"];
|
|
293
293
|
var DEFAULT_CLOCK_TOLERANCE_SECONDS = 30;
|
|
294
|
+
var JWKS_FETCH_TIMEOUT_MS = 5e3;
|
|
294
295
|
var OAuthTokenError = class extends Error {
|
|
295
296
|
constructor(status, oauthError, message) {
|
|
296
297
|
super(message);
|
|
@@ -310,12 +311,17 @@ function tokenHeaderFields(token) {
|
|
|
310
311
|
return { tokenLength: token.length };
|
|
311
312
|
}
|
|
312
313
|
}
|
|
313
|
-
function
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
314
|
+
async function fetchVerificationKeySet(jwksUri) {
|
|
315
|
+
try {
|
|
316
|
+
const response = await fetch(jwksUri, { signal: AbortSignal.timeout(JWKS_FETCH_TIMEOUT_MS), redirect: "manual" });
|
|
317
|
+
if (!response.ok)
|
|
318
|
+
throw new Error(`JWKS endpoint returned ${response.status}`);
|
|
319
|
+
const json = await response.json();
|
|
320
|
+
return (0, import_jose.createLocalJWKSet)(json);
|
|
321
|
+
} catch (err) {
|
|
322
|
+
log.error("oauth.jwks.fetch_failed", { ...describeError(err), outcome: "500 oauth configuration error" });
|
|
323
|
+
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
324
|
+
}
|
|
319
325
|
}
|
|
320
326
|
async function verifyJwtClaims(token, keySet, issuer, audience, auth) {
|
|
321
327
|
try {
|
|
@@ -330,10 +336,6 @@ async function verifyJwtClaims(token, keySet, issuer, audience, auth) {
|
|
|
330
336
|
});
|
|
331
337
|
return payload;
|
|
332
338
|
} catch (err) {
|
|
333
|
-
if (isJwksFetchFailure(err)) {
|
|
334
|
-
log.error("oauth.jwks.fetch_failed", { ...describeError(err), outcome: "500 oauth configuration error" });
|
|
335
|
-
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
336
|
-
}
|
|
337
339
|
log.debug("oauth.verify.rejected", { ...describeError(err), outcome: "401 invalid_token" });
|
|
338
340
|
throw err;
|
|
339
341
|
}
|
|
@@ -378,8 +380,8 @@ function createOAuthTokenVerifier(auth, discovery) {
|
|
|
378
380
|
const acceptedAudiences = resolveAcceptedAudiences(auth, resource);
|
|
379
381
|
log.debug("oauth.verify.start", { issuer, acceptedAudiences, resource, ...tokenHeaderFields(token) });
|
|
380
382
|
const jwksUri = await discovery.resolveJwksUri();
|
|
381
|
-
log.debug("oauth.jwks.
|
|
382
|
-
const keySet =
|
|
383
|
+
log.debug("oauth.jwks.fetch", { jwksUri });
|
|
384
|
+
const keySet = await fetchVerificationKeySet(jwksUri);
|
|
383
385
|
const claims = await verifyJwtClaims(token, keySet, issuer, acceptedAudiences, auth);
|
|
384
386
|
assertNonEmptySubject(claims);
|
|
385
387
|
const context = buildMcpAuthContext({ token, claims, issuer, resource, acceptedAudiences });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createInvokeToolHandler,
|
|
3
3
|
createListToolsHandler
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-LMT6RXUF.js";
|
|
5
5
|
import "../../chunk-MA5H6PSF.js";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-HRMLGCXV.js";
|
|
7
7
|
import "../../chunk-QC3DXQTH.js";
|
|
8
8
|
import "../../chunk-6DXGZZA4.js";
|
|
9
9
|
export {
|
|
@@ -293,6 +293,7 @@ function stringClaim(claims, name) {
|
|
|
293
293
|
// src/auth/verifier.ts
|
|
294
294
|
var DEFAULT_JWT_ALGORITHMS = ["RS256", "RS384", "RS512", "ES256", "ES384", "ES512", "EdDSA"];
|
|
295
295
|
var DEFAULT_CLOCK_TOLERANCE_SECONDS = 30;
|
|
296
|
+
var JWKS_FETCH_TIMEOUT_MS = 5e3;
|
|
296
297
|
var OAuthTokenError = class extends Error {
|
|
297
298
|
constructor(status, oauthError, message) {
|
|
298
299
|
super(message);
|
|
@@ -312,12 +313,17 @@ function tokenHeaderFields(token) {
|
|
|
312
313
|
return { tokenLength: token.length };
|
|
313
314
|
}
|
|
314
315
|
}
|
|
315
|
-
function
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
316
|
+
async function fetchVerificationKeySet(jwksUri) {
|
|
317
|
+
try {
|
|
318
|
+
const response = await fetch(jwksUri, { signal: AbortSignal.timeout(JWKS_FETCH_TIMEOUT_MS), redirect: "manual" });
|
|
319
|
+
if (!response.ok)
|
|
320
|
+
throw new Error(`JWKS endpoint returned ${response.status}`);
|
|
321
|
+
const json = await response.json();
|
|
322
|
+
return (0, import_jose.createLocalJWKSet)(json);
|
|
323
|
+
} catch (err) {
|
|
324
|
+
log.error("oauth.jwks.fetch_failed", { ...describeError(err), outcome: "500 oauth configuration error" });
|
|
325
|
+
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
326
|
+
}
|
|
321
327
|
}
|
|
322
328
|
async function verifyJwtClaims(token, keySet, issuer, audience, auth) {
|
|
323
329
|
try {
|
|
@@ -332,10 +338,6 @@ async function verifyJwtClaims(token, keySet, issuer, audience, auth) {
|
|
|
332
338
|
});
|
|
333
339
|
return payload;
|
|
334
340
|
} catch (err) {
|
|
335
|
-
if (isJwksFetchFailure(err)) {
|
|
336
|
-
log.error("oauth.jwks.fetch_failed", { ...describeError(err), outcome: "500 oauth configuration error" });
|
|
337
|
-
throw new OAuthConfigurationError(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
338
|
-
}
|
|
339
341
|
log.debug("oauth.verify.rejected", { ...describeError(err), outcome: "401 invalid_token" });
|
|
340
342
|
throw err;
|
|
341
343
|
}
|
|
@@ -380,8 +382,8 @@ function createOAuthTokenVerifier(auth, discovery) {
|
|
|
380
382
|
const acceptedAudiences = resolveAcceptedAudiences(auth, resource);
|
|
381
383
|
log.debug("oauth.verify.start", { issuer, acceptedAudiences, resource, ...tokenHeaderFields(token) });
|
|
382
384
|
const jwksUri = await discovery.resolveJwksUri();
|
|
383
|
-
log.debug("oauth.jwks.
|
|
384
|
-
const keySet =
|
|
385
|
+
log.debug("oauth.jwks.fetch", { jwksUri });
|
|
386
|
+
const keySet = await fetchVerificationKeySet(jwksUri);
|
|
385
387
|
const claims = await verifyJwtClaims(token, keySet, issuer, acceptedAudiences, auth);
|
|
386
388
|
assertNonEmptySubject(claims);
|
|
387
389
|
const context = buildMcpAuthContext({ token, claims, issuer, resource, acceptedAudiences });
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createMcpProtocolHandler
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-3XPKR4G6.js";
|
|
4
4
|
import {
|
|
5
5
|
createOAuthProtectedResourceMetadataHandler
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-W7F6JRDB.js";
|
|
7
7
|
import {
|
|
8
8
|
createInvokeToolHandler,
|
|
9
9
|
createListToolsHandler
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-LMT6RXUF.js";
|
|
11
11
|
import "../../chunk-MA5H6PSF.js";
|
|
12
|
-
import "../../chunk-
|
|
12
|
+
import "../../chunk-HRMLGCXV.js";
|
|
13
13
|
import "../../chunk-QC3DXQTH.js";
|
|
14
14
|
import "../../chunk-6DXGZZA4.js";
|
|
15
15
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovable.dev/mcp-js",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Author MCP servers for Lovable apps. Declare tools with defineTool, register them in defineMcp, and the framework adapter (TanStack today, Supabase Edge Functions next) emits the route(s) at build time.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|