@zuplo/runtime 6.70.49 → 6.70.51

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.
@@ -956,8 +956,9 @@ declare interface Logger extends BaseLogger {
956
956
  * with a `ConfigurationError` (surfaced in the 500 problem body) rather than
957
957
  * crashing boot.
958
958
  *
959
- * @hidden
959
+ * @public
960
960
  * @title MCP Auth0 OAuth
961
+ * @product mcp-gateway
961
962
  */
962
963
  export declare class McpAuth0OAuthInboundPolicy extends InboundPolicy<McpAuth0OAuthInboundPolicyOptions> {
963
964
  #private;
@@ -1028,8 +1029,9 @@ export declare interface McpAuth0OAuthInboundPolicyOptions {
1028
1029
  * with a customer-facing `ConfigurationError` instead of failing at module
1029
1030
  * load.
1030
1031
  *
1031
- * @hidden
1032
+ * @public
1032
1033
  * @title MCP Capability Filter
1034
+ * @product mcp-gateway
1033
1035
  */
1034
1036
  export declare class McpCapabilityFilterInboundPolicy extends InboundPolicy<ValidatedOptions> {
1035
1037
  #private;
@@ -1145,50 +1147,19 @@ declare const mcpCapabilityFilterOptionsSchema: z.ZodObject<
1145
1147
  >;
1146
1148
 
1147
1149
  /**
1148
- * Activates the MCP Gateway internal routes (OAuth authorization server,
1149
- * upstream connection management, well-known metadata) on the runtime router.
1150
- * The plugin is a no-op when no MCP-related policy is present.
1150
+ * Authenticate MCP gateway requests using a gateway-issued OAuth access token,
1151
+ * with browser login delegated to Clerk.
1151
1152
  *
1152
- * Importing from `@zuplo/runtime/mcp-gateway` is the opt-in: the runtime core
1153
- * does not statically reference any MCP gateway code, so unrelated projects
1154
- * pay no bundle cost.
1153
+ * Clerk-friendly wrapper around `McpOAuthInboundPolicy`. Provide Clerk's
1154
+ * Frontend API URL plus the OAuth application client id and secret; the
1155
+ * constructor derives the Clerk issuer, JWKS URL, authorize URL, and token URL.
1155
1156
  *
1157
+ * @title MCP Clerk OAuth
1156
1158
  * @public
1157
- * @example
1158
- * ```ts
1159
- * import { McpGatewayPlugin } from "@zuplo/runtime/mcp-gateway";
1160
- *
1161
- * export default async function (runtime: RuntimeExtensions) {
1162
- * runtime.addPlugin(new McpGatewayPlugin());
1163
- * }
1164
- * ```
1165
- */
1166
- export declare class McpGatewayPlugin extends SystemRuntimePlugin {
1167
- registerRoutes(options: {
1168
- router: Router;
1169
- runtimeSettings: RuntimeSettings;
1170
- parsedRouteData?: ParsedRouteData;
1171
- }): void;
1172
- }
1173
-
1174
- /**
1175
- * Authenticate MCP gateway requests using a gateway-issued OAuth access token.
1176
- *
1177
- * The gateway hosts its own OAuth authorization server endpoints (DCR,
1178
- * `/authorize`, `/token`, `/callback`) — registered automatically when this
1179
- * policy is present in `policies.json`. End-user browser login is delegated
1180
- * to the OpenID Connect identity provider configured via the `oidc` and
1181
- * `browserLogin` policy options.
1182
- *
1183
- * Validation runs lazily inside the policy constructor, which the runtime
1184
- * caches per policy name — so a misconfigured policy fails the first request
1185
- * with a `ConfigurationError` (surfaced in the 500 problem body) rather than
1186
- * crashing boot.
1187
- *
1188
- * @hidden
1189
- * @title MCP OAuth
1159
+ * @product mcp-gateway
1190
1160
  */
1191
- export declare class McpOAuthInboundPolicy extends InboundPolicy<McpOAuthRuntimeConfig> {
1161
+ export declare class McpClerkOAuthInboundPolicy extends InboundPolicy<McpClerkOAuthInboundPolicyOptions> {
1162
+ #private;
1192
1163
  constructor(rawOptions: unknown, policyName: string);
1193
1164
  handler(
1194
1165
  request: ZuploRequest,
@@ -1200,65 +1171,170 @@ export declare class McpOAuthInboundPolicy extends InboundPolicy<McpOAuthRuntime
1200
1171
  * The options for this policy.
1201
1172
  * @public
1202
1173
  */
1203
- export declare interface McpOAuthInboundPolicyOptions {
1174
+ export declare interface McpClerkOAuthInboundPolicyOptions {
1204
1175
  /**
1205
- * OpenID Connect identity provider that authenticates end-users before the gateway issues its own OAuth access token.
1176
+ * The Clerk Frontend API URL origin, without a trailing path, query string, or fragment.
1206
1177
  */
1207
- oidc: {
1178
+ frontendApiUrl: string;
1179
+ /**
1180
+ * The Clerk OAuth application client_id registered for the gateway's browser login flow.
1181
+ */
1182
+ clientId: string;
1183
+ /**
1184
+ * The Clerk OAuth application client_secret. Use $env(...) to source from a secret environment variable.
1185
+ */
1186
+ clientSecret: string;
1187
+ /**
1188
+ * OIDC scopes requested during browser login.
1189
+ */
1190
+ scope?: string;
1191
+ /**
1192
+ * Gateway-side OAuth token settings. The gateway issuer and advertised URLs are derived from the incoming request origin.
1193
+ */
1194
+ gateway?: {
1208
1195
  /**
1209
- * The OIDC issuer URL of the identity provider.
1196
+ * Lifetime of access tokens issued by /oauth/token.
1210
1197
  */
1211
- issuer: string;
1198
+ accessTokenTtlSeconds?: number;
1212
1199
  /**
1213
- * The JWKS endpoint used to verify ID tokens issued by the identity provider.
1200
+ * Lifetime of refresh tokens issued by /oauth/token.
1214
1201
  */
1215
- jwksUrl: string;
1202
+ refreshTokenTtlSeconds?: number;
1216
1203
  /**
1217
- * Optional IdP audience value. Leave unset when browser login ID tokens use the OIDC client_id as their audience.
1204
+ * Whether to advertise client_id_metadata_document_supported in AS metadata.
1218
1205
  */
1219
- audience?: string;
1206
+ cimdEnabled?: boolean;
1220
1207
  };
1221
1208
  /**
1222
- * Browser-side OAuth/OIDC settings used when the gateway redirects the user to the identity provider for login.
1209
+ * Optional overrides for the derived browser-login settings.
1223
1210
  */
1224
- browserLogin: {
1225
- /**
1226
- * The IdP /authorize endpoint to redirect the user to. For local development on loopback, use http://127.0.0.1:9000/oauth/dev-login.
1227
- */
1228
- url: string;
1229
- /**
1230
- * The IdP token endpoint used for the federated authorization code exchange. Required for federated_oidc browser login.
1231
- */
1232
- tokenUrl?: string;
1233
- /**
1234
- * The OIDC client_id registered with the identity provider for the gateway's browser login flow.
1235
- */
1236
- clientId?: string;
1237
- /**
1238
- * The OIDC client_secret. Required for federated browser login. Use $env(...) to source from a secret environment variable.
1239
- */
1240
- clientSecret?: string;
1211
+ browserLoginOverrides?: {
1212
+ remoteTimeoutMs?: number;
1213
+ stateTtlSeconds?: number;
1214
+ sessionTtlSeconds?: number;
1215
+ };
1216
+ }
1217
+
1218
+ /**
1219
+ * Authenticate MCP gateway requests using a gateway-issued OAuth access token,
1220
+ * with browser login delegated to Amazon Cognito.
1221
+ *
1222
+ * Cognito-friendly wrapper around `McpOAuthInboundPolicy`. Provide an AWS
1223
+ * region, user pool id, user pool domain, client id, and client secret; the
1224
+ * constructor derives the Cognito issuer, JWKS URL, authorize URL, and token
1225
+ * URL.
1226
+ *
1227
+ * @title MCP Amazon Cognito OAuth
1228
+ * @public
1229
+ * @product mcp-gateway
1230
+ */
1231
+ export declare class McpCognitoOAuthInboundPolicy extends InboundPolicy<McpCognitoOAuthInboundPolicyOptions> {
1232
+ #private;
1233
+ constructor(rawOptions: unknown, policyName: string);
1234
+ handler(
1235
+ request: ZuploRequest,
1236
+ context: ZuploContext
1237
+ ): Promise<ZuploRequest | Response>;
1238
+ }
1239
+
1240
+ /**
1241
+ * The options for this policy.
1242
+ * @public
1243
+ */
1244
+ export declare interface McpCognitoOAuthInboundPolicyOptions {
1245
+ /**
1246
+ * The AWS region that contains the Amazon Cognito user pool.
1247
+ */
1248
+ awsRegion: string;
1249
+ /**
1250
+ * The Amazon Cognito user pool ID.
1251
+ */
1252
+ userPoolId: string;
1253
+ /**
1254
+ * The hosted UI domain for the user pool, without https://, a trailing slash, or a path.
1255
+ */
1256
+ userPoolDomain: string;
1257
+ /**
1258
+ * The Cognito app client_id registered for the gateway's browser login flow.
1259
+ */
1260
+ clientId: string;
1261
+ /**
1262
+ * The Cognito app client_secret. Use $env(...) to source from a secret environment variable.
1263
+ */
1264
+ clientSecret: string;
1265
+ /**
1266
+ * OIDC scopes requested during browser login.
1267
+ */
1268
+ scope?: string;
1269
+ /**
1270
+ * Gateway-side OAuth token settings. The gateway issuer and advertised URLs are derived from the incoming request origin.
1271
+ */
1272
+ gateway?: {
1241
1273
  /**
1242
- * The OIDC scopes requested during browser login.
1274
+ * Lifetime of access tokens issued by /oauth/token.
1243
1275
  */
1244
- scope?: string;
1276
+ accessTokenTtlSeconds?: number;
1245
1277
  /**
1246
- * Optional audience parameter for the IdP authorization request (Auth0-style API audiences).
1278
+ * Lifetime of refresh tokens issued by /oauth/token.
1247
1279
  */
1248
- audience?: string;
1280
+ refreshTokenTtlSeconds?: number;
1249
1281
  /**
1250
- * Timeout for outbound calls to the IdP (token exchange, JWKS fetch).
1282
+ * Whether to advertise client_id_metadata_document_supported in AS metadata.
1251
1283
  */
1284
+ cimdEnabled?: boolean;
1285
+ };
1286
+ /**
1287
+ * Optional overrides for the derived browser-login settings.
1288
+ */
1289
+ browserLoginOverrides?: {
1252
1290
  remoteTimeoutMs?: number;
1253
- /**
1254
- * Lifetime of an in-flight browser-login state record.
1255
- */
1256
1291
  stateTtlSeconds?: number;
1257
- /**
1258
- * Lifetime of the gateway browser-login session cookie issued after a successful login.
1259
- */
1260
1292
  sessionTtlSeconds?: number;
1261
1293
  };
1294
+ }
1295
+
1296
+ /**
1297
+ * Authenticate MCP gateway requests using a gateway-issued OAuth access token,
1298
+ * with browser login delegated to Microsoft Entra ID.
1299
+ *
1300
+ * Entra-friendly wrapper around `McpOAuthInboundPolicy`. Provide a tenant UUID,
1301
+ * application client id, and client secret; the constructor derives the Entra
1302
+ * v2 issuer, JWKS URL, authorize URL, and token URL.
1303
+ *
1304
+ * @title MCP Microsoft Entra OAuth
1305
+ * @public
1306
+ * @product mcp-gateway
1307
+ */
1308
+ export declare class McpEntraOAuthInboundPolicy extends InboundPolicy<McpEntraOAuthInboundPolicyOptions> {
1309
+ #private;
1310
+ constructor(rawOptions: unknown, policyName: string);
1311
+ handler(
1312
+ request: ZuploRequest,
1313
+ context: ZuploContext
1314
+ ): Promise<ZuploRequest | Response>;
1315
+ }
1316
+
1317
+ /**
1318
+ * The options for this policy.
1319
+ * @public
1320
+ */
1321
+ export declare interface McpEntraOAuthInboundPolicyOptions {
1322
+ /**
1323
+ * The Microsoft Entra tenant UUID. Multi-tenant aliases like common and organizations are not supported by this policy yet.
1324
+ */
1325
+ tenantId: string;
1326
+ /**
1327
+ * The Microsoft Entra application (client) ID UUID registered for the gateway's browser login flow.
1328
+ */
1329
+ clientId: string;
1330
+ /**
1331
+ * The Microsoft Entra client secret. Use $env(...) to source from a secret environment variable.
1332
+ */
1333
+ clientSecret: string;
1334
+ /**
1335
+ * OIDC scopes requested during browser login.
1336
+ */
1337
+ scope?: string;
1262
1338
  /**
1263
1339
  * Gateway-side OAuth token settings. The gateway issuer and advertised URLs are derived from the incoming request origin.
1264
1340
  */
@@ -1276,70 +1352,649 @@ export declare interface McpOAuthInboundPolicyOptions {
1276
1352
  */
1277
1353
  cimdEnabled?: boolean;
1278
1354
  };
1355
+ /**
1356
+ * Optional overrides for the derived browser-login settings.
1357
+ */
1358
+ browserLoginOverrides?: {
1359
+ remoteTimeoutMs?: number;
1360
+ stateTtlSeconds?: number;
1361
+ sessionTtlSeconds?: number;
1362
+ };
1279
1363
  }
1280
1364
 
1281
- declare type McpOAuthRuntimeConfig = z.infer<
1282
- typeof mcpOAuthRuntimeConfigSchema
1283
- >;
1284
-
1285
- declare const mcpOAuthRuntimeConfigSchema: z.ZodObject<
1286
- {
1287
- oidc: z.ZodObject<
1288
- {
1289
- issuer: z.ZodURL;
1290
- jwksUrl: z.ZodURL;
1291
- audience: z.ZodOptional<z.ZodString>;
1292
- },
1293
- z.core.$strip
1294
- >;
1295
- browserLogin: z.ZodObject<
1296
- {
1297
- url: z.ZodURL;
1298
- tokenUrl: z.ZodOptional<z.ZodURL>;
1299
- clientId: z.ZodOptional<z.ZodString>;
1300
- clientSecret: z.ZodOptional<z.ZodString>;
1301
- scope: z.ZodDefault<z.ZodString>;
1302
- audience: z.ZodOptional<z.ZodString>;
1303
- remoteTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1304
- stateTtlSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1305
- sessionTtlSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1306
- },
1307
- z.core.$strict
1308
- >;
1309
- gateway: z.ZodDefault<
1310
- z.ZodOptional<
1311
- z.ZodDefault<
1312
- z.ZodObject<
1313
- {
1314
- accessTokenTtlSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1315
- refreshTokenTtlSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1316
- cimdEnabled: z.ZodDefault<z.ZodBoolean>;
1317
- },
1318
- z.core.$strict
1319
- >
1320
- >
1321
- >
1322
- >;
1323
- },
1324
- z.core.$strict
1325
- >;
1326
-
1327
- export declare function McpProxyHandler(
1328
- request: ZuploRequest,
1329
- context: ZuploContext
1330
- ): Promise<Response>;
1331
-
1332
1365
  /**
1333
- * Resolve a gateway-managed upstream MCP credential and apply it to the
1334
- * request before the normal Zuplo route handler forwards the request.
1366
+ * Activates the MCP Gateway internal routes (OAuth authorization server,
1367
+ * upstream connection management, well-known metadata) on the runtime router.
1368
+ * The plugin is a no-op when no MCP-related policy is present.
1369
+ *
1370
+ * Importing from `@zuplo/runtime/mcp-gateway` is the opt-in: the runtime core
1371
+ * does not statically reference any MCP gateway code, so unrelated projects
1372
+ * pay no bundle cost.
1373
+ *
1374
+ * @beta
1375
+ * @example
1376
+ * ```ts
1377
+ * import { McpGatewayPlugin } from "@zuplo/runtime/mcp-gateway";
1378
+ *
1379
+ * export default async function (runtime: RuntimeExtensions) {
1380
+ * runtime.addPlugin(new McpGatewayPlugin());
1381
+ * }
1382
+ * ```
1383
+ */
1384
+ export declare class McpGatewayPlugin extends SystemRuntimePlugin {
1385
+ registerRoutes(options: {
1386
+ router: Router;
1387
+ runtimeSettings: RuntimeSettings;
1388
+ parsedRouteData?: ParsedRouteData;
1389
+ }): void;
1390
+ }
1391
+
1392
+ /**
1393
+ * Authenticate MCP gateway requests using a gateway-issued OAuth access token,
1394
+ * with browser login delegated to Google.
1395
+ *
1396
+ * Google-friendly wrapper around `McpOAuthInboundPolicy`. Provide `clientId`
1397
+ * and `clientSecret`; the constructor uses Google's fixed OIDC issuer, JWKS
1398
+ * URL, authorize URL, and token URL, then runs the resulting shape through the
1399
+ * same Zod schema as the generic policy.
1400
+ *
1401
+ * @title MCP Google OAuth
1402
+ * @public
1403
+ * @product mcp-gateway
1404
+ */
1405
+ export declare class McpGoogleOAuthInboundPolicy extends InboundPolicy<McpGoogleOAuthInboundPolicyOptions> {
1406
+ #private;
1407
+ constructor(rawOptions: unknown, policyName: string);
1408
+ handler(
1409
+ request: ZuploRequest,
1410
+ context: ZuploContext
1411
+ ): Promise<ZuploRequest | Response>;
1412
+ }
1413
+
1414
+ /**
1415
+ * The options for this policy.
1416
+ * @public
1417
+ */
1418
+ export declare interface McpGoogleOAuthInboundPolicyOptions {
1419
+ /**
1420
+ * The Google OAuth client_id registered for the gateway's browser login flow. Google uses a fixed OIDC issuer and discovery endpoint.
1421
+ */
1422
+ clientId: string;
1423
+ /**
1424
+ * The Google OAuth client_secret. Use $env(...) to source from a secret environment variable.
1425
+ */
1426
+ clientSecret: string;
1427
+ /**
1428
+ * OIDC scopes requested during browser login.
1429
+ */
1430
+ scope?: string;
1431
+ /**
1432
+ * Gateway-side OAuth token settings. The gateway issuer and advertised URLs are derived from the incoming request origin.
1433
+ */
1434
+ gateway?: {
1435
+ /**
1436
+ * Lifetime of access tokens issued by /oauth/token.
1437
+ */
1438
+ accessTokenTtlSeconds?: number;
1439
+ /**
1440
+ * Lifetime of refresh tokens issued by /oauth/token.
1441
+ */
1442
+ refreshTokenTtlSeconds?: number;
1443
+ /**
1444
+ * Whether to advertise client_id_metadata_document_supported in AS metadata.
1445
+ */
1446
+ cimdEnabled?: boolean;
1447
+ };
1448
+ /**
1449
+ * Optional overrides for the derived browser-login settings.
1450
+ */
1451
+ browserLoginOverrides?: {
1452
+ remoteTimeoutMs?: number;
1453
+ stateTtlSeconds?: number;
1454
+ sessionTtlSeconds?: number;
1455
+ };
1456
+ }
1457
+
1458
+ /**
1459
+ * Authenticate MCP gateway requests using a gateway-issued OAuth access token,
1460
+ * with browser login delegated to Keycloak.
1461
+ *
1462
+ * Keycloak-friendly wrapper around `McpOAuthInboundPolicy`. Provide the
1463
+ * Keycloak server root, realm, client id, and client secret; the constructor
1464
+ * derives the realm issuer, JWKS URL, authorize URL, and token URL from
1465
+ * Keycloak's documented OIDC endpoint layout.
1466
+ *
1467
+ * @title MCP Keycloak OAuth
1468
+ * @public
1469
+ * @product mcp-gateway
1470
+ */
1471
+ export declare class McpKeycloakOAuthInboundPolicy extends InboundPolicy<McpKeycloakOAuthInboundPolicyOptions> {
1472
+ #private;
1473
+ constructor(rawOptions: unknown, policyName: string);
1474
+ handler(
1475
+ request: ZuploRequest,
1476
+ context: ZuploContext
1477
+ ): Promise<ZuploRequest | Response>;
1478
+ }
1479
+
1480
+ /**
1481
+ * The options for this policy.
1482
+ * @public
1483
+ */
1484
+ export declare interface McpKeycloakOAuthInboundPolicyOptions {
1485
+ /**
1486
+ * The absolute URL for the Keycloak server root. Do not include /realms/{realm}; set the realm option separately.
1487
+ */
1488
+ keycloakBaseUrl: string;
1489
+ /**
1490
+ * The Keycloak realm name.
1491
+ */
1492
+ realm: string;
1493
+ /**
1494
+ * The Keycloak OIDC client_id registered for the gateway's browser login flow.
1495
+ */
1496
+ clientId: string;
1497
+ /**
1498
+ * The Keycloak OIDC client_secret. Use $env(...) to source from a secret environment variable.
1499
+ */
1500
+ clientSecret: string;
1501
+ /**
1502
+ * OIDC scopes requested during browser login.
1503
+ */
1504
+ scope?: string;
1505
+ /**
1506
+ * Gateway-side OAuth token settings. The gateway issuer and advertised URLs are derived from the incoming request origin.
1507
+ */
1508
+ gateway?: {
1509
+ /**
1510
+ * Lifetime of access tokens issued by /oauth/token.
1511
+ */
1512
+ accessTokenTtlSeconds?: number;
1513
+ /**
1514
+ * Lifetime of refresh tokens issued by /oauth/token.
1515
+ */
1516
+ refreshTokenTtlSeconds?: number;
1517
+ /**
1518
+ * Whether to advertise client_id_metadata_document_supported in AS metadata.
1519
+ */
1520
+ cimdEnabled?: boolean;
1521
+ };
1522
+ /**
1523
+ * Optional overrides for the derived browser-login settings.
1524
+ */
1525
+ browserLoginOverrides?: {
1526
+ remoteTimeoutMs?: number;
1527
+ stateTtlSeconds?: number;
1528
+ sessionTtlSeconds?: number;
1529
+ };
1530
+ }
1531
+
1532
+ /**
1533
+ * Authenticate MCP gateway requests using a gateway-issued OAuth access token,
1534
+ * with browser login delegated to Logto.
1535
+ *
1536
+ * Logto-friendly wrapper around `McpOAuthInboundPolicy`. Provide the Logto
1537
+ * tenant endpoint, client id, and client secret; the constructor derives the
1538
+ * Logto `/oidc` issuer, JWKS URL, authorize URL, and token URL.
1539
+ *
1540
+ * @title MCP Logto OAuth
1541
+ * @public
1542
+ * @product mcp-gateway
1543
+ */
1544
+ export declare class McpLogtoOAuthInboundPolicy extends InboundPolicy<McpLogtoOAuthInboundPolicyOptions> {
1545
+ #private;
1546
+ constructor(rawOptions: unknown, policyName: string);
1547
+ handler(
1548
+ request: ZuploRequest,
1549
+ context: ZuploContext
1550
+ ): Promise<ZuploRequest | Response>;
1551
+ }
1552
+
1553
+ /**
1554
+ * The options for this policy.
1555
+ * @public
1556
+ */
1557
+ export declare interface McpLogtoOAuthInboundPolicyOptions {
1558
+ /**
1559
+ * Your Logto tenant endpoint or custom domain, without the /oidc path. The OIDC issuer, JWKS URL, authorization URL, and token URL are derived from this.
1560
+ */
1561
+ logtoEndpoint: string;
1562
+ /**
1563
+ * The Logto application client_id registered for the gateway's browser login flow.
1564
+ */
1565
+ clientId: string;
1566
+ /**
1567
+ * The Logto application client_secret. Use $env(...) to source from a secret environment variable.
1568
+ */
1569
+ clientSecret: string;
1570
+ /**
1571
+ * OIDC scopes requested during browser login.
1572
+ */
1573
+ scope?: string;
1574
+ /**
1575
+ * Gateway-side OAuth token settings. The gateway issuer and advertised URLs are derived from the incoming request origin.
1576
+ */
1577
+ gateway?: {
1578
+ /**
1579
+ * Lifetime of access tokens issued by /oauth/token.
1580
+ */
1581
+ accessTokenTtlSeconds?: number;
1582
+ /**
1583
+ * Lifetime of refresh tokens issued by /oauth/token.
1584
+ */
1585
+ refreshTokenTtlSeconds?: number;
1586
+ /**
1587
+ * Whether to advertise client_id_metadata_document_supported in AS metadata.
1588
+ */
1589
+ cimdEnabled?: boolean;
1590
+ };
1591
+ /**
1592
+ * Optional overrides for the derived browser-login settings.
1593
+ */
1594
+ browserLoginOverrides?: {
1595
+ remoteTimeoutMs?: number;
1596
+ stateTtlSeconds?: number;
1597
+ sessionTtlSeconds?: number;
1598
+ };
1599
+ }
1600
+
1601
+ /**
1602
+ * Authenticate MCP gateway requests using a gateway-issued OAuth access token.
1603
+ *
1604
+ * The gateway hosts its own OAuth authorization server endpoints (DCR,
1605
+ * `/authorize`, `/token`, `/callback`) — registered automatically when this
1606
+ * policy is present in `policies.json`. End-user browser login is delegated
1607
+ * to the OpenID Connect identity provider configured via the `oidc` and
1608
+ * `browserLogin` policy options.
1609
+ *
1610
+ * Validation runs lazily inside the policy constructor, which the runtime
1611
+ * caches per policy name — so a misconfigured policy fails the first request
1612
+ * with a `ConfigurationError` (surfaced in the 500 problem body) rather than
1613
+ * crashing boot.
1614
+ *
1615
+ * @public
1616
+ * @title MCP OAuth
1617
+ * @product mcp-gateway
1618
+ */
1619
+ export declare class McpOAuthInboundPolicy extends InboundPolicy<McpOAuthRuntimeConfig> {
1620
+ constructor(rawOptions: unknown, policyName: string);
1621
+ handler(
1622
+ request: ZuploRequest,
1623
+ context: ZuploContext
1624
+ ): Promise<ZuploRequest | Response>;
1625
+ }
1626
+
1627
+ /**
1628
+ * The options for this policy.
1629
+ * @public
1630
+ */
1631
+ export declare interface McpOAuthInboundPolicyOptions {
1632
+ /**
1633
+ * OpenID Connect identity provider that authenticates end-users before the gateway issues its own OAuth access token.
1634
+ */
1635
+ oidc: {
1636
+ /**
1637
+ * The OIDC issuer URL of the identity provider.
1638
+ */
1639
+ issuer: string;
1640
+ /**
1641
+ * The JWKS endpoint used to verify ID tokens issued by the identity provider.
1642
+ */
1643
+ jwksUrl: string;
1644
+ /**
1645
+ * Optional IdP audience value. Leave unset when browser login ID tokens use the OIDC client_id as their audience.
1646
+ */
1647
+ audience?: string;
1648
+ };
1649
+ /**
1650
+ * Browser-side OAuth/OIDC settings used when the gateway redirects the user to the identity provider for login.
1651
+ */
1652
+ browserLogin: {
1653
+ /**
1654
+ * The IdP /authorize endpoint to redirect the user to. For local development on loopback, use http://127.0.0.1:9000/oauth/dev-login.
1655
+ */
1656
+ url: string;
1657
+ /**
1658
+ * The IdP token endpoint used for the federated authorization code exchange. Required for federated_oidc browser login.
1659
+ */
1660
+ tokenUrl?: string;
1661
+ /**
1662
+ * The OIDC client_id registered with the identity provider for the gateway's browser login flow.
1663
+ */
1664
+ clientId?: string;
1665
+ /**
1666
+ * The OIDC client_secret. Required for federated browser login. Use $env(...) to source from a secret environment variable.
1667
+ */
1668
+ clientSecret?: string;
1669
+ /**
1670
+ * The OIDC scopes requested during browser login.
1671
+ */
1672
+ scope?: string;
1673
+ /**
1674
+ * Optional audience parameter for the IdP authorization request (Auth0-style API audiences).
1675
+ */
1676
+ audience?: string;
1677
+ /**
1678
+ * Timeout for outbound calls to the IdP (token exchange, JWKS fetch).
1679
+ */
1680
+ remoteTimeoutMs?: number;
1681
+ /**
1682
+ * Lifetime of an in-flight browser-login state record.
1683
+ */
1684
+ stateTtlSeconds?: number;
1685
+ /**
1686
+ * Lifetime of the gateway browser-login session cookie issued after a successful login.
1687
+ */
1688
+ sessionTtlSeconds?: number;
1689
+ };
1690
+ /**
1691
+ * Gateway-side OAuth token settings. The gateway issuer and advertised URLs are derived from the incoming request origin.
1692
+ */
1693
+ gateway?: {
1694
+ /**
1695
+ * Lifetime of access tokens issued by /oauth/token.
1696
+ */
1697
+ accessTokenTtlSeconds?: number;
1698
+ /**
1699
+ * Lifetime of refresh tokens issued by /oauth/token.
1700
+ */
1701
+ refreshTokenTtlSeconds?: number;
1702
+ /**
1703
+ * Whether to advertise client_id_metadata_document_supported in AS metadata.
1704
+ */
1705
+ cimdEnabled?: boolean;
1706
+ };
1707
+ }
1708
+
1709
+ declare type McpOAuthRuntimeConfig = z.infer<
1710
+ typeof mcpOAuthRuntimeConfigSchema
1711
+ >;
1712
+
1713
+ declare const mcpOAuthRuntimeConfigSchema: z.ZodObject<
1714
+ {
1715
+ oidc: z.ZodObject<
1716
+ {
1717
+ issuer: z.ZodURL;
1718
+ jwksUrl: z.ZodURL;
1719
+ audience: z.ZodOptional<z.ZodString>;
1720
+ },
1721
+ z.core.$strip
1722
+ >;
1723
+ browserLogin: z.ZodObject<
1724
+ {
1725
+ url: z.ZodURL;
1726
+ tokenUrl: z.ZodOptional<z.ZodURL>;
1727
+ clientId: z.ZodOptional<z.ZodString>;
1728
+ clientSecret: z.ZodOptional<z.ZodString>;
1729
+ scope: z.ZodDefault<z.ZodString>;
1730
+ audience: z.ZodOptional<z.ZodString>;
1731
+ remoteTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1732
+ stateTtlSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1733
+ sessionTtlSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1734
+ },
1735
+ z.core.$strict
1736
+ >;
1737
+ gateway: z.ZodDefault<
1738
+ z.ZodOptional<
1739
+ z.ZodDefault<
1740
+ z.ZodObject<
1741
+ {
1742
+ accessTokenTtlSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1743
+ refreshTokenTtlSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1744
+ cimdEnabled: z.ZodDefault<z.ZodBoolean>;
1745
+ },
1746
+ z.core.$strict
1747
+ >
1748
+ >
1749
+ >
1750
+ >;
1751
+ },
1752
+ z.core.$strict
1753
+ >;
1754
+
1755
+ /**
1756
+ * Authenticate MCP gateway requests using a gateway-issued OAuth access token,
1757
+ * with browser login delegated to Okta.
1758
+ *
1759
+ * Okta-friendly wrapper around `McpOAuthInboundPolicy`. Provide an Okta org
1760
+ * domain, optional authorization server id, client id, and client secret; the
1761
+ * constructor derives the Okta issuer, JWKS URL, authorize URL, and token URL.
1762
+ *
1763
+ * @title MCP Okta OAuth
1764
+ * @public
1765
+ * @product mcp-gateway
1766
+ */
1767
+ export declare class McpOktaOAuthInboundPolicy extends InboundPolicy<McpOktaOAuthInboundPolicyOptions> {
1768
+ #private;
1769
+ constructor(rawOptions: unknown, policyName: string);
1770
+ handler(
1771
+ request: ZuploRequest,
1772
+ context: ZuploContext
1773
+ ): Promise<ZuploRequest | Response>;
1774
+ }
1775
+
1776
+ /**
1777
+ * The options for this policy.
1778
+ * @public
1779
+ */
1780
+ export declare interface McpOktaOAuthInboundPolicyOptions {
1781
+ /**
1782
+ * The Okta org domain, without https://, a trailing slash, or a path.
1783
+ */
1784
+ oktaDomain: string;
1785
+ /**
1786
+ * Optional Okta custom authorization server id. Omit this to use the org authorization server.
1787
+ */
1788
+ authorizationServerId?: string;
1789
+ /**
1790
+ * The Okta OIDC application client_id registered for the gateway's browser login flow.
1791
+ */
1792
+ clientId: string;
1793
+ /**
1794
+ * The Okta OIDC application client_secret. Use $env(...) to source from a secret environment variable.
1795
+ */
1796
+ clientSecret: string;
1797
+ /**
1798
+ * OIDC scopes requested during browser login.
1799
+ */
1800
+ scope?: string;
1801
+ /**
1802
+ * Gateway-side OAuth token settings. The gateway issuer and advertised URLs are derived from the incoming request origin.
1803
+ */
1804
+ gateway?: {
1805
+ /**
1806
+ * Lifetime of access tokens issued by /oauth/token.
1807
+ */
1808
+ accessTokenTtlSeconds?: number;
1809
+ /**
1810
+ * Lifetime of refresh tokens issued by /oauth/token.
1811
+ */
1812
+ refreshTokenTtlSeconds?: number;
1813
+ /**
1814
+ * Whether to advertise client_id_metadata_document_supported in AS metadata.
1815
+ */
1816
+ cimdEnabled?: boolean;
1817
+ };
1818
+ /**
1819
+ * Optional overrides for the derived browser-login settings.
1820
+ */
1821
+ browserLoginOverrides?: {
1822
+ remoteTimeoutMs?: number;
1823
+ stateTtlSeconds?: number;
1824
+ sessionTtlSeconds?: number;
1825
+ };
1826
+ }
1827
+
1828
+ /**
1829
+ * Authenticate MCP gateway requests using a gateway-issued OAuth access token,
1830
+ * with browser login delegated to OneLogin.
1831
+ *
1832
+ * OneLogin-friendly wrapper around `McpOAuthInboundPolicy`. Provide the
1833
+ * OneLogin account subdomain, client id, and client secret; the constructor
1834
+ * derives OneLogin's OIDC issuer, JWKS URL, authorize URL, and token URL.
1835
+ *
1836
+ * @title MCP OneLogin OAuth
1837
+ * @public
1838
+ * @product mcp-gateway
1839
+ */
1840
+ export declare class McpOneLoginOAuthInboundPolicy extends InboundPolicy<McpOneLoginOAuthInboundPolicyOptions> {
1841
+ #private;
1842
+ constructor(rawOptions: unknown, policyName: string);
1843
+ handler(
1844
+ request: ZuploRequest,
1845
+ context: ZuploContext
1846
+ ): Promise<ZuploRequest | Response>;
1847
+ }
1848
+
1849
+ /**
1850
+ * The options for this policy.
1851
+ * @public
1852
+ */
1853
+ export declare interface McpOneLoginOAuthInboundPolicyOptions {
1854
+ /**
1855
+ * The OneLogin account subdomain, without https://, .onelogin.com, a trailing slash, or a path.
1856
+ */
1857
+ oneLoginSubdomain: string;
1858
+ /**
1859
+ * The OneLogin OIDC application client_id registered for the gateway's browser login flow.
1860
+ */
1861
+ clientId: string;
1862
+ /**
1863
+ * The OneLogin OIDC application client_secret. Use $env(...) to source from a secret environment variable.
1864
+ */
1865
+ clientSecret: string;
1866
+ /**
1867
+ * OIDC scopes requested during browser login.
1868
+ */
1869
+ scope?: string;
1870
+ /**
1871
+ * Gateway-side OAuth token settings. The gateway issuer and advertised URLs are derived from the incoming request origin.
1872
+ */
1873
+ gateway?: {
1874
+ /**
1875
+ * Lifetime of access tokens issued by /oauth/token.
1876
+ */
1877
+ accessTokenTtlSeconds?: number;
1878
+ /**
1879
+ * Lifetime of refresh tokens issued by /oauth/token.
1880
+ */
1881
+ refreshTokenTtlSeconds?: number;
1882
+ /**
1883
+ * Whether to advertise client_id_metadata_document_supported in AS metadata.
1884
+ */
1885
+ cimdEnabled?: boolean;
1886
+ };
1887
+ /**
1888
+ * Optional overrides for the derived browser-login settings.
1889
+ */
1890
+ browserLoginOverrides?: {
1891
+ remoteTimeoutMs?: number;
1892
+ stateTtlSeconds?: number;
1893
+ sessionTtlSeconds?: number;
1894
+ };
1895
+ }
1896
+
1897
+ /**
1898
+ * Authenticate MCP gateway requests using a gateway-issued OAuth access token,
1899
+ * with browser login delegated to PingOne.
1900
+ *
1901
+ * PingOne-friendly wrapper around `McpOAuthInboundPolicy`. Provide a PingOne
1902
+ * environment ID plus optional region, or a PingOne custom domain, with client
1903
+ * ID and client secret; the constructor derives the PingOne issuer, JWKS URL,
1904
+ * authorize URL, and token URL.
1905
+ *
1906
+ * @title MCP Ping OAuth
1907
+ * @public
1908
+ * @product mcp-gateway
1909
+ */
1910
+ export declare class McpPingOAuthInboundPolicy extends InboundPolicy<McpPingOAuthInboundPolicyOptions> {
1911
+ #private;
1912
+ constructor(rawOptions: unknown, policyName: string);
1913
+ handler(
1914
+ request: ZuploRequest,
1915
+ context: ZuploContext
1916
+ ): Promise<ZuploRequest | Response>;
1917
+ }
1918
+
1919
+ /**
1920
+ * The options for this policy.
1921
+ * @public
1922
+ */
1923
+ export declare interface McpPingOAuthInboundPolicyOptions {
1924
+ /**
1925
+ * The PingOne environment ID. Required unless customDomain is set.
1926
+ */
1927
+ environmentId?: string;
1928
+ /**
1929
+ * The PingOne geography for the environment. Ignored when customDomain is set.
1930
+ */
1931
+ region?:
1932
+ | "north-america"
1933
+ | "canada"
1934
+ | "europe"
1935
+ | "singapore"
1936
+ | "australia"
1937
+ | "asia-pacific";
1938
+ /**
1939
+ * Optional PingOne custom domain, without https://, a trailing slash, or a path. When set, environmentId and region are not used.
1940
+ */
1941
+ customDomain?: string;
1942
+ /**
1943
+ * The PingOne OIDC application client_id registered for the gateway's browser login flow.
1944
+ */
1945
+ clientId: string;
1946
+ /**
1947
+ * The PingOne OIDC application client_secret. Use $env(...) to source from a secret environment variable.
1948
+ */
1949
+ clientSecret: string;
1950
+ /**
1951
+ * OIDC scopes requested during browser login.
1952
+ */
1953
+ scope?: string;
1954
+ /**
1955
+ * Gateway-side OAuth token settings. The gateway issuer and advertised URLs are derived from the incoming request origin.
1956
+ */
1957
+ gateway?: {
1958
+ /**
1959
+ * Lifetime of access tokens issued by /oauth/token.
1960
+ */
1961
+ accessTokenTtlSeconds?: number;
1962
+ /**
1963
+ * Lifetime of refresh tokens issued by /oauth/token.
1964
+ */
1965
+ refreshTokenTtlSeconds?: number;
1966
+ /**
1967
+ * Whether to advertise client_id_metadata_document_supported in AS metadata.
1968
+ */
1969
+ cimdEnabled?: boolean;
1970
+ };
1971
+ /**
1972
+ * Optional overrides for the derived browser-login settings.
1973
+ */
1974
+ browserLoginOverrides?: {
1975
+ remoteTimeoutMs?: number;
1976
+ stateTtlSeconds?: number;
1977
+ sessionTtlSeconds?: number;
1978
+ };
1979
+ }
1980
+
1981
+ export declare function McpProxyHandler(
1982
+ request: ZuploRequest,
1983
+ context: ZuploContext
1984
+ ): Promise<Response>;
1985
+
1986
+ /**
1987
+ * Resolve a gateway-managed upstream MCP credential and apply it to the
1988
+ * request before the normal Zuplo route handler forwards the request.
1335
1989
  *
1336
1990
  * Validation runs lazily inside the policy constructor, which the runtime
1337
1991
  * caches per policy name — so a misconfigured policy fails the first request
1338
1992
  * with a `ConfigurationError` (surfaced in the 500 problem body) rather than
1339
1993
  * crashing boot.
1340
1994
  *
1341
- * @hidden
1995
+ * @public
1342
1996
  * @title MCP Token Exchange
1997
+ * @product mcp-gateway
1343
1998
  */
1344
1999
  export declare class McpTokenExchangeInboundPolicy extends InboundPolicy<UpstreamTokenExchangePolicyOptions> {
1345
2000
  constructor(rawOptions: unknown, policyName: string);