@zuplo/runtime 6.66.11 → 6.66.13

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.
@@ -1870,6 +1870,8 @@ export declare interface ClerkJwtInboundPolicyOptions {
1870
1870
  oAuthResourceMetadataEnabled?: boolean;
1871
1871
  }
1872
1872
 
1873
+ /* Excluded from this release type: ClientConfig */
1874
+
1873
1875
  /**
1874
1876
  * Authentication options for OIDC authentication.
1875
1877
  * @public
@@ -2577,12 +2579,16 @@ export declare class DataDogMetricsPlugin extends MetricsPlugin {
2577
2579
  static setContext(context: ZuploContext, data: DataDogMetricsContext): void;
2578
2580
  }
2579
2581
 
2582
+ /* Excluded from this release type: DcrClientRegistration */
2583
+
2580
2584
  /**
2581
2585
  * Default function to generate Hydrolix log entries
2582
2586
  * @public
2583
2587
  */
2584
2588
  export declare const defaultGenerateHydrolixEntry: GenerateRequestLoggerEntry<HydrolixDefaultEntry>;
2585
2589
 
2590
+ /* Excluded from this release type: deleteUpstreamToken */
2591
+
2586
2592
  /* Excluded from this release type: DevPortalRuntimeConfig */
2587
2593
 
2588
2594
  declare type DevPortalType = "legacy" | "zudoku";
@@ -2854,6 +2860,8 @@ declare interface GeoSpec {
2854
2860
  asns?: string;
2855
2861
  }
2856
2862
 
2863
+ /* Excluded from this release type: getDcrClient */
2864
+
2857
2865
  /* Excluded from this release type: getIdForParameterSchema */
2858
2866
 
2859
2867
  /* Excluded from this release type: getIdForRefSchema */
