@agimon-ai/mcp-proxy 0.4.5 → 0.5.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.
package/dist/cli.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const require_src = require('./src-h-U3G1P0.cjs');
2
+ const require_src = require('./src-B2m53VQ1.cjs');
3
3
  let node_crypto = require("node:crypto");
4
4
  let node_fs_promises = require("node:fs/promises");
5
5
  let node_path = require("node:path");
@@ -8,8 +8,8 @@ let node_fs = require("node:fs");
8
8
  let liquidjs = require("liquidjs");
9
9
  let node_child_process = require("node:child_process");
10
10
  let commander = require("commander");
11
- let __agimon_ai_foundation_process_registry = require("@agimon-ai/foundation-process-registry");
12
11
  let __agimon_ai_foundation_port_registry = require("@agimon-ai/foundation-port-registry");
12
+ let __agimon_ai_foundation_process_registry = require("@agimon-ai/foundation-process-registry");
13
13
  let node_url = require("node:url");
14
14
 
15
15
  //#region src/utils/output.ts
@@ -383,6 +383,22 @@ function createTransportConfig(options, mode) {
383
383
  host: options.host || process.env.MCP_HOST || DEFAULT_HOST
384
384
  };
385
385
  }
386
+ function createStdioSafeLogger() {
387
+ const logToStderr = (message, data) => {
388
+ if (data === void 0) {
389
+ console.error(message);
390
+ return;
391
+ }
392
+ console.error(message, data);
393
+ };
394
+ return {
395
+ trace: logToStderr,
396
+ debug: logToStderr,
397
+ info: logToStderr,
398
+ warn: logToStderr,
399
+ error: logToStderr
400
+ };
401
+ }
386
402
  function createServerOptions(options, resolvedConfigPath, serverId) {
387
403
  return {
388
404
  configFilePath: resolvedConfigPath,
@@ -649,7 +665,7 @@ async function createAndStartHttpRuntime(serverOptions, config, resolvedConfigPa
649
665
  }
650
666
  async function startStdioTransport(serverOptions) {
651
667
  try {
652
- await startServer(new require_src.StdioTransportHandler(await require_src.createServer(serverOptions)));
668
+ await startServer(new require_src.StdioTransportHandler(await require_src.createServer(serverOptions), createStdioSafeLogger()));
653
669
  } catch (error) {
654
670
  throw new Error(`Failed to start stdio transport: ${toErrorMessage$9(error)}`);
655
671
  }
@@ -683,7 +699,7 @@ async function resolveStdioHttpEndpoint(config, options, resolvedConfigPath) {
683
699
  }
684
700
  async function startStdioHttpTransport(config, options, resolvedConfigPath) {
685
701
  try {
686
- await startServer(new require_src.StdioHttpTransportHandler({ endpoint: await resolveStdioHttpEndpoint(config, options, resolvedConfigPath) }));
702
+ await startServer(new require_src.StdioHttpTransportHandler({ endpoint: await resolveStdioHttpEndpoint(config, options, resolvedConfigPath) }, createStdioSafeLogger()));
687
703
  } catch (error) {
688
704
  throw new Error(`Failed to start stdio-http transport: ${toErrorMessage$9(error)}`);
689
705
  }
@@ -710,7 +726,7 @@ async function startTransport(transportType, options, resolvedConfigPath, server
710
726
  /**
711
727
  * MCP Serve command
712
728
  */
713
- const mcpServeCommand = new commander.Command("mcp-serve").description("Start MCP server with specified transport").option("-t, --type <type>", `Transport type: ${TRANSPORT_TYPE_STDIO}, ${TRANSPORT_TYPE_HTTP}, ${TRANSPORT_TYPE_SSE}, or ${TRANSPORT_TYPE_STDIO_HTTP}`, TRANSPORT_TYPE_STDIO).option("-p, --port <port>", "Port to listen on (http/sse) or backend port for stdio-http", (val) => parseInt(val, 10)).option("--host <host>", "Host to bind to (http/sse) or backend host for stdio-http", DEFAULT_HOST).option("-c, --config <path>", "Path to MCP server configuration file").option("--no-cache", "Disable configuration caching, always reload from config file").option("--definitions-cache <path>", "Path to prefetched tool/prompt/skill definitions cache file").option("--clear-definitions-cache", "Delete definitions cache before startup", false).option("--proxy-mode <mode>", "How mcp-proxy exposes downstream tools: meta, flat, or search", "meta").option("--id <id>", "Unique server identifier (overrides config file id, auto-generated if not provided)").action(async (options) => {
729
+ const mcpServeCommand = new commander.Command("mcp-serve").description("Start MCP server with specified transport").option("-t, --type <type>", `Transport type: ${TRANSPORT_TYPE_STDIO}, ${TRANSPORT_TYPE_HTTP}, ${TRANSPORT_TYPE_SSE}, or ${TRANSPORT_TYPE_STDIO_HTTP}`, TRANSPORT_TYPE_STDIO).option("-p, --port <port>", "Port to listen on (http/sse) or backend port for stdio-http", (val) => Number.parseInt(val, 10)).option("--host <host>", "Host to bind to (http/sse) or backend host for stdio-http", DEFAULT_HOST).option("-c, --config <path>", "Path to MCP server configuration file").option("--no-cache", "Disable configuration caching, always reload from config file").option("--definitions-cache <path>", "Path to prefetched tool/prompt/skill definitions cache file").option("--clear-definitions-cache", "Delete definitions cache before startup", false).option("--proxy-mode <mode>", "How mcp-proxy exposes downstream tools: meta, flat, or search", "meta").option("--id <id>", "Unique server identifier (overrides config file id, auto-generated if not provided)").action(async (options) => {
714
730
  try {
715
731
  const transportType = validateTransportType(options.type.toLowerCase());
716
732
  validateProxyMode(options.proxyMode);
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { D as findConfigFile, E as generateServerId, T as DefinitionsCacheService, d as version, f as StdioHttpTransportHandler, h as HttpTransportHandler, m as SseTransportHandler, n as createServer, o as createProxyIoCContainer, p as StdioTransportHandler, r as createSessionServer, t as TRANSPORT_MODE, u as initializeSharedServices, v as RuntimeStateService } from "./src-BgRM8oW0.mjs";
2
+ import { D as findConfigFile, E as generateServerId, T as DefinitionsCacheService, d as version, f as StdioHttpTransportHandler, h as HttpTransportHandler, m as SseTransportHandler, n as createServer, o as createProxyIoCContainer, p as StdioTransportHandler, r as createSessionServer, t as TRANSPORT_MODE, u as initializeSharedServices, v as RuntimeStateService } from "./src-DCIv5S_2.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { access, writeFile } from "node:fs/promises";
5
5
  import path, { join, resolve } from "node:path";
@@ -7,8 +7,8 @@ import { constants, existsSync } from "node:fs";
7
7
  import { Liquid } from "liquidjs";
8
8
  import { spawn } from "node:child_process";
9
9
  import { Command } from "commander";
10
- import { ProcessRegistryService } from "@agimon-ai/foundation-process-registry";
11
10
  import { DEFAULT_PORT_RANGE, PortRegistryService } from "@agimon-ai/foundation-port-registry";
11
+ import { ProcessRegistryService } from "@agimon-ai/foundation-process-registry";
12
12
  import { fileURLToPath } from "node:url";
13
13
 
14
14
  //#region src/utils/output.ts
@@ -382,6 +382,22 @@ function createTransportConfig(options, mode) {
382
382
  host: options.host || process.env.MCP_HOST || DEFAULT_HOST
383
383
  };
384
384
  }
385
+ function createStdioSafeLogger() {
386
+ const logToStderr = (message, data) => {
387
+ if (data === void 0) {
388
+ console.error(message);
389
+ return;
390
+ }
391
+ console.error(message, data);
392
+ };
393
+ return {
394
+ trace: logToStderr,
395
+ debug: logToStderr,
396
+ info: logToStderr,
397
+ warn: logToStderr,
398
+ error: logToStderr
399
+ };
400
+ }
385
401
  function createServerOptions(options, resolvedConfigPath, serverId) {
386
402
  return {
387
403
  configFilePath: resolvedConfigPath,
@@ -648,7 +664,7 @@ async function createAndStartHttpRuntime(serverOptions, config, resolvedConfigPa
648
664
  }
649
665
  async function startStdioTransport(serverOptions) {
650
666
  try {
651
- await startServer(new StdioTransportHandler(await createServer(serverOptions)));
667
+ await startServer(new StdioTransportHandler(await createServer(serverOptions), createStdioSafeLogger()));
652
668
  } catch (error) {
653
669
  throw new Error(`Failed to start stdio transport: ${toErrorMessage$9(error)}`);
654
670
  }
@@ -682,7 +698,7 @@ async function resolveStdioHttpEndpoint(config, options, resolvedConfigPath) {
682
698
  }
683
699
  async function startStdioHttpTransport(config, options, resolvedConfigPath) {
684
700
  try {
685
- await startServer(new StdioHttpTransportHandler({ endpoint: await resolveStdioHttpEndpoint(config, options, resolvedConfigPath) }));
701
+ await startServer(new StdioHttpTransportHandler({ endpoint: await resolveStdioHttpEndpoint(config, options, resolvedConfigPath) }, createStdioSafeLogger()));
686
702
  } catch (error) {
687
703
  throw new Error(`Failed to start stdio-http transport: ${toErrorMessage$9(error)}`);
688
704
  }
@@ -709,7 +725,7 @@ async function startTransport(transportType, options, resolvedConfigPath, server
709
725
  /**
710
726
  * MCP Serve command
711
727
  */
712
- const mcpServeCommand = new Command("mcp-serve").description("Start MCP server with specified transport").option("-t, --type <type>", `Transport type: ${TRANSPORT_TYPE_STDIO}, ${TRANSPORT_TYPE_HTTP}, ${TRANSPORT_TYPE_SSE}, or ${TRANSPORT_TYPE_STDIO_HTTP}`, TRANSPORT_TYPE_STDIO).option("-p, --port <port>", "Port to listen on (http/sse) or backend port for stdio-http", (val) => parseInt(val, 10)).option("--host <host>", "Host to bind to (http/sse) or backend host for stdio-http", DEFAULT_HOST).option("-c, --config <path>", "Path to MCP server configuration file").option("--no-cache", "Disable configuration caching, always reload from config file").option("--definitions-cache <path>", "Path to prefetched tool/prompt/skill definitions cache file").option("--clear-definitions-cache", "Delete definitions cache before startup", false).option("--proxy-mode <mode>", "How mcp-proxy exposes downstream tools: meta, flat, or search", "meta").option("--id <id>", "Unique server identifier (overrides config file id, auto-generated if not provided)").action(async (options) => {
728
+ const mcpServeCommand = new Command("mcp-serve").description("Start MCP server with specified transport").option("-t, --type <type>", `Transport type: ${TRANSPORT_TYPE_STDIO}, ${TRANSPORT_TYPE_HTTP}, ${TRANSPORT_TYPE_SSE}, or ${TRANSPORT_TYPE_STDIO_HTTP}`, TRANSPORT_TYPE_STDIO).option("-p, --port <port>", "Port to listen on (http/sse) or backend port for stdio-http", (val) => Number.parseInt(val, 10)).option("--host <host>", "Host to bind to (http/sse) or backend host for stdio-http", DEFAULT_HOST).option("-c, --config <path>", "Path to MCP server configuration file").option("--no-cache", "Disable configuration caching, always reload from config file").option("--definitions-cache <path>", "Path to prefetched tool/prompt/skill definitions cache file").option("--clear-definitions-cache", "Delete definitions cache before startup", false).option("--proxy-mode <mode>", "How mcp-proxy exposes downstream tools: meta, flat, or search", "meta").option("--id <id>", "Unique server identifier (overrides config file id, auto-generated if not provided)").action(async (options) => {
713
729
  try {
714
730
  const transportType = validateTransportType(options.type.toLowerCase());
715
731
  validateProxyMode(options.proxyMode);
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_src = require('./src-h-U3G1P0.cjs');
1
+ const require_src = require('./src-B2m53VQ1.cjs');
2
2
 
3
3
  exports.ConfigFetcherService = require_src.ConfigFetcherService;
4
4
  exports.DefinitionsCacheService = require_src.DefinitionsCacheService;
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { C as SearchListToolsTool, D as findConfigFile, E as generateServerId, S as UseToolTool, T as DefinitionsCacheService, _ as StopServerService, a as createProxyContainer, b as createProxyLogger, c as createStdioHttpTransportHandler, f as StdioHttpTransportHandler, g as SkillService, h as HttpTransportHandler, i as createHttpTransportHandler, l as createStdioTransportHandler, m as SseTransportHandler, n as createServer, p as StdioTransportHandler, r as createSessionServer, s as createSseTransportHandler, t as TRANSPORT_MODE, u as initializeSharedServices, v as RuntimeStateService, w as DescribeToolsTool, x as ConfigFetcherService, y as McpClientManagerService } from "./src-BgRM8oW0.mjs";
1
+ import { C as SearchListToolsTool, D as findConfigFile, E as generateServerId, S as UseToolTool, T as DefinitionsCacheService, _ as StopServerService, a as createProxyContainer, b as createProxyLogger, c as createStdioHttpTransportHandler, f as StdioHttpTransportHandler, g as SkillService, h as HttpTransportHandler, i as createHttpTransportHandler, l as createStdioTransportHandler, m as SseTransportHandler, n as createServer, p as StdioTransportHandler, r as createSessionServer, s as createSseTransportHandler, t as TRANSPORT_MODE, u as initializeSharedServices, v as RuntimeStateService, w as DescribeToolsTool, x as ConfigFetcherService, y as McpClientManagerService } from "./src-DCIv5S_2.mjs";
2
2
 
3
3
  export { ConfigFetcherService, DefinitionsCacheService, DescribeToolsTool, HttpTransportHandler, McpClientManagerService, RuntimeStateService, SearchListToolsTool, SkillService, SseTransportHandler, StdioHttpTransportHandler, StdioTransportHandler, StopServerService, TRANSPORT_MODE, UseToolTool, createHttpTransportHandler, createProxyContainer, createProxyLogger, createServer, createSessionServer, createSseTransportHandler, createStdioHttpTransportHandler, createStdioTransportHandler, findConfigFile, generateServerId, initializeSharedServices };
@@ -4342,7 +4342,7 @@ var StdioHttpTransportHandler = class {
4342
4342
 
4343
4343
  //#endregion
4344
4344
  //#region package.json
4345
- var version = "0.4.4";
4345
+ var version = "0.5.0";
4346
4346
 
4347
4347
  //#endregion
4348
4348
  //#region src/container/index.ts
@@ -4313,7 +4313,7 @@ var StdioHttpTransportHandler = class {
4313
4313
 
4314
4314
  //#endregion
4315
4315
  //#region package.json
4316
- var version = "0.4.4";
4316
+ var version = "0.5.0";
4317
4317
 
4318
4318
  //#endregion
4319
4319
  //#region src/container/index.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agimon-ai/mcp-proxy",
3
3
  "description": "MCP proxy server package",
4
- "version": "0.4.5",
4
+ "version": "0.5.0",
5
5
  "license": "AGPL-3.0",
6
6
  "keywords": [
7
7
  "mcp",