nuwax-mcp-stdio-proxy 1.4.4 → 1.4.5

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 (2) hide show
  1. package/dist/index.js +43 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6785,12 +6785,12 @@ var require_dist = __commonJS({
6785
6785
  throw new Error(`Unknown format "${name}"`);
6786
6786
  return f;
6787
6787
  };
6788
- function addFormats(ajv, list, fs2, exportName) {
6788
+ function addFormats(ajv, list, fs3, exportName) {
6789
6789
  var _a2;
6790
6790
  var _b;
6791
6791
  (_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== void 0 ? _a2 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
6792
6792
  for (const f of list)
6793
- ajv.addFormat(f, fs2[f]);
6793
+ ajv.addFormat(f, fs3[f]);
6794
6794
  }
6795
6795
  module.exports = exports = formatsPlugin;
6796
6796
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -6798,6 +6798,9 @@ var require_dist = __commonJS({
6798
6798
  }
6799
6799
  });
6800
6800
 
6801
+ // src/index.ts
6802
+ import * as fs2 from "fs";
6803
+
6801
6804
  // src/logger.ts
6802
6805
  function log(level, msg) {
6803
6806
  process.stderr.write(`[nuwax-mcp-proxy] ${level}: ${msg}
@@ -23764,7 +23767,7 @@ var StdioServerTransport = class {
23764
23767
 
23765
23768
  // src/constants.ts
23766
23769
  var PKG_NAME = "nuwax-mcp-stdio-proxy";
23767
- var PKG_VERSION = "1.4.4";
23770
+ var PKG_VERSION = "1.4.5";
23768
23771
 
23769
23772
  // src/shared.ts
23770
23773
  async function discoverTools(client) {
@@ -25782,6 +25785,7 @@ function parseCliArgs() {
25782
25785
  }
25783
25786
  function parseStdioArgs(args) {
25784
25787
  let configJson;
25788
+ let configFile;
25785
25789
  let allowTools;
25786
25790
  let denyTools;
25787
25791
  for (let i = 0; i < args.length; i++) {
@@ -25789,6 +25793,9 @@ function parseStdioArgs(args) {
25789
25793
  if (arg === "--config" && i + 1 < args.length) {
25790
25794
  i++;
25791
25795
  configJson = args[i];
25796
+ } else if (arg === "--config-file" && i + 1 < args.length) {
25797
+ i++;
25798
+ configFile = args[i];
25792
25799
  } else if (arg === "--allow-tools" && i + 1 < args.length) {
25793
25800
  i++;
25794
25801
  allowTools = args[i].split(",").map((s) => s.trim()).filter(Boolean);
@@ -25797,16 +25804,21 @@ function parseStdioArgs(args) {
25797
25804
  denyTools = args[i].split(",").map((s) => s.trim()).filter(Boolean);
25798
25805
  }
25799
25806
  }
25800
- if (!configJson) {
25801
- logError("Missing --config argument");
25807
+ if (!configJson && !configFile) {
25808
+ logError("Missing --config or --config-file argument");
25802
25809
  logError(`Usage: nuwax-mcp-stdio-proxy --config '{"mcpServers":{...}}'`);
25810
+ logError(" or: nuwax-mcp-stdio-proxy --config-file /path/to/config.json");
25811
+ process.exit(1);
25812
+ }
25813
+ if (configJson && configFile) {
25814
+ logError("Cannot use both --config and --config-file");
25803
25815
  process.exit(1);
25804
25816
  }
25805
25817
  if (allowTools && denyTools) {
25806
25818
  logError("Cannot use both --allow-tools and --deny-tools");
25807
25819
  process.exit(1);
25808
25820
  }
25809
- const config2 = parseConfigJson(configJson);
25821
+ const config2 = configFile ? parseConfigFile(configFile) : parseConfigJson(configJson);
25810
25822
  return { mode: "stdio", config: config2, allowTools, denyTools };
25811
25823
  }
25812
25824
  function parseConvertArgs(args) {
@@ -25860,6 +25872,7 @@ function parseConvertArgs(args) {
25860
25872
  function parseProxyArgs(args) {
25861
25873
  let port;
25862
25874
  let config2;
25875
+ let configFile;
25863
25876
  for (let i = 0; i < args.length; i++) {
25864
25877
  const arg = args[i];
25865
25878
  if (arg === "--port" && i + 1 < args.length) {
@@ -25873,6 +25886,9 @@ function parseProxyArgs(args) {
25873
25886
  } else if (arg === "--config" && i + 1 < args.length) {
25874
25887
  i++;
25875
25888
  config2 = parseConfigJson(args[i]);
25889
+ } else if (arg === "--config-file" && i + 1 < args.length) {
25890
+ i++;
25891
+ configFile = args[i];
25876
25892
  } else {
25877
25893
  logError(`Unknown argument: "${arg}"`);
25878
25894
  printProxyUsage();
@@ -25884,8 +25900,11 @@ function parseProxyArgs(args) {
25884
25900
  printProxyUsage();
25885
25901
  process.exit(1);
25886
25902
  }
25903
+ if (configFile) {
25904
+ config2 = parseConfigFile(configFile);
25905
+ }
25887
25906
  if (!config2) {
25888
- logError("--config is required for proxy mode");
25907
+ logError("--config or --config-file is required for proxy mode");
25889
25908
  printProxyUsage();
25890
25909
  process.exit(1);
25891
25910
  }
@@ -25903,13 +25922,29 @@ function parseConfigJson(json2) {
25903
25922
  process.exit(1);
25904
25923
  }
25905
25924
  }
25925
+ function parseConfigFile(filePath) {
25926
+ try {
25927
+ const content = fs2.readFileSync(filePath, "utf-8");
25928
+ const config2 = JSON.parse(content);
25929
+ if (!config2.mcpServers || typeof config2.mcpServers !== "object") {
25930
+ throw new Error('config must contain a "mcpServers" object');
25931
+ }
25932
+ return config2;
25933
+ } catch (e) {
25934
+ logError(`Failed to read or parse config file "${filePath}": ${e}`);
25935
+ process.exit(1);
25936
+ }
25937
+ }
25906
25938
  function printUsage() {
25907
25939
  logError("Usage:");
25908
25940
  logError(` nuwax-mcp-stdio-proxy --config '{"mcpServers":{...}}' [OPTIONS] (stdio aggregation)`);
25941
+ logError(" nuwax-mcp-stdio-proxy --config-file <FILE> [OPTIONS] (stdio aggregation from file)");
25909
25942
  logError(" nuwax-mcp-stdio-proxy convert [URL] [OPTIONS] (remote \u2192 stdio)");
25910
25943
  logError(" nuwax-mcp-stdio-proxy proxy --port <PORT> --config '...' (HTTP server)");
25911
25944
  logError("");
25912
25945
  logError("Options (stdio / convert):");
25946
+ logError(" --config <JSON> MCP config JSON string");
25947
+ logError(" --config-file <FILE> MCP config JSON file path");
25913
25948
  logError(" --allow-tools <TOOLS> Tool whitelist (comma-separated)");
25914
25949
  logError(" --deny-tools <TOOLS> Tool blacklist (comma-separated)");
25915
25950
  }
@@ -25928,6 +25963,7 @@ function printConvertUsage() {
25928
25963
  }
25929
25964
  function printProxyUsage() {
25930
25965
  logError(`Usage: nuwax-mcp-stdio-proxy proxy --port <PORT> --config '{"mcpServers":{...}}'`);
25966
+ logError(" or: nuwax-mcp-stdio-proxy proxy --port <PORT> --config-file <FILE>");
25931
25967
  }
25932
25968
  async function main() {
25933
25969
  const args = parseCliArgs();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuwax-mcp-stdio-proxy",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "description": "TypeScript MCP proxy — aggregates multiple MCP servers (stdio + streamable-http + SSE) with convert & proxy modes",
5
5
  "type": "module",
6
6
  "bin": {