@zuplo/runtime 6.70.24 → 6.70.26
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/out/esm/{chunk-RQLHORT4.js → chunk-LCNCH3K2.js} +47 -47
- package/out/esm/chunk-LCNCH3K2.js.map +1 -0
- package/out/esm/{chunk-GDWI24KD.js → chunk-W6JQ5D4W.js} +2 -2
- package/out/esm/{chunk-GDWI24KD.js.map → chunk-W6JQ5D4W.js.map} +1 -1
- package/out/esm/index.js +1 -1
- package/out/esm/internal/index.js +1 -1
- package/out/esm/mcp-gateway/index.js +23 -17
- package/out/esm/mcp-gateway/index.js.map +1 -1
- package/out/types/index.d.ts +12 -3
- package/out/types/mcp-gateway/index.d.ts +157 -67
- package/package.json +1 -1
- package/out/esm/chunk-RQLHORT4.js.map +0 -1
- /package/out/esm/{chunk-RQLHORT4.js.LEGAL.txt → chunk-LCNCH3K2.js.LEGAL.txt} +0 -0
package/out/types/index.d.ts
CHANGED
|
@@ -6106,16 +6106,24 @@ export declare const MTLSAuthInboundPolicy: InboundPolicyHandler<MTLSAuthInbound
|
|
|
6106
6106
|
* The options for this policy.
|
|
6107
6107
|
* @public
|
|
6108
6108
|
*/
|
|
6109
|
-
export declare
|
|
6109
|
+
export declare type MTLSAuthInboundPolicyOptions = (
|
|
6110
|
+
| {
|
|
6111
|
+
[k: string]: unknown;
|
|
6112
|
+
}
|
|
6113
|
+
| {
|
|
6114
|
+
allowUnauthenticatedRequests: true;
|
|
6115
|
+
[k: string]: unknown;
|
|
6116
|
+
}
|
|
6117
|
+
) & {
|
|
6110
6118
|
/**
|
|
6111
6119
|
* Allows requests to continue even when mTLS verification fails, no client certificate is presented, or the certificate metadata cannot be parsed. Defaults to false.
|
|
6112
6120
|
*/
|
|
6113
6121
|
allowUnauthenticatedRequests?: boolean;
|
|
6114
6122
|
/**
|
|
6115
|
-
*
|
|
6123
|
+
* Fully qualified issuer distinguished name to require on the client certificate. The policy rejects certificates whose parsed issuer DN does not match this string exactly. Required unless `allowUnauthenticatedRequests` is `true`. The expected format matches the parsed metadata issuer, e.g. "CN=example-ca, O=Example, C=US".
|
|
6116
6124
|
*/
|
|
6117
6125
|
certIssuerDN?: string;
|
|
6118
|
-
}
|
|
6126
|
+
};
|
|
6119
6127
|
|
|
6120
6128
|
/**
|
|
6121
6129
|
* Parsed client certificate metadata attached by the mTLS auth policy.
|
|
@@ -7410,6 +7418,7 @@ declare interface ParsedCorsPolicyConfiguration {
|
|
|
7410
7418
|
*/
|
|
7411
7419
|
declare interface ParsedRouteData extends Omit<RouteData, "corsPolicies"> {
|
|
7412
7420
|
corsPolicies: ParsedCorsPolicyConfiguration[];
|
|
7421
|
+
/* Excluded from this release type: getInboundPolicyInstance */
|
|
7413
7422
|
}
|
|
7414
7423
|
|
|
7415
7424
|
/**
|
|
@@ -504,52 +504,62 @@ declare type HttpStatusCodeRangeDefinition =
|
|
|
504
504
|
| "5XX";
|
|
505
505
|
|
|
506
506
|
/**
|
|
507
|
-
* A
|
|
508
|
-
*
|
|
509
|
-
*
|
|
510
|
-
*
|
|
511
|
-
* @param context - The current context of the Request
|
|
512
|
-
* @param options - The configuration options for the policy
|
|
513
|
-
* @param policyName - The name set on the policy in the configuration
|
|
514
|
-
* @returns A Response to short-circuit or a Request to continue
|
|
507
|
+
* A policy that can modify the incoming HTTP request before it is sent to
|
|
508
|
+
* the handler. If a response is returned, the request is short-circuited and
|
|
509
|
+
* the response is returned to the client. If a Request is returned, policies
|
|
510
|
+
* or a handler that follow are executed.
|
|
515
511
|
*
|
|
516
512
|
* @public
|
|
517
513
|
* @example
|
|
518
514
|
* ```typescript
|
|
519
|
-
* import {
|
|
515
|
+
* import { InboundPolicy, ZuploContext, ZuploRequest } from "@zuplo/runtime";
|
|
520
516
|
*
|
|
521
|
-
* interface
|
|
522
|
-
*
|
|
523
|
-
*
|
|
517
|
+
* interface MyPolicyOptions {
|
|
518
|
+
* headerName: string;
|
|
519
|
+
* headerValue: string;
|
|
524
520
|
* }
|
|
525
521
|
*
|
|
526
|
-
* export
|
|
527
|
-
* request,
|
|
528
|
-
*
|
|
529
|
-
*
|
|
530
|
-
* policyName
|
|
531
|
-
* ) => {
|
|
532
|
-
* const key = request.headers.get("x-api-key") || "anonymous";
|
|
533
|
-
* const count = await incrementCounter(key, options.windowMs);
|
|
522
|
+
* export class AddHeaderPolicy extends InboundPolicy<MyPolicyOptions> {
|
|
523
|
+
* async handler(request: ZuploRequest, context: ZuploContext) {
|
|
524
|
+
* // Add a custom header
|
|
525
|
+
* request.headers.set(this.options.headerName, this.options.headerValue);
|
|
534
526
|
*
|
|
535
|
-
*
|
|
536
|
-
*
|
|
537
|
-
* }
|
|
527
|
+
* // Log the action
|
|
528
|
+
* context.log.info(`Added header ${this.options.headerName}`);
|
|
538
529
|
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
*
|
|
530
|
+
* // Continue to next policy/handler
|
|
531
|
+
* return request;
|
|
532
|
+
* }
|
|
533
|
+
* }
|
|
542
534
|
*
|
|
543
|
-
*
|
|
544
|
-
*
|
|
535
|
+
* // Usage in policies.json:
|
|
536
|
+
* // {
|
|
537
|
+
* // "name": "add-custom-header",
|
|
538
|
+
* // "policyType": "custom-add-header-policy",
|
|
539
|
+
* // "handler": {
|
|
540
|
+
* // "export": "AddHeaderPolicy",
|
|
541
|
+
* // "module": "$import(./policies/add-header)",
|
|
542
|
+
* // "options": {
|
|
543
|
+
* // "headerName": "X-Custom-Header",
|
|
544
|
+
* // "headerValue": "My Value"
|
|
545
|
+
* // }
|
|
546
|
+
* // }
|
|
547
|
+
* // }
|
|
545
548
|
* ```
|
|
546
549
|
*/
|
|
547
|
-
declare
|
|
548
|
-
|
|
550
|
+
declare abstract class InboundPolicy<
|
|
551
|
+
TOptions = any,
|
|
552
|
+
> extends PolicyBase<TOptions> {
|
|
553
|
+
/**
|
|
554
|
+
* The handler that is called each time this policy is invoked
|
|
555
|
+
*
|
|
556
|
+
* @param request - The incoming Request
|
|
557
|
+
* @param context - The current context of the Request
|
|
558
|
+
* @returns A Response or Request object
|
|
559
|
+
*/
|
|
560
|
+
abstract handler(
|
|
549
561
|
request: ZuploRequest,
|
|
550
|
-
context: ZuploContext
|
|
551
|
-
options: TOptions,
|
|
552
|
-
policyName: string
|
|
562
|
+
context: ZuploContext
|
|
553
563
|
): Promise<ZuploRequest | Response>;
|
|
554
564
|
}
|
|
555
565
|
|
|
@@ -937,22 +947,27 @@ declare interface Logger extends BaseLogger {
|
|
|
937
947
|
* Authenticate MCP gateway requests using a gateway-issued OAuth access token,
|
|
938
948
|
* with browser login delegated to Auth0.
|
|
939
949
|
*
|
|
940
|
-
* Auth0-friendly wrapper around `McpOAuthInboundPolicy`. Provide
|
|
941
|
-
*
|
|
942
|
-
*
|
|
943
|
-
*
|
|
944
|
-
*
|
|
945
|
-
*
|
|
950
|
+
* Auth0-friendly wrapper around `McpOAuthInboundPolicy`. Provide `auth0Domain`
|
|
951
|
+
* and `clientId`; the constructor derives the OIDC issuer, JWKS URL, and Auth0
|
|
952
|
+
* authorize/token endpoints automatically and runs the resulting shape through
|
|
953
|
+
* the same Zod schema as the generic policy.
|
|
954
|
+
*
|
|
955
|
+
* Validation runs lazily inside the policy constructor, which the runtime
|
|
956
|
+
* caches per policy name — so a misconfigured policy fails the first request
|
|
957
|
+
* with a `ConfigurationError` (surfaced in the 500 problem body) rather than
|
|
958
|
+
* crashing boot.
|
|
946
959
|
*
|
|
947
960
|
* @hidden
|
|
948
961
|
* @title MCP Auth0 OAuth
|
|
949
|
-
* @param request - The ZuploRequest
|
|
950
|
-
* @param context - The ZuploContext
|
|
951
|
-
* @param _options - The policy options set in policies.json
|
|
952
|
-
* @param _policyName - The name of the policy as set in policies.json
|
|
953
|
-
* @returns A Request or a Response
|
|
954
962
|
*/
|
|
955
|
-
export declare
|
|
963
|
+
export declare class McpAuth0OAuthInboundPolicy extends InboundPolicy<McpAuth0OAuthInboundPolicyOptions> {
|
|
964
|
+
#private;
|
|
965
|
+
constructor(rawOptions: unknown, policyName: string);
|
|
966
|
+
handler(
|
|
967
|
+
request: ZuploRequest,
|
|
968
|
+
context: ZuploContext
|
|
969
|
+
): Promise<ZuploRequest | Response>;
|
|
970
|
+
}
|
|
956
971
|
|
|
957
972
|
/**
|
|
958
973
|
* The options for this policy.
|
|
@@ -964,9 +979,9 @@ export declare interface McpAuth0OAuthInboundPolicyOptions {
|
|
|
964
979
|
*/
|
|
965
980
|
auth0Domain: string;
|
|
966
981
|
/**
|
|
967
|
-
*
|
|
982
|
+
* Optional Auth0 API audience. When set, the gateway sends it as the Auth0 authorize?audience= parameter and validates returned provider access tokens against it. Leave unset when Auth0 is only used for browser identity.
|
|
968
983
|
*/
|
|
969
|
-
audience
|
|
984
|
+
audience?: string;
|
|
970
985
|
/**
|
|
971
986
|
* The Auth0 client_id registered for the gateway's browser login flow.
|
|
972
987
|
*/
|
|
@@ -1042,21 +1057,22 @@ export declare class McpGatewayPlugin extends SystemRuntimePlugin {
|
|
|
1042
1057
|
* to the OpenID Connect identity provider configured via the `oidc` and
|
|
1043
1058
|
* `browserLogin` policy options.
|
|
1044
1059
|
*
|
|
1045
|
-
*
|
|
1046
|
-
*
|
|
1047
|
-
*
|
|
1048
|
-
*
|
|
1049
|
-
* request context.
|
|
1060
|
+
* Validation runs lazily inside the policy constructor, which the runtime
|
|
1061
|
+
* caches per policy name — so a misconfigured policy fails the first request
|
|
1062
|
+
* with a `ConfigurationError` (surfaced in the 500 problem body) rather than
|
|
1063
|
+
* crashing boot.
|
|
1050
1064
|
*
|
|
1051
1065
|
* @hidden
|
|
1052
1066
|
* @title MCP OAuth
|
|
1053
|
-
* @param request - The ZuploRequest
|
|
1054
|
-
* @param context - The ZuploContext
|
|
1055
|
-
* @param _options - The policy options set in policies.json
|
|
1056
|
-
* @param _policyName - The name of the policy as set in policies.json
|
|
1057
|
-
* @returns A Request or a Response
|
|
1058
1067
|
*/
|
|
1059
|
-
export declare
|
|
1068
|
+
export declare class McpOAuthInboundPolicy extends InboundPolicy<McpOAuthInboundPolicyOptions> {
|
|
1069
|
+
#private;
|
|
1070
|
+
constructor(rawOptions: unknown, policyName: string);
|
|
1071
|
+
handler(
|
|
1072
|
+
request: ZuploRequest,
|
|
1073
|
+
context: ZuploContext
|
|
1074
|
+
): Promise<ZuploRequest | Response>;
|
|
1075
|
+
}
|
|
1060
1076
|
|
|
1061
1077
|
/**
|
|
1062
1078
|
* The options for this policy.
|
|
@@ -1141,19 +1157,27 @@ export declare interface McpOAuthInboundPolicyOptions {
|
|
|
1141
1157
|
}
|
|
1142
1158
|
|
|
1143
1159
|
/**
|
|
1144
|
-
* Bind a route to an upstream MCP server.
|
|
1145
|
-
*
|
|
1146
|
-
*
|
|
1160
|
+
* Bind a route to an upstream MCP server. Resolves the upstream connection
|
|
1161
|
+
* config plus per-request credential and appends a
|
|
1162
|
+
* `ResolvedUpstreamBindingContext` onto the request context for
|
|
1163
|
+
* `McpVirtualServerHandler` to pick up during capability dispatch.
|
|
1164
|
+
*
|
|
1165
|
+
* Validation runs lazily inside the policy constructor, which the runtime
|
|
1166
|
+
* caches per policy name — so a misconfigured policy fails the first request
|
|
1167
|
+
* with a `ConfigurationError` (surfaced in the 500 problem body) rather than
|
|
1168
|
+
* crashing boot.
|
|
1147
1169
|
*
|
|
1148
1170
|
* @hidden
|
|
1149
1171
|
* @title MCP Upstream Connection
|
|
1150
|
-
* @param request - The ZuploRequest
|
|
1151
|
-
* @param context - The ZuploContext
|
|
1152
|
-
* @param options - The policy options set in policies.json
|
|
1153
|
-
* @param policyName - The name of the policy as set in policies.json
|
|
1154
|
-
* @returns A Request or a Response
|
|
1155
1172
|
*/
|
|
1156
|
-
export declare
|
|
1173
|
+
export declare class McpUpstreamConnectionInboundPolicy extends InboundPolicy<McpUpstreamConnectionInboundPolicyOptions> {
|
|
1174
|
+
#private;
|
|
1175
|
+
constructor(rawOptions: unknown, policyName: string);
|
|
1176
|
+
handler(
|
|
1177
|
+
request: ZuploRequest,
|
|
1178
|
+
context: ZuploContext
|
|
1179
|
+
): Promise<ZuploRequest | Response>;
|
|
1180
|
+
}
|
|
1157
1181
|
|
|
1158
1182
|
/**
|
|
1159
1183
|
* The options for this policy.
|
|
@@ -1247,6 +1271,58 @@ export declare interface McpUpstreamConnectionInboundPolicyOptions {
|
|
|
1247
1271
|
};
|
|
1248
1272
|
}
|
|
1249
1273
|
|
|
1274
|
+
/**
|
|
1275
|
+
* Thin MCP upstream proxy. Pair this with `McpOAuthInboundPolicy` (or
|
|
1276
|
+
* `McpAuth0OAuthInboundPolicy`) plus `McpUpstreamConnectionInboundPolicy`:
|
|
1277
|
+
* the OAuth policy authenticates the request, the upstream-connection
|
|
1278
|
+
* policy resolves a single upstream binding onto the request context, and
|
|
1279
|
+
* this handler:
|
|
1280
|
+
*
|
|
1281
|
+
* 1. Reads the resolved binding off the context.
|
|
1282
|
+
* 2. Resolves the per-request upstream credential (handling user OAuth
|
|
1283
|
+
* via the connection's auth provider when configured).
|
|
1284
|
+
* 3. Builds a new `Request` targeting the upstream's MCP HTTP endpoint
|
|
1285
|
+
* with the customer's body and headers, plus the resolved credential
|
|
1286
|
+
* translated to `Authorization` / custom request headers.
|
|
1287
|
+
* 4. `fetch`-es the upstream and returns the response untouched.
|
|
1288
|
+
*
|
|
1289
|
+
* Use this for the common single-upstream pass-through case (the new
|
|
1290
|
+
* recommended shape). For multi-upstream aggregation or curated catalogs,
|
|
1291
|
+
* use `McpVirtualServerHandler` instead.
|
|
1292
|
+
*
|
|
1293
|
+
* Any customer-supplied policy attached between the upstream-connection
|
|
1294
|
+
* policy and this handler can observe or transform the rewritten
|
|
1295
|
+
* `Request` before it leaves the gateway.
|
|
1296
|
+
*
|
|
1297
|
+
* @beta
|
|
1298
|
+
*
|
|
1299
|
+
* @example
|
|
1300
|
+
* ```json
|
|
1301
|
+
* // routes.oas.json — single-upstream MCP proxy
|
|
1302
|
+
* {
|
|
1303
|
+
* "paths": {
|
|
1304
|
+
* "/mcp/linear": {
|
|
1305
|
+
* "post": {
|
|
1306
|
+
* "x-zuplo-route": {
|
|
1307
|
+
* "handler": {
|
|
1308
|
+
* "module": "$import(@zuplo/runtime)",
|
|
1309
|
+
* "export": "mcpUpstreamHandler"
|
|
1310
|
+
* },
|
|
1311
|
+
* "policies": {
|
|
1312
|
+
* "inbound": ["mcp-oauth", "mcp-upstream-linear"]
|
|
1313
|
+
* }
|
|
1314
|
+
* }
|
|
1315
|
+
* }
|
|
1316
|
+
* }
|
|
1317
|
+
* }
|
|
1318
|
+
* }
|
|
1319
|
+
* ```
|
|
1320
|
+
*/
|
|
1321
|
+
export declare function mcpUpstreamHandler(
|
|
1322
|
+
request: ZuploRequest,
|
|
1323
|
+
context: ZuploContext
|
|
1324
|
+
): Promise<Response>;
|
|
1325
|
+
|
|
1250
1326
|
/**
|
|
1251
1327
|
* Implements the server-side MCP request lifecycle for the gateway. Pair with
|
|
1252
1328
|
* `McpOAuthInboundPolicy` (or `McpAuth0OAuthInboundPolicy`) plus an
|
|
@@ -1911,6 +1987,20 @@ declare interface ParsedCorsPolicyConfiguration {
|
|
|
1911
1987
|
*/
|
|
1912
1988
|
declare interface ParsedRouteData extends Omit<RouteData, "corsPolicies"> {
|
|
1913
1989
|
corsPolicies: ParsedCorsPolicyConfiguration[];
|
|
1990
|
+
/* Excluded from this release type: getInboundPolicyInstance */
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
/**
|
|
1994
|
+
* The base class for inbound and outbound policies.
|
|
1995
|
+
* Provides common functionality for all policy types.
|
|
1996
|
+
*
|
|
1997
|
+
* @public
|
|
1998
|
+
*/
|
|
1999
|
+
declare abstract class PolicyBase<TOptions = any> {
|
|
2000
|
+
options: TOptions;
|
|
2001
|
+
policyName: string;
|
|
2002
|
+
policyType: string;
|
|
2003
|
+
/* Excluded from this release type: __constructor */
|
|
1914
2004
|
}
|
|
1915
2005
|
|
|
1916
2006
|
/**
|