deadbyte-mcp 0.15.16 → 0.15.18
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/MANIFEST.SHA256 +99 -96
- package/PROVENANCE.json +1 -1
- package/README.txt +6 -6
- package/RELEASE.json +1 -1
- package/SBOM.cdx.json +7 -33
- package/TEST-MATRIX.json +10 -25
- package/node_modules/@modelcontextprotocol/client/dist/{index-CHhhk6PQ.d.cts → index-BCtJi0p5.d.mts} +38 -6
- package/node_modules/@modelcontextprotocol/client/dist/index-BCtJi0p5.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/{index-D4xIIEF6.d.mts → index-CEk3qkZM.d.cts} +41 -3
- package/node_modules/@modelcontextprotocol/client/dist/index-CEk3qkZM.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index.cjs +375 -60
- package/node_modules/@modelcontextprotocol/client/dist/index.cjs.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.d.cts +227 -11
- package/node_modules/@modelcontextprotocol/client/dist/index.d.cts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.d.mts +227 -11
- package/node_modules/@modelcontextprotocol/client/dist/index.d.mts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.mjs +369 -61
- package/node_modules/@modelcontextprotocol/client/dist/index.mjs.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/{src-NAgB4Mp8.cjs → src-D0qEN74R.cjs} +111 -38
- package/node_modules/@modelcontextprotocol/client/dist/src-D0qEN74R.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/{src-D_zzAWoS.mjs → src-DDAAhLnO.mjs} +106 -33
- package/node_modules/@modelcontextprotocol/client/dist/src-DDAAhLnO.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs +8 -2
- package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.d.cts +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.d.cts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.d.mts +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.d.mts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs +8 -2
- package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs.map +1 -1
- package/node_modules/@modelcontextprotocol/client/package.json +4 -4
- package/node_modules/@modelcontextprotocol/core/dist/{auth-BWdKR39I.d.mts → auth--n_Yzytt.d.cts} +6 -1
- package/node_modules/@modelcontextprotocol/core/dist/{auth-BWdKR39I.d.mts.map → auth--n_Yzytt.d.cts.map} +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/{auth-CfDMXiII.cjs → auth-4-zilcqg.cjs} +3 -2
- package/node_modules/@modelcontextprotocol/core/dist/{auth-CfDMXiII.cjs.map → auth-4-zilcqg.cjs.map} +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/{auth-CUe6YdwF.mjs → auth-CGP0BDVq.mjs} +3 -2
- package/node_modules/@modelcontextprotocol/core/dist/{auth-CUe6YdwF.mjs.map → auth-CGP0BDVq.mjs.map} +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/{auth-hYtaIUZm.d.cts → auth-YUQV3RRv.d.mts} +6 -1
- package/node_modules/@modelcontextprotocol/core/dist/{auth-hYtaIUZm.d.cts.map → auth-YUQV3RRv.d.mts.map} +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/index.cjs +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/index.d.cts +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/index.d.mts +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/index.mjs +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/internal.cjs +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/internal.d.cts +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/internal.d.mts +1 -1
- package/node_modules/@modelcontextprotocol/core/dist/internal.mjs +1 -1
- package/node_modules/@modelcontextprotocol/core/package.json +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/{createMcpHandler-dBHMsxwf.d.cts → createMcpHandler-BLVe3qmU.d.cts} +110 -7
- package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-BLVe3qmU.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/{createMcpHandler-CLhGwQTn.d.mts → createMcpHandler-Bt6U_Fqb.d.mts} +110 -7
- package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-Bt6U_Fqb.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/index.cjs +144 -248
- package/node_modules/@modelcontextprotocol/server/dist/index.cjs.map +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/index.d.cts +38 -3
- package/node_modules/@modelcontextprotocol/server/dist/index.d.cts.map +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/index.d.mts +38 -3
- package/node_modules/@modelcontextprotocol/server/dist/index.d.mts.map +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/index.mjs +136 -243
- package/node_modules/@modelcontextprotocol/server/dist/index.mjs.map +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/{mcp-D7GmuPnv.cjs → mcp-DUcCQSTW.cjs} +426 -21
- package/node_modules/@modelcontextprotocol/server/dist/mcp-DUcCQSTW.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/{mcp-DXXb3Vv3.mjs → mcp-Dw2OlZ1f.mjs} +367 -22
- package/node_modules/@modelcontextprotocol/server/dist/mcp-Dw2OlZ1f.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.cjs +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.mjs +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/{src-STyD_Vvf.cjs → src-CgFsfg3E.cjs} +114 -36
- package/node_modules/@modelcontextprotocol/server/dist/src-CgFsfg3E.cjs.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/{src-CX2iR2pK.mjs → src-D-y6h4N7.mjs} +114 -36
- package/node_modules/@modelcontextprotocol/server/dist/src-D-y6h4N7.mjs.map +1 -0
- package/node_modules/@modelcontextprotocol/server/dist/stdio.cjs +30 -3
- package/node_modules/@modelcontextprotocol/server/dist/stdio.cjs.map +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/stdio.d.cts +9 -1
- package/node_modules/@modelcontextprotocol/server/dist/stdio.d.cts.map +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/stdio.d.mts +9 -1
- package/node_modules/@modelcontextprotocol/server/dist/stdio.d.mts.map +1 -1
- package/node_modules/@modelcontextprotocol/server/dist/stdio.mjs +30 -3
- package/node_modules/@modelcontextprotocol/server/dist/stdio.mjs.map +1 -1
- package/node_modules/@modelcontextprotocol/server/package.json +3 -3
- package/package.json +91 -93
- package/scripts/commander-hardening-gate-r47.mjs +1 -0
- package/scripts/full-regression-r47.mjs +1 -1
- package/scripts/init-host-policy.ps1 +2 -1
- package/src/coding-plane.mjs +24 -0
- package/src/commander-core-bridge.mjs +26 -30
- package/src/commander-extended-bridge-r47.mjs +17 -0
- package/src/commander-extended-runtime.mjs +2 -1
- package/src/commander-wire-adapter-r47.mjs +341 -0
- package/src/machine-fs.mjs +6 -6
- package/src/mcp-server.mjs +13 -87
- package/src/tunnel-stdio-compat.mjs +3 -3
- package/src/version.mjs +1 -1
- package/test/commander-core-bridge-r47.test.mjs +1 -1
- package/test/commander-protocol-r47.test.mjs +17 -2
- package/test/commander-wire-contract-r47.test.mjs +143 -0
- package/test/machine-fs-runtime.test.mjs +19 -1
- package/test/r47-release-contract.test.mjs +3 -3
- package/node_modules/@modelcontextprotocol/client/dist/index-CHhhk6PQ.d.cts.map +0 -1
- package/node_modules/@modelcontextprotocol/client/dist/index-D4xIIEF6.d.mts.map +0 -1
- package/node_modules/@modelcontextprotocol/client/dist/src-D_zzAWoS.mjs.map +0 -1
- package/node_modules/@modelcontextprotocol/client/dist/src-NAgB4Mp8.cjs.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-CLhGwQTn.d.mts.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-dBHMsxwf.d.cts.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/mcp-D7GmuPnv.cjs.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/mcp-DXXb3Vv3.mjs.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/src-CX2iR2pK.mjs.map +0 -1
- package/node_modules/@modelcontextprotocol/server/dist/src-STyD_Vvf.cjs.map +0 -1
- package/node_modules/which/CHANGELOG.md +0 -166
package/node_modules/@modelcontextprotocol/client/dist/{src-NAgB4Mp8.cjs → src-D0qEN74R.cjs}
RENAMED
|
@@ -177,6 +177,16 @@ let OAuthErrorCode = /* @__PURE__ */ function(OAuthErrorCode$1) {
|
|
|
177
177
|
* The requested resource is invalid, missing, unknown, or malformed. (Custom error for resource indicators - RFC 8707)
|
|
178
178
|
*/
|
|
179
179
|
OAuthErrorCode$1["InvalidTarget"] = "invalid_target";
|
|
180
|
+
/**
|
|
181
|
+
* The DPoP proof accompanying the request is invalid, or does not match the key the grant
|
|
182
|
+
* (e.g. a refresh token) is bound to. (RFC 9449 §5 / §7.1)
|
|
183
|
+
*/
|
|
184
|
+
OAuthErrorCode$1["InvalidDpopProof"] = "invalid_dpop_proof";
|
|
185
|
+
/**
|
|
186
|
+
* The server requires a server-supplied nonce in the DPoP proof; retry with the `DPoP-Nonce`
|
|
187
|
+
* it returned. (RFC 9449 §8 / §9)
|
|
188
|
+
*/
|
|
189
|
+
OAuthErrorCode$1["UseDpopNonce"] = "use_dpop_nonce";
|
|
180
190
|
return OAuthErrorCode$1;
|
|
181
191
|
}({});
|
|
182
192
|
/**
|
|
@@ -360,8 +370,18 @@ var SdkError = class extends Error {
|
|
|
360
370
|
if (typeof this !== "function") throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");
|
|
361
371
|
return brandedHasInstance(this, value);
|
|
362
372
|
}
|
|
363
|
-
|
|
364
|
-
|
|
373
|
+
/**
|
|
374
|
+
* @param code - Stable string code identifying the failure ({@linkcode SdkErrorCode}).
|
|
375
|
+
* @param message - Human-readable description.
|
|
376
|
+
* @param data - Optional structured payload (for example the HTTP status carried by
|
|
377
|
+
* {@linkcode SdkHttpError}). Opaque to the SDK: a `cause` key inside `data` is not
|
|
378
|
+
* promoted to `Error.cause`.
|
|
379
|
+
* @param options - Standard `ErrorOptions`, forwarded to `Error`. Pass the underlying
|
|
380
|
+
* failure as `{ cause }` so it is reachable through the `Error.cause` chain that
|
|
381
|
+
* loggers and error trackers walk.
|
|
382
|
+
*/
|
|
383
|
+
constructor(code, message, data, options) {
|
|
384
|
+
super(message, options);
|
|
365
385
|
this.code = code;
|
|
366
386
|
this.data = data;
|
|
367
387
|
this.name = "SdkError";
|
|
@@ -388,8 +408,11 @@ var SdkHttpError = class extends SdkError {
|
|
|
388
408
|
static {
|
|
389
409
|
Object.defineProperty(this, "mcpBrand", { value: "mcp.SdkHttpError" });
|
|
390
410
|
}
|
|
391
|
-
|
|
392
|
-
|
|
411
|
+
/**
|
|
412
|
+
* @param options - Standard `ErrorOptions`, forwarded to `Error` (see {@linkcode SdkError}).
|
|
413
|
+
*/
|
|
414
|
+
constructor(code, message, data, options) {
|
|
415
|
+
super(code, message, data, options);
|
|
393
416
|
this.name = "SdkHttpError";
|
|
394
417
|
}
|
|
395
418
|
get status() {
|
|
@@ -2215,7 +2238,7 @@ const rev2025NotificationMethods = Object.keys(notificationMethodKeys$1);
|
|
|
2215
2238
|
|
|
2216
2239
|
//#endregion
|
|
2217
2240
|
//#region ../core-internal/src/wire/rev2025-11-25/codec.ts
|
|
2218
|
-
function isPlainObject$
|
|
2241
|
+
function isPlainObject$5(value) {
|
|
2219
2242
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
2220
2243
|
}
|
|
2221
2244
|
/** Tri-state wrap of an optional Zod schema lookup (the function-only contract). */
|
|
@@ -2240,7 +2263,7 @@ const NOT_IN_ERA$1 = {
|
|
|
2240
2263
|
};
|
|
2241
2264
|
/** Whether a `tools/list` entry advertises a non-object `outputSchema` root that needs the SEP-2106 legacy wrap. */
|
|
2242
2265
|
function toolNeedsLegacyWrap(t) {
|
|
2243
|
-
return isPlainObject$
|
|
2266
|
+
return isPlainObject$5(t) && isPlainObject$5(t["outputSchema"]) && isNonObjectJsonSchemaRoot(t["outputSchema"]);
|
|
2244
2267
|
}
|
|
2245
2268
|
/** The wire→neutral trust boundary: a decoded 2025-era wire result is adopted as the neutral `Result` here (the module's single deliberate assertion). */
|
|
2246
2269
|
function toNeutralResult(value) {
|
|
@@ -2275,7 +2298,7 @@ const rev2025Codec = {
|
|
|
2275
2298
|
};
|
|
2276
2299
|
},
|
|
2277
2300
|
decodeResult(_method, raw) {
|
|
2278
|
-
if (isPlainObject$
|
|
2301
|
+
if (isPlainObject$5(raw) && "resultType" in raw) {
|
|
2279
2302
|
const stripped = { ...raw };
|
|
2280
2303
|
delete stripped["resultType"];
|
|
2281
2304
|
return {
|
|
@@ -3650,7 +3673,7 @@ function fillCacheFields(method, result) {
|
|
|
3650
3673
|
delete filled[RESULT_CACHE_HINT_FALLBACK];
|
|
3651
3674
|
return filled;
|
|
3652
3675
|
}
|
|
3653
|
-
function isPlainObject$
|
|
3676
|
+
function isPlainObject$4(value) {
|
|
3654
3677
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
3655
3678
|
}
|
|
3656
3679
|
/**
|
|
@@ -3678,7 +3701,7 @@ function stampServerInfoMeta(result, serverInfo) {
|
|
|
3678
3701
|
...result,
|
|
3679
3702
|
_meta: { [_modelcontextprotocol_core_internal.SERVER_INFO_META_KEY]: serverInfo }
|
|
3680
3703
|
};
|
|
3681
|
-
if (!isPlainObject$
|
|
3704
|
+
if (!isPlainObject$4(meta)) return result;
|
|
3682
3705
|
if (meta[_modelcontextprotocol_core_internal.SERVER_INFO_META_KEY] !== void 0) return result;
|
|
3683
3706
|
return {
|
|
3684
3707
|
...result,
|
|
@@ -3823,7 +3846,7 @@ const rev2026NotificationMethods = Object.keys(notificationMethodKeys);
|
|
|
3823
3846
|
|
|
3824
3847
|
//#endregion
|
|
3825
3848
|
//#region ../core-internal/src/wire/rev2026-07-28/codec.ts
|
|
3826
|
-
function isPlainObject$
|
|
3849
|
+
function isPlainObject$3(value) {
|
|
3827
3850
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
3828
3851
|
}
|
|
3829
3852
|
/** Tri-state wrap of an optional Zod schema lookup (the function-only contract). */
|
|
@@ -3865,14 +3888,14 @@ function enforceDeletedFields(method, result) {
|
|
|
3865
3888
|
return next;
|
|
3866
3889
|
};
|
|
3867
3890
|
const tools = result.tools;
|
|
3868
|
-
if (method === "tools/list" && Array.isArray(tools) && tools.some((tool) => isPlainObject$
|
|
3869
|
-
if (!isPlainObject$
|
|
3891
|
+
if (method === "tools/list" && Array.isArray(tools) && tools.some((tool) => isPlainObject$3(tool) && "execution" in tool)) copy().tools = tools.map((tool) => {
|
|
3892
|
+
if (!isPlainObject$3(tool) || !("execution" in tool)) return tool;
|
|
3870
3893
|
const rest = { ...tool };
|
|
3871
3894
|
delete rest["execution"];
|
|
3872
3895
|
return rest;
|
|
3873
3896
|
});
|
|
3874
3897
|
const capabilities = result.capabilities;
|
|
3875
|
-
if (isPlainObject$
|
|
3898
|
+
if (isPlainObject$3(capabilities) && "tasks" in capabilities) {
|
|
3876
3899
|
const rest = { ...capabilities };
|
|
3877
3900
|
delete rest["tasks"];
|
|
3878
3901
|
copy().capabilities = rest;
|
|
@@ -3919,7 +3942,7 @@ const rev2026Codec = {
|
|
|
3919
3942
|
projectCallToolResult: (result) => appendTextFallbackForNonObject(result),
|
|
3920
3943
|
inputRequestSchema: getInputRequestSchema2026,
|
|
3921
3944
|
decodeResult(method, raw) {
|
|
3922
|
-
if (!isPlainObject$
|
|
3945
|
+
if (!isPlainObject$3(raw)) return {
|
|
3923
3946
|
kind: "invalid",
|
|
3924
3947
|
error: new SdkError(SdkErrorCode.InvalidResult, `Invalid result for ${method}: not an object`, { method })
|
|
3925
3948
|
};
|
|
@@ -3940,7 +3963,7 @@ const rev2026Codec = {
|
|
|
3940
3963
|
};
|
|
3941
3964
|
if (rawResultType === "input_required") {
|
|
3942
3965
|
const rawInputRequests = raw["inputRequests"];
|
|
3943
|
-
const inputRequests = isPlainObject$
|
|
3966
|
+
const inputRequests = isPlainObject$3(rawInputRequests) ? rawInputRequests : {};
|
|
3944
3967
|
const requestState = raw["requestState"];
|
|
3945
3968
|
if (Object.keys(inputRequests).length === 0 && typeof requestState !== "string") return {
|
|
3946
3969
|
kind: "invalid",
|
|
@@ -4608,7 +4631,7 @@ const INBOUND_VALIDATION_LADDER = [
|
|
|
4608
4631
|
evaluatedAt: "pre-dispatch",
|
|
4609
4632
|
codes: [HEADER_MISMATCH_ERROR_CODE],
|
|
4610
4633
|
conformance: ["http-header-validation"],
|
|
4611
|
-
rationale: "SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."
|
|
4634
|
+
rationale: "SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half — including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."
|
|
4612
4635
|
},
|
|
4613
4636
|
{
|
|
4614
4637
|
rung: "client-capabilities",
|
|
@@ -4651,6 +4674,55 @@ const LADDER_ERROR_HTTP_STATUS = {
|
|
|
4651
4674
|
[ProtocolErrorCode.MissingRequiredClientCapability]: 400,
|
|
4652
4675
|
[HEADER_MISMATCH_ERROR_CODE]: 400
|
|
4653
4676
|
};
|
|
4677
|
+
/**
|
|
4678
|
+
* The methods whose body carries a `params.name` / `params.uri` /
|
|
4679
|
+
* `params.taskId` value the `Mcp-Name` header must mirror, and which body
|
|
4680
|
+
* field supplies it. The core rows come from SEP-2243 § Standard Request
|
|
4681
|
+
* Headers (`Required For` column); the `tasks/*` rows come from SEP-2663's
|
|
4682
|
+
* Streamable HTTP binding ("the client MUST set the `Mcp-Name` header to the
|
|
4683
|
+
* value of `params.taskId`" for `tasks/get` / `tasks/update` /
|
|
4684
|
+
* `tasks/cancel`, so intermediaries can route every request for a task to the
|
|
4685
|
+
* instance holding its state). Shared by the client transport (header
|
|
4686
|
+
* emission) and the server ladder (validation) so both sides derive from one
|
|
4687
|
+
* table.
|
|
4688
|
+
*/
|
|
4689
|
+
const MCP_NAME_HEADER_SOURCE = {
|
|
4690
|
+
"tools/call": "name",
|
|
4691
|
+
"prompts/get": "name",
|
|
4692
|
+
"resources/read": "uri",
|
|
4693
|
+
"tasks/get": "taskId",
|
|
4694
|
+
"tasks/update": "taskId",
|
|
4695
|
+
"tasks/cancel": "taskId"
|
|
4696
|
+
};
|
|
4697
|
+
/**
|
|
4698
|
+
* Resolve the `Mcp-Name` source for one request against
|
|
4699
|
+
* {@linkcode MCP_NAME_HEADER_SOURCE}: which body field the header mirrors for
|
|
4700
|
+
* `method`, and the string value that field carries in `params`.
|
|
4701
|
+
*
|
|
4702
|
+
* Returns `undefined` when `method` is off-table (no `Mcp-Name` is emitted or
|
|
4703
|
+
* required). Otherwise `value` is the field's string value, or `undefined`
|
|
4704
|
+
* when `params` is not a plain object or the field is absent / not a string —
|
|
4705
|
+
* the client emits no header then, and the server leaves that body to the
|
|
4706
|
+
* rungs further down the ladder.
|
|
4707
|
+
*
|
|
4708
|
+
* `method` is peer-supplied on the server and caller-supplied on the client,
|
|
4709
|
+
* so the table lookup is `Object.hasOwn`-guarded against `Object.prototype`
|
|
4710
|
+
* collisions (`constructor`, `toString`, …). Shared by the client transport
|
|
4711
|
+
* (emission) and {@linkcode validateStandardRequestHeaders} (validation) so
|
|
4712
|
+
* the extraction — not just the table — cannot drift between the two sides.
|
|
4713
|
+
*/
|
|
4714
|
+
function mcpNameSource(method, params) {
|
|
4715
|
+
const field = Object.hasOwn(MCP_NAME_HEADER_SOURCE, method) ? MCP_NAME_HEADER_SOURCE[method] : void 0;
|
|
4716
|
+
if (field === void 0) return;
|
|
4717
|
+
const raw = isPlainObject$2(params) ? params[field] : void 0;
|
|
4718
|
+
return {
|
|
4719
|
+
field,
|
|
4720
|
+
value: typeof raw === "string" ? raw : void 0
|
|
4721
|
+
};
|
|
4722
|
+
}
|
|
4723
|
+
function isPlainObject$2(value) {
|
|
4724
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
4725
|
+
}
|
|
4654
4726
|
|
|
4655
4727
|
//#endregion
|
|
4656
4728
|
//#region ../core-internal/src/util/schema.ts
|
|
@@ -5698,7 +5770,7 @@ var Protocol = class {
|
|
|
5698
5770
|
return this._requestHandlers.get(method);
|
|
5699
5771
|
}
|
|
5700
5772
|
async _oncancel(notification) {
|
|
5701
|
-
if (
|
|
5773
|
+
if (notification.params.requestId === void 0) return;
|
|
5702
5774
|
this._requestHandlerAbortControllers.get(notification.params.requestId)?.abort(notification.params.reason);
|
|
5703
5775
|
}
|
|
5704
5776
|
_setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) {
|
|
@@ -6097,19 +6169,20 @@ var Protocol = class {
|
|
|
6097
6169
|
const cancel = (reason) => {
|
|
6098
6170
|
if (responseReceived) return;
|
|
6099
6171
|
this._progressHandlers.delete(messageId);
|
|
6100
|
-
if (requestAbort === void 0)
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6172
|
+
if (requestAbort === void 0) {
|
|
6173
|
+
if (request.method !== "initialize") this._transport?.send(this._envelopeOutbound({
|
|
6174
|
+
jsonrpc: "2.0",
|
|
6175
|
+
method: "notifications/cancelled",
|
|
6176
|
+
params: {
|
|
6177
|
+
requestId: messageId,
|
|
6178
|
+
reason: String(reason)
|
|
6179
|
+
}
|
|
6180
|
+
}), {
|
|
6181
|
+
relatedRequestId,
|
|
6182
|
+
resumptionToken,
|
|
6183
|
+
onresumptiontoken
|
|
6184
|
+
}).catch((error) => this._onerror(/* @__PURE__ */ new Error(`Failed to send cancellation: ${error}`)));
|
|
6185
|
+
} else requestAbort.abort();
|
|
6113
6186
|
reject(reason instanceof SdkError ? reason : new SdkError(SdkErrorCode.RequestTimeout, String(reason)));
|
|
6114
6187
|
};
|
|
6115
6188
|
this._responseHandlers.set(messageId, (response) => {
|
|
@@ -6189,7 +6262,7 @@ var Protocol = class {
|
|
|
6189
6262
|
jsonrpc: "2.0",
|
|
6190
6263
|
...notification
|
|
6191
6264
|
});
|
|
6192
|
-
if ((this._options?.debouncedNotificationMethods ?? []).includes(notification.method) && !notification.params &&
|
|
6265
|
+
if ((this._options?.debouncedNotificationMethods ?? []).includes(notification.method) && !notification.params && options?.relatedRequestId === void 0) {
|
|
6193
6266
|
if (this._pendingDebouncedNotifications.has(notification.method)) return;
|
|
6194
6267
|
this._pendingDebouncedNotifications.add(notification.method);
|
|
6195
6268
|
Promise.resolve().then(() => {
|
|
@@ -7338,6 +7411,12 @@ Object.defineProperty(exports, 'legacyProtocolVersions', {
|
|
|
7338
7411
|
return legacyProtocolVersions;
|
|
7339
7412
|
}
|
|
7340
7413
|
});
|
|
7414
|
+
Object.defineProperty(exports, 'mcpNameSource', {
|
|
7415
|
+
enumerable: true,
|
|
7416
|
+
get: function () {
|
|
7417
|
+
return mcpNameSource;
|
|
7418
|
+
}
|
|
7419
|
+
});
|
|
7341
7420
|
Object.defineProperty(exports, 'mediaTypeEssence', {
|
|
7342
7421
|
enumerable: true,
|
|
7343
7422
|
get: function () {
|
|
@@ -7356,12 +7435,6 @@ Object.defineProperty(exports, 'modernProtocolVersions', {
|
|
|
7356
7435
|
return modernProtocolVersions;
|
|
7357
7436
|
}
|
|
7358
7437
|
});
|
|
7359
|
-
Object.defineProperty(exports, 'normalizeHeaders', {
|
|
7360
|
-
enumerable: true,
|
|
7361
|
-
get: function () {
|
|
7362
|
-
return normalizeHeaders;
|
|
7363
|
-
}
|
|
7364
|
-
});
|
|
7365
7438
|
Object.defineProperty(exports, 'parseJSONRPCMessage', {
|
|
7366
7439
|
enumerable: true,
|
|
7367
7440
|
get: function () {
|
|
@@ -7428,4 +7501,4 @@ Object.defineProperty(exports, 'withInputRequired', {
|
|
|
7428
7501
|
return withInputRequired;
|
|
7429
7502
|
}
|
|
7430
7503
|
});
|
|
7431
|
-
//# sourceMappingURL=src-
|
|
7504
|
+
//# sourceMappingURL=src-D0qEN74R.cjs.map
|