@@ -2888,6 +2896,10 @@ declare interface GetQuotaResult {
2888
2896
 
2889
2897
  /* Excluded from this release type: getRawOperationDataIdentifierName */
2890
2898
 
2899
+ /* Excluded from this release type: getUpstreamMetadata */
2900
+
2901
+ /* Excluded from this release type: getUpstreamToken */
2902
+
2891
2903
  declare interface GoogleCloudLoggingOptions {
2892
2904
  serviceAccountJson: string;
2893
2905
  logName: string;
@@ -2982,6 +2994,41 @@ declare interface HeaderCredentialsConfig {
2982
2994
  headerName: string;
2983
2995
  }
2984
2996
 
2997
+ /**
2998
+ * Sets HTTP deprecation headers on the outgoing response following the IETF
2999
+ * HTTP Deprecation Header standard. Supports the Deprecation, Sunset, and Link
3000
+ * headers.
3001
+ *
3002
+ * @title HTTP Deprecation
3003
+ * @public
3004
+ * @param response - The Response
3005
+ * @param request - The ZuploRequest
3006
+ * @param context - The ZuploContext
3007
+ * @param options - The policy options set in policies.json
3008
+ * @param policyName - The name of the policy as set in policies.json
3009
+ * @returns A Response with deprecation headers
3010
+ */
3011
+ export declare const HttpDeprecationOutboundPolicy: OutboundPolicyHandler<HttpDeprecationOutboundPolicyOptions>;
3012
+
3013
+ /**
3014
+ * The options for the HTTP Deprecation outbound policy.
3015
+ * @public
3016
+ */
3017
+ export declare interface HttpDeprecationOutboundPolicyOptions {
3018
+ /**
3019
+ * The deprecation value. Use `true` for already deprecated, an ISO 8601 date string for a specific date, or a Unix timestamp number.
3020
+ */
3021
+ deprecation: true | string | number;
3022
+ /**
3023
+ * An ISO 8601 date string indicating when the endpoint will be removed. Sets the Sunset header.
3024
+ */
3025
+ sunset?: string;
3026
+ /**
3027
+ * A URL to documentation about the deprecation or migration guide. Sets the Link header.
3028
+ */
3029
+ link?: string;
3030
+ }
3031
+
2985
3032
  /**
2986
3033
  * @public
2987
3034
  */
@@ -4516,6 +4563,8 @@ export declare interface HydrolixRequestLoggerPluginOptions<T> {
4516
4563
  batchPeriodSeconds?: number;
4517
4564
  }
4518
4565
 
4566
+ /* Excluded from this release type: IdpConfig */
4567
+
4519
4568
  /**
4520
4569
  * A policy that can modify the incoming HTTP request before it is sent to
4521
4570
  * the handler. If a response is returned, the request is short-circuited and
@@ -5330,6 +5379,16 @@ declare interface McpGatewayServerConfig {
5330
5379
  * Array of origin configurations for this server
5331
5380
  */
5332
5381
  origins: McpGatewayOrigin[];
5382
+ /**
5383
+ * OAuth resource name for this MCP server.
5384
+ * When set, the gateway will look up upstream tokens using userId:resource
5385
+ * and inject them into requests to the origin.
5386
+ * This should match a resource key configured in the MCP OAuth Gateway plugin.
5387
+ * @example "jira"
5388
+ *
5389
+ * // TODO: Make sure these are unique per origin
5390
+ */
5391
+ oauthResource?: string;
5333
5392
  }
5334
5393
 
5335
5394
  declare interface McpGatewayTool {
@@ -5338,6 +5397,98 @@ declare interface McpGatewayTool {
5338
5397
  inputSchema: object;
5339
5398
  }
5340
5399
 
5400
+ /**
5401
+ * MCP OAuth Gateway Plugin
5402
+ *
5403
+ * This plugin implements an OAuth 2.0 Authorization Server that acts as a gateway
5404
+ * between MCP clients and upstream OAuth providers. It enables a two-phase OAuth
5405
+ * flow:
5406
+ *
5407
+ * 1. **Gateway IDP Authentication**: The client first authenticates with the gateway's
5408
+ * identity provider to establish user identity.
5409
+ *
5410
+ * 2. **Upstream Provider Authorization**: After IDP authentication, if the user hasn't
5411
+ * previously authorized the upstream resource (e.g., Jira, GitHub), they are
5412
+ * redirected to complete upstream OAuth authorization.
5413
+ *
5414
+ * The gateway maintains tokens for upstream providers and can skip the upstream
5415
+ * authorization step on subsequent requests if valid tokens exist.
5416
+ *
5417
+ * ## Registered Routes
5418
+ *
5419
+ * - `GET /.well-known/oauth-authorization-server` - OAuth Authorization Server Metadata (RFC 8414)
5420
+ * - `GET /oauth/:resource/authorize` - Authorization endpoint (entry point)
5421
+ * - `GET /oauth/idp-callback` - IDP callback (receives auth code from gateway IDP)
5422
+ * - `GET /oauth/upstream-callback` - Upstream callback (receives auth code from upstream)
5423
+ * - `POST /oauth/token` - Token endpoint (exchanges codes for tokens)
5424
+ * - `POST /oauth/register` - Dynamic Client Registration proxy (if IDP supports DCR)
5425
+ *
5426
+ * ## Configuration Example
5427
+ *
5428
+ * ```typescript
5429
+ * import { McpOAuthGatewayPlugin, RuntimeExtensions } from "@zuplo/runtime";
5430
+ *
5431
+ * export function runtimeInit(runtime: RuntimeExtensions) {
5432
+ * runtime.addPlugin(
5433
+ * new McpOAuthGatewayPlugin({
5434
+ * idp: {
5435
+ * baseUrl: "https://zuplo-playground.us.auth0.com",
5436
+ * clientId: process.env.IDP_CLIENT_ID,
5437
+ * clientSecret: process.env.IDP_CLIENT_SECRET,
5438
+ * },
5439
+ * upstreams: {
5440
+ * jira: {
5441
+ * baseUrl: "https://mcp.atlassian.com",
5442
+ * scopes: ["read:jira-work", "write:jira-work"],
5443
+ * clientName: "My MCP Gateway",
5444
+ * },
5445
+ * },
5446
+ * clients: {
5447
+ * "my-mcp-client": {
5448
+ * redirectUris: ["http://localhost:3000/callback"],
5449
+ * },
5450
+ * },
5451
+ * })
5452
+ * );
5453
+ * }
5454
+ * ```
5455
+ *
5456
+ * @public
5457
+ */
5458
+ export declare class McpOAuthGatewayPlugin extends SystemRuntimePlugin {
5459
+ #private;
5460
+ private readonly options;
5461
+ constructor(options: McpOAuthGatewayPluginOptions);
5462
+ /* Excluded from this release type: registerRoutes */
5463
+ }
5464
+
5465
+ /**
5466
+ * Options for the MCP OAuth Gateway plugin.
5467
+ * @public
5468
+ */
5469
+ export declare interface McpOAuthGatewayPluginOptions {
5470
+ /**
5471
+ * Gateway IDP configuration (Zuplo's auth or another identity provider).
5472
+ */
5473
+ idp: IdpConfig;
5474
+ /**
5475
+ * Upstream provider configurations keyed by resource name.
5476
+ * @example { jira: { ... }, github: { ... } }
5477
+ */
5478
+ upstreams: Record<string, UpstreamConfig>;
5479
+ /**
5480
+ * Registered client configurations keyed by client ID.
5481
+ * For POC, this is static configuration. In production, this would be
5482
+ * backed by Dynamic Client Registration (DCR).
5483
+ */
5484
+ clients: Record<string, ClientConfig>;
5485
+ /**
5486
+ * Authorization endpoint path to advertise in OAuth metadata.
5487
+ * Defaults to "/oauth/:resource/authorize".
5488
+ */
5489
+ authorizationEndpointPath?: string;
5490
+ }
5491
+
5341
5492
  /**
5342
5493
  * An MCP Server handler for Zuplo
5343
5494
  * Only POST requests are supported for the HTTP streamable MCP transport.
@@ -7261,7 +7412,9 @@ declare type RateLimitFunction<T extends CustomRateLimitDetailsBase> = (
7261
7412
  policyName: string
7262
7413
  ) =>
7263
7414
  | (Partial<T> & CustomRateLimitDetailsBase)
7264
- | Promise<Partial<T> & CustomRateLimitDetailsBase>;
7415
+ | undefined
7416
+ | null
7417
+ | Promise<(Partial<T> & CustomRateLimitDetailsBase) | undefined | null>;
7265
7418
 
7266
7419
  /**
7267
7420
  * Adds the retry-after header.
@@ -7360,6 +7513,24 @@ declare type RateLimitHeaderMode_2 = "none" | "retry-after";
7360
7513
  * }
7361
7514
  * };
7362
7515
  * ```
7516
+ *
7517
+ * @example
7518
+ * ```typescript
7519
+ * // Skip rate limiting for specific conditions (return undefined)
7520
+ * import { CustomRateLimitFunction, CustomRateLimitDetails } from "@zuplo/runtime";
7521
+ *
7522
+ * export const customRateLimitWithSkip: CustomRateLimitFunction = async (
7523
+ * request,
7524
+ * context
7525
+ * ): Promise<CustomRateLimitDetails | undefined> => {
7526
+ * // Skip rate limiting for whitelisted IPs or internal services
7527
+ * const clientIp = request.headers.get("cf-connecting-ip");
7528
+ * if (isWhitelisted(clientIp)) {
7529
+ * return undefined; // Skip rate limiting entirely - no Redis call
7530
+ * }
7531
+ * return { key: `user-${request.user?.sub}` };
7532
+ * };
7533
+ * ```
7363
7534
  */
7364
7535
  declare const RateLimitInboundPolicy: InboundPolicyHandler<RateLimitInboundPolicyOptions>;
7365
7536
  export { RateLimitInboundPolicy as BasicRateLimitInboundPolicy };
@@ -8261,6 +8432,8 @@ export declare interface SetBodyInboundPolicyOptions {
8261
8432
  body: string;
8262
8433
  }
8263
8434
 
8435
+ /* Excluded from this release type: setDcrClient */
8436
+
8264
8437
  /**
8265
8438
  * Adds or sets headers on the incoming request.
8266
8439
  *
@@ -8411,6 +8584,10 @@ export declare interface SetStatusOutboundPolicyOptions {
8411
8584
  statusText?: string;
8412
8585
  }
8413
8586
 
8587
+ /* Excluded from this release type: setUpstreamMetadata */
8588
+
8589
+ /* Excluded from this release type: setUpstreamToken */
8590
+
8414
8591
  /**
8415
8592
  * Function type for determining if a request should be logged
8416
8593
  * @public
@@ -8773,6 +8950,8 @@ declare interface UnauthenticatedCredentialConfig {
8773
8950
  method: "none";
8774
8951
  }
8775
8952
 
8953
+ /* Excluded from this release type: UpstreamAuthServerMetadata */
8954
+
8776
8955
  /**
8777
8956
  * Uses Azure Active Directory to add an Authorization header to the request
8778
8957
  * in order to authenticate requests using Azure identity.
@@ -8814,6 +8993,8 @@ export declare interface UpstreamAzureAdServiceAuthInboundPolicyOptions {
8814
8993
  expirationOffsetSeconds?: number;
8815
8994
  }
8816
8995
 
8996
+ /* Excluded from this release type: UpstreamConfig */
8997
+
8817
8998
  /**
8818
8999
  * Creates a Firebase Admin token and attaches it to the outgoing request.
8819
9000
  * Useful when calling Firebase services as an administrator.
@@ -9044,6 +9225,8 @@ export declare interface UpstreamGcpServiceAuthInboundPolicyOptions {
9044
9225
  version?: 1 | 2;
9045
9226
  }
9046
9227
 
9228
+ /* Excluded from this release type: UpstreamTokens */
9229
+
9047
9230
  /**
9048
9231
  * Generates a Zuplo JWT token and attaches it to the outgoing request. This
9049
9232
  * policy creates a self-signed JWT using the Zuplo JWT plugin and adds it
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "6.66.11",
4
+ "version": "6.66.13",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {