@frontmcp/adapters 1.8.1 → 1.8.3
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/esm/index.mjs +65 -26
- package/esm/openapi/index.mjs +65 -26
- package/esm/package.json +6 -6
- package/esm/skills/index.mjs +94 -12
- package/index.js +64 -25
- package/openapi/index.js +64 -25
- package/openapi/openapi.security.d.ts +3 -3
- package/openapi/openapi.security.d.ts.map +1 -1
- package/openapi/openapi.types.d.ts +17 -0
- package/openapi/openapi.types.d.ts.map +1 -1
- package/package.json +6 -6
- package/skills/index.js +94 -12
- package/skills/source-options.d.ts.map +1 -1
- package/skills/sources/npm.source.d.ts +9 -4
- package/skills/sources/npm.source.d.ts.map +1 -1
- package/skills/sources/saas-pull.source.d.ts +25 -2
- package/skills/sources/saas-pull.source.d.ts.map +1 -1
package/index.js
CHANGED
|
@@ -224,7 +224,7 @@ async function createSecurityContextFromAuth(tool2, ctx, options) {
|
|
|
224
224
|
return await options.securityResolver(tool2, ctx);
|
|
225
225
|
}
|
|
226
226
|
if (options.authProviderMapper) {
|
|
227
|
-
const context =
|
|
227
|
+
const context = {};
|
|
228
228
|
const securitySchemes = /* @__PURE__ */ new Set();
|
|
229
229
|
for (const mapper of tool2.mapper) {
|
|
230
230
|
if (mapper.security?.scheme) {
|
|
@@ -277,22 +277,38 @@ async function createSecurityContextFromAuth(tool2, ctx, options) {
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
+
if (hasStaticAuth(options)) {
|
|
281
|
+
return (0, import_mcp_from_openapi2.createSecurityContext)({ ...options.staticAuth, ...context });
|
|
282
|
+
}
|
|
280
283
|
const hasAnyAuth = context.jwt || context.apiKey || context.basic || context.oauth2Token;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
if (
|
|
284
|
-
|
|
284
|
+
if (!hasAnyAuth && options.passthroughCallerToken === true) {
|
|
285
|
+
const callerToken = getCallerToken(ctx);
|
|
286
|
+
if (callerToken) {
|
|
287
|
+
context.jwt = callerToken;
|
|
285
288
|
}
|
|
286
|
-
context.jwt = authToken;
|
|
287
289
|
}
|
|
288
|
-
return context;
|
|
290
|
+
return (0, import_mcp_from_openapi2.createSecurityContext)(context);
|
|
289
291
|
}
|
|
290
|
-
if (options
|
|
292
|
+
if (hasStaticAuth(options)) {
|
|
291
293
|
return (0, import_mcp_from_openapi2.createSecurityContext)(options.staticAuth);
|
|
292
294
|
}
|
|
293
|
-
|
|
294
|
-
jwt: ctx
|
|
295
|
-
}
|
|
295
|
+
if (options.passthroughCallerToken === true) {
|
|
296
|
+
return (0, import_mcp_from_openapi2.createSecurityContext)({ jwt: getCallerToken(ctx) });
|
|
297
|
+
}
|
|
298
|
+
return (0, import_mcp_from_openapi2.createSecurityContext)({});
|
|
299
|
+
}
|
|
300
|
+
function hasStaticAuth(options) {
|
|
301
|
+
return !!options.staticAuth && Object.keys(options.staticAuth).length > 0;
|
|
302
|
+
}
|
|
303
|
+
function getCallerToken(ctx) {
|
|
304
|
+
const authToken = ctx.authInfo?.token;
|
|
305
|
+
if (authToken === void 0 || authToken === null || authToken === "") {
|
|
306
|
+
return void 0;
|
|
307
|
+
}
|
|
308
|
+
if (typeof authToken !== "string") {
|
|
309
|
+
throw new Error(`authInfo.token must be a string, but got: ${typeof authToken}`);
|
|
310
|
+
}
|
|
311
|
+
return authToken;
|
|
296
312
|
}
|
|
297
313
|
function extractSecuritySchemes(tools) {
|
|
298
314
|
const schemes = /* @__PURE__ */ new Set();
|
|
@@ -328,12 +344,12 @@ function validateSecurityConfiguration(tools, options) {
|
|
|
328
344
|
);
|
|
329
345
|
return result;
|
|
330
346
|
}
|
|
331
|
-
if (
|
|
347
|
+
if (hasStaticAuth(options)) {
|
|
332
348
|
result.securityRiskScore = "medium";
|
|
333
349
|
result.warnings.push(
|
|
334
350
|
"SECURITY INFO: Using staticAuth with hardcoded credentials. Ensure credentials are stored securely (environment variables, secrets manager)."
|
|
335
351
|
);
|
|
336
|
-
return result;
|
|
352
|
+
return withPassthroughRisk(result, securitySchemes, options);
|
|
337
353
|
}
|
|
338
354
|
const schemesInInput = new Set(options.securitySchemesInInput || []);
|
|
339
355
|
if (options.authProviderMapper || schemesInInput.size > 0) {
|
|
@@ -343,13 +359,18 @@ function validateSecurityConfiguration(tools, options) {
|
|
|
343
359
|
`INFO: Per-scheme security control enabled. Schemes in input: ${Array.from(schemesInInput).join(", ")}`
|
|
344
360
|
);
|
|
345
361
|
}
|
|
362
|
+
const passthroughFallback = [];
|
|
346
363
|
for (const scheme of securitySchemes) {
|
|
347
364
|
if (schemesInInput.has(scheme)) {
|
|
348
365
|
continue;
|
|
349
366
|
}
|
|
350
367
|
if (!options.authProviderMapper?.[scheme]) {
|
|
351
|
-
|
|
352
|
-
|
|
368
|
+
if (options.passthroughCallerToken === true) {
|
|
369
|
+
passthroughFallback.push(scheme);
|
|
370
|
+
} else {
|
|
371
|
+
result.valid = false;
|
|
372
|
+
result.missingMappings.push(scheme);
|
|
373
|
+
}
|
|
353
374
|
}
|
|
354
375
|
}
|
|
355
376
|
if (!result.valid) {
|
|
@@ -357,19 +378,36 @@ function validateSecurityConfiguration(tools, options) {
|
|
|
357
378
|
`ERROR: Missing auth provider mappings for security schemes: ${result.missingMappings.join(", ")}`
|
|
358
379
|
);
|
|
359
380
|
}
|
|
381
|
+
withPassthroughRisk(result, securitySchemes, options);
|
|
382
|
+
if (passthroughFallback.length > 0) {
|
|
383
|
+
result.warnings.push(
|
|
384
|
+
`SECURITY WARNING: Security schemes with no authProviderMapper entry (${passthroughFallback.join(", ")}) get the MCP client's own token, because passthroughCallerToken is enabled.`
|
|
385
|
+
);
|
|
386
|
+
}
|
|
360
387
|
return result;
|
|
361
388
|
}
|
|
362
|
-
if (securitySchemes.size > 0) {
|
|
389
|
+
if (securitySchemes.size > 0 && options.passthroughCallerToken !== true) {
|
|
390
|
+
const schemesStr = Array.from(securitySchemes).join(", ");
|
|
363
391
|
result.securityRiskScore = "medium";
|
|
364
392
|
result.warnings.push(
|
|
365
|
-
`
|
|
366
|
-
securitySchemes
|
|
367
|
-
).join(", ")}`
|
|
368
|
-
);
|
|
369
|
-
result.warnings.push(
|
|
370
|
-
"RECOMMENDATION: For multiple auth providers, use authProviderMapper or securityResolver to map each security scheme to the correct auth provider."
|
|
393
|
+
`SECURITY WARNING: No auth configuration provided, so the adapter has no credentials for the API (security schemes: ${schemesStr}). Operations that require authentication will fail. The MCP client's own token is not forwarded: configure authProviderMapper, securityResolver or staticAuth, or set passthroughCallerToken: true if the API is meant to receive the caller's MCP token.`
|
|
371
394
|
);
|
|
372
395
|
}
|
|
396
|
+
return withPassthroughRisk(result, securitySchemes, options);
|
|
397
|
+
}
|
|
398
|
+
function canPassThroughCallerToken(options) {
|
|
399
|
+
return options.passthroughCallerToken === true && !options.securityResolver && !hasStaticAuth(options);
|
|
400
|
+
}
|
|
401
|
+
function withPassthroughRisk(result, securitySchemes, options) {
|
|
402
|
+
if (securitySchemes.size === 0 || !canPassThroughCallerToken(options)) {
|
|
403
|
+
return result;
|
|
404
|
+
}
|
|
405
|
+
const schemesStr = Array.from(securitySchemes).join(", ");
|
|
406
|
+
const when = options.authProviderMapper ? " whenever no authProviderMapper function returns a credential" : "";
|
|
407
|
+
result.securityRiskScore = "high";
|
|
408
|
+
result.warnings.push(
|
|
409
|
+
`SECURITY WARNING: passthroughCallerToken is enabled. The MCP client's own token (ctx.authInfo.token) is sent to the API${when} for security schemes: ${schemesStr}. Only use this when the API accepts tokens issued for this MCP server.`
|
|
410
|
+
);
|
|
373
411
|
return result;
|
|
374
412
|
}
|
|
375
413
|
async function resolveToolSecurity(tool2, ctx, options) {
|
|
@@ -387,9 +425,10 @@ async function resolveToolSecurity(tool2, ctx, options) {
|
|
|
387
425
|
Required security schemes: ${schemesStr}
|
|
388
426
|
Solutions:
|
|
389
427
|
1. Add authProviderMapper: { '${firstScheme}': (ctx) => ctx.authInfo.user?.token }
|
|
390
|
-
2. Add securityResolver: (tool, ctx) => ({ jwt: ctx
|
|
428
|
+
2. Add securityResolver: async (tool, ctx) => ({ jwt: await getApiToken(ctx) })
|
|
391
429
|
3. Add staticAuth: { jwt: process.env.API_TOKEN }
|
|
392
|
-
4. Set
|
|
430
|
+
4. Set passthroughCallerToken: true, only if the API accepts the MCP client's own token
|
|
431
|
+
5. Set generateOptions.includeSecurityInInput: true (not recommended for production)`
|
|
393
432
|
);
|
|
394
433
|
}
|
|
395
434
|
return await securityResolver.resolve(tool2.mapper, securityContext);
|
|
@@ -1190,7 +1229,7 @@ Add one of the following to your adapter configuration:
|
|
|
1190
1229
|
}
|
|
1191
1230
|
|
|
1192
1231
|
2. securityResolver:
|
|
1193
|
-
securityResolver: (tool,
|
|
1232
|
+
securityResolver: async (tool, ctx) => ({ jwt: await getApiToken(ctx) })
|
|
1194
1233
|
|
|
1195
1234
|
3. staticAuth:
|
|
1196
1235
|
staticAuth: { jwt: process.env.API_TOKEN }
|
package/openapi/index.js
CHANGED
|
@@ -224,7 +224,7 @@ async function createSecurityContextFromAuth(tool2, ctx, options) {
|
|
|
224
224
|
return await options.securityResolver(tool2, ctx);
|
|
225
225
|
}
|
|
226
226
|
if (options.authProviderMapper) {
|
|
227
|
-
const context =
|
|
227
|
+
const context = {};
|
|
228
228
|
const securitySchemes = /* @__PURE__ */ new Set();
|
|
229
229
|
for (const mapper of tool2.mapper) {
|
|
230
230
|
if (mapper.security?.scheme) {
|
|
@@ -277,22 +277,38 @@ async function createSecurityContextFromAuth(tool2, ctx, options) {
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
+
if (hasStaticAuth(options)) {
|
|
281
|
+
return (0, import_mcp_from_openapi2.createSecurityContext)({ ...options.staticAuth, ...context });
|
|
282
|
+
}
|
|
280
283
|
const hasAnyAuth = context.jwt || context.apiKey || context.basic || context.oauth2Token;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
if (
|
|
284
|
-
|
|
284
|
+
if (!hasAnyAuth && options.passthroughCallerToken === true) {
|
|
285
|
+
const callerToken = getCallerToken(ctx);
|
|
286
|
+
if (callerToken) {
|
|
287
|
+
context.jwt = callerToken;
|
|
285
288
|
}
|
|
286
|
-
context.jwt = authToken;
|
|
287
289
|
}
|
|
288
|
-
return context;
|
|
290
|
+
return (0, import_mcp_from_openapi2.createSecurityContext)(context);
|
|
289
291
|
}
|
|
290
|
-
if (options
|
|
292
|
+
if (hasStaticAuth(options)) {
|
|
291
293
|
return (0, import_mcp_from_openapi2.createSecurityContext)(options.staticAuth);
|
|
292
294
|
}
|
|
293
|
-
|
|
294
|
-
jwt: ctx
|
|
295
|
-
}
|
|
295
|
+
if (options.passthroughCallerToken === true) {
|
|
296
|
+
return (0, import_mcp_from_openapi2.createSecurityContext)({ jwt: getCallerToken(ctx) });
|
|
297
|
+
}
|
|
298
|
+
return (0, import_mcp_from_openapi2.createSecurityContext)({});
|
|
299
|
+
}
|
|
300
|
+
function hasStaticAuth(options) {
|
|
301
|
+
return !!options.staticAuth && Object.keys(options.staticAuth).length > 0;
|
|
302
|
+
}
|
|
303
|
+
function getCallerToken(ctx) {
|
|
304
|
+
const authToken = ctx.authInfo?.token;
|
|
305
|
+
if (authToken === void 0 || authToken === null || authToken === "") {
|
|
306
|
+
return void 0;
|
|
307
|
+
}
|
|
308
|
+
if (typeof authToken !== "string") {
|
|
309
|
+
throw new Error(`authInfo.token must be a string, but got: ${typeof authToken}`);
|
|
310
|
+
}
|
|
311
|
+
return authToken;
|
|
296
312
|
}
|
|
297
313
|
function extractSecuritySchemes(tools) {
|
|
298
314
|
const schemes = /* @__PURE__ */ new Set();
|
|
@@ -328,12 +344,12 @@ function validateSecurityConfiguration(tools, options) {
|
|
|
328
344
|
);
|
|
329
345
|
return result;
|
|
330
346
|
}
|
|
331
|
-
if (
|
|
347
|
+
if (hasStaticAuth(options)) {
|
|
332
348
|
result.securityRiskScore = "medium";
|
|
333
349
|
result.warnings.push(
|
|
334
350
|
"SECURITY INFO: Using staticAuth with hardcoded credentials. Ensure credentials are stored securely (environment variables, secrets manager)."
|
|
335
351
|
);
|
|
336
|
-
return result;
|
|
352
|
+
return withPassthroughRisk(result, securitySchemes, options);
|
|
337
353
|
}
|
|
338
354
|
const schemesInInput = new Set(options.securitySchemesInInput || []);
|
|
339
355
|
if (options.authProviderMapper || schemesInInput.size > 0) {
|
|
@@ -343,13 +359,18 @@ function validateSecurityConfiguration(tools, options) {
|
|
|
343
359
|
`INFO: Per-scheme security control enabled. Schemes in input: ${Array.from(schemesInInput).join(", ")}`
|
|
344
360
|
);
|
|
345
361
|
}
|
|
362
|
+
const passthroughFallback = [];
|
|
346
363
|
for (const scheme of securitySchemes) {
|
|
347
364
|
if (schemesInInput.has(scheme)) {
|
|
348
365
|
continue;
|
|
349
366
|
}
|
|
350
367
|
if (!options.authProviderMapper?.[scheme]) {
|
|
351
|
-
|
|
352
|
-
|
|
368
|
+
if (options.passthroughCallerToken === true) {
|
|
369
|
+
passthroughFallback.push(scheme);
|
|
370
|
+
} else {
|
|
371
|
+
result.valid = false;
|
|
372
|
+
result.missingMappings.push(scheme);
|
|
373
|
+
}
|
|
353
374
|
}
|
|
354
375
|
}
|
|
355
376
|
if (!result.valid) {
|
|
@@ -357,19 +378,36 @@ function validateSecurityConfiguration(tools, options) {
|
|
|
357
378
|
`ERROR: Missing auth provider mappings for security schemes: ${result.missingMappings.join(", ")}`
|
|
358
379
|
);
|
|
359
380
|
}
|
|
381
|
+
withPassthroughRisk(result, securitySchemes, options);
|
|
382
|
+
if (passthroughFallback.length > 0) {
|
|
383
|
+
result.warnings.push(
|
|
384
|
+
`SECURITY WARNING: Security schemes with no authProviderMapper entry (${passthroughFallback.join(", ")}) get the MCP client's own token, because passthroughCallerToken is enabled.`
|
|
385
|
+
);
|
|
386
|
+
}
|
|
360
387
|
return result;
|
|
361
388
|
}
|
|
362
|
-
if (securitySchemes.size > 0) {
|
|
389
|
+
if (securitySchemes.size > 0 && options.passthroughCallerToken !== true) {
|
|
390
|
+
const schemesStr = Array.from(securitySchemes).join(", ");
|
|
363
391
|
result.securityRiskScore = "medium";
|
|
364
392
|
result.warnings.push(
|
|
365
|
-
`
|
|
366
|
-
securitySchemes
|
|
367
|
-
).join(", ")}`
|
|
368
|
-
);
|
|
369
|
-
result.warnings.push(
|
|
370
|
-
"RECOMMENDATION: For multiple auth providers, use authProviderMapper or securityResolver to map each security scheme to the correct auth provider."
|
|
393
|
+
`SECURITY WARNING: No auth configuration provided, so the adapter has no credentials for the API (security schemes: ${schemesStr}). Operations that require authentication will fail. The MCP client's own token is not forwarded: configure authProviderMapper, securityResolver or staticAuth, or set passthroughCallerToken: true if the API is meant to receive the caller's MCP token.`
|
|
371
394
|
);
|
|
372
395
|
}
|
|
396
|
+
return withPassthroughRisk(result, securitySchemes, options);
|
|
397
|
+
}
|
|
398
|
+
function canPassThroughCallerToken(options) {
|
|
399
|
+
return options.passthroughCallerToken === true && !options.securityResolver && !hasStaticAuth(options);
|
|
400
|
+
}
|
|
401
|
+
function withPassthroughRisk(result, securitySchemes, options) {
|
|
402
|
+
if (securitySchemes.size === 0 || !canPassThroughCallerToken(options)) {
|
|
403
|
+
return result;
|
|
404
|
+
}
|
|
405
|
+
const schemesStr = Array.from(securitySchemes).join(", ");
|
|
406
|
+
const when = options.authProviderMapper ? " whenever no authProviderMapper function returns a credential" : "";
|
|
407
|
+
result.securityRiskScore = "high";
|
|
408
|
+
result.warnings.push(
|
|
409
|
+
`SECURITY WARNING: passthroughCallerToken is enabled. The MCP client's own token (ctx.authInfo.token) is sent to the API${when} for security schemes: ${schemesStr}. Only use this when the API accepts tokens issued for this MCP server.`
|
|
410
|
+
);
|
|
373
411
|
return result;
|
|
374
412
|
}
|
|
375
413
|
async function resolveToolSecurity(tool2, ctx, options) {
|
|
@@ -387,9 +425,10 @@ async function resolveToolSecurity(tool2, ctx, options) {
|
|
|
387
425
|
Required security schemes: ${schemesStr}
|
|
388
426
|
Solutions:
|
|
389
427
|
1. Add authProviderMapper: { '${firstScheme}': (ctx) => ctx.authInfo.user?.token }
|
|
390
|
-
2. Add securityResolver: (tool, ctx) => ({ jwt: ctx
|
|
428
|
+
2. Add securityResolver: async (tool, ctx) => ({ jwt: await getApiToken(ctx) })
|
|
391
429
|
3. Add staticAuth: { jwt: process.env.API_TOKEN }
|
|
392
|
-
4. Set
|
|
430
|
+
4. Set passthroughCallerToken: true, only if the API accepts the MCP client's own token
|
|
431
|
+
5. Set generateOptions.includeSecurityInInput: true (not recommended for production)`
|
|
393
432
|
);
|
|
394
433
|
}
|
|
395
434
|
return await securityResolver.resolve(tool2.mapper, securityContext);
|
|
@@ -1190,7 +1229,7 @@ Add one of the following to your adapter configuration:
|
|
|
1190
1229
|
}
|
|
1191
1230
|
|
|
1192
1231
|
2. securityResolver:
|
|
1193
|
-
securityResolver: (tool,
|
|
1232
|
+
securityResolver: async (tool, ctx) => ({ jwt: await getApiToken(ctx) })
|
|
1194
1233
|
|
|
1195
1234
|
3. staticAuth:
|
|
1196
1235
|
staticAuth: { jwt: process.env.API_TOKEN }
|
|
@@ -28,7 +28,7 @@ export interface SecurityValidationResult {
|
|
|
28
28
|
* @param options - Adapter options with auth configuration
|
|
29
29
|
* @returns Security context for resolver
|
|
30
30
|
*/
|
|
31
|
-
export declare function createSecurityContextFromAuth(tool: McpOpenAPITool, ctx: FrontMcpContext, options: Pick<OpenApiAdapterOptions, 'securityResolver' | 'authProviderMapper' | 'staticAuth'>): Promise<SecurityContext>;
|
|
31
|
+
export declare function createSecurityContextFromAuth(tool: McpOpenAPITool, ctx: FrontMcpContext, options: Pick<OpenApiAdapterOptions, 'securityResolver' | 'authProviderMapper' | 'staticAuth' | 'passthroughCallerToken'>): Promise<SecurityContext>;
|
|
32
32
|
/**
|
|
33
33
|
* Extract all security schemes used by a set of tools
|
|
34
34
|
*
|
|
@@ -43,7 +43,7 @@ export declare function extractSecuritySchemes(tools: McpOpenAPITool[]): Set<str
|
|
|
43
43
|
* @param options - Adapter options
|
|
44
44
|
* @returns Validation result with errors and warnings
|
|
45
45
|
*/
|
|
46
|
-
export declare function validateSecurityConfiguration(tools: McpOpenAPITool[], options: Pick<OpenApiAdapterOptions, 'securityResolver' | 'authProviderMapper' | 'staticAuth' | 'generateOptions' | 'securitySchemesInInput'>): SecurityValidationResult;
|
|
46
|
+
export declare function validateSecurityConfiguration(tools: McpOpenAPITool[], options: Pick<OpenApiAdapterOptions, 'securityResolver' | 'authProviderMapper' | 'staticAuth' | 'generateOptions' | 'securitySchemesInInput' | 'passthroughCallerToken'>): SecurityValidationResult;
|
|
47
47
|
/**
|
|
48
48
|
* Resolve security for an OpenAPI tool with validation
|
|
49
49
|
*
|
|
@@ -53,5 +53,5 @@ export declare function validateSecurityConfiguration(tools: McpOpenAPITool[], o
|
|
|
53
53
|
* @returns Resolved security (headers, query params, etc.)
|
|
54
54
|
* @throws Error if security cannot be resolved
|
|
55
55
|
*/
|
|
56
|
-
export declare function resolveToolSecurity(tool: McpOpenAPITool, ctx: FrontMcpContext, options: Pick<OpenApiAdapterOptions, 'securityResolver' | 'authProviderMapper' | 'staticAuth'>): Promise<import("mcp-from-openapi").ResolvedSecurity>;
|
|
56
|
+
export declare function resolveToolSecurity(tool: McpOpenAPITool, ctx: FrontMcpContext, options: Pick<OpenApiAdapterOptions, 'securityResolver' | 'authProviderMapper' | 'staticAuth' | 'passthroughCallerToken'>): Promise<import("mcp-from-openapi").ResolvedSecurity>;
|
|
57
57
|
//# sourceMappingURL=openapi.security.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.security.d.ts","sourceRoot":"","sources":["../../src/openapi/openapi.security.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"openapi.security.d.ts","sourceRoot":"","sources":["../../src/openapi/openapi.security.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,cAAc,EAAE,KAAK,eAAe,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AAqB,EACrB,kBAAkB,GAAG,oBAAoB,GAAG,YAAY,GAAG,wBAAwB,CACpF,wDAyCF"}
|
|
@@ -638,6 +638,9 @@ interface BaseOptions {
|
|
|
638
638
|
* Static authentication configuration when not using dynamic auth from context.
|
|
639
639
|
* Useful for server-to-server APIs with static credentials.
|
|
640
640
|
*
|
|
641
|
+
* With an `authProviderMapper`, it fills every credential no mapper function returned (a mapped
|
|
642
|
+
* value wins), so the caller's token (`passthroughCallerToken`) is never used alongside it.
|
|
643
|
+
*
|
|
641
644
|
* @example
|
|
642
645
|
* ```typescript
|
|
643
646
|
* staticAuth: {
|
|
@@ -647,6 +650,20 @@ interface BaseOptions {
|
|
|
647
650
|
* ```
|
|
648
651
|
*/
|
|
649
652
|
staticAuth?: Partial<SecurityContext>;
|
|
653
|
+
/**
|
|
654
|
+
* Forward the MCP client's own bearer token (`ctx.authInfo.token`) to the API when no other
|
|
655
|
+
* credential source (`authProviderMapper`, `staticAuth`) supplied a credential.
|
|
656
|
+
*
|
|
657
|
+
* Off by default: the caller's token was issued for this MCP server, and sending it to another
|
|
658
|
+
* service is token passthrough, which the MCP specification forbids. Without this option an
|
|
659
|
+
* operation that requires authentication fails when the adapter has no credential for it.
|
|
660
|
+
* Enable it only when the API is meant to accept the same token (same issuer and audience).
|
|
661
|
+
* It also covers a security scheme with no `authProviderMapper` entry, which is otherwise refused
|
|
662
|
+
* at startup.
|
|
663
|
+
*
|
|
664
|
+
* @default false
|
|
665
|
+
*/
|
|
666
|
+
passthroughCallerToken?: boolean;
|
|
650
667
|
/**
|
|
651
668
|
* Options for loading the OpenAPI specification.
|
|
652
669
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.types.d.ts","sourceRoot":"","sources":["../../src/openapi/openapi.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACpH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AAC;IAElC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,gBAAgB,CAAC,EAAE,sBAAsB,CAAC;IAE1C;;;;;;;;;;;;;;;;;;OAkBG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAEnC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,cAAc,CAAC,EAAE,oBAAoB,CAAC;IAEtC;;;OAGG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC;IAExB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,CAAC,EAAE,iBAAiB,GAAG;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CACpD;AAED,UAAU,WAAY,SAAQ,WAAW;IACvC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,EAAE,SAAS,CAAC,QAAQ,GAAG,WAAW,CAAC,QAAQ,GAAG,MAAM,CAAC;CAC1D;AAED,UAAU,UAAW,SAAQ,WAAW;IACtC;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,qBAAqB,GAAG,WAAW,GAAG,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/adapters",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"description": "Adapters for the FrontMCP framework",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://docs.agentfront.dev",
|
|
@@ -64,15 +64,15 @@
|
|
|
64
64
|
"node": ">=24.0.0"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@frontmcp/auth": "1.8.
|
|
68
|
-
"@frontmcp/di": "1.8.
|
|
69
|
-
"@frontmcp/sdk": "1.8.
|
|
70
|
-
"@frontmcp/utils": "1.8.
|
|
67
|
+
"@frontmcp/auth": "1.8.3",
|
|
68
|
+
"@frontmcp/di": "1.8.3",
|
|
69
|
+
"@frontmcp/sdk": "1.8.3",
|
|
70
|
+
"@frontmcp/utils": "1.8.3",
|
|
71
71
|
"js-yaml": "^4.1.0",
|
|
72
72
|
"mcp-from-openapi": "2.8.0",
|
|
73
73
|
"openapi-types": "^12.1.3"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@frontmcp/lazy-zod": "1.8.
|
|
76
|
+
"@frontmcp/lazy-zod": "1.8.3"
|
|
77
77
|
}
|
|
78
78
|
}
|
package/skills/index.js
CHANGED
|
@@ -709,7 +709,13 @@ var npmSourceSchema = import_lazy_zod2.z.object({
|
|
|
709
709
|
exportName: import_lazy_zod2.z.string().optional(),
|
|
710
710
|
/**
|
|
711
711
|
* Verify GitHub artifact attestation / npm provenance for the package before loading.
|
|
712
|
-
* Defaults to true.
|
|
712
|
+
* Defaults to true. Provenance verification is not implemented yet, so `true` refuses
|
|
713
|
+
* to load the package; set `false` to load it without a provenance check.
|
|
714
|
+
*
|
|
715
|
+
* With `false`, the package is imported (its code runs) before the bundle is parsed, so
|
|
716
|
+
* bundle signing (`requireSignature` + `trustedKeys`) cannot protect the import itself.
|
|
717
|
+
* Only use it for a package you trust: pin its exact version in `package.json` and
|
|
718
|
+
* install from a lockfile with integrity hashes.
|
|
713
719
|
*/
|
|
714
720
|
verifyProvenance: import_lazy_zod2.z.boolean().default(true)
|
|
715
721
|
});
|
|
@@ -717,11 +723,15 @@ var saasSourceSchema = import_lazy_zod2.z.object({
|
|
|
717
723
|
type: import_lazy_zod2.z.literal("saas"),
|
|
718
724
|
/** SaaS pull endpoint, e.g. `https://cloud.frontmcp.dev/v1/bundles/<bundleId>`. */
|
|
719
725
|
endpoint: httpsUrl,
|
|
720
|
-
/**
|
|
726
|
+
/**
|
|
727
|
+
* Pinned JWT issued by the SaaS for the customer's FrontMCP server. Verified
|
|
728
|
+
* before every pull: signed by a key in `jwksUrl`, `iss` = `expectedIssuer`,
|
|
729
|
+
* `aud` includes `expectedAudience`, not expired. A rejected token stops the pull.
|
|
730
|
+
*/
|
|
721
731
|
authToken: import_lazy_zod2.z.string().min(1),
|
|
722
732
|
/**
|
|
723
|
-
* RFC 8707 resource indicator the JWT must encode
|
|
724
|
-
*
|
|
733
|
+
* RFC 8707 resource indicator the JWT must encode: its `aud` claim must include
|
|
734
|
+
* this value (and its `resource` claim too, when it has one).
|
|
725
735
|
*/
|
|
726
736
|
expectedAudience: import_lazy_zod2.z.string().min(1),
|
|
727
737
|
/** Polling interval in ms (boot pull is always immediate). Default 300000 (5 min). */
|
|
@@ -731,9 +741,9 @@ var saasSourceSchema = import_lazy_zod2.z.object({
|
|
|
731
741
|
* updates synchronously. Default false in v1.2 (interval polling only).
|
|
732
742
|
*/
|
|
733
743
|
enableWebhook: import_lazy_zod2.z.boolean().default(false),
|
|
734
|
-
/** JWKS URL for verifying SaaS-issued tokens. */
|
|
744
|
+
/** JWKS URL for verifying SaaS-issued tokens (fetched without credentials, redirects refused). */
|
|
735
745
|
jwksUrl: httpsUrl,
|
|
736
|
-
/** Expected issuer (`iss`) claim
|
|
746
|
+
/** Expected issuer (`iss`) claim of `authToken`. */
|
|
737
747
|
expectedIssuer: import_lazy_zod2.z.string().min(1)
|
|
738
748
|
});
|
|
739
749
|
var inlineSourceSchema = import_lazy_zod2.z.object({
|
|
@@ -831,8 +841,8 @@ var NpmSource = class {
|
|
|
831
841
|
}
|
|
832
842
|
async loadBundleFromPackage() {
|
|
833
843
|
if (this.options.verifyProvenance) {
|
|
834
|
-
|
|
835
|
-
`
|
|
844
|
+
throw new Error(
|
|
845
|
+
`npm source "${this.options.packageName}": verifyProvenance is true, but npm provenance verification is not implemented, so the package was not loaded. Set verifyProvenance: false to load it without a provenance check, only for a package you trust: importing it runs its code before any bundle signature is checked, so pin its exact version and install it from a lockfile with integrity hashes.`
|
|
836
846
|
);
|
|
837
847
|
}
|
|
838
848
|
const mod = await this.dynamicImport(this.options.packageName);
|
|
@@ -867,9 +877,33 @@ var NpmSource = class {
|
|
|
867
877
|
};
|
|
868
878
|
|
|
869
879
|
// libs/adapters/src/skills/sources/saas-pull.source.ts
|
|
880
|
+
var import_auth = require("@frontmcp/auth");
|
|
870
881
|
var import_utils = require("@frontmcp/utils");
|
|
871
882
|
var DEFAULT_CACHE_DIR = ".frontmcp/skilled-openapi";
|
|
872
883
|
var DEFAULT_PULL_TIMEOUT_MS = 3e4;
|
|
884
|
+
var USER_AGENT = "frontmcp-skilled-openapi";
|
|
885
|
+
var SaasPullTokenRejectedError = class extends Error {
|
|
886
|
+
constructor(reason) {
|
|
887
|
+
super(`[saas-source] pull token rejected: ${reason}`);
|
|
888
|
+
this.name = "SaasPullTokenRejectedError";
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
function claimValues(claim) {
|
|
892
|
+
if (Array.isArray(claim)) return claim;
|
|
893
|
+
return claim === void 0 ? [] : [claim];
|
|
894
|
+
}
|
|
895
|
+
var PUBLIC_KEY_MEMBERS = /* @__PURE__ */ new Map([
|
|
896
|
+
["RSA", ["n", "e"]],
|
|
897
|
+
["EC", ["crv", "x", "y"]],
|
|
898
|
+
["OKP", ["crv", "x"]]
|
|
899
|
+
]);
|
|
900
|
+
function isUsableSigningKey(key) {
|
|
901
|
+
if (typeof key !== "object" || key === null) return false;
|
|
902
|
+
const jwk = key;
|
|
903
|
+
const members = typeof jwk["kty"] === "string" ? PUBLIC_KEY_MEMBERS.get(jwk["kty"]) : void 0;
|
|
904
|
+
if (!members || jwk["use"] !== void 0 && jwk["use"] !== "sig") return false;
|
|
905
|
+
return members.every((m) => typeof jwk[m] === "string" && jwk[m] !== "");
|
|
906
|
+
}
|
|
873
907
|
var SaasPullSource = class {
|
|
874
908
|
constructor(options, cacheDir, logger, deps = {}) {
|
|
875
909
|
this.options = options;
|
|
@@ -887,6 +921,7 @@ var SaasPullSource = class {
|
|
|
887
921
|
pollHandle;
|
|
888
922
|
inFlight = false;
|
|
889
923
|
stopped = false;
|
|
924
|
+
jwksService = new import_auth.JwksService({});
|
|
890
925
|
async start() {
|
|
891
926
|
if (this.stopped || this.inFlight) {
|
|
892
927
|
this.schedulePoll();
|
|
@@ -899,6 +934,7 @@ var SaasPullSource = class {
|
|
|
899
934
|
bundle = await this.fetchOnce();
|
|
900
935
|
await this.persistCache(bundle);
|
|
901
936
|
} catch (e) {
|
|
937
|
+
if (e instanceof SaasPullTokenRejectedError) throw e;
|
|
902
938
|
this.logger.warn(
|
|
903
939
|
`[saas-source] initial pull failed (${e.message}); attempting cached bundle fallback`
|
|
904
940
|
);
|
|
@@ -970,7 +1006,11 @@ var SaasPullSource = class {
|
|
|
970
1006
|
await this.persistCache(bundle);
|
|
971
1007
|
this.notify(bundle);
|
|
972
1008
|
} catch (e) {
|
|
973
|
-
|
|
1009
|
+
if (e instanceof SaasPullTokenRejectedError) {
|
|
1010
|
+
this.logger.error(`[saas-source] poll refused: ${e.message}; keeping the current bundle`);
|
|
1011
|
+
} else {
|
|
1012
|
+
this.logger.warn(`[saas-source] poll failed: ${e.message}`);
|
|
1013
|
+
}
|
|
974
1014
|
} finally {
|
|
975
1015
|
this.inFlight = false;
|
|
976
1016
|
this.schedulePoll();
|
|
@@ -991,11 +1031,53 @@ var SaasPullSource = class {
|
|
|
991
1031
|
clearTimeout(timer);
|
|
992
1032
|
}
|
|
993
1033
|
}
|
|
1034
|
+
/**
|
|
1035
|
+
* Verify the pinned pull token against the issuer's JWKS, issuer and audience.
|
|
1036
|
+
* Throws {@link SaasPullTokenRejectedError} when the token is refused, and a
|
|
1037
|
+
* plain Error when the JWKS can't be fetched (an outage).
|
|
1038
|
+
*/
|
|
1039
|
+
async verifyPullToken() {
|
|
1040
|
+
const { jwksUrl, expectedIssuer, expectedAudience, authToken } = this.options;
|
|
1041
|
+
const { status, body } = await this.httpGet(jwksUrl, { Accept: "application/json", "User-Agent": USER_AGENT });
|
|
1042
|
+
if (status < 200 || status >= 300) {
|
|
1043
|
+
throw new Error(`JWKS ${jwksUrl} responded ${status}`);
|
|
1044
|
+
}
|
|
1045
|
+
let jwks;
|
|
1046
|
+
try {
|
|
1047
|
+
jwks = JSON.parse(body);
|
|
1048
|
+
} catch {
|
|
1049
|
+
throw new Error(`JWKS ${jwksUrl} is not valid JSON`);
|
|
1050
|
+
}
|
|
1051
|
+
if (!jwks || !Array.isArray(jwks.keys) || jwks.keys.length === 0) {
|
|
1052
|
+
throw new Error(`JWKS ${jwksUrl} has no keys`);
|
|
1053
|
+
}
|
|
1054
|
+
const signingKeys = jwks.keys.filter(isUsableSigningKey);
|
|
1055
|
+
if (signingKeys.length === 0) {
|
|
1056
|
+
throw new Error(`JWKS ${jwksUrl} has no usable signing keys`);
|
|
1057
|
+
}
|
|
1058
|
+
const verified = await this.jwksService.verifyTransparentToken(authToken, [
|
|
1059
|
+
{ id: "skilled-openapi-saas", issuerUrl: expectedIssuer, jwks: { keys: signingKeys } }
|
|
1060
|
+
]);
|
|
1061
|
+
if (!verified.ok || !verified.payload) {
|
|
1062
|
+
throw new SaasPullTokenRejectedError(
|
|
1063
|
+
`not a valid token from issuer "${expectedIssuer}" signed by a key in ${jwksUrl} (${verified.error ?? "verification failed"})`
|
|
1064
|
+
);
|
|
1065
|
+
}
|
|
1066
|
+
const payload = verified.payload;
|
|
1067
|
+
if (!claimValues(payload["aud"]).includes(expectedAudience)) {
|
|
1068
|
+
throw new SaasPullTokenRejectedError(`its "aud" claim does not include "${expectedAudience}"`);
|
|
1069
|
+
}
|
|
1070
|
+
const resource = claimValues(payload["resource"]);
|
|
1071
|
+
if (resource.length > 0 && !resource.includes(expectedAudience)) {
|
|
1072
|
+
throw new SaasPullTokenRejectedError(`its "resource" claim does not include "${expectedAudience}"`);
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
994
1075
|
async fetchOnce() {
|
|
1076
|
+
await this.verifyPullToken();
|
|
995
1077
|
const { status, body } = await this.httpGet(this.options.endpoint, {
|
|
996
1078
|
Authorization: `Bearer ${this.options.authToken}`,
|
|
997
1079
|
Accept: "application/json, application/yaml",
|
|
998
|
-
"User-Agent":
|
|
1080
|
+
"User-Agent": USER_AGENT
|
|
999
1081
|
});
|
|
1000
1082
|
if (status < 200 || status >= 300) {
|
|
1001
1083
|
throw new Error(`pull responded ${status}`);
|
|
@@ -1609,13 +1691,13 @@ function verifyBundleSignature(bundle, trustedKeys, telemetry) {
|
|
|
1609
1691
|
}
|
|
1610
1692
|
|
|
1611
1693
|
// libs/adapters/src/skills/security/jwt-verifier.ts
|
|
1612
|
-
var
|
|
1694
|
+
var import_auth2 = require("@frontmcp/auth");
|
|
1613
1695
|
var DEFAULT_REQUIRED_ROLES = ["frontmcp:cloud:push"];
|
|
1614
1696
|
var BundlePushJwtVerifier = class {
|
|
1615
1697
|
constructor(options, logger, jwks) {
|
|
1616
1698
|
this.options = options;
|
|
1617
1699
|
this.logger = logger;
|
|
1618
|
-
this.jwks = jwks ?? new
|
|
1700
|
+
this.jwks = jwks ?? new import_auth2.JwksService({});
|
|
1619
1701
|
this.providerRef = {
|
|
1620
1702
|
id: "skilled-openapi-cloud-push",
|
|
1621
1703
|
issuerUrl: options.expectedIssuer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-options.d.ts","sourceRoot":"","sources":["../../src/skills/source-options.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAkBvC,eAAO,MAAM,kBAAkB;;;;gCAM7B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;
|
|
1
|
+
{"version":3,"file":"source-options.d.ts","sourceRoot":"","sources":["../../src/skills/source-options.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAkBvC,eAAO,MAAM,kBAAkB;;;;gCAM7B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;gCAiB1B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;gCA0B3B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;gCAS7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;0CAK7B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACrE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC/D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACjE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACrE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAIrE,eAAO,MAAM,kBAAkB;;;;;;;gCAO7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|