@wrongstack/mcp 0.296.4 → 0.298.0

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.
Files changed (41) hide show
  1. package/dist/client-protocol-helpers.d.ts +6 -0
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +192 -29
  4. package/dist/manage.d.ts +15 -0
  5. package/dist/server.d.ts +33 -0
  6. package/package.json +4 -3
  7. package/dist/authorization-manager.d.ts.map +0 -1
  8. package/dist/authorization.d.ts.map +0 -1
  9. package/dist/client-process.d.ts.map +0 -1
  10. package/dist/client-protocol-helpers.d.ts.map +0 -1
  11. package/dist/client.d.ts.map +0 -1
  12. package/dist/constants.d.ts.map +0 -1
  13. package/dist/content-selection.d.ts.map +0 -1
  14. package/dist/index.d.ts.map +0 -1
  15. package/dist/index.js.map +0 -7
  16. package/dist/manage.d.ts.map +0 -1
  17. package/dist/manifest-cache.d.ts.map +0 -1
  18. package/dist/operations.d.ts.map +0 -1
  19. package/dist/protocol.d.ts.map +0 -1
  20. package/dist/read-body.d.ts.map +0 -1
  21. package/dist/registry-authorization.d.ts.map +0 -1
  22. package/dist/registry-catalog.d.ts.map +0 -1
  23. package/dist/registry-disconnect.d.ts.map +0 -1
  24. package/dist/registry-health.d.ts.map +0 -1
  25. package/dist/registry-operations.d.ts.map +0 -1
  26. package/dist/registry-reconnect.d.ts.map +0 -1
  27. package/dist/registry-slots.d.ts.map +0 -1
  28. package/dist/registry-types.d.ts.map +0 -1
  29. package/dist/registry.d.ts.map +0 -1
  30. package/dist/server.d.ts.map +0 -1
  31. package/dist/sse-reader.d.ts.map +0 -1
  32. package/dist/test-helpers/mock-server.d.ts.map +0 -1
  33. package/dist/token-store.d.ts.map +0 -1
  34. package/dist/tool-schema.d.ts.map +0 -1
  35. package/dist/transport-base.d.ts.map +0 -1
  36. package/dist/transport-jsonrpc.d.ts.map +0 -1
  37. package/dist/transport-security.d.ts.map +0 -1
  38. package/dist/transport-sse.d.ts.map +0 -1
  39. package/dist/transport-streamable.d.ts.map +0 -1
  40. package/dist/transport.d.ts.map +0 -1
  41. package/dist/wrap-tool.d.ts.map +0 -1
@@ -3,6 +3,12 @@
3
3
  * Windows. Only args containing whitespace or quotes need wrapping; inside
4
4
  * double quotes cmd.exe escapes a literal `"` as `""`. Backslashes are literal
5
5
  * inside cmd quotes, so paths like `C:\Program Files\x` pass through unharmed.
6
+ *
7
+ * @deprecated Unsafe for spawning. An argument with no whitespace is returned
8
+ * verbatim, so `--flag=x&calc.exe` reaches `cmd.exe` unquoted and `&` separates
9
+ * commands. Retained only for API compatibility; the stdio MCP transport now
10
+ * uses `buildWin32CmdShimInvocation` from `@wrongstack/core/utils`, which quotes
11
+ * every token and refuses metacharacters outright (CMDI-005).
6
12
  */
7
13
  export declare function quoteWindowsArg(arg: string): string;
