@zuplo/runtime 6.70.33 → 6.70.35
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-SFFHEDT5.js → chunk-YTQ3TTI6.js} +29 -29
- package/out/esm/{chunk-SFFHEDT5.js.map → chunk-YTQ3TTI6.js.map} +1 -1
- package/out/esm/index.js +1 -1
- package/out/esm/mcp-gateway/index.js +7 -36
- package/out/esm/mcp-gateway/index.js.map +1 -1
- package/out/types/index.d.ts +7 -0
- package/out/types/mcp-gateway/index.d.ts +197 -137
- package/package.json +1 -1
- /package/out/esm/{chunk-SFFHEDT5.js.LEGAL.txt → chunk-YTQ3TTI6.js.LEGAL.txt} +0 -0
package/out/types/index.d.ts
CHANGED
|
@@ -6072,6 +6072,13 @@ export declare interface MonetizationSubscription {
|
|
|
6072
6072
|
* Defaults to 3 days.
|
|
6073
6073
|
*/
|
|
6074
6074
|
maxPaymentOverdueDays: number;
|
|
6075
|
+
/**
|
|
6076
|
+
* If true, end-user API requests for this subscription have been
|
|
6077
|
+
* administratively blocked by the Zuplo customer. The policy returns 403
|
|
6078
|
+
* regardless of payment / entitlement status. Toggled via the
|
|
6079
|
+
* block-access / unblock-access endpoints.
|
|
6080
|
+
*/
|
|
6081
|
+
accessBlocked?: boolean;
|
|
6075
6082
|
createdAt: string;
|
|
6076
6083
|
updatedAt: string;
|
|
6077
6084
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
|
|
1
3
|
declare interface ApiRuntimeConfig {
|
|
2
4
|
urls: UrlConfig | undefined;
|
|
3
5
|
}
|
|
@@ -1054,8 +1056,7 @@ export declare class McpGatewayPlugin extends SystemRuntimePlugin {
|
|
|
1054
1056
|
* @hidden
|
|
1055
1057
|
* @title MCP OAuth
|
|
1056
1058
|
*/
|
|
1057
|
-
export declare class McpOAuthInboundPolicy extends InboundPolicy<
|
|
1058
|
-
#private;
|
|
1059
|
+
export declare class McpOAuthInboundPolicy extends InboundPolicy<McpOAuthRuntimeConfig> {
|
|
1059
1060
|
constructor(rawOptions: unknown, policyName: string);
|
|
1060
1061
|
handler(
|
|
1061
1062
|
request: ZuploRequest,
|
|
@@ -1145,11 +1146,60 @@ export declare interface McpOAuthInboundPolicyOptions {
|
|
|
1145
1146
|
};
|
|
1146
1147
|
}
|
|
1147
1148
|
|
|
1149
|
+
declare type McpOAuthRuntimeConfig = z.infer<
|
|
1150
|
+
typeof mcpOAuthRuntimeConfigSchema
|
|
1151
|
+
>;
|
|
1152
|
+
|
|
1153
|
+
declare const mcpOAuthRuntimeConfigSchema: z.ZodObject<
|
|
1154
|
+
{
|
|
1155
|
+
oidc: z.ZodObject<
|
|
1156
|
+
{
|
|
1157
|
+
issuer: z.ZodURL;
|
|
1158
|
+
jwksUrl: z.ZodURL;
|
|
1159
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
1160
|
+
},
|
|
1161
|
+
z.core.$strip
|
|
1162
|
+
>;
|
|
1163
|
+
browserLogin: z.ZodObject<
|
|
1164
|
+
{
|
|
1165
|
+
url: z.ZodURL;
|
|
1166
|
+
tokenUrl: z.ZodOptional<z.ZodURL>;
|
|
1167
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
1168
|
+
clientSecret: z.ZodOptional<z.ZodString>;
|
|
1169
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1170
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
1171
|
+
remoteTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
1172
|
+
stateTtlSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
1173
|
+
sessionTtlSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
1174
|
+
},
|
|
1175
|
+
z.core.$strict
|
|
1176
|
+
>;
|
|
1177
|
+
gateway: z.ZodDefault<
|
|
1178
|
+
z.ZodOptional<
|
|
1179
|
+
z.ZodDefault<
|
|
1180
|
+
z.ZodObject<
|
|
1181
|
+
{
|
|
1182
|
+
accessTokenTtlSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
1183
|
+
refreshTokenTtlSeconds: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
1184
|
+
cimdEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
1185
|
+
},
|
|
1186
|
+
z.core.$strict
|
|
1187
|
+
>
|
|
1188
|
+
>
|
|
1189
|
+
>
|
|
1190
|
+
>;
|
|
1191
|
+
},
|
|
1192
|
+
z.core.$strict
|
|
1193
|
+
>;
|
|
1194
|
+
|
|
1195
|
+
export declare function McpProxyHandler(
|
|
1196
|
+
request: ZuploRequest,
|
|
1197
|
+
context: ZuploContext
|
|
1198
|
+
): Promise<Response>;
|
|
1199
|
+
|
|
1148
1200
|
/**
|
|
1149
|
-
*
|
|
1150
|
-
*
|
|
1151
|
-
* `ResolvedUpstreamBindingContext` onto the request context for
|
|
1152
|
-
* `McpVirtualServerHandler` to pick up during capability dispatch.
|
|
1201
|
+
* Resolve a gateway-managed upstream MCP credential and apply it to the
|
|
1202
|
+
* request before the normal Zuplo route handler forwards the request.
|
|
1153
1203
|
*
|
|
1154
1204
|
* Validation runs lazily inside the policy constructor, which the runtime
|
|
1155
1205
|
* caches per policy name — so a misconfigured policy fails the first request
|
|
@@ -1157,10 +1207,9 @@ export declare interface McpOAuthInboundPolicyOptions {
|
|
|
1157
1207
|
* crashing boot.
|
|
1158
1208
|
*
|
|
1159
1209
|
* @hidden
|
|
1160
|
-
* @title MCP
|
|
1210
|
+
* @title MCP Token Exchange
|
|
1161
1211
|
*/
|
|
1162
|
-
export declare class
|
|
1163
|
-
#private;
|
|
1212
|
+
export declare class McpTokenExchangeInboundPolicy extends InboundPolicy<UpstreamTokenExchangePolicyOptions> {
|
|
1164
1213
|
constructor(rawOptions: unknown, policyName: string);
|
|
1165
1214
|
handler(
|
|
1166
1215
|
request: ZuploRequest,
|
|
@@ -1172,9 +1221,9 @@ export declare class McpUpstreamConnectionInboundPolicy extends InboundPolicy<Mc
|
|
|
1172
1221
|
* The options for this policy.
|
|
1173
1222
|
* @public
|
|
1174
1223
|
*/
|
|
1175
|
-
export declare interface
|
|
1224
|
+
export declare interface McpTokenExchangeInboundPolicyOptions {
|
|
1176
1225
|
/**
|
|
1177
|
-
* Stable id for the upstream connection. Used to namespace per-user OAuth state and audit events. If omitted, the gateway tries to infer it from the policy name (`mcp-
|
|
1226
|
+
* Stable id for the upstream connection. Used to namespace per-user OAuth state and audit events. If omitted, the gateway tries to infer it from the policy name (`mcp-token-exchange-{id}`).
|
|
1178
1227
|
*/
|
|
1179
1228
|
id?: string;
|
|
1180
1229
|
/**
|
|
@@ -1186,30 +1235,13 @@ export declare interface McpUpstreamConnectionInboundPolicyOptions {
|
|
|
1186
1235
|
*/
|
|
1187
1236
|
summary?: string;
|
|
1188
1237
|
/**
|
|
1189
|
-
*
|
|
1190
|
-
*/
|
|
1191
|
-
mcpUrl: string;
|
|
1192
|
-
/**
|
|
1193
|
-
* Optional override for the upstream's OAuth protected-resource metadata URL.
|
|
1238
|
+
* Optional override for the upstream's OAuth protected-resource metadata URL. Defaults from the route handler's rewritePattern.
|
|
1194
1239
|
*/
|
|
1195
1240
|
protectedResourceMetadataUrl?: string;
|
|
1196
1241
|
/**
|
|
1197
|
-
*
|
|
1242
|
+
* Authentication mode. `user-oauth` performs per-user OAuth federation; `shared-oauth` uses a gateway-wide OAuth grant.
|
|
1198
1243
|
*/
|
|
1199
|
-
|
|
1200
|
-
name: string;
|
|
1201
|
-
value?: string;
|
|
1202
|
-
required?: boolean;
|
|
1203
|
-
}[];
|
|
1204
|
-
/**
|
|
1205
|
-
* Authentication mode. `user-oauth` performs per-user OAuth federation; `shared-oauth` uses a gateway-wide OAuth grant; `static-secret` / `user-secret` / `shared-secret` use a configured secret instead of OAuth.
|
|
1206
|
-
*/
|
|
1207
|
-
authMode:
|
|
1208
|
-
| "user-oauth"
|
|
1209
|
-
| "shared-oauth"
|
|
1210
|
-
| "static-secret"
|
|
1211
|
-
| "user-secret"
|
|
1212
|
-
| "shared-secret";
|
|
1244
|
+
authMode: "user-oauth" | "shared-oauth";
|
|
1213
1245
|
/**
|
|
1214
1246
|
* OAuth scopes to request from the upstream (for OAuth modes).
|
|
1215
1247
|
*/
|
|
@@ -1252,114 +1284,8 @@ export declare interface McpUpstreamConnectionInboundPolicyOptions {
|
|
|
1252
1284
|
| "client_secret_post"
|
|
1253
1285
|
| "none";
|
|
1254
1286
|
};
|
|
1255
|
-
/**
|
|
1256
|
-
* Static secret configuration (for `static-secret`, `user-secret`, and `shared-secret` auth modes).
|
|
1257
|
-
*/
|
|
1258
|
-
secret?: {
|
|
1259
|
-
[k: string]: unknown;
|
|
1260
|
-
};
|
|
1261
1287
|
}
|
|
1262
1288
|
|
|
1263
|
-
/**
|
|
1264
|
-
* Thin MCP upstream proxy. Pair this with `McpOAuthInboundPolicy` (or
|
|
1265
|
-
* `McpAuth0OAuthInboundPolicy`) plus `McpUpstreamConnectionInboundPolicy`:
|
|
1266
|
-
* the OAuth policy authenticates the request, the upstream-connection
|
|
1267
|
-
* policy resolves a single upstream binding onto the request context, and
|
|
1268
|
-
* this handler:
|
|
1269
|
-
*
|
|
1270
|
-
* 1. Reads the resolved binding off the context.
|
|
1271
|
-
* 2. Resolves the per-request upstream credential (handling user OAuth
|
|
1272
|
-
* via the connection's auth provider when configured).
|
|
1273
|
-
* 3. Builds a new `Request` targeting the upstream's MCP HTTP endpoint
|
|
1274
|
-
* with the customer's body and headers, plus the resolved credential
|
|
1275
|
-
* translated to `Authorization` / custom request headers.
|
|
1276
|
-
* 4. `fetch`-es the upstream, returning successful responses untouched and
|
|
1277
|
-
* mapping upstream error responses to problem+json responses.
|
|
1278
|
-
*
|
|
1279
|
-
* Use this for the common single-upstream pass-through case (the new
|
|
1280
|
-
* recommended shape). For multi-upstream aggregation or curated catalogs,
|
|
1281
|
-
* use `McpVirtualServerHandler` instead.
|
|
1282
|
-
*
|
|
1283
|
-
* Any customer-supplied policy attached between the upstream-connection
|
|
1284
|
-
* policy and this handler can observe or transform the rewritten
|
|
1285
|
-
* `Request` before it leaves the gateway.
|
|
1286
|
-
*
|
|
1287
|
-
* @beta
|
|
1288
|
-
*
|
|
1289
|
-
* @example
|
|
1290
|
-
* ```json
|
|
1291
|
-
* // routes.oas.json — single-upstream MCP proxy
|
|
1292
|
-
* {
|
|
1293
|
-
* "paths": {
|
|
1294
|
-
* "/mcp/linear": {
|
|
1295
|
-
* "post": {
|
|
1296
|
-
* "x-zuplo-route": {
|
|
1297
|
-
* "handler": {
|
|
1298
|
-
* "module": "$import(@zuplo/runtime)",
|
|
1299
|
-
* "export": "mcpUpstreamHandler"
|
|
1300
|
-
* },
|
|
1301
|
-
* "policies": {
|
|
1302
|
-
* "inbound": ["mcp-oauth", "mcp-upstream-linear"]
|
|
1303
|
-
* }
|
|
1304
|
-
* }
|
|
1305
|
-
* }
|
|
1306
|
-
* }
|
|
1307
|
-
* }
|
|
1308
|
-
* }
|
|
1309
|
-
* ```
|
|
1310
|
-
*/
|
|
1311
|
-
export declare function mcpUpstreamHandler(
|
|
1312
|
-
request: ZuploRequest,
|
|
1313
|
-
context: ZuploContext
|
|
1314
|
-
): Promise<Response>;
|
|
1315
|
-
|
|
1316
|
-
/**
|
|
1317
|
-
* Implements the server-side MCP request lifecycle for the gateway. Pair with
|
|
1318
|
-
* `McpOAuthInboundPolicy` (or `McpAuth0OAuthInboundPolicy`) plus an
|
|
1319
|
-
* `McpUpstreamConnectionInboundPolicy` instance: the OAuth inbound policy
|
|
1320
|
-
* authenticates the request, the upstream-connection policy resolves which
|
|
1321
|
-
* upstream MCP server is bound to the route, and this handler accepts the
|
|
1322
|
-
* incoming JSON-RPC POST, dispatches `initialize`, `tools/list`, `tools/call`,
|
|
1323
|
-
* `prompts/list`, `prompts/get`, `resources/list`, and `resources/read` to the
|
|
1324
|
-
* upstream MCP server through the streamable HTTP transport, and returns the
|
|
1325
|
-
* JSON-RPC response.
|
|
1326
|
-
*
|
|
1327
|
-
* GET requests (for the standalone SSE channel of the streamable HTTP
|
|
1328
|
-
* transport) are intentionally rejected with JSON-RPC error code `-32000` and
|
|
1329
|
-
* `Allow: POST` because this handler runs in stateless mode.
|
|
1330
|
-
*
|
|
1331
|
-
* @beta
|
|
1332
|
-
* @param request - The ZuploRequest. The body must contain a JSON-RPC request.
|
|
1333
|
-
* @param context - The ZuploContext.
|
|
1334
|
-
* @returns The JSON-RPC response from the upstream MCP server.
|
|
1335
|
-
*
|
|
1336
|
-
* @example
|
|
1337
|
-
* ```json
|
|
1338
|
-
* // routes.oas.json - Pair with the MCP OAuth + upstream-connection policies.
|
|
1339
|
-
* {
|
|
1340
|
-
* "paths": {
|
|
1341
|
-
* "/mcp/linear": {
|
|
1342
|
-
* "post": {
|
|
1343
|
-
* "x-zuplo-route": {
|
|
1344
|
-
* "handler": {
|
|
1345
|
-
* "module": "$import(@zuplo/runtime)",
|
|
1346
|
-
* "export": "McpVirtualServerHandler"
|
|
1347
|
-
* },
|
|
1348
|
-
* "policies": {
|
|
1349
|
-
* "inbound": ["auth0-managed-oauth", "mcp-upstream-linear"]
|
|
1350
|
-
* }
|
|
1351
|
-
* }
|
|
1352
|
-
* }
|
|
1353
|
-
* }
|
|
1354
|
-
* }
|
|
1355
|
-
* }
|
|
1356
|
-
* ```
|
|
1357
|
-
*/
|
|
1358
|
-
export declare function McpVirtualServerHandler(
|
|
1359
|
-
request: ZuploRequest,
|
|
1360
|
-
context: ZuploContext
|
|
1361
|
-
): Promise<Response>;
|
|
1362
|
-
|
|
1363
1289
|
declare type Modify<T, R> = Omit<T, keyof R> & R;
|
|
1364
1290
|
|
|
1365
1291
|
declare interface NotFoundOptions {
|
|
@@ -2292,6 +2218,140 @@ declare abstract class SystemRuntimePlugin extends RuntimePlugin {
|
|
|
2292
2218
|
/* Excluded from this release type: registerRoutes */
|
|
2293
2219
|
}
|
|
2294
2220
|
|
|
2221
|
+
declare type UpstreamTokenExchangePolicyOptions = z.infer<
|
|
2222
|
+
typeof upstreamTokenExchangePolicyOptionsSchema
|
|
2223
|
+
>;
|
|
2224
|
+
|
|
2225
|
+
declare const upstreamTokenExchangePolicyOptionsSchema: z.ZodObject<
|
|
2226
|
+
{
|
|
2227
|
+
id: z.core.$ZodBranded<z.ZodString, "UpstreamServerId">;
|
|
2228
|
+
displayName: z.ZodString;
|
|
2229
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2230
|
+
serverInfo: z.ZodOptional<
|
|
2231
|
+
z.ZodObject<
|
|
2232
|
+
{
|
|
2233
|
+
version: z.ZodString;
|
|
2234
|
+
websiteUrl: z.ZodOptional<z.ZodString>;
|
|
2235
|
+
description: z.ZodOptional<z.ZodString>;
|
|
2236
|
+
icons: z.ZodOptional<
|
|
2237
|
+
z.ZodArray<
|
|
2238
|
+
z.ZodObject<
|
|
2239
|
+
{
|
|
2240
|
+
src: z.ZodString;
|
|
2241
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
2242
|
+
sizes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2243
|
+
theme: z.ZodOptional<
|
|
2244
|
+
z.ZodEnum<{
|
|
2245
|
+
light: "light";
|
|
2246
|
+
dark: "dark";
|
|
2247
|
+
}>
|
|
2248
|
+
>;
|
|
2249
|
+
},
|
|
2250
|
+
z.core.$strip
|
|
2251
|
+
>
|
|
2252
|
+
>
|
|
2253
|
+
>;
|
|
2254
|
+
name: z.ZodString;
|
|
2255
|
+
title: z.ZodOptional<z.ZodString>;
|
|
2256
|
+
},
|
|
2257
|
+
z.core.$strip
|
|
2258
|
+
>
|
|
2259
|
+
>;
|
|
2260
|
+
protectedResourceMetadataUrl: z.ZodOptional<z.ZodURL>;
|
|
2261
|
+
authMode: z.ZodEnum<{
|
|
2262
|
+
"user-oauth": "user-oauth";
|
|
2263
|
+
"shared-oauth": "shared-oauth";
|
|
2264
|
+
}>;
|
|
2265
|
+
authConfig: z.ZodDiscriminatedUnion<
|
|
2266
|
+
[
|
|
2267
|
+
z.ZodObject<
|
|
2268
|
+
{
|
|
2269
|
+
mode: z.ZodLiteral<"shared-oauth">;
|
|
2270
|
+
oauth: z.ZodObject<
|
|
2271
|
+
{
|
|
2272
|
+
scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2273
|
+
scopeDelimiter: z.ZodDefault<z.ZodString>;
|
|
2274
|
+
clientRegistration: z.ZodDefault<
|
|
2275
|
+
z.ZodDiscriminatedUnion<
|
|
2276
|
+
[
|
|
2277
|
+
z.ZodObject<
|
|
2278
|
+
{
|
|
2279
|
+
mode: z.ZodLiteral<"auto">;
|
|
2280
|
+
},
|
|
2281
|
+
z.core.$strict
|
|
2282
|
+
>,
|
|
2283
|
+
z.ZodObject<
|
|
2284
|
+
{
|
|
2285
|
+
mode: z.ZodLiteral<"manual">;
|
|
2286
|
+
clientId: z.ZodString;
|
|
2287
|
+
clientSecret: z.ZodOptional<z.ZodString>;
|
|
2288
|
+
tokenEndpointAuthMethod: z.ZodDefault<
|
|
2289
|
+
z.ZodEnum<{
|
|
2290
|
+
none: "none";
|
|
2291
|
+
client_secret_basic: "client_secret_basic";
|
|
2292
|
+
client_secret_post: "client_secret_post";
|
|
2293
|
+
}>
|
|
2294
|
+
>;
|
|
2295
|
+
},
|
|
2296
|
+
z.core.$strict
|
|
2297
|
+
>,
|
|
2298
|
+
]
|
|
2299
|
+
>
|
|
2300
|
+
>;
|
|
2301
|
+
redirectPath: z.ZodString;
|
|
2302
|
+
},
|
|
2303
|
+
z.core.$strict
|
|
2304
|
+
>;
|
|
2305
|
+
},
|
|
2306
|
+
z.core.$strict
|
|
2307
|
+
>,
|
|
2308
|
+
z.ZodObject<
|
|
2309
|
+
{
|
|
2310
|
+
mode: z.ZodLiteral<"user-oauth">;
|
|
2311
|
+
oauth: z.ZodObject<
|
|
2312
|
+
{
|
|
2313
|
+
scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
2314
|
+
scopeDelimiter: z.ZodDefault<z.ZodString>;
|
|
2315
|
+
clientRegistration: z.ZodDefault<
|
|
2316
|
+
z.ZodDiscriminatedUnion<
|
|
2317
|
+
[
|
|
2318
|
+
z.ZodObject<
|
|
2319
|
+
{
|
|
2320
|
+
mode: z.ZodLiteral<"auto">;
|
|
2321
|
+
},
|
|
2322
|
+
z.core.$strict
|
|
2323
|
+
>,
|
|
2324
|
+
z.ZodObject<
|
|
2325
|
+
{
|
|
2326
|
+
mode: z.ZodLiteral<"manual">;
|
|
2327
|
+
clientId: z.ZodString;
|
|
2328
|
+
clientSecret: z.ZodOptional<z.ZodString>;
|
|
2329
|
+
tokenEndpointAuthMethod: z.ZodDefault<
|
|
2330
|
+
z.ZodEnum<{
|
|
2331
|
+
none: "none";
|
|
2332
|
+
client_secret_basic: "client_secret_basic";
|
|
2333
|
+
client_secret_post: "client_secret_post";
|
|
2334
|
+
}>
|
|
2335
|
+
>;
|
|
2336
|
+
},
|
|
2337
|
+
z.core.$strict
|
|
2338
|
+
>,
|
|
2339
|
+
]
|
|
2340
|
+
>
|
|
2341
|
+
>;
|
|
2342
|
+
redirectPath: z.ZodString;
|
|
2343
|
+
},
|
|
2344
|
+
z.core.$strict
|
|
2345
|
+
>;
|
|
2346
|
+
},
|
|
2347
|
+
z.core.$strict
|
|
2348
|
+
>,
|
|
2349
|
+
]
|
|
2350
|
+
>;
|
|
2351
|
+
},
|
|
2352
|
+
z.core.$strict
|
|
2353
|
+
>;
|
|
2354
|
+
|
|
2295
2355
|
declare interface UrlConfig {
|
|
2296
2356
|
defaultUrl: string;
|
|
2297
2357
|
urls: string[];
|
package/package.json
CHANGED
|
File without changes
|