@zuplo/runtime 6.70.25 → 6.70.27
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-H7UGARU6.js +26 -0
- package/out/esm/chunk-H7UGARU6.js.map +1 -0
- package/out/esm/chunk-P4G7GA42.js +318 -0
- package/out/esm/chunk-P4G7GA42.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/esm/mocks/index.js +1 -1
- package/out/types/index.d.ts +27 -42
- package/out/types/mcp-gateway/index.d.ts +187 -113
- package/out/types/mocks/index.d.ts +26 -42
- package/package.json +1 -1
- package/out/esm/chunk-BOEEWEWW.js +0 -318
- package/out/esm/chunk-BOEEWEWW.js.map +0 -1
- package/out/esm/chunk-NW4YQXGC.js +0 -26
- package/out/esm/chunk-NW4YQXGC.js.map +0 -1
- /package/out/esm/{chunk-BOEEWEWW.js.LEGAL.txt → chunk-P4G7GA42.js.LEGAL.txt} +0 -0
package/out/esm/mocks/index.js
CHANGED
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*--------------------------------------------------------------------------------------------*/
|
|
24
24
|
|
|
25
|
-
import{b as d}from"../chunk-
|
|
25
|
+
import{b as d}from"../chunk-H7UGARU6.js";import{_ as n,a as t}from"../chunk-JAEQKE5H.js";function g(u={request:new Request("https://api.example.com")}){let e=[];function o(i){e.push(Promise.resolve(i))}return t(o,"waitUntil"),{context:new s({event:{waitUntil:o},route:u.route}),invokeResponse:t(async()=>{await Promise.all(e)},"invokeResponse")}}t(g,"createMockContext");var p={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:t(()=>({}),"raw")},s=class extends EventTarget{static{t(this,"MockZuploContext")}#e;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:o=p,parentContext:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:n.console.info,log:n.console.log,debug:n.console.debug,warn:n.console.warn,error:n.console.error,setLogProperties:t(()=>{},"setLogProperties")},this.custom={},this.route=o,this.incomingRequestProperties={asn:1234,asOrganization:"ORGANIZATION",city:"Seattle",region:"Washington",regionCode:"WA",colo:"SEA",continent:"NA",country:"US",postalCode:"98004",metroCode:"SEA",latitude:void 0,longitude:void 0,timezone:void 0,httpProtocol:void 0,clientCert:void 0,clientMtlsVerificationStatus:void 0,clientMtlsVerificationReason:void 0},this.parentContext=r,this.#e=e,this.analyticsContext=new d(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,o){throw new Error("Not implemented")}invokeOutboundPolicy(e,o,r){throw new Error("Not implemented")}invokeRoute(e,o){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addEventListener(e,o,r){let l=t(i=>{try{typeof o=="function"?o(i):o.handleEvent(i)}catch(a){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),a}},"wrapped");super.addEventListener(e,l,r)}};export{s as MockZuploContext,g as createMockContext};
|
|
26
26
|
//# sourceMappingURL=index.js.map
|
package/out/types/index.d.ts
CHANGED
|
@@ -2957,54 +2957,38 @@ export declare interface ErrorHandler {
|
|
|
2957
2957
|
declare type EventsInterval = number;
|
|
2958
2958
|
|
|
2959
2959
|
declare const EventType: {
|
|
2960
|
-
readonly MCP_TOOL_USAGE: "mcp_tool_usage";
|
|
2961
|
-
readonly MCP_RESOURCE_READ: "mcp_resource_read";
|
|
2962
|
-
readonly MCP_PROMPT_GET: "mcp_prompt_get";
|
|
2963
|
-
readonly MCP_SESSION_START: "mcp_session_start";
|
|
2964
2960
|
readonly AI_GATEWAY_COST_SUM: "ai_gateway_cost_sum";
|
|
2965
2961
|
readonly AI_GATEWAY_REQUEST_COUNT: "ai_gateway_request_count";
|
|
2966
2962
|
readonly AI_GATEWAY_TOKEN_SUM: "ai_gateway_token_sum";
|
|
2967
2963
|
readonly AI_GATEWAY_LATENCY_HISTOGRAM: "ai_gateway_latency_histogram";
|
|
2968
2964
|
readonly AI_GATEWAY_WARNING_COUNT: "ai_gateway_warning_count";
|
|
2969
2965
|
readonly AI_GATEWAY_BLOCKED_COUNT: "ai_gateway_blocked_count";
|
|
2970
|
-
readonly
|
|
2971
|
-
readonly
|
|
2972
|
-
readonly
|
|
2973
|
-
readonly
|
|
2974
|
-
readonly
|
|
2975
|
-
readonly
|
|
2976
|
-
readonly
|
|
2977
|
-
readonly
|
|
2978
|
-
readonly
|
|
2979
|
-
readonly
|
|
2980
|
-
readonly
|
|
2981
|
-
readonly
|
|
2982
|
-
readonly
|
|
2983
|
-
readonly
|
|
2984
|
-
readonly
|
|
2985
|
-
readonly
|
|
2986
|
-
readonly
|
|
2987
|
-
readonly
|
|
2988
|
-
readonly
|
|
2989
|
-
readonly
|
|
2990
|
-
readonly
|
|
2991
|
-
readonly
|
|
2992
|
-
readonly
|
|
2993
|
-
readonly
|
|
2994
|
-
readonly
|
|
2995
|
-
readonly
|
|
2996
|
-
readonly MCP_GATEWAY_AUTH_UPSTREAM_CREDENTIAL_RESOLVED: "mcp_gateway_auth_upstream_credential_resolved";
|
|
2997
|
-
readonly MCP_GATEWAY_AUTH_UPSTREAM_CREDENTIAL_MISSING: "mcp_gateway_auth_upstream_credential_missing";
|
|
2998
|
-
readonly MCP_GATEWAY_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_gateway_auth_upstream_reconsent_required";
|
|
2999
|
-
readonly MCP_GATEWAY_POLICY_DECISION: "mcp_gateway_policy_decision";
|
|
3000
|
-
readonly MCP_GATEWAY_GUARDRAIL_DECISION: "mcp_gateway_guardrail_decision";
|
|
3001
|
-
readonly MCP_GATEWAY_RATE_LIMIT_DECISION: "mcp_gateway_rate_limit_decision";
|
|
3002
|
-
readonly MCP_GATEWAY_UPSTREAM_REQUEST_SENT: "mcp_gateway_upstream_request_sent";
|
|
3003
|
-
readonly MCP_GATEWAY_UPSTREAM_REQUEST_COMPLETED: "mcp_gateway_upstream_request_completed";
|
|
3004
|
-
readonly MCP_GATEWAY_UPSTREAM_REQUEST_FAILED: "mcp_gateway_upstream_request_failed";
|
|
3005
|
-
readonly MCP_GATEWAY_AUDIT_VIRTUAL_SERVER_CREATED: "mcp_gateway_audit_virtual_server_created";
|
|
3006
|
-
readonly MCP_GATEWAY_AUDIT_VIRTUAL_SERVER_UPDATED: "mcp_gateway_audit_virtual_server_updated";
|
|
3007
|
-
readonly MCP_GATEWAY_AUDIT_VIRTUAL_SERVER_DELETED: "mcp_gateway_audit_virtual_server_deleted";
|
|
2966
|
+
readonly MCP_REQUEST_RECEIVED: "mcp_request_received";
|
|
2967
|
+
readonly MCP_REQUEST_COMPLETED: "mcp_request_completed";
|
|
2968
|
+
readonly MCP_REQUEST_REJECTED: "mcp_request_rejected";
|
|
2969
|
+
readonly MCP_INITIALIZE_NEGOTIATED: "mcp_initialize_negotiated";
|
|
2970
|
+
readonly MCP_CLIENT_UNSUPPORTED_BEHAVIOR: "mcp_client_unsupported_behavior";
|
|
2971
|
+
readonly MCP_CAPABILITY_LISTED: "mcp_capability_listed";
|
|
2972
|
+
readonly MCP_CAPABILITY_INVOKED: "mcp_capability_invoked";
|
|
2973
|
+
readonly MCP_CAPABILITY_COMPLETED: "mcp_capability_completed";
|
|
2974
|
+
readonly MCP_CAPABILITY_FAILED: "mcp_capability_failed";
|
|
2975
|
+
readonly MCP_CAPABILITY_CONNECT_REQUIRED: "mcp_capability_connect_required";
|
|
2976
|
+
readonly MCP_AUTH_DOWNSTREAM_TOKEN_VALIDATED: "mcp_auth_downstream_token_validated";
|
|
2977
|
+
readonly MCP_AUTH_DOWNSTREAM_TOKEN_REJECTED: "mcp_auth_downstream_token_rejected";
|
|
2978
|
+
readonly MCP_OAUTH_CLIENT_REGISTERED: "mcp_oauth_client_registered";
|
|
2979
|
+
readonly MCP_OAUTH_AUTHORIZE_STARTED: "mcp_oauth_authorize_started";
|
|
2980
|
+
readonly MCP_OAUTH_AUTHORIZE_AWAITING_SETUP: "mcp_oauth_authorize_awaiting_setup";
|
|
2981
|
+
readonly MCP_OAUTH_TOKEN_ISSUED: "mcp_oauth_token_issued";
|
|
2982
|
+
readonly MCP_OAUTH_TOKEN_REFRESH_ROTATED: "mcp_oauth_token_refresh_rotated";
|
|
2983
|
+
readonly MCP_OAUTH_TOKEN_REVOKED: "mcp_oauth_token_revoked";
|
|
2984
|
+
readonly MCP_AUTH_UPSTREAM_CONNECT_REQUIRED: "mcp_auth_upstream_connect_required";
|
|
2985
|
+
readonly MCP_AUTH_UPSTREAM_CONNECT_STARTED: "mcp_auth_upstream_connect_started";
|
|
2986
|
+
readonly MCP_AUTH_UPSTREAM_CALLBACK_RECEIVED: "mcp_auth_upstream_callback_received";
|
|
2987
|
+
readonly MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_SUCCEEDED: "mcp_auth_upstream_token_exchange_succeeded";
|
|
2988
|
+
readonly MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_FAILED: "mcp_auth_upstream_token_exchange_failed";
|
|
2989
|
+
readonly MCP_AUTH_UPSTREAM_CREDENTIAL_RESOLVED: "mcp_auth_upstream_credential_resolved";
|
|
2990
|
+
readonly MCP_AUTH_UPSTREAM_CREDENTIAL_MISSING: "mcp_auth_upstream_credential_missing";
|
|
2991
|
+
readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
|
|
3008
2992
|
};
|
|
3009
2993
|
|
|
3010
2994
|
declare type EventType = (typeof EventType)[keyof typeof EventType];
|
|
@@ -7418,6 +7402,7 @@ declare interface ParsedCorsPolicyConfiguration {
|
|
|
7418
7402
|
*/
|
|
7419
7403
|
declare interface ParsedRouteData extends Omit<RouteData, "corsPolicies"> {
|
|
7420
7404
|
corsPolicies: ParsedCorsPolicyConfiguration[];
|
|
7405
|
+
/* Excluded from this release type: getInboundPolicyInstance */
|
|
7421
7406
|
}
|
|
7422
7407
|
|
|
7423
7408
|
/**
|
|
@@ -87,54 +87,38 @@ declare interface CorsPolicyConfiguration {
|
|
|
87
87
|
declare type DevPortalType = "legacy" | "zudoku";
|
|
88
88
|
|
|
89
89
|
declare const EventType: {
|
|
90
|
-
readonly MCP_TOOL_USAGE: "mcp_tool_usage";
|
|
91
|
-
readonly MCP_RESOURCE_READ: "mcp_resource_read";
|
|
92
|
-
readonly MCP_PROMPT_GET: "mcp_prompt_get";
|
|
93
|
-
readonly MCP_SESSION_START: "mcp_session_start";
|
|
94
90
|
readonly AI_GATEWAY_COST_SUM: "ai_gateway_cost_sum";
|
|
95
91
|
readonly AI_GATEWAY_REQUEST_COUNT: "ai_gateway_request_count";
|
|
96
92
|
readonly AI_GATEWAY_TOKEN_SUM: "ai_gateway_token_sum";
|
|
97
93
|
readonly AI_GATEWAY_LATENCY_HISTOGRAM: "ai_gateway_latency_histogram";
|
|
98
94
|
readonly AI_GATEWAY_WARNING_COUNT: "ai_gateway_warning_count";
|
|
99
95
|
readonly AI_GATEWAY_BLOCKED_COUNT: "ai_gateway_blocked_count";
|
|
100
|
-
readonly
|
|
101
|
-
readonly
|
|
102
|
-
readonly
|
|
103
|
-
readonly
|
|
104
|
-
readonly
|
|
105
|
-
readonly
|
|
106
|
-
readonly
|
|
107
|
-
readonly
|
|
108
|
-
readonly
|
|
109
|
-
readonly
|
|
110
|
-
readonly
|
|
111
|
-
readonly
|
|
112
|
-
readonly
|
|
113
|
-
readonly
|
|
114
|
-
readonly
|
|
115
|
-
readonly
|
|
116
|
-
readonly
|
|
117
|
-
readonly
|
|
118
|
-
readonly
|
|
119
|
-
readonly
|
|
120
|
-
readonly
|
|
121
|
-
readonly
|
|
122
|
-
readonly
|
|
123
|
-
readonly
|
|
124
|
-
readonly
|
|
125
|
-
readonly
|
|
126
|
-
readonly MCP_GATEWAY_AUTH_UPSTREAM_CREDENTIAL_RESOLVED: "mcp_gateway_auth_upstream_credential_resolved";
|
|
127
|
-
readonly MCP_GATEWAY_AUTH_UPSTREAM_CREDENTIAL_MISSING: "mcp_gateway_auth_upstream_credential_missing";
|
|
128
|
-
readonly MCP_GATEWAY_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_gateway_auth_upstream_reconsent_required";
|
|
129
|
-
readonly MCP_GATEWAY_POLICY_DECISION: "mcp_gateway_policy_decision";
|
|
130
|
-
readonly MCP_GATEWAY_GUARDRAIL_DECISION: "mcp_gateway_guardrail_decision";
|
|
131
|
-
readonly MCP_GATEWAY_RATE_LIMIT_DECISION: "mcp_gateway_rate_limit_decision";
|
|
132
|
-
readonly MCP_GATEWAY_UPSTREAM_REQUEST_SENT: "mcp_gateway_upstream_request_sent";
|
|
133
|
-
readonly MCP_GATEWAY_UPSTREAM_REQUEST_COMPLETED: "mcp_gateway_upstream_request_completed";
|
|
134
|
-
readonly MCP_GATEWAY_UPSTREAM_REQUEST_FAILED: "mcp_gateway_upstream_request_failed";
|
|
135
|
-
readonly MCP_GATEWAY_AUDIT_VIRTUAL_SERVER_CREATED: "mcp_gateway_audit_virtual_server_created";
|
|
136
|
-
readonly MCP_GATEWAY_AUDIT_VIRTUAL_SERVER_UPDATED: "mcp_gateway_audit_virtual_server_updated";
|
|
137
|
-
readonly MCP_GATEWAY_AUDIT_VIRTUAL_SERVER_DELETED: "mcp_gateway_audit_virtual_server_deleted";
|
|
96
|
+
readonly MCP_REQUEST_RECEIVED: "mcp_request_received";
|
|
97
|
+
readonly MCP_REQUEST_COMPLETED: "mcp_request_completed";
|
|
98
|
+
readonly MCP_REQUEST_REJECTED: "mcp_request_rejected";
|
|
99
|
+
readonly MCP_INITIALIZE_NEGOTIATED: "mcp_initialize_negotiated";
|
|
100
|
+
readonly MCP_CLIENT_UNSUPPORTED_BEHAVIOR: "mcp_client_unsupported_behavior";
|
|
101
|
+
readonly MCP_CAPABILITY_LISTED: "mcp_capability_listed";
|
|
102
|
+
readonly MCP_CAPABILITY_INVOKED: "mcp_capability_invoked";
|
|
103
|
+
readonly MCP_CAPABILITY_COMPLETED: "mcp_capability_completed";
|
|
104
|
+
readonly MCP_CAPABILITY_FAILED: "mcp_capability_failed";
|
|
105
|
+
readonly MCP_CAPABILITY_CONNECT_REQUIRED: "mcp_capability_connect_required";
|
|
106
|
+
readonly MCP_AUTH_DOWNSTREAM_TOKEN_VALIDATED: "mcp_auth_downstream_token_validated";
|
|
107
|
+
readonly MCP_AUTH_DOWNSTREAM_TOKEN_REJECTED: "mcp_auth_downstream_token_rejected";
|
|
108
|
+
readonly MCP_OAUTH_CLIENT_REGISTERED: "mcp_oauth_client_registered";
|
|
109
|
+
readonly MCP_OAUTH_AUTHORIZE_STARTED: "mcp_oauth_authorize_started";
|
|
110
|
+
readonly MCP_OAUTH_AUTHORIZE_AWAITING_SETUP: "mcp_oauth_authorize_awaiting_setup";
|
|
111
|
+
readonly MCP_OAUTH_TOKEN_ISSUED: "mcp_oauth_token_issued";
|
|
112
|
+
readonly MCP_OAUTH_TOKEN_REFRESH_ROTATED: "mcp_oauth_token_refresh_rotated";
|
|
113
|
+
readonly MCP_OAUTH_TOKEN_REVOKED: "mcp_oauth_token_revoked";
|
|
114
|
+
readonly MCP_AUTH_UPSTREAM_CONNECT_REQUIRED: "mcp_auth_upstream_connect_required";
|
|
115
|
+
readonly MCP_AUTH_UPSTREAM_CONNECT_STARTED: "mcp_auth_upstream_connect_started";
|
|
116
|
+
readonly MCP_AUTH_UPSTREAM_CALLBACK_RECEIVED: "mcp_auth_upstream_callback_received";
|
|
117
|
+
readonly MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_SUCCEEDED: "mcp_auth_upstream_token_exchange_succeeded";
|
|
118
|
+
readonly MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_FAILED: "mcp_auth_upstream_token_exchange_failed";
|
|
119
|
+
readonly MCP_AUTH_UPSTREAM_CREDENTIAL_RESOLVED: "mcp_auth_upstream_credential_resolved";
|
|
120
|
+
readonly MCP_AUTH_UPSTREAM_CREDENTIAL_MISSING: "mcp_auth_upstream_credential_missing";
|
|
121
|
+
readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
|
|
138
122
|
};
|
|
139
123
|
|
|
140
124
|
declare type EventType = (typeof EventType)[keyof typeof EventType];
|
|
@@ -504,52 +488,62 @@ declare type HttpStatusCodeRangeDefinition =
|
|
|
504
488
|
| "5XX";
|
|
505
489
|
|
|
506
490
|
/**
|
|
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
|
|
491
|
+
* A policy that can modify the incoming HTTP request before it is sent to
|
|
492
|
+
* the handler. If a response is returned, the request is short-circuited and
|
|
493
|
+
* the response is returned to the client. If a Request is returned, policies
|
|
494
|
+
* or a handler that follow are executed.
|
|
515
495
|
*
|
|
516
496
|
* @public
|
|
517
497
|
* @example
|
|
518
498
|
* ```typescript
|
|
519
|
-
* import {
|
|
499
|
+
* import { InboundPolicy, ZuploContext, ZuploRequest } from "@zuplo/runtime";
|
|
520
500
|
*
|
|
521
|
-
* interface
|
|
522
|
-
*
|
|
523
|
-
*
|
|
501
|
+
* interface MyPolicyOptions {
|
|
502
|
+
* headerName: string;
|
|
503
|
+
* headerValue: string;
|
|
524
504
|
* }
|
|
525
505
|
*
|
|
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);
|
|
506
|
+
* export class AddHeaderPolicy extends InboundPolicy<MyPolicyOptions> {
|
|
507
|
+
* async handler(request: ZuploRequest, context: ZuploContext) {
|
|
508
|
+
* // Add a custom header
|
|
509
|
+
* request.headers.set(this.options.headerName, this.options.headerValue);
|
|
534
510
|
*
|
|
535
|
-
*
|
|
536
|
-
*
|
|
537
|
-
* }
|
|
511
|
+
* // Log the action
|
|
512
|
+
* context.log.info(`Added header ${this.options.headerName}`);
|
|
538
513
|
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
*
|
|
514
|
+
* // Continue to next policy/handler
|
|
515
|
+
* return request;
|
|
516
|
+
* }
|
|
517
|
+
* }
|
|
542
518
|
*
|
|
543
|
-
*
|
|
544
|
-
*
|
|
519
|
+
* // Usage in policies.json:
|
|
520
|
+
* // {
|
|
521
|
+
* // "name": "add-custom-header",
|
|
522
|
+
* // "policyType": "custom-add-header-policy",
|
|
523
|
+
* // "handler": {
|
|
524
|
+
* // "export": "AddHeaderPolicy",
|
|
525
|
+
* // "module": "$import(./policies/add-header)",
|
|
526
|
+
* // "options": {
|
|
527
|
+
* // "headerName": "X-Custom-Header",
|
|
528
|
+
* // "headerValue": "My Value"
|
|
529
|
+
* // }
|
|
530
|
+
* // }
|
|
531
|
+
* // }
|
|
545
532
|
* ```
|
|
546
533
|
*/
|
|
547
|
-
declare
|
|
548
|
-
|
|
534
|
+
declare abstract class InboundPolicy<
|
|
535
|
+
TOptions = any,
|
|
536
|
+
> extends PolicyBase<TOptions> {
|
|
537
|
+
/**
|
|
538
|
+
* The handler that is called each time this policy is invoked
|
|
539
|
+
*
|
|
540
|
+
* @param request - The incoming Request
|
|
541
|
+
* @param context - The current context of the Request
|
|
542
|
+
* @returns A Response or Request object
|
|
543
|
+
*/
|
|
544
|
+
abstract handler(
|
|
549
545
|
request: ZuploRequest,
|
|
550
|
-
context: ZuploContext
|
|
551
|
-
options: TOptions,
|
|
552
|
-
policyName: string
|
|
546
|
+
context: ZuploContext
|
|
553
547
|
): Promise<ZuploRequest | Response>;
|
|
554
548
|
}
|
|
555
549
|
|
|
@@ -937,22 +931,27 @@ declare interface Logger extends BaseLogger {
|
|
|
937
931
|
* Authenticate MCP gateway requests using a gateway-issued OAuth access token,
|
|
938
932
|
* with browser login delegated to Auth0.
|
|
939
933
|
*
|
|
940
|
-
* Auth0-friendly wrapper around `McpOAuthInboundPolicy`. Provide
|
|
941
|
-
*
|
|
942
|
-
*
|
|
943
|
-
*
|
|
944
|
-
*
|
|
945
|
-
*
|
|
934
|
+
* Auth0-friendly wrapper around `McpOAuthInboundPolicy`. Provide `auth0Domain`
|
|
935
|
+
* and `clientId`; the constructor derives the OIDC issuer, JWKS URL, and Auth0
|
|
936
|
+
* authorize/token endpoints automatically and runs the resulting shape through
|
|
937
|
+
* the same Zod schema as the generic policy.
|
|
938
|
+
*
|
|
939
|
+
* Validation runs lazily inside the policy constructor, which the runtime
|
|
940
|
+
* caches per policy name — so a misconfigured policy fails the first request
|
|
941
|
+
* with a `ConfigurationError` (surfaced in the 500 problem body) rather than
|
|
942
|
+
* crashing boot.
|
|
946
943
|
*
|
|
947
944
|
* @hidden
|
|
948
945
|
* @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
946
|
*/
|
|
955
|
-
export declare
|
|
947
|
+
export declare class McpAuth0OAuthInboundPolicy extends InboundPolicy<McpAuth0OAuthInboundPolicyOptions> {
|
|
948
|
+
#private;
|
|
949
|
+
constructor(rawOptions: unknown, policyName: string);
|
|
950
|
+
handler(
|
|
951
|
+
request: ZuploRequest,
|
|
952
|
+
context: ZuploContext
|
|
953
|
+
): Promise<ZuploRequest | Response>;
|
|
954
|
+
}
|
|
956
955
|
|
|
957
956
|
/**
|
|
958
957
|
* The options for this policy.
|
|
@@ -964,9 +963,9 @@ export declare interface McpAuth0OAuthInboundPolicyOptions {
|
|
|
964
963
|
*/
|
|
965
964
|
auth0Domain: string;
|
|
966
965
|
/**
|
|
967
|
-
*
|
|
966
|
+
* 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
967
|
*/
|
|
969
|
-
audience
|
|
968
|
+
audience?: string;
|
|
970
969
|
/**
|
|
971
970
|
* The Auth0 client_id registered for the gateway's browser login flow.
|
|
972
971
|
*/
|
|
@@ -1042,21 +1041,22 @@ export declare class McpGatewayPlugin extends SystemRuntimePlugin {
|
|
|
1042
1041
|
* to the OpenID Connect identity provider configured via the `oidc` and
|
|
1043
1042
|
* `browserLogin` policy options.
|
|
1044
1043
|
*
|
|
1045
|
-
*
|
|
1046
|
-
*
|
|
1047
|
-
*
|
|
1048
|
-
*
|
|
1049
|
-
* request context.
|
|
1044
|
+
* Validation runs lazily inside the policy constructor, which the runtime
|
|
1045
|
+
* caches per policy name — so a misconfigured policy fails the first request
|
|
1046
|
+
* with a `ConfigurationError` (surfaced in the 500 problem body) rather than
|
|
1047
|
+
* crashing boot.
|
|
1050
1048
|
*
|
|
1051
1049
|
* @hidden
|
|
1052
1050
|
* @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
1051
|
*/
|
|
1059
|
-
export declare
|
|
1052
|
+
export declare class McpOAuthInboundPolicy extends InboundPolicy<McpOAuthInboundPolicyOptions> {
|
|
1053
|
+
#private;
|
|
1054
|
+
constructor(rawOptions: unknown, policyName: string);
|
|
1055
|
+
handler(
|
|
1056
|
+
request: ZuploRequest,
|
|
1057
|
+
context: ZuploContext
|
|
1058
|
+
): Promise<ZuploRequest | Response>;
|
|
1059
|
+
}
|
|
1060
1060
|
|
|
1061
1061
|
/**
|
|
1062
1062
|
* The options for this policy.
|
|
@@ -1141,19 +1141,27 @@ export declare interface McpOAuthInboundPolicyOptions {
|
|
|
1141
1141
|
}
|
|
1142
1142
|
|
|
1143
1143
|
/**
|
|
1144
|
-
* Bind a route to an upstream MCP server.
|
|
1145
|
-
*
|
|
1146
|
-
*
|
|
1144
|
+
* Bind a route to an upstream MCP server. Resolves the upstream connection
|
|
1145
|
+
* config plus per-request credential and appends a
|
|
1146
|
+
* `ResolvedUpstreamBindingContext` onto the request context for
|
|
1147
|
+
* `McpVirtualServerHandler` to pick up during capability dispatch.
|
|
1148
|
+
*
|
|
1149
|
+
* Validation runs lazily inside the policy constructor, which the runtime
|
|
1150
|
+
* caches per policy name — so a misconfigured policy fails the first request
|
|
1151
|
+
* with a `ConfigurationError` (surfaced in the 500 problem body) rather than
|
|
1152
|
+
* crashing boot.
|
|
1147
1153
|
*
|
|
1148
1154
|
* @hidden
|
|
1149
1155
|
* @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
1156
|
*/
|
|
1156
|
-
export declare
|
|
1157
|
+
export declare class McpUpstreamConnectionInboundPolicy extends InboundPolicy<McpUpstreamConnectionInboundPolicyOptions> {
|
|
1158
|
+
#private;
|
|
1159
|
+
constructor(rawOptions: unknown, policyName: string);
|
|
1160
|
+
handler(
|
|
1161
|
+
request: ZuploRequest,
|
|
1162
|
+
context: ZuploContext
|
|
1163
|
+
): Promise<ZuploRequest | Response>;
|
|
1164
|
+
}
|
|
1157
1165
|
|
|
1158
1166
|
/**
|
|
1159
1167
|
* The options for this policy.
|
|
@@ -1189,12 +1197,12 @@ export declare interface McpUpstreamConnectionInboundPolicyOptions {
|
|
|
1189
1197
|
required?: boolean;
|
|
1190
1198
|
}[];
|
|
1191
1199
|
/**
|
|
1192
|
-
* Authentication mode. `
|
|
1200
|
+
* 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.
|
|
1193
1201
|
*/
|
|
1194
1202
|
authMode:
|
|
1195
|
-
| "
|
|
1203
|
+
| "user-oauth"
|
|
1196
1204
|
| "shared-oauth"
|
|
1197
|
-
| "
|
|
1205
|
+
| "static-secret"
|
|
1198
1206
|
| "user-secret"
|
|
1199
1207
|
| "shared-secret";
|
|
1200
1208
|
/**
|
|
@@ -1240,13 +1248,65 @@ export declare interface McpUpstreamConnectionInboundPolicyOptions {
|
|
|
1240
1248
|
| "none";
|
|
1241
1249
|
};
|
|
1242
1250
|
/**
|
|
1243
|
-
* Static secret configuration (for `
|
|
1251
|
+
* Static secret configuration (for `static-secret`, `user-secret`, and `shared-secret` auth modes).
|
|
1244
1252
|
*/
|
|
1245
1253
|
secret?: {
|
|
1246
1254
|
[k: string]: unknown;
|
|
1247
1255
|
};
|
|
1248
1256
|
}
|
|
1249
1257
|
|
|
1258
|
+
/**
|
|
1259
|
+
* Thin MCP upstream proxy. Pair this with `McpOAuthInboundPolicy` (or
|
|
1260
|
+
* `McpAuth0OAuthInboundPolicy`) plus `McpUpstreamConnectionInboundPolicy`:
|
|
1261
|
+
* the OAuth policy authenticates the request, the upstream-connection
|
|
1262
|
+
* policy resolves a single upstream binding onto the request context, and
|
|
1263
|
+
* this handler:
|
|
1264
|
+
*
|
|
1265
|
+
* 1. Reads the resolved binding off the context.
|
|
1266
|
+
* 2. Resolves the per-request upstream credential (handling user OAuth
|
|
1267
|
+
* via the connection's auth provider when configured).
|
|
1268
|
+
* 3. Builds a new `Request` targeting the upstream's MCP HTTP endpoint
|
|
1269
|
+
* with the customer's body and headers, plus the resolved credential
|
|
1270
|
+
* translated to `Authorization` / custom request headers.
|
|
1271
|
+
* 4. `fetch`-es the upstream and returns the response untouched.
|
|
1272
|
+
*
|
|
1273
|
+
* Use this for the common single-upstream pass-through case (the new
|
|
1274
|
+
* recommended shape). For multi-upstream aggregation or curated catalogs,
|
|
1275
|
+
* use `McpVirtualServerHandler` instead.
|
|
1276
|
+
*
|
|
1277
|
+
* Any customer-supplied policy attached between the upstream-connection
|
|
1278
|
+
* policy and this handler can observe or transform the rewritten
|
|
1279
|
+
* `Request` before it leaves the gateway.
|
|
1280
|
+
*
|
|
1281
|
+
* @beta
|
|
1282
|
+
*
|
|
1283
|
+
* @example
|
|
1284
|
+
* ```json
|
|
1285
|
+
* // routes.oas.json — single-upstream MCP proxy
|
|
1286
|
+
* {
|
|
1287
|
+
* "paths": {
|
|
1288
|
+
* "/mcp/linear": {
|
|
1289
|
+
* "post": {
|
|
1290
|
+
* "x-zuplo-route": {
|
|
1291
|
+
* "handler": {
|
|
1292
|
+
* "module": "$import(@zuplo/runtime)",
|
|
1293
|
+
* "export": "mcpUpstreamHandler"
|
|
1294
|
+
* },
|
|
1295
|
+
* "policies": {
|
|
1296
|
+
* "inbound": ["mcp-oauth", "mcp-upstream-linear"]
|
|
1297
|
+
* }
|
|
1298
|
+
* }
|
|
1299
|
+
* }
|
|
1300
|
+
* }
|
|
1301
|
+
* }
|
|
1302
|
+
* }
|
|
1303
|
+
* ```
|
|
1304
|
+
*/
|
|
1305
|
+
export declare function mcpUpstreamHandler(
|
|
1306
|
+
request: ZuploRequest,
|
|
1307
|
+
context: ZuploContext
|
|
1308
|
+
): Promise<Response>;
|
|
1309
|
+
|
|
1250
1310
|
/**
|
|
1251
1311
|
* Implements the server-side MCP request lifecycle for the gateway. Pair with
|
|
1252
1312
|
* `McpOAuthInboundPolicy` (or `McpAuth0OAuthInboundPolicy`) plus an
|
|
@@ -1911,6 +1971,20 @@ declare interface ParsedCorsPolicyConfiguration {
|
|
|
1911
1971
|
*/
|
|
1912
1972
|
declare interface ParsedRouteData extends Omit<RouteData, "corsPolicies"> {
|
|
1913
1973
|
corsPolicies: ParsedCorsPolicyConfiguration[];
|
|
1974
|
+
/* Excluded from this release type: getInboundPolicyInstance */
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
/**
|
|
1978
|
+
* The base class for inbound and outbound policies.
|
|
1979
|
+
* Provides common functionality for all policy types.
|
|
1980
|
+
*
|
|
1981
|
+
* @public
|
|
1982
|
+
*/
|
|
1983
|
+
declare abstract class PolicyBase<TOptions = any> {
|
|
1984
|
+
options: TOptions;
|
|
1985
|
+
policyName: string;
|
|
1986
|
+
policyType: string;
|
|
1987
|
+
/* Excluded from this release type: __constructor */
|
|
1914
1988
|
}
|
|
1915
1989
|
|
|
1916
1990
|
/**
|
|
@@ -78,54 +78,38 @@ export declare function createMockContext(options?: {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
declare const EventType: {
|
|
81
|
-
readonly MCP_TOOL_USAGE: "mcp_tool_usage";
|
|
82
|
-
readonly MCP_RESOURCE_READ: "mcp_resource_read";
|
|
83
|
-
readonly MCP_PROMPT_GET: "mcp_prompt_get";
|
|
84
|
-
readonly MCP_SESSION_START: "mcp_session_start";
|
|
85
81
|
readonly AI_GATEWAY_COST_SUM: "ai_gateway_cost_sum";
|
|
86
82
|
readonly AI_GATEWAY_REQUEST_COUNT: "ai_gateway_request_count";
|
|
87
83
|
readonly AI_GATEWAY_TOKEN_SUM: "ai_gateway_token_sum";
|
|
88
84
|
readonly AI_GATEWAY_LATENCY_HISTOGRAM: "ai_gateway_latency_histogram";
|
|
89
85
|
readonly AI_GATEWAY_WARNING_COUNT: "ai_gateway_warning_count";
|
|
90
86
|
readonly AI_GATEWAY_BLOCKED_COUNT: "ai_gateway_blocked_count";
|
|
91
|
-
readonly
|
|
92
|
-
readonly
|
|
93
|
-
readonly
|
|
94
|
-
readonly
|
|
95
|
-
readonly
|
|
96
|
-
readonly
|
|
97
|
-
readonly
|
|
98
|
-
readonly
|
|
99
|
-
readonly
|
|
100
|
-
readonly
|
|
101
|
-
readonly
|
|
102
|
-
readonly
|
|
103
|
-
readonly
|
|
104
|
-
readonly
|
|
105
|
-
readonly
|
|
106
|
-
readonly
|
|
107
|
-
readonly
|
|
108
|
-
readonly
|
|
109
|
-
readonly
|
|
110
|
-
readonly
|
|
111
|
-
readonly
|
|
112
|
-
readonly
|
|
113
|
-
readonly
|
|
114
|
-
readonly
|
|
115
|
-
readonly
|
|
116
|
-
readonly
|
|
117
|
-
readonly MCP_GATEWAY_AUTH_UPSTREAM_CREDENTIAL_RESOLVED: "mcp_gateway_auth_upstream_credential_resolved";
|
|
118
|
-
readonly MCP_GATEWAY_AUTH_UPSTREAM_CREDENTIAL_MISSING: "mcp_gateway_auth_upstream_credential_missing";
|
|
119
|
-
readonly MCP_GATEWAY_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_gateway_auth_upstream_reconsent_required";
|
|
120
|
-
readonly MCP_GATEWAY_POLICY_DECISION: "mcp_gateway_policy_decision";
|
|
121
|
-
readonly MCP_GATEWAY_GUARDRAIL_DECISION: "mcp_gateway_guardrail_decision";
|
|
122
|
-
readonly MCP_GATEWAY_RATE_LIMIT_DECISION: "mcp_gateway_rate_limit_decision";
|
|
123
|
-
readonly MCP_GATEWAY_UPSTREAM_REQUEST_SENT: "mcp_gateway_upstream_request_sent";
|
|
124
|
-
readonly MCP_GATEWAY_UPSTREAM_REQUEST_COMPLETED: "mcp_gateway_upstream_request_completed";
|
|
125
|
-
readonly MCP_GATEWAY_UPSTREAM_REQUEST_FAILED: "mcp_gateway_upstream_request_failed";
|
|
126
|
-
readonly MCP_GATEWAY_AUDIT_VIRTUAL_SERVER_CREATED: "mcp_gateway_audit_virtual_server_created";
|
|
127
|
-
readonly MCP_GATEWAY_AUDIT_VIRTUAL_SERVER_UPDATED: "mcp_gateway_audit_virtual_server_updated";
|
|
128
|
-
readonly MCP_GATEWAY_AUDIT_VIRTUAL_SERVER_DELETED: "mcp_gateway_audit_virtual_server_deleted";
|
|
87
|
+
readonly MCP_REQUEST_RECEIVED: "mcp_request_received";
|
|
88
|
+
readonly MCP_REQUEST_COMPLETED: "mcp_request_completed";
|
|
89
|
+
readonly MCP_REQUEST_REJECTED: "mcp_request_rejected";
|
|
90
|
+
readonly MCP_INITIALIZE_NEGOTIATED: "mcp_initialize_negotiated";
|
|
91
|
+
readonly MCP_CLIENT_UNSUPPORTED_BEHAVIOR: "mcp_client_unsupported_behavior";
|
|
92
|
+
readonly MCP_CAPABILITY_LISTED: "mcp_capability_listed";
|
|
93
|
+
readonly MCP_CAPABILITY_INVOKED: "mcp_capability_invoked";
|
|
94
|
+
readonly MCP_CAPABILITY_COMPLETED: "mcp_capability_completed";
|
|
95
|
+
readonly MCP_CAPABILITY_FAILED: "mcp_capability_failed";
|
|
96
|
+
readonly MCP_CAPABILITY_CONNECT_REQUIRED: "mcp_capability_connect_required";
|
|
97
|
+
readonly MCP_AUTH_DOWNSTREAM_TOKEN_VALIDATED: "mcp_auth_downstream_token_validated";
|
|
98
|
+
readonly MCP_AUTH_DOWNSTREAM_TOKEN_REJECTED: "mcp_auth_downstream_token_rejected";
|
|
99
|
+
readonly MCP_OAUTH_CLIENT_REGISTERED: "mcp_oauth_client_registered";
|
|
100
|
+
readonly MCP_OAUTH_AUTHORIZE_STARTED: "mcp_oauth_authorize_started";
|
|
101
|
+
readonly MCP_OAUTH_AUTHORIZE_AWAITING_SETUP: "mcp_oauth_authorize_awaiting_setup";
|
|
102
|
+
readonly MCP_OAUTH_TOKEN_ISSUED: "mcp_oauth_token_issued";
|
|
103
|
+
readonly MCP_OAUTH_TOKEN_REFRESH_ROTATED: "mcp_oauth_token_refresh_rotated";
|
|
104
|
+
readonly MCP_OAUTH_TOKEN_REVOKED: "mcp_oauth_token_revoked";
|
|
105
|
+
readonly MCP_AUTH_UPSTREAM_CONNECT_REQUIRED: "mcp_auth_upstream_connect_required";
|
|
106
|
+
readonly MCP_AUTH_UPSTREAM_CONNECT_STARTED: "mcp_auth_upstream_connect_started";
|
|
107
|
+
readonly MCP_AUTH_UPSTREAM_CALLBACK_RECEIVED: "mcp_auth_upstream_callback_received";
|
|
108
|
+
readonly MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_SUCCEEDED: "mcp_auth_upstream_token_exchange_succeeded";
|
|
109
|
+
readonly MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_FAILED: "mcp_auth_upstream_token_exchange_failed";
|
|
110
|
+
readonly MCP_AUTH_UPSTREAM_CREDENTIAL_RESOLVED: "mcp_auth_upstream_credential_resolved";
|
|
111
|
+
readonly MCP_AUTH_UPSTREAM_CREDENTIAL_MISSING: "mcp_auth_upstream_credential_missing";
|
|
112
|
+
readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
|
|
129
113
|
};
|
|
130
114
|
|
|
131
115
|
declare type EventType = (typeof EventType)[keyof typeof EventType];
|