@zuplo/runtime 7.14.5 → 7.14.8

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.
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{G as p,M as c,Q as u}from"../chunk-UGZSO3CK.js";import"../chunk-VP5Q3DEN.js";import{a as d}from"../chunk-7RNZS3GX.js";import"../chunk-A3QGJZO7.js";import"../chunk-C32OTSKW.js";import"../chunk-UKQQD2JN.js";import{aa as i}from"../chunk-UFTMOJ7K.js";import{a as o}from"../chunk-TYV53J3B.js";function w(l={request:new Request("https://api.example.com")}){let e=[];function t(s){e.push(Promise.resolve(s))}return o(t,"waitUntil"),{context:new a({event:{waitUntil:t},route:l.route,originalRequest:l.request}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(w,"createMockContext");var g={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},a=class extends EventTarget{static{o(this,"MockZuploContext")}#e;#t;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=g,parentContext:n,originalRequest:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:i.console.info,log:i.console.log,debug:i.console.debug,warn:i.console.warn,error:i.console.error,setLogProperties:o(()=>{},"setLogProperties")},this.custom={},this.route=t,this.incomingRequestProperties={ip:"203.0.113.7",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,clientCertFingerprintSha256:void 0,clientCertNotBefore:void 0,clientCertNotAfter:void 0,clientCertIssuerDn:void 0,clientCertSubjectDn:void 0},this.parentContext=n,this.#e=e,this.#t=r,this.analyticsContext=new c(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,n){throw new Error("Not implemented")}invokeRoute(e,t){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addPreRequestHandler(e,t){let n;try{n=u.getContextExtensions(this)}catch{n=u.initialize(this,new d(this.#t??new Request("https://api.example.com")))}n.preRequestPhase??="active",p(this,n,e,t)}get preRequestHandlers(){let e;try{e=u.getContextExtensions(this)}catch{return[]}return(e.preRequestState?.entries??[]).map(t=>({policyName:t.policyName,name:t.name}))}addEventListener(e,t,n){let r=o(s=>{try{typeof t=="function"?t(s):t.handleEvent(s)}catch(m){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),m}},"wrapped");super.addEventListener(e,r,n)}};export{a as MockZuploContext,w as createMockContext};
25
+ import{G as p,M as c,Q as u}from"../chunk-DB6LKZ36.js";import"../chunk-VP5Q3DEN.js";import{a as d}from"../chunk-PY52EHDX.js";import"../chunk-A3QGJZO7.js";import"../chunk-6R2COTV6.js";import"../chunk-UKQQD2JN.js";import{aa as i}from"../chunk-2HVCLUM4.js";import{a as o}from"../chunk-TYV53J3B.js";function w(l={request:new Request("https://api.example.com")}){let e=[];function t(s){e.push(Promise.resolve(s))}return o(t,"waitUntil"),{context:new a({event:{waitUntil:t},route:l.route,originalRequest:l.request}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(w,"createMockContext");var g={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},a=class extends EventTarget{static{o(this,"MockZuploContext")}#e;#t;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=g,parentContext:n,originalRequest:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:i.console.info,log:i.console.log,debug:i.console.debug,warn:i.console.warn,error:i.console.error,setLogProperties:o(()=>{},"setLogProperties")},this.custom={},this.route=t,this.incomingRequestProperties={ip:"203.0.113.7",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,clientCertFingerprintSha256:void 0,clientCertNotBefore:void 0,clientCertNotAfter:void 0,clientCertIssuerDn:void 0,clientCertSubjectDn:void 0},this.parentContext=n,this.#e=e,this.#t=r,this.analyticsContext=new c(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,n){throw new Error("Not implemented")}invokeRoute(e,t){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addPreRequestHandler(e,t){let n;try{n=u.getContextExtensions(this)}catch{n=u.initialize(this,new d(this.#t??new Request("https://api.example.com")))}n.preRequestPhase??="active",p(this,n,e,t)}get preRequestHandlers(){let e;try{e=u.getContextExtensions(this)}catch{return[]}return(e.preRequestState?.entries??[]).map(t=>({policyName:t.policyName,name:t.name}))}addEventListener(e,t,n){let r=o(s=>{try{typeof t=="function"?t(s):t.handleEvent(s)}catch(m){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),m}},"wrapped");super.addEventListener(e,r,n)}};export{a as MockZuploContext,w as createMockContext};
26
26
  //# sourceMappingURL=index.js.map
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{H as a,I as l,J as c,K as o,N as p,O as y,P as m}from"../../chunk-C32OTSKW.js";import"../../chunk-UKQQD2JN.js";import"../../chunk-UFTMOJ7K.js";import{a as i}from"../../chunk-TYV53J3B.js";async function g(r,e){let t=typeof e.credentials=="function"?await e.credentials():e.credentials,n=r.method,d=n!=="GET"&&n!=="HEAD"&&r.body!=null?await r.arrayBuffer():null,s=await new o({method:n,url:r.url,headers:r.headers,body:d,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,sessionToken:t.sessionToken,service:e.service,region:e.region,signQuery:e.signQuery}).sign();return new Request(s.url.toString(),{method:s.method,headers:s.headers,body:s.body})}i(g,"signRequest");export{c as AwsClient,o as AwsV4Signer,p as fromTemporaryCredentials,y as fromWebToken,m as fromZuploIdentity,l as getAwsCredentialProvider,a as setAwsCredentialProvider,g as signRequest};
25
+ import{H as a,I as l,J as c,K as o,N as p,O as y,P as m}from"../../chunk-6R2COTV6.js";import"../../chunk-UKQQD2JN.js";import"../../chunk-2HVCLUM4.js";import{a as i}from"../../chunk-TYV53J3B.js";async function g(r,e){let t=typeof e.credentials=="function"?await e.credentials():e.credentials,n=r.method,d=n!=="GET"&&n!=="HEAD"&&r.body!=null?await r.arrayBuffer():null,s=await new o({method:n,url:r.url,headers:r.headers,body:d,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,sessionToken:t.sessionToken,service:e.service,region:e.region,signQuery:e.signQuery}).sign();return new Request(s.url.toString(),{method:s.method,headers:s.headers,body:s.body})}i(g,"signRequest");export{c as AwsClient,o as AwsV4Signer,p as fromTemporaryCredentials,y as fromWebToken,m as fromZuploIdentity,l as getAwsCredentialProvider,a as setAwsCredentialProvider,g as signRequest};
26
26
  //# sourceMappingURL=index.js.map
@@ -4352,9 +4352,11 @@ declare interface CompatibilityFlags {
4352
4352
  * precompiled Ajv validators from the OpenAPI document, validated per the
4353
4353
  * dialect and OpenAPI version they declare (specs/mcp-tool-schemas.md), and
4354
4354
  * `prompts/list` also lists the arguments behind a prompt schema's `$ref`
4355
- * and `allOf`. `request-validation-inbound` validates with the same dialect,
4356
- * `format` and pattern rules, and keeps its parameter type coercion
4357
- * (specs/compat-improved-schema-validation.md).
4355
+ * and `allOf`. A tool set to `toolInputStyle: "flat"` whose input can't be
4356
+ * fully flattened fails the build instead of staying nested
4357
+ * (specs/mcp-flat-input.md FLAT-18). `request-validation-inbound` validates
4358
+ * with the same dialect, `format` and pattern rules, and keeps its parameter
4359
+ * type coercion (specs/compat-improved-schema-validation.md).
4358
4360
  *
4359
4361
  * @compatibilityDate 2026-11-06
4360
4362
  */
@@ -4433,10 +4435,11 @@ declare interface CompatibilityFlags {
4433
4435
  omitMcpFieldsNewerThanNegotiatedVersion: boolean;
4434
4436
  /**
4435
4437
  * Whether built-in policies treat an empty or whitespace-only value for an
4436
- * optional string option as if the option were left out.
4438
+ * optional string option as if the option were left out, and reject one for
4439
+ * a required string option.
4437
4440
  *
4438
4441
  * `$env(VAR)` with `VAR` defined but empty reaches a policy as `""`, so this
4439
- * decides what an empty environment variable does to an optional option.
4442
+ * decides what an empty environment variable does to a policy option.
4440
4443
  *
4441
4444
  * Before this flag: Many policies reject `""`. Some fail every request with
4442
4445
  * a `ConfigurationError` (for example `http-deprecation-outbound` `link`,
@@ -4451,11 +4454,18 @@ declare interface CompatibilityFlags {
4451
4454
  * current behavior. `BLANK_IS_NOT_UNSET` in
4452
4455
  * `policies/optional-string-options.spec.ts` lists them with the reason.
4453
4456
  *
4457
+ * A required string option that is empty or whitespace-only fails with a
4458
+ * `ConfigurationError` naming the option when the policy is created, instead
4459
+ * of being sent as a blank credential, host or header. Required options
4460
+ * where an empty value means something (`replace-string-outbound`
4461
+ * `replaceWith`, `set-body-inbound` `body`) are used as given.
4462
+ *
4454
4463
  * @compatibilityDate 2026-11-06
4455
4464
  */
4456
4465
  treatBlankOptionalStringOptionsAsUnset: boolean;
4457
4466
  /**
4458
- * Whether the MCP Gateway supports MCP protocol revision `2026-07-28`.
4467
+ * Whether the MCP Gateway and `mcpServerHandler` support MCP protocol
4468
+ * revision `2026-07-28`.
4459
4469
  *
4460
4470
  * MCP requests on `2025-11-25` and earlier get the same answers with or
4461
4471
  * without this flag, with one exception: an `initialize` reply the upstream
@@ -4472,11 +4482,24 @@ declare interface CompatibilityFlags {
4472
4482
  * reading it as `2026-07-28`. An upstream that answers only `server/discover`
4473
4483
  * is reported as unavailable, and a caller that hasn't connected the
4474
4484
  * upstream gets the `-32042` URL-elicitation error, which `2026-07-28`
4475
- * clients can't act on.
4485
+ * clients can't act on. `mcpServerHandler` refuses a `2026-07-28`
4486
+ * `MCP-Protocol-Version` header with HTTP 400 and `-32000`.
4476
4487
  *
4477
- * After this flag: The MCP Gateway handles `2026-07-28` requests as that
4478
- * revision requires:
4488
+ * After this flag: The MCP Gateway and `mcpServerHandler` handle
4489
+ * `2026-07-28` requests as that revision requires:
4479
4490
  *
4491
+ * - `mcpServerHandler` serves a `2026-07-28` request: `server/discover`,
4492
+ * the per-request `_meta` envelope and its validation (`-32602`,
4493
+ * `-32020`, `-32022`), including the required `MCP-Protocol-Version`,
4494
+ * `Mcp-Method` and `Mcp-Name` headers,
4495
+ * HTTP `404` with `-32601` for the methods `2026-07-28` removed
4496
+ * (`initialize`, `ping`, `logging/setLevel`, `resources/subscribe`,
4497
+ * `resources/unsubscribe`), and `resultType`, `serverInfo` and
4498
+ * `ttlMs: 0` / `cacheScope: "private"` on its results. An unknown tool,
4499
+ * prompt or resource gets the MCP SDK's not-found error. The era comes
4500
+ * from the body, so a request that names `2026-07-28` only in
4501
+ * `params._meta`, with no header, gets HTTP `400` with `-32020`. The MCP
4502
+ * capability filter answers a hidden target with the same checks first.
4480
4503
  * - Upstream readiness falls back to `server/discover` when `initialize` is
4481
4504
  * refused with a JSON-RPC error.
4482
4505
  * - `server/discover` gets the configured icon fallback, and the gateway
@@ -4488,10 +4511,18 @@ declare interface CompatibilityFlags {
4488
4511
  * other event is relayed unchanged, and the stream is not buffered.
4489
4512
  * - A caller that hasn't connected the upstream gets an `input_required`
4490
4513
  * result with a URL-mode connect elicitation (or `-32021` when the client
4491
- * didn't declare URL elicitation), not `-32042`. Before the gateway
4492
- * answers such a request itself, it refuses one a `2026-07-28` server
4493
- * would refuse (`-32602`, `-32020` or `-32022`, HTTP 400), and it accepts
4494
- * a notification with `202` and no body.
4514
+ * didn't declare URL elicitation), not `-32042`. Any other method, the
4515
+ * list methods included, gets `-32603` with the connect link in
4516
+ * `data.connectRequired`. Before the gateway answers such a request
4517
+ * itself, it refuses one a `2026-07-28` server would refuse (`-32602`,
4518
+ * `-32020` or `-32022`, HTTP 400), a request without a required
4519
+ * `MCP-Protocol-Version`, `Mcp-Method` or `Mcp-Name` header included, and
4520
+ * it accepts a notification with `202` and no body. Its own
4521
+ * `server/discover` answer lists `2026-07-28` and the 2025-era versions
4522
+ * the route relays through `initialize`.
4523
+ * - A retry's `requestState` with the gateway's `zuplo-connect.` prefix
4524
+ * that doesn't verify under this deployment's key (another Zuplo
4525
+ * gateway's, behind this one) is passed to the upstream, not refused.
4495
4526
  * - The capability filter checks the `Mcp-Method` and `Mcp-Name` headers
4496
4527
  * against the body (`-32020`), answers an unknown method spelling with
4497
4528
  * HTTP `404`, marks lists and `resources/read` results on routes with
@@ -4548,6 +4579,97 @@ declare interface CompatibilityFlags {
4548
4579
  * @compatibilityDate 2026-11-06
4549
4580
  */
4550
4581
  rejectInvalidMcpResourceUris: boolean;
4582
+ /**
4583
+ * Whether the MCP Gateway follows the MCP transport, elicitation and
4584
+ * authorization rules for the answers it builds itself on `2025-11-25` and
4585
+ * earlier requests, and in its upstream readiness check.
4586
+ *
4587
+ * Before this flag:
4588
+ *
4589
+ * - A caller that hasn't connected the upstream gets a JSON-RPC error with
4590
+ * HTTP 200 for every message: `-32042` with a URL-mode elicitation when
4591
+ * the gateway has a connect URL, `-32600` when it doesn't. That includes
4592
+ * a notification or a JSON-RPC response (answered with an error that has
4593
+ * no `id`), an `initialize`, a client that never declared URL-mode
4594
+ * elicitation, and a client on a protocol version before `2025-11-25`,
4595
+ * which has no URL mode.
4596
+ * - When the upstream still answers 401 after the gateway refreshed its
4597
+ * credential (or the gateway could not retry), and when it answers 403
4598
+ * with a `WWW-Authenticate` challenge, the client gets the upstream's
4599
+ * response, `WWW-Authenticate` included. The challenge points at the
4600
+ * upstream's authorization server, and the client reads the 401 as its
4601
+ * own gateway token failing.
4602
+ * - The readiness check ends the upstream session it opened with
4603
+ * `MCP-Protocol-Version: 2025-11-25`, whatever version the upstream
4604
+ * negotiated.
4605
+ *
4606
+ * After this flag:
4607
+ *
4608
+ * - A request from a caller that hasn't connected the upstream is first
4609
+ * checked as `mcpServerHandler` checks it: a body that is not JSON (an
4610
+ * empty one included) gets HTTP `400` `-32700`, a message that is not
4611
+ * valid JSON-RPC `400` `-32600`, an `initialize` batched with other
4612
+ * messages `400` `-32600`, and an `MCP-Protocol-Version` the route does
4613
+ * not serve `400` `-32000` (a missing header is allowed; the route
4614
+ * serves its upstream's versions once the gateway has learned them). A
4615
+ * batch on `2025-06-18` or later is refused whole with `400` `-32600`.
4616
+ * - A valid notification or JSON-RPC response is accepted with `202` and
4617
+ * no body, and dropped. `ping` gets an empty result. A `2025-03-26`
4618
+ * batch is answered per member.
4619
+ * - The `-32042` URL-elicitation error is sent only to an `initialize` that
4620
+ * names `2025-11-25` (and not `2026-07-28` or later) and declares
4621
+ * `capabilities.elicitation.url`: the gateway keeps no session, so it
4622
+ * cannot know what a later request's client declared. Every other
4623
+ * connect-required answer is `-32603` with the connect link in
4624
+ * `data.connectRequired`, never `-32600`.
4625
+ * - On a request the token exchange policy sent with the gateway's own
4626
+ * upstream credential, an upstream 401 the refresh did not fix, or an
4627
+ * upstream 403 with a `WWW-Authenticate` challenge, is answered by the
4628
+ * gateway with JSON-RPC `-32603` (`data.upstreamStatus`) and no
4629
+ * `WWW-Authenticate`; a message without a request gets HTTP `502` with
4630
+ * the error and no id. A route without the policy relays the challenge.
4631
+ * - The readiness check ends the session with the version the upstream
4632
+ * negotiated in its `initialize` result.
4633
+ * - The MCP capability filter answers a 2025-era request for a hidden
4634
+ * target as `mcpServerHandler` answers an absent one: its `406`, `415`,
4635
+ * invalid-message and batched-`initialize` `400`s and unsupported-version
4636
+ * `400` first, then a mistyped `arguments` `-32602`, then the not-found.
4637
+ * - On a `2026-07-28` request (with `mcpProtocolVersion20260728`), a method
4638
+ * 2026-07-28 removed (`ping`, `logging/setLevel`, …) gets `404`
4639
+ * `-32601` from the gateway instead of the connect-required error.
4640
+ *
4641
+ * @compatibilityDate 2026-11-06
4642
+ */
4643
+ mcpGatewaySpecCompliance: boolean;
4644
+ /**
4645
+ * Whether the MCP server handler checks the results and requests that MCP
4646
+ * 2025-11-25 constrains and the handler did not check.
4647
+ *
4648
+ * Before this flag:
4649
+ *
4650
+ * - `prompts/get` returns the prompt route's messages as the route sent
4651
+ * them, so a `role` other than `user` or `assistant` (such as
4652
+ * `"system"`) or an invalid content block reaches the client.
4653
+ * - A JSON-RPC batch (allowed on `2025-03-26` and earlier) whose answer has
4654
+ * one response gets that response as a bare object, not an array.
4655
+ * - A tool from the deprecated `options.files` whose `x-zuplo-mcp-tool`
4656
+ * name is blank is registered with the name `""`.
4657
+ *
4658
+ * After this flag:
4659
+ *
4660
+ * - `prompts/get` answers JSON-RPC `-32603` naming the prompt and the first
4661
+ * invalid message when a message's `role` is not `user` or `assistant`,
4662
+ * or its `content` is not a content block the request's protocol version
4663
+ * defines (`audio` from `2025-03-26`, `resource_link` from `2025-06-18`).
4664
+ * A prompt message's `annotations.lastModified` may be any string, as
4665
+ * every revision's schema types it.
4666
+ * - Every answer to a batch is an array.
4667
+ * - A blank tool name falls back to the operationId, as on every other
4668
+ * path.
4669
+ *
4670
+ * @compatibilityDate 2026-11-06
4671
+ */
4672
+ mcpServerSpecCompliance: boolean;
4551
4673
  }
4552
4674
 
4553
4675
  declare interface CompletionsFallbacks {
@@ -223,9 +223,11 @@ declare interface CompatibilityFlags {
223
223
  * precompiled Ajv validators from the OpenAPI document, validated per the
224
224
  * dialect and OpenAPI version they declare (specs/mcp-tool-schemas.md), and
225
225
  * `prompts/list` also lists the arguments behind a prompt schema's `$ref`
226
- * and `allOf`. `request-validation-inbound` validates with the same dialect,
227
- * `format` and pattern rules, and keeps its parameter type coercion
228
- * (specs/compat-improved-schema-validation.md).
226
+ * and `allOf`. A tool set to `toolInputStyle: "flat"` whose input can't be
227
+ * fully flattened fails the build instead of staying nested
228
+ * (specs/mcp-flat-input.md FLAT-18). `request-validation-inbound` validates
229
+ * with the same dialect, `format` and pattern rules, and keeps its parameter
230
+ * type coercion (specs/compat-improved-schema-validation.md).
229
231
  *
230
232
  * @compatibilityDate 2026-11-06
231
233
  */
@@ -304,10 +306,11 @@ declare interface CompatibilityFlags {
304
306
  omitMcpFieldsNewerThanNegotiatedVersion: boolean;
305
307
  /**
306
308
  * Whether built-in policies treat an empty or whitespace-only value for an
307
- * optional string option as if the option were left out.
309
+ * optional string option as if the option were left out, and reject one for
310
+ * a required string option.
308
311
  *
309
312
  * `$env(VAR)` with `VAR` defined but empty reaches a policy as `""`, so this
310
- * decides what an empty environment variable does to an optional option.
313
+ * decides what an empty environment variable does to a policy option.
311
314
  *
312
315
  * Before this flag: Many policies reject `""`. Some fail every request with
313
316
  * a `ConfigurationError` (for example `http-deprecation-outbound` `link`,
@@ -322,11 +325,18 @@ declare interface CompatibilityFlags {
322
325
  * current behavior. `BLANK_IS_NOT_UNSET` in
323
326
  * `policies/optional-string-options.spec.ts` lists them with the reason.
324
327
  *
328
+ * A required string option that is empty or whitespace-only fails with a
329
+ * `ConfigurationError` naming the option when the policy is created, instead
330
+ * of being sent as a blank credential, host or header. Required options
331
+ * where an empty value means something (`replace-string-outbound`
332
+ * `replaceWith`, `set-body-inbound` `body`) are used as given.
333
+ *
325
334
  * @compatibilityDate 2026-11-06
326
335
  */
327
336
  treatBlankOptionalStringOptionsAsUnset: boolean;
328
337
  /**
329
- * Whether the MCP Gateway supports MCP protocol revision `2026-07-28`.
338
+ * Whether the MCP Gateway and `mcpServerHandler` support MCP protocol
339
+ * revision `2026-07-28`.
330
340
  *
331
341
  * MCP requests on `2025-11-25` and earlier get the same answers with or
332
342
  * without this flag, with one exception: an `initialize` reply the upstream
@@ -343,11 +353,24 @@ declare interface CompatibilityFlags {
343
353
  * reading it as `2026-07-28`. An upstream that answers only `server/discover`
344
354
  * is reported as unavailable, and a caller that hasn't connected the
345
355
  * upstream gets the `-32042` URL-elicitation error, which `2026-07-28`
346
- * clients can't act on.
347
- *
348
- * After this flag: The MCP Gateway handles `2026-07-28` requests as that
349
- * revision requires:
350
- *
356
+ * clients can't act on. `mcpServerHandler` refuses a `2026-07-28`
357
+ * `MCP-Protocol-Version` header with HTTP 400 and `-32000`.
358
+ *
359
+ * After this flag: The MCP Gateway and `mcpServerHandler` handle
360
+ * `2026-07-28` requests as that revision requires:
361
+ *
362
+ * - `mcpServerHandler` serves a `2026-07-28` request: `server/discover`,
363
+ * the per-request `_meta` envelope and its validation (`-32602`,
364
+ * `-32020`, `-32022`), including the required `MCP-Protocol-Version`,
365
+ * `Mcp-Method` and `Mcp-Name` headers,
366
+ * HTTP `404` with `-32601` for the methods `2026-07-28` removed
367
+ * (`initialize`, `ping`, `logging/setLevel`, `resources/subscribe`,
368
+ * `resources/unsubscribe`), and `resultType`, `serverInfo` and
369
+ * `ttlMs: 0` / `cacheScope: "private"` on its results. An unknown tool,
370
+ * prompt or resource gets the MCP SDK's not-found error. The era comes
371
+ * from the body, so a request that names `2026-07-28` only in
372
+ * `params._meta`, with no header, gets HTTP `400` with `-32020`. The MCP
373
+ * capability filter answers a hidden target with the same checks first.
351
374
  * - Upstream readiness falls back to `server/discover` when `initialize` is
352
375
  * refused with a JSON-RPC error.
353
376
  * - `server/discover` gets the configured icon fallback, and the gateway
@@ -359,10 +382,18 @@ declare interface CompatibilityFlags {
359
382
  * other event is relayed unchanged, and the stream is not buffered.
360
383
  * - A caller that hasn't connected the upstream gets an `input_required`
361
384
  * result with a URL-mode connect elicitation (or `-32021` when the client
362
- * didn't declare URL elicitation), not `-32042`. Before the gateway
363
- * answers such a request itself, it refuses one a `2026-07-28` server
364
- * would refuse (`-32602`, `-32020` or `-32022`, HTTP 400), and it accepts
365
- * a notification with `202` and no body.
385
+ * didn't declare URL elicitation), not `-32042`. Any other method, the
386
+ * list methods included, gets `-32603` with the connect link in
387
+ * `data.connectRequired`. Before the gateway answers such a request
388
+ * itself, it refuses one a `2026-07-28` server would refuse (`-32602`,
389
+ * `-32020` or `-32022`, HTTP 400), a request without a required
390
+ * `MCP-Protocol-Version`, `Mcp-Method` or `Mcp-Name` header included, and
391
+ * it accepts a notification with `202` and no body. Its own
392
+ * `server/discover` answer lists `2026-07-28` and the 2025-era versions
393
+ * the route relays through `initialize`.
394
+ * - A retry's `requestState` with the gateway's `zuplo-connect.` prefix
395
+ * that doesn't verify under this deployment's key (another Zuplo
396
+ * gateway's, behind this one) is passed to the upstream, not refused.
366
397
  * - The capability filter checks the `Mcp-Method` and `Mcp-Name` headers
367
398
  * against the body (`-32020`), answers an unknown method spelling with
368
399
  * HTTP `404`, marks lists and `resources/read` results on routes with
@@ -419,6 +450,97 @@ declare interface CompatibilityFlags {
419
450
  * @compatibilityDate 2026-11-06
420
451
  */
421
452
  rejectInvalidMcpResourceUris: boolean;
453
+ /**
454
+ * Whether the MCP Gateway follows the MCP transport, elicitation and
455
+ * authorization rules for the answers it builds itself on `2025-11-25` and
456
+ * earlier requests, and in its upstream readiness check.
457
+ *
458
+ * Before this flag:
459
+ *
460
+ * - A caller that hasn't connected the upstream gets a JSON-RPC error with
461
+ * HTTP 200 for every message: `-32042` with a URL-mode elicitation when
462
+ * the gateway has a connect URL, `-32600` when it doesn't. That includes
463
+ * a notification or a JSON-RPC response (answered with an error that has
464
+ * no `id`), an `initialize`, a client that never declared URL-mode
465
+ * elicitation, and a client on a protocol version before `2025-11-25`,
466
+ * which has no URL mode.
467
+ * - When the upstream still answers 401 after the gateway refreshed its
468
+ * credential (or the gateway could not retry), and when it answers 403
469
+ * with a `WWW-Authenticate` challenge, the client gets the upstream's
470
+ * response, `WWW-Authenticate` included. The challenge points at the
471
+ * upstream's authorization server, and the client reads the 401 as its
472
+ * own gateway token failing.
473
+ * - The readiness check ends the upstream session it opened with
474
+ * `MCP-Protocol-Version: 2025-11-25`, whatever version the upstream
475
+ * negotiated.
476
+ *
477
+ * After this flag:
478
+ *
479
+ * - A request from a caller that hasn't connected the upstream is first
480
+ * checked as `mcpServerHandler` checks it: a body that is not JSON (an
481
+ * empty one included) gets HTTP `400` `-32700`, a message that is not
482
+ * valid JSON-RPC `400` `-32600`, an `initialize` batched with other
483
+ * messages `400` `-32600`, and an `MCP-Protocol-Version` the route does
484
+ * not serve `400` `-32000` (a missing header is allowed; the route
485
+ * serves its upstream's versions once the gateway has learned them). A
486
+ * batch on `2025-06-18` or later is refused whole with `400` `-32600`.
487
+ * - A valid notification or JSON-RPC response is accepted with `202` and
488
+ * no body, and dropped. `ping` gets an empty result. A `2025-03-26`
489
+ * batch is answered per member.
490
+ * - The `-32042` URL-elicitation error is sent only to an `initialize` that
491
+ * names `2025-11-25` (and not `2026-07-28` or later) and declares
492
+ * `capabilities.elicitation.url`: the gateway keeps no session, so it
493
+ * cannot know what a later request's client declared. Every other
494
+ * connect-required answer is `-32603` with the connect link in
495
+ * `data.connectRequired`, never `-32600`.
496
+ * - On a request the token exchange policy sent with the gateway's own
497
+ * upstream credential, an upstream 401 the refresh did not fix, or an
498
+ * upstream 403 with a `WWW-Authenticate` challenge, is answered by the
499
+ * gateway with JSON-RPC `-32603` (`data.upstreamStatus`) and no
500
+ * `WWW-Authenticate`; a message without a request gets HTTP `502` with
501
+ * the error and no id. A route without the policy relays the challenge.
502
+ * - The readiness check ends the session with the version the upstream
503
+ * negotiated in its `initialize` result.
504
+ * - The MCP capability filter answers a 2025-era request for a hidden
505
+ * target as `mcpServerHandler` answers an absent one: its `406`, `415`,
506
+ * invalid-message and batched-`initialize` `400`s and unsupported-version
507
+ * `400` first, then a mistyped `arguments` `-32602`, then the not-found.
508
+ * - On a `2026-07-28` request (with `mcpProtocolVersion20260728`), a method
509
+ * 2026-07-28 removed (`ping`, `logging/setLevel`, …) gets `404`
510
+ * `-32601` from the gateway instead of the connect-required error.
511
+ *
512
+ * @compatibilityDate 2026-11-06
513
+ */
514
+ mcpGatewaySpecCompliance: boolean;
515
+ /**
516
+ * Whether the MCP server handler checks the results and requests that MCP
517
+ * 2025-11-25 constrains and the handler did not check.
518
+ *
519
+ * Before this flag:
520
+ *
521
+ * - `prompts/get` returns the prompt route's messages as the route sent
522
+ * them, so a `role` other than `user` or `assistant` (such as
523
+ * `"system"`) or an invalid content block reaches the client.
524
+ * - A JSON-RPC batch (allowed on `2025-03-26` and earlier) whose answer has
525
+ * one response gets that response as a bare object, not an array.
526
+ * - A tool from the deprecated `options.files` whose `x-zuplo-mcp-tool`
527
+ * name is blank is registered with the name `""`.
528
+ *
529
+ * After this flag:
530
+ *
531
+ * - `prompts/get` answers JSON-RPC `-32603` naming the prompt and the first
532
+ * invalid message when a message's `role` is not `user` or `assistant`,
533
+ * or its `content` is not a content block the request's protocol version
534
+ * defines (`audio` from `2025-03-26`, `resource_link` from `2025-06-18`).
535
+ * A prompt message's `annotations.lastModified` may be any string, as
536
+ * every revision's schema types it.
537
+ * - Every answer to a batch is an array.
538
+ * - A blank tool name falls back to the operationId, as on every other
539
+ * path.
540
+ *
541
+ * @compatibilityDate 2026-11-06
542
+ */
543
+ mcpServerSpecCompliance: boolean;
422
544
  }
423
545
 
424
546
  /**
@@ -2925,6 +2925,46 @@ export declare function McpProxyHandler(
2925
2925
  context: ZuploContext
2926
2926
  ): Promise<Response>;
2927
2927
 
2928
+ /**
2929
+ * OpenTelemetry options for the MCP Gateway's `McpProxyHandler`, set under
2930
+ * `telemetry` in the route's handler options. The same options as the MCP
2931
+ * Server handler's `telemetry`.
2932
+ */
2933
+ export declare interface McpProxyHandlerTelemetryOptions {
2934
+ /**
2935
+ * Record tool call content on the MCP SERVER and CLIENT spans of a
2936
+ * forwarded `tools/call`: the arguments the client sent as
2937
+ * `gen_ai.tool.call.arguments` and, when the upstream returns a result
2938
+ * without `isError: true`, that result as `gen_ai.tool.call.result`. Both
2939
+ * are JSON strings capped at 8192 UTF-16 code units.
2940
+ *
2941
+ * Off by default. Tool arguments and results often contain personal or
2942
+ * otherwise sensitive data, and enabling this sends them to your telemetry
2943
+ * backend.
2944
+ *
2945
+ * The gateway records content only for a `tools/call` it forwards upstream.
2946
+ * A call a gateway policy answers itself (for example, by asking the client
2947
+ * to connect the upstream) records neither attribute. A result is recorded
2948
+ * when the JSON response, or the SSE event that carries it, is 1 MiB or
2949
+ * less; a larger result is forwarded to the client but not recorded.
2950
+ *
2951
+ * @example
2952
+ * ```json
2953
+ * {
2954
+ * "handler": {
2955
+ * "export": "McpProxyHandler",
2956
+ * "module": "$import(@zuplo/runtime/mcp-gateway)",
2957
+ * "options": {
2958
+ * "rewritePattern": "https://mcp.example.com/mcp",
2959
+ * "telemetry": { "captureToolCallContent": true }
2960
+ * }
2961
+ * }
2962
+ * }
2963
+ * ```
2964
+ */
2965
+ captureToolCallContent?: boolean;
2966
+ }
2967
+
2928
2968
  /**
2929
2969
  * Resolve a gateway-managed upstream MCP credential and apply it to the
2930
2970
  * request before the normal Zuplo route handler forwards the request.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "7.14.5",
4
+ "version": "7.14.8",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {
@@ -1,26 +0,0 @@
1
-
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Zuplo, Inc. All rights reserved.
4
- *
5
- * This software and associated documentation files (the "Software") is intended to be used
6
- * only by Zuplo customers solely to develop and test applications that will be deployed
7
- * to Zuplo hosted services. You and others in your organization may use these files on your
8
- * Development Devices solely for the above stated purpose.
9
- *
10
- * Outside of uses stated above, no license is granted for any other purpose including
11
- * without limitation the rights to use, copy, modify, merge, publish, distribute,
12
- * sublicense, host, and/or sell copies of the Software.
13
- *
14
- * The software may include third party components with separate legal notices or governed by
15
- * other agreements, as described in licenses either embedded in or accompanying the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19
- * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
20
- * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
- * DEALINGS IN THE SOFTWARE.
23
- *--------------------------------------------------------------------------------------------*/
24
-
25
- import{a as g}from"./chunk-A3QGJZO7.js";import{$ as T}from"./chunk-UFTMOJ7K.js";import{a as r}from"./chunk-TYV53J3B.js";var P=class e extends Request{static{r(this,"ZuploRequest")}#t=void 0;#e;#n;constructor(t,n,s){super(t,n);let o=n?.params;this.#n=s,o?this.#e=o:t instanceof e?this.#e=t.#e:this.#e={};let a=n?.user;a?this.user=a:t instanceof e&&(this.user=t.user)}get originalRequest(){return this.#n??null}get query(){if(this.#t===void 0){let t={},n=new URL(this.url).searchParams;for(let[s,o]of n.entries())t[s]=o;this.#t=t}return g(this.#t)}get params(){return g(this.#e)}user};function h(){return T.instance.build.COMPATIBILITY_FLAGS.mcpProtocolVersion20260728===!0}r(h,"isMcp20260728Enabled");var S="2026-07-28",A="io.modelcontextprotocol/protocolVersion",U="io.modelcontextprotocol/clientCapabilities",B="io.modelcontextprotocol/clientInfo",W="io.modelcontextprotocol/serverInfo";var Q=/^\d{4}-\d{2}-\d{2}$/;function I(e){return typeof e=="string"&&Q.test(e)&&e>=S}r(I,"isModernProtocolVersion");function f(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}r(f,"isRecord");function k(e){if(!f(e)||!f(e.params))return;let t=e.params._meta;return f(t)?t:void 0}r(k,"readRequestMeta");function L(e){let t=k(e)?.[A];return typeof t=="string"?t:void 0}r(L,"readEnvelopeProtocolVersion");function Z(e){let t=k(e)?.[U];return f(t)?t:void 0}r(Z,"readEnvelopeClientCapabilities");function x(e,t){if(Array.isArray(t))return!1;let n=e.get("mcp-protocol-version"),s=L(t);return n!==null&&I(n)||s!==void 0&&I(s)}r(x,"isModernMcpRequest");var X="zuplo_upstream_connect";var M="2.0",R=-32600,N=-32602,se=-32603,re=-32001,b=10*1024*1024;function c(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}r(c,"isRecord");function y(e){return typeof e=="string"||typeof e=="number"}r(y,"isRequestId");function p(e){return e===null?"null":Array.isArray(e)?"an array":typeof e=="object"?"an object":typeof e=="string"?JSON.stringify(e.length>40?`${e.slice(0,40)}\u2026`:e):String(e)}r(p,"describeValue");function i(e){if(!(e===void 0||c(e)))return`params must be an object when present (got ${p(e)}).`}r(i,"optionalObjectParams");function u(e,t){return n=>{if(!c(n))return`params must be an object with a string \`${e}\` (got ${p(n)}). Example: ${t}`;if(typeof n[e]!="string")return`params.${e} must be a string (got ${p(n[e])}). Example: ${t}`}}r(u,"requireStringField");var v={initialize:i,ping:i,"tools/list":i,"tools/call":u("name",'{"name":"my_tool","arguments":{}}'),"prompts/list":i,"prompts/get":u("name",'{"name":"my_prompt"}'),"resources/list":i,"resources/templates/list":i,"resources/read":u("uri",'{"uri":"file:///a.txt"}'),"resources/subscribe":u("uri",'{"uri":"file:///a.txt"}'),"resources/unsubscribe":u("uri",'{"uri":"file:///a.txt"}'),"completion/complete":i,"logging/setLevel":u("level",'{"level":"info"}'),"server/discover":i,"subscriptions/listen":i,"tasks/get":u("taskId",'{"taskId":"task-123"}'),"tasks/update":u("taskId",'{"taskId":"task-123"}'),"tasks/cancel":u("taskId",'{"taskId":"task-123"}')},C={"notifications/initialized":i,"notifications/cancelled":i,"notifications/progress":i,"notifications/roots/list_changed":i,"notifications/subscriptions/acknowledged":i},j=new Set(["server/discover","subscriptions/listen","tasks/get","tasks/update","tasks/cancel"]),$=new Set(["notifications/subscriptions/acknowledged"]);function V(e,t){return Object.hasOwn(v,e)&&(t||!j.has(e))}r(V,"isKnownRequestMethod");function w(e,t){return Object.hasOwn(C,e)&&(t||!$.has(e))}r(w,"isKnownNotificationMethod");function l(e){return{type:"invalid",...e.method===void 0?{}:{method:e.method},id:e.id,error:{code:e.code,message:e.message},raw:e.raw}}r(l,"invalidMessage");function m(e){return y(e)?e:null}r(m,"usableId");function K(e,t,n,s){if(V(t,s)){let o=v[t](e.params);if(o!==void 0)return l({raw:e,method:t,id:n,code:N,message:`Invalid params for \`${t}\`: ${o}`});let a=e.params===void 0?{}:e.params;return{type:"request",method:t,id:n,params:a,raw:e}}return{type:"request",method:t,id:n,params:e.params,raw:e}}r(K,"classifyRequest");function Y(e,t,n){if(w(t,n)){let s=C[t](e.params);if(s!==void 0)return l({raw:e,method:t,id:null,code:N,message:`Invalid params for \`${t}\`: ${s}`});let o=e.params===void 0?{}:e.params;return{type:"notification",method:t,params:o,raw:e}}return{type:"notification",method:t,params:e.params,raw:e}}r(Y,"classifyNotification");function _(e,t=!1){if(!c(e)||e.jsonrpc!==M)return l({raw:e,id:m(c(e)?e.id:void 0),code:R,message:`Invalid Request: batch member is not a JSON-RPC 2.0 message (got ${p(e)}). Every member must include \`"jsonrpc":"2.0"\`.`});let n=e.method;if(typeof n=="string"){if(!("id"in e))return Y(e,n,t);let s=e.id;return y(s)?K(e,n,s,t):l({raw:e,method:n,id:null,code:R,message:`Invalid Request: request id must be a string or number (got ${p(s)}). The gateway cannot correlate a reply to this id \u2014 omit \`id\` to send a notification instead.`})}if(n!==void 0)return l({raw:e,id:m(e.id),code:R,message:`Invalid Request: method must be a string (got ${p(n)}).`});if("result"in e&&y(e.id)&&c(e.result))return{type:"result",id:e.id,result:e.result,raw:e};if("error"in e){let s=e.error;if(c(s)&&typeof s.code=="number"&&typeof s.message=="string"){let o={code:s.code,message:s.message,...s.data===void 0?{}:{data:s.data}};return{type:"error",id:m(e.id),error:o,raw:e}}}return l({raw:e,id:m(e.id),code:R,message:"Invalid Request: message has no `method` and is not a valid JSON-RPC result or error."})}r(_,"classifyMember");var D=new WeakMap,q=new WeakMap;function oe(e){return q.get(e)}r(oe,"getEnvelopeText");async function G(e){let t=e.headers.get("content-type");if(t===null||!t.toLowerCase().includes("json"))return null;let n=e.headers.get("content-length");if(n!==null&&Number(n)>b)return null;let s;try{s=await e.clone().text()}catch{return null}if(s.length>b)return null;let o;try{o=JSON.parse(s)}catch{return null}let a=e.headers.get("mcp-protocol-version");if(Array.isArray(o)){if(o.length>0&&!o.some(d=>c(d)&&d.jsonrpc===M))return null;let O={transport:"json",shape:"batch",messages:o.map(d=>_(d)),...a===null?{}:{protocolVersion:a}};return q.set(O,s),O}if(!c(o)||o.jsonrpc!==M)return null;let E={transport:"json",shape:"single",messages:[_(o,h()&&x(e.headers,o))],...a===null?{}:{protocolVersion:a}};return q.set(E,s),E}r(G,"parseEnvelope");function ie(e){let t=D.get(e);return t===void 0&&(t=G(e),D.set(e,t)),t}r(ie,"getRequest");export{P as a,h as b,S as c,A as d,U as e,B as f,W as g,I as h,L as i,Z as j,x as k,X as l,M as m,R as n,se as o,re as p,c as q,y as r,oe as s,ie as t};
26
- //# sourceMappingURL=chunk-7RNZS3GX.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@zuplo/runtime/request.ts","@zuplo/runtime/mcp-gateway/v2/runtime-utils/mcp-modern-protocol.ts","@zuplo/runtime/mcp/messages/parse.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;wHA0JO,IAAMA,EAAN,MAAMC,UAEH,OAAQ,CA5JlB,MA4JkB,CAAAC,EAAA,qBAChBC,GAAkD,OAClDC,GACAC,GAEA,YACEC,EACAC,EACAC,EACA,CACA,MAAMF,EAAOC,CAAI,EACjB,IAAME,EAASF,GAAM,OACrB,KAAKF,GAAmBG,EAIpBC,EACF,KAAKL,GAAUK,EACNH,aAAiBL,EAC1B,KAAKG,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ACX,MAAO,QAEP,SAAUM,EAAK,IAAKE,GAAWd,EAAec,CAAM,CAAC,EACrD,GAAID,IAAoB,KAAO,CAAC,EAAI,CAAE,gBAAAA,CAAgB,CACxD,EACA,OAAAT,EAAa,IAAIE,EAAUK,CAAI,EACxBL,CACT,CAEA,GAAI,CAAChC,EAASsC,CAAI,GAAKA,EAAK,UAAY5C,EACtC,OAAO,KAET,IAAMsC,EAAwB,CAC5B,UAAW,OACX,MAAO,SACP,SAAU,CACRN,EACEY,EACAG,EAAqB,GAAKC,EAAmBR,EAAQ,QAASI,CAAI,CACpE,CACF,EACA,GAAIC,IAAoB,KAAO,CAAC,EAAI,CAAE,gBAAAA,CAAgB,CACxD,EACA,OAAAT,EAAa,IAAIE,EAAUK,CAAI,EACxBL,CACT,CApEe9B,EAAA+B,EAAA,iBAkFR,SAASU,GAAWT,EAA+C,CACxE,IAAIU,EAASf,EAAc,IAAIK,CAAO,EACtC,OAAIU,IAAW,SACbA,EAASX,EAAcC,CAAO,EAC9BL,EAAc,IAAIK,EAASU,CAAM,GAE5BA,CACT,CAPgB1C,EAAAyC,GAAA","names":["ZuploRequest","_ZuploRequest","__name","#query","#params","#originalRequest","input","init","originalRequest","params","user","query","searchParams","key","value","deepFreeze","isMcp20260728Enabled","Environment","__name","MCP_MODERN_PROTOCOL_VERSION","MCP_PROTOCOL_VERSION_META_KEY","MCP_CLIENT_CAPABILITIES_META_KEY","MCP_CLIENT_INFO_META_KEY","MCP_SERVER_INFO_META_KEY","PROTOCOL_REVISION_PATTERN","isModernProtocolVersion","version","MCP_MODERN_PROTOCOL_VERSION","__name","isRecord","value","readRequestMeta","message","meta","readEnvelopeProtocolVersion","MCP_PROTOCOL_VERSION_META_KEY","readEnvelopeClientCapabilities","capabilities","MCP_CLIENT_CAPABILITIES_META_KEY","isModernMcpRequest","headers","header","claim","CONNECT_INPUT_REQUEST_KEY","JSONRPC_VERSION","INVALID_REQUEST","INVALID_PARAMS","INTERNAL_ERROR","NOT_PROCESSED","MAX_BODY_CHARS","isRecord","value","__name","isRequestId","describeValue","optionalObjectParams","params","requireStringField","field","example","REQUEST_PARAM_CHECKS","NOTIFICATION_PARAM_CHECKS","MODERN_ONLY_REQUEST_METHODS","MODERN_ONLY_NOTIFICATION_METHODS","isKnownRequestMethod","method","modern","isKnownNotificationMethod","invalidMessage","input","usableId","classifyRequest","raw","id","problem","classifyNotification","classifyMember","error","detail","envelopeCache","envelopeText","getEnvelopeText","envelope","parseEnvelope","request","contentType","contentLength","text","body","protocolVersion","member","isMcp20260728Enabled","isModernMcpRequest","getRequest","cached"]}