8
14
  export declare function validateProtocolString(value: unknown, label: string, allowEmpty?: boolean): asserts value is string;
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { type MCPAuthorizationCompleteInput, MCPAuthorizationManager, type MCPAu
3
3
  export { type ConnectionState, MCPClient, type MCPClientOptions, type MCPListChangedListener, type MCPPageOptions, type MCPRequestOptions, type MCPTool, type ToolCallResult, type Transport, } from './client.js';
4
4
  export { MCP_CONSTANTS } from './constants.js';
5
5
  export { DEFAULT_MCP_INSERTION_MAX_BYTES, DEFAULT_MCP_RESOURCE_SCHEMES, type MCPContentProvenance, type MCPInsertionPolicy, type MCPPromptInsertion, type MCPResourceInsertion, preparePromptInsertion, prepareResourceInsertion, } from './content-selection.js';
6
- export { addMcp, disableMcp, discoverMcp, enableMcp, listMcp, type McpManageDeps, type McpOpResult, type McpServerInfo, type McpServerInput, removeMcp, restartMcp, updateMcp, } from './manage.js';
6
+ export { addMcp, disableMcp, discoverMcp, enableMcp, listMcp, MCP_ENV_MASK, type McpManageDeps, type McpOpResult, type McpServerInfo, type McpServerInput, removeMcp, restartMcp, updateMcp, } from './manage.js';
7
7
  export { type MCPCapabilityManifest, manifestConfigHash, readCapabilityManifest, readManifest, writeCapabilityManifest, writeManifest, } from './manifest-cache.js';
8
8
  export { MCP_OPERATION_LIMITS, type MCPFailureKind, type MCPHealthState, type MCPLatencySummary, type MCPOperationEvent, type MCPOperationKind, type MCPServerOperationalHealth, } from './operations.js';
9
9
  export { type MCPGetPromptResult, type MCPImplementationInfo, type MCPListPromptsResult, type MCPListResourcesResult, type MCPListResourceTemplatesResult, type MCPPrompt, type MCPPromptArgument, type MCPPromptMessage, type MCPReadResourceResult, type MCPResource, type MCPResourceContents, type MCPResourceTemplate, type MCPServerCapabilities, type MCPServerMetadata, parseGetPromptResult, parseListPromptsResult, parseListResourcesResult, parseListResourceTemplatesResult, parseReadResourceResult, parseServerMetadata, } from './protocol.js';
package/dist/index.js CHANGED
@@ -739,7 +739,7 @@ function boundedServerName(value) {
739
739
 
740
740
  // src/client.ts
741
741
  import { spawn as spawn2 } from "node:child_process";
742
- import { buildChildEnv, toErrorMessage } from "@wrongstack/core/utils";
742
+ import { buildChildEnv, buildWin32CmdShimInvocation, toErrorMessage } from "@wrongstack/core/utils";
743
743
 
744
744
  // src/constants.ts
745
745
  var MCP_CONSTANTS = Object.freeze({
@@ -1182,6 +1182,7 @@ function validateTransportUrl(rawUrl) {
1182
1182
  }
1183
1183
 
1184
1184
  // src/transport-base.ts
1185
+ var MAX_TRANSPORT_REDIRECTS = 5;
1185
1186
  function makeAbortError(method) {
1186
1187
  const err = new Error(`MCP request "${method}" aborted by client`);
1187
1188
  err.name = "AbortError";
@@ -1275,7 +1276,28 @@ var BaseHTTPTransport = class {
1275
1276
  authorizationHeaderForToken(token, this.authorizationResource)
1276
1277
  );
1277
1278
  }
1278
- return fetch(input, { ...init, headers });
1279
+ let currentUrl = typeof input === "string" ? input : String(input);
1280
+ let hopHeaders = headers;
1281
+ for (let hop = 0; hop < MAX_TRANSPORT_REDIRECTS; hop++) {
1282
+ const res = await fetch(currentUrl, { ...init, headers: hopHeaders, redirect: "manual" });
1283
+ if (res.status !== 301 && res.status !== 302 && res.status !== 303 && res.status !== 307 && res.status !== 308) {
1284
+ return res;
1285
+ }
1286
+ const location = res.headers.get("location");
1287
+ if (!location) return res;
1288
+ const nextUrl = new URL(location, currentUrl).toString();
1289
+ validateTransportUrl(nextUrl);
1290
+ if (new URL(nextUrl).origin !== new URL(currentUrl).origin) {
1291
+ hopHeaders = new Headers(hopHeaders);
1292
+ hopHeaders.delete("Authorization");
1293
+ }
1294
+ await res.body?.cancel().catch(() => void 0);
1295
+ currentUrl = nextUrl;
1296
+ }
1297
+ throw new ConfigError2({
1298
+ message: `MCP server "${this.name}" exceeded ${MAX_TRANSPORT_REDIRECTS} redirects.`,
1299
+ code: "CONFIG_INVALID"
1300
+ });
1279
1301
  };
1280
1302
  let response = await send();
1281
1303
  if (response.status !== 401 || !this.authorizationProvider?.handleUnauthorized) {
@@ -2019,10 +2041,6 @@ var StreamableHTTPTransport = class extends BaseHTTPTransport {
2019
2041
  };
2020
2042
 
2021
2043
  // src/client-protocol-helpers.ts
2022
- function quoteWindowsArg(arg) {
2023
- if (!/[\s"]/.test(arg)) return arg;
2024
- return `"${arg.replace(/"/g, '""')}"`;
2025
- }
2026
2044
  var MAX_PROTOCOL_INPUT_CHARS = 8192;
2027
2045
  function validateProtocolString(value, label, allowEmpty = false) {
2028
2046
  if (typeof value !== "string" || !allowEmpty && value.length === 0) {
@@ -2188,14 +2206,17 @@ var MCPClient = class _MCPClient {
2188
2206
  const rawArgs = this.opts.args ?? [];
2189
2207
  const spawnEnv = buildChildEnv({ extra: extraEnv });
2190
2208
  const stdio = ["pipe", "pipe", "pipe"];
2191
- const child = isWin ? spawn2([this.opts.command, ...rawArgs].map(quoteWindowsArg).join(" "), {
2192
- env: spawnEnv,
2193
- stdio,
2194
- shell: true,
2195
- // Without this every MCP server spawned from a console-less host
2196
- // (WebUI server, scheduled runs) opens a visible console window.
2197
- windowsHide: true
2198
- }) : spawn2(this.opts.command, rawArgs, { env: spawnEnv, stdio, windowsHide: true });
2209
+ const child = isWin ? (() => {
2210
+ const shim = buildWin32CmdShimInvocation(this.opts.command, rawArgs);
2211
+ return spawn2(shim.command, shim.args, {
2212
+ env: spawnEnv,
2213
+ stdio,
2214
+ windowsVerbatimArguments: shim.windowsVerbatimArguments,
2215
+ // Without this every MCP server spawned from a console-less host
2216
+ // (WebUI server, scheduled runs) opens a visible console window.
2217
+ windowsHide: true
2218
+ });
2219
+ })() : spawn2(this.opts.command, rawArgs, { env: spawnEnv, stdio, windowsHide: true });
2199
2220
  this.child = child;
2200
2221
  child.stdout?.on("data", (chunk) => this.onData(chunk.toString()));
2201
2222
  child.stderr?.on("data", () => {
@@ -2472,6 +2493,10 @@ var MCPClient = class _MCPClient {
2472
2493
  new Promise((resolve) => setTimeout(resolve, FORCE_TIMEOUT_MS))
2473
2494
  ]);
2474
2495
  }
2496
+ child.stdout?.removeAllListeners();
2497
+ child.stderr?.removeAllListeners();
2498
+ child.removeAllListeners();
2499
+ this.child = void 0;
2475
2500
  }
2476
2501
  this.failPending(`MCP "${this.opts.name}" closed`);
2477
2502
  this.sseTransport?.close();
@@ -2932,6 +2957,26 @@ function normalizeTransport(t) {
2932
2957
  if (t === "http" || t === "streamable-http") return "streamable-http";
2933
2958
  return "stdio";
2934
2959
  }
2960
+ var MCP_ENV_MASK = "__wrongstack_unchanged__";
2961
+ function unmaskEnv(env, base) {
2962
+ if (env === void 0) return void 0;
2963
+ let changed = false;
2964
+ const out = {};
2965
+ for (const [key, value] of Object.entries(env)) {
2966
+ if (value === MCP_ENV_MASK) {
2967
+ const stored = base?.[key];
2968
+ if (stored === void 0) {
2969
+ changed = true;
2970
+ continue;
2971
+ }
2972
+ out[key] = stored;
2973
+ changed = true;
2974
+ continue;
2975
+ }
2976
+ out[key] = value;
2977
+ }
2978
+ return changed ? out : env;
2979
+ }
2935
2980
  function buildConfig(input, base) {
2936
2981
  const cfg = {
2937
2982
  name: input.name,
@@ -2943,7 +2988,7 @@ function buildConfig(input, base) {
2943
2988
  if (command !== void 0) cfg.command = command;
2944
2989
  const args = input.args ?? base?.args;
2945
2990
  if (args !== void 0) cfg.args = args;
2946
- const env = input.env ?? base?.env;
2991
+ const env = unmaskEnv(input.env ?? base?.env, base?.env);
2947
2992
  if (env !== void 0) cfg.env = env;
2948
2993
  const url = input.url ?? base?.url;
2949
2994
  if (url !== void 0) cfg.url = url;
@@ -3570,6 +3615,7 @@ function scheduleRegistryReconnect({
3570
3615
 
3571
3616
  // src/wrap-tool.ts
3572
3617
  import { ToolCapabilities } from "@wrongstack/core/security";
3618
+ import { mcpQualifiedToolName } from "@wrongstack/core/utils";
3573
3619
  var MUTATING_RE = /create|update|delete|write|send|set|put|post|patch|remove|rename|move/i;
3574
3620
  function isMutatingTool(mcpTool) {
3575
3621
  if (MUTATING_RE.test(mcpTool.name)) return true;
@@ -3585,7 +3631,7 @@ function isMutatingTool(mcpTool) {
3585
3631
  return false;
3586
3632
  }
3587
3633
  function wrapMCPTool(serverName, mcpTool, client, permission = "confirm", observer) {
3588
- const qualifiedName = `mcp__${serverName}__${mcpTool.name}`;
3634
+ const qualifiedName = mcpQualifiedToolName(serverName, mcpTool.name);
3589
3635
  return {
3590
3636
  name: qualifiedName,
3591
3637
  description: mcpTool.description ?? `${qualifiedName} (MCP tool)`,
@@ -4417,11 +4463,13 @@ var MCPRegistry = class _MCPRegistry {
4417
4463
  };
4418
4464
 
4419
4465
  // src/server.ts
4466
+ import { timingSafeEqual as timingSafeEqual2 } from "node:crypto";
4420
4467
  import { createServer } from "node:http";
4421
- import { expectDefined as expectDefined2, toErrorMessage as toErrorMessage2 } from "@wrongstack/core/utils";
4468
+ import { expectDefined as expectDefined2, toErrorMessage as toErrorMessage2, validateAgainstSchema } from "@wrongstack/core/utils";
4422
4469
  var PARSE_ERROR = -32700;
4423
4470
  var INVALID_REQUEST = -32600;
4424
4471
  var METHOD_NOT_FOUND = -32601;
4472
+ var INVALID_PARAMS = -32602;
4425
4473
  var INTERNAL_ERROR = -32603;
4426
4474
  var MCPServer = class {
4427
4475
  host;
@@ -4474,7 +4522,8 @@ var MCPServer = class {
4474
4522
  } catch (err) {
4475
4523
  const message = toErrorMessage2(err);
4476
4524
  this.logger?.warn?.(`MCP server: method "${msg.method}" threw: ${message}`);
4477
- return this.encodeError(expectDefined2(msg.id), INTERNAL_ERROR, message);
4525
+ const code = err instanceof InvalidToolArgumentsError ? INVALID_PARAMS : INTERNAL_ERROR;
4526
+ return this.encodeError(expectDefined2(msg.id), code, message);
4478
4527
  }
4479
4528
  }
4480
4529
  async dispatch(method, params) {
@@ -4501,6 +4550,7 @@ var MCPServer = class {
4501
4550
  throw new Error('tools/call requires a string "name"');
4502
4551
  }
4503
4552
  const args = p.arguments && typeof p.arguments === "object" && !Array.isArray(p.arguments) ? p.arguments : {};
4553
+ await this.assertArgumentsMatchSchema(p.name, args);
4504
4554
  const res = await this.host.callTool(p.name, args);
4505
4555
  return { content: toContentBlocks(res.content), isError: res.isError };
4506
4556
  }
@@ -4556,10 +4606,56 @@ var MCPServer = class {
4556
4606
  return METHOD_NOT_FOUND_SENTINEL;
4557
4607
  }
4558
4608
  }
4609
+ /**
4610
+ * WS-026: enforce the `inputSchema` this server advertises on `tools/list`.
4611
+ *
4612
+ * `tools/call` used to forward `params.arguments` to the host verbatim after
4613
+ * checking only that it was a non-array object — so every `enum`, `required`,
4614
+ * `additionalProperties: false`, and numeric bound in the published schema
4615
+ * was advisory. A client (or an attacker who reached the transport) could
4616
+ * send `{mode: "../../etc"}` to a tool whose schema declares
4617
+ * `enum: ["read","write"]` and the tool would receive it. Publishing a
4618
+ * contract and not enforcing it is worse than publishing none: downstream
4619
+ * tools are written against the schema they declared.
4620
+ *
4621
+ * SCOPE: `validateAgainstSchema` is the shared validator that also gates the
4622
+ * agent's own tool executor. It checks `type`, `enum`, and `required`, and
4623
+ * recurses through `properties`/`items` — it does NOT check
4624
+ * `additionalProperties: false`, numeric bounds, or string lengths. So those
4625
+ * keywords stay advisory here. Teaching the shared validator about them
4626
+ * would change what the agent accepts on every tool call in the product,
4627
+ * which is a deliberate decision that does not belong inside a transport
4628
+ * fix; it is tracked separately.
4629
+ *
4630
+ * Unknown tool names are left alone — the host owns that error, and
4631
+ * answering "no such tool" here would fork the message for no benefit.
4632
+ */
4633
+ async assertArgumentsMatchSchema(name, args) {
4634
+ let tools;
4635
+ try {
4636
+ tools = await this.host.listTools();
4637
+ } catch {
4638
+ return;
4639
+ }
4640
+ const schema = tools.find((tool) => tool.name === name)?.inputSchema;
4641
+ if (!schema || typeof schema !== "object") return;
4642
+ const result = validateAgainstSchema(
4643
+ args,
4644
+ schema
4645
+ );
4646
+ if (result.ok) return;
4647
+ const detail = result.errors.slice(0, MAX_REPORTED_SCHEMA_ERRORS).map((error) => `${error.path || "(root)"}: ${error.message}`).join("; ");
4648
+ const more = result.errors.length > MAX_REPORTED_SCHEMA_ERRORS ? ` (+${result.errors.length - MAX_REPORTED_SCHEMA_ERRORS} more)` : "";
4649
+ throw new InvalidToolArgumentsError(`invalid arguments for tool "${name}" \u2014 ${detail}${more}`);
4650
+ }
4559
4651
  encodeError(id, code, message) {
4560
4652
  return JSON.stringify({ jsonrpc: "2.0", id, error: { code, message } });
4561
4653
  }
4562
4654
  };
4655
+ var MAX_REPORTED_SCHEMA_ERRORS = 5;
4656
+ var InvalidToolArgumentsError = class extends Error {
4657
+ name = "InvalidToolArgumentsError";
4658
+ };
4563
4659
  var SERVER_PAGE_SIZE = 100;
4564
4660
  function paginate(items, params) {
4565
4661
  const cursor = paramsRecord(params)["cursor"];
@@ -4635,6 +4731,7 @@ function serveStdio(server, opts = {}) {
4635
4731
  let closed = false;
4636
4732
  let bufferTooLarge = false;
4637
4733
  let writeChain = Promise.resolve();
4734
+ const inFlightHandlers = /* @__PURE__ */ new Set();
4638
4735
  const writeLine = (s) => {
4639
4736
  writeChain = writeChain.then(
4640
4737
  () => new Promise((resolve) => {
@@ -4681,7 +4778,7 @@ function serveStdio(server, opts = {}) {
4681
4778
  buffer = buffer.slice(idx + 1);
4682
4779
  idx = buffer.indexOf("\n");
4683
4780
  if (!line.trim()) continue;
4684
- void server.handleMessage(line).then((res) => {
4781
+ const handler = server.handleMessage(line).then((res) => {
4685
4782
  if (res !== null) writeLine(res);
4686
4783
  }).catch((err) => {
4687
4784
  console.error(
@@ -4692,13 +4789,16 @@ function serveStdio(server, opts = {}) {
4692
4789
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
4693
4790
  })
4694
4791
  );
4792
+ }).finally(() => {
4793
+ inFlightHandlers.delete(handler);
4695
4794
  });
4795
+ inFlightHandlers.add(handler);
4696
4796
  }
4697
4797
  };
4698
4798
  let resolveDone;
4699
4799
  const done = new Promise((resolve) => {
4700
4800
  resolveDone = () => {
4701
- void writeChain.then(() => resolve());
4801
+ void Promise.allSettled([...inFlightHandlers]).then(() => writeChain).then(() => resolve());
4702
4802
  };
4703
4803
  });
4704
4804
  const onEnd = () => {
@@ -4737,7 +4837,7 @@ function serveHttp(server, opts = {}) {
4737
4837
  );
4738
4838
  }
4739
4839
  const httpServer = createServer((req, res) => {
4740
- void handleHttpRequest(server, req, res, token, log);
4840
+ void handleHttpRequest(server, req, res, token, log, host);
4741
4841
  });
4742
4842
  return new Promise((resolve, reject) => {
4743
4843
  httpServer.once("error", reject);
@@ -4756,23 +4856,37 @@ function serveHttp(server, opts = {}) {
4756
4856
  });
4757
4857
  });
4758
4858
  }
4759
- async function handleHttpRequest(server, req, res, token, log) {
4859
+ async function handleHttpRequest(server, req, res, token, log, boundHost) {
4760
4860
  const send = (status, body2, type = "application/json") => {
4761
- res.writeHead(status, { "content-type": type });
4861
+ res.writeHead(status, {
4862
+ "content-type": type,
4863
+ // This endpoint executes tools. Nothing about it should be embedded,
4864
+ // sniffed into another type, or leak its URL onward.
4865
+ "x-content-type-options": "nosniff",
4866
+ "x-frame-options": "DENY",
4867
+ "referrer-policy": "no-referrer"
4868
+ // No CORS headers are ever emitted: a cross-origin reader must not be
4869
+ // able to see a response even if it manages to send the request.
4870
+ });
4762
4871
  res.end(body2);
4763
4872
  };
4873
+ if (!originIsAcceptable(req, boundHost)) {
4874
+ return send(403, JSON.stringify({ error: "cross-origin forbidden" }));
4875
+ }
4876
+ if (!hostHeaderIsAcceptable(req, boundHost)) {
4877
+ return send(403, JSON.stringify({ error: "untrusted host header" }));
4878
+ }
4879
+ if (token && !bearerTokenMatches(req.headers.authorization, token)) {
4880
+ return send(401, JSON.stringify({ error: "unauthorized" }));
4881
+ }
4764
4882
  if (req.method === "GET") {
4765
4883
  return send(200, JSON.stringify({ status: "ok", server: "wrongstack-mcp" }));
4766
4884
  }
4767
4885
  if (req.method !== "POST") {
4768
4886
  return send(405, JSON.stringify({ error: "method not allowed" }));
4769
4887
  }
4770
- if (token) {
4771
- const auth = req.headers.authorization ?? "";
4772
- const expected = `Bearer ${token}`;
4773
- if (auth !== expected) {
4774
- return send(401, JSON.stringify({ error: "unauthorized" }));
4775
- }
4888
+ if (!isJsonContentType(req.headers["content-type"])) {
4889
+ return send(415, JSON.stringify({ error: "content-type must be application/json" }));
4776
4890
  }
4777
4891
  let body = "";
4778
4892
  req.on("data", (chunk) => {
@@ -4792,6 +4906,54 @@ async function handleHttpRequest(server, req, res, token, log) {
4792
4906
  });
4793
4907
  });
4794
4908
  }
4909
+ function isLoopbackHostname(hostname) {
4910
+ const bare = hostname.toLowerCase().replace(/^\[(.*)\]$/, "$1");
4911
+ return bare === "localhost" || bare === "::1" || bare === "127.0.0.1" || bare.startsWith("127.");
4912
+ }
4913
+ function originIsAcceptable(req, boundHost) {
4914
+ const origin = req.headers.origin;
4915
+ if (origin === void 0 || origin === "null") return origin === void 0;
4916
+ let parsed;
4917
+ try {
4918
+ parsed = new URL(origin);
4919
+ } catch {
4920
+ return false;
4921
+ }
4922
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return false;
4923
+ const rawHost = req.headers.host?.trim();
4924
+ if (!rawHost) return false;
4925
+ try {
4926
+ const requestAuthority = new URL(`${parsed.protocol}//${rawHost}`).host.toLowerCase();
4927
+ if (parsed.host.toLowerCase() !== requestAuthority) return false;
4928
+ } catch {
4929
+ return false;
4930
+ }
4931
+ return isLoopbackHost(boundHost) ? isLoopbackHostname(parsed.hostname) : true;
4932
+ }
4933
+ function hostHeaderIsAcceptable(req, boundHost) {
4934
+ const rawHost = req.headers.host?.trim();
4935
+ if (!rawHost) return false;
4936
+ let parsed;
4937
+ try {
4938
+ parsed = new URL(`http://${rawHost}`);
4939
+ } catch {
4940
+ return false;
4941
+ }
4942
+ if (parsed.username || parsed.password || parsed.pathname !== "/" || parsed.search) return false;
4943
+ if (isLoopbackHost(boundHost)) return isLoopbackHostname(parsed.hostname);
4944
+ return true;
4945
+ }
4946
+ function isJsonContentType(value) {
4947
+ if (!value) return false;
4948
+ const base = value.split(";")[0]?.trim().toLowerCase() ?? "";
4949
+ return base === "application/json" || base.endsWith("+json");
4950
+ }
4951
+ function bearerTokenMatches(header, token) {
4952
+ const expected = Buffer.from(`Bearer ${token}`);
4953
+ const supplied = Buffer.from(header ?? "");
4954
+ if (supplied.length !== expected.length) return false;
4955
+ return timingSafeEqual2(supplied, expected);
4956
+ }
4795
4957
 
4796
4958
  // src/token-store.ts
4797
4959
  import * as fs3 from "node:fs/promises";
@@ -5093,6 +5255,7 @@ export {
5093
5255
  MCPServer,
5094
5256
  MCPVaultTokenStore,
5095
5257
  MCP_CONSTANTS,
5258
+ MCP_ENV_MASK,
5096
5259
  MCP_OPERATION_LIMITS,
5097
5260
  SSEReader,
5098
5261
  SSETransport,
package/dist/manage.d.ts CHANGED
@@ -59,6 +59,21 @@ export interface McpManageDeps {
59
59
  /** Built-in presets (from core `allServers()`), used by name-only `add`. */
60
60
  presets?: Record<string, MCPServerConfig> | undefined;
61
61
  }
62
+ /**
63
+ * Build a clean MCPServerConfig from loose input, omitting undefined keys so
64
+ * `exactOptionalPropertyTypes` stays satisfied and we never write `null`-ish
65
+ * holes into config.json. `base` lets `update` merge onto an existing entry.
66
+ */
67
+ /**
68
+ * Placeholder a caller receives in place of a secret-bearing env value.
69
+ *
70
+ * WS-036: `mcp.list` echoed MCP server env verbatim over the WebSocket, and
71
+ * MCP env is where server credentials live (`GITHUB_TOKEN`, `*_API_KEY`, …).
72
+ * Read surfaces substitute this; sending it back means "leave that value
73
+ * alone", so the browser can still edit a server without ever having been
74
+ * given its secrets.
75
+ */
76
+ export declare const MCP_ENV_MASK = "__wrongstack_unchanged__";
62
77
  /** List all configured servers, merged with live registry status + tool names. */
63
78
  export declare function listMcp(deps: McpManageDeps): Promise<McpServerInfo[]>;
64
79
  /**
package/dist/server.d.ts CHANGED
@@ -79,8 +79,41 @@ export declare class MCPServer {
79
79
  */
80
80
  handleMessage(raw: string): Promise<string | null>;
81
81
  private dispatch;
82
+ /**
83
+ * WS-026: enforce the `inputSchema` this server advertises on `tools/list`.
84
+ *
85
+ * `tools/call` used to forward `params.arguments` to the host verbatim after
86
+ * checking only that it was a non-array object — so every `enum`, `required`,
87
+ * `additionalProperties: false`, and numeric bound in the published schema
88
+ * was advisory. A client (or an attacker who reached the transport) could
89
+ * send `{mode: "../../etc"}` to a tool whose schema declares
90
+ * `enum: ["read","write"]` and the tool would receive it. Publishing a
91
+ * contract and not enforcing it is worse than publishing none: downstream
92
+ * tools are written against the schema they declared.
93
+ *
94
+ * SCOPE: `validateAgainstSchema` is the shared validator that also gates the
95
+ * agent's own tool executor. It checks `type`, `enum`, and `required`, and
96
+ * recurses through `properties`/`items` — it does NOT check
97
+ * `additionalProperties: false`, numeric bounds, or string lengths. So those
98
+ * keywords stay advisory here. Teaching the shared validator about them
99
+ * would change what the agent accepts on every tool call in the product,
100
+ * which is a deliberate decision that does not belong inside a transport
101
+ * fix; it is tracked separately.
102
+ *
103
+ * Unknown tool names are left alone — the host owns that error, and
104
+ * answering "no such tool" here would fork the message for no benefit.
105
+ */
106
+ private assertArgumentsMatchSchema;
82
107
  private encodeError;
83
108
  }
109
+ /**
110
+ * Marks a `tools/call` rejected by {@link MCPServer.assertArgumentsMatchSchema}
111
+ * so `handleMessage` can answer with JSON-RPC `-32602 Invalid params` rather
112
+ * than the generic internal-error code every other throw maps to.
113
+ */
114
+ export declare class InvalidToolArgumentsError extends Error {
115
+ readonly name = "InvalidToolArgumentsError";
116
+ }
84
117
  /** Normalize a host result's content into MCP content blocks. */
85
118
  export declare function toContentBlocks(content: unknown): Array<{
86
119
  type: 'text';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/mcp",
3
- "version": "0.296.4",
3
+ "version": "0.298.0",
4
4
  "license": "MIT",
5
5
  "description": "WrongStack Model Context Protocol client and registry: stdio, SSE, and streamable HTTP transports.",
6
6
  "repository": {
@@ -22,10 +22,11 @@
22
22
  }
23
23
  },
24
24
  "files": [
25
- "dist"
25
+ "dist",
26
+ "!dist/**/*.map"
26
27
  ],
27
28
  "dependencies": {
28
- "@wrongstack/core": "0.296.4"
29
+ "@wrongstack/core": "0.298.0"
29
30
  },
30
31
  "devDependencies": {
31
32
  "@types/node": "^26.1.1",
@@ -1 +0,0 @@
1
- {"version":3,"file":"authorization-manager.d.ts","sourceRoot":"","sources":["../src/authorization-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,gCAAgC,EACrC,KAAK,+BAA+B,EAEpC,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAGjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,0BAA0B,EAE1B,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAK1B,KAAK,qBAAqB,GAAG,CAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,gCAAgC,KACvC,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAE9C,KAAK,yBAAyB,GAAG,CAAC,OAAO,EAAE,uBAAuB,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;AAE5F,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,kBAAkB,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,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,KAAK,EAAE,OAAO,GACb,8BAA8B,CAkBhC;AAED;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,gCAAqC,GAC7C,OAAO,CAAC,+BAA+B,CAAC,CA0C1C;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,8BAA8B,GACtC,uBAAuB,CA4BzB;AAED,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,aAAa,GAAG,OAAO,CAAC,GAC9D,MAAM,CAwBR;AAED,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,WAAW,CAAC,CAsBtB;AAED,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,WAAW,CAAC,CAsBjG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-process.d.ts","sourceRoot":"","sources":["../src/client-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,oBAAoB,CAAC;AAE9D;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CA6BvD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-protocol-helpers.d.ts","sourceRoot":"","sources":["../src/client-protocol-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGnD;AAID,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,EACb,UAAU,UAAQ,GACjB,OAAO,CAAC,KAAK,IAAI,MAAM,CAOzB;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAI5F;AAED,wBAA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mBAAmB;IAmB3B;;;;;OAKG;YACW,sBAAsB;IAoBpC,uBAAuB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAE5D;IAED,0BAA0B,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAE/D;IAED,2BAA2B,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI,CAElE;IAED,8BAA8B,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI,CAErE;IAED,yBAAyB,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI,CAEhE;IAED,4BAA4B,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI,CAEnE;IAED,OAAO,CAAC,qBAAqB;CAW9B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;IACxB,wDAAwD;+BACtC,YAAY;IAE9B,6DAA6D;;;;;IAM7D,2DAA2D;;QAEzD,oEAAoE;;QAEpE,sEAAsE;;QAEtE,sEAAsE;;QAEtE,qDAAqD;;QAErD,iGAAiG;;;IAInG,+CAA+C;;QAE7C,0EAA0E;;QAE1E,wDAAwD;;;IAI1D,mCAAmC;;QAEjC,qFAAqF;;QAErF,mEAAmE;;;IAIrE,0DAA0D;kCACrC,GAAG;IAExB,0CAA0C;;IAG1C,iDAAiD;8BAChC,IAAI;EACZ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-selection.d.ts","sourceRoot":"","sources":["../src/content-selection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,+BAA+B,QAAa,CAAC;AAC1D,eAAO,MAAM,4BAA4B,YACvC,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,KAAK,EACL,MAAM,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