@agimon-ai/mcp-proxy 0.10.1 → 0.10.3

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-CRhtaDaz.cjs");
2
+ const require_src = require("./src-Dyzi_Dyb.cjs");
3
3
  let node_fs = require("node:fs");
4
4
  let node_fs_promises = require("node:fs/promises");
5
5
  let js_yaml = require("js-yaml");
@@ -13,12 +13,12 @@ let liquidjs = require("liquidjs");
13
13
  let commander = require("commander");
14
14
  let node_url = require("node:url");
15
15
  let _agimon_ai_foundation_port_registry = require("@agimon-ai/foundation-port-registry");
16
- //#region src/commands/prestart-http.ts
16
+ //#region src/commands/http-runtime.ts
17
17
  /**
18
- * Prestart HTTP Command
18
+ * HTTP Runtime Helper
19
19
  *
20
20
  * Starts an mcp-proxy HTTP runtime in the background, waits until it is healthy,
21
- * and then exits so the runtime can be reused by other commands.
21
+ * and returns the runtime details for callers that need to reuse it.
22
22
  */
23
23
  const WORKSPACE_MARKERS = [
24
24
  "pnpm-workspace.yaml",
@@ -26,7 +26,7 @@ const WORKSPACE_MARKERS = [
26
26
  ".git"
27
27
  ];
28
28
  const DEFAULT_HOST$1 = "localhost";
29
- const DEFAULT_TIMEOUT_MS = 12e4;
29
+ const DEFAULT_HTTP_RUNTIME_TIMEOUT_MS = 12e4;
30
30
  const POLL_INTERVAL_MS = 250;
31
31
  function resolveWorkspaceRoot(startPath = process.env.PROJECT_PATH || process.cwd()) {
32
32
  let current = node_path.default.resolve(startPath);
@@ -82,7 +82,7 @@ function buildCliCandidates() {
82
82
  throw new Error("Unable to locate mcp-proxy CLI entrypoint");
83
83
  }
84
84
  function parseTimeoutMs(value) {
85
- if (!value) return DEFAULT_TIMEOUT_MS;
85
+ if (!value) return DEFAULT_HTTP_RUNTIME_TIMEOUT_MS;
86
86
  const parsed = Number.parseInt(value, 10);
87
87
  if (!Number.isInteger(parsed) || parsed <= 0) throw new Error(`Invalid timeout value: ${value}`);
88
88
  return parsed;
@@ -208,17 +208,12 @@ async function prestartHttpRuntime(options) {
208
208
  throw new Error(`Failed to prestart HTTP runtime '${serverId}': ${error instanceof Error ? error.message : String(error)}`, { cause: error });
209
209
  }
210
210
  }
211
- const prestartHttpCommand = new commander.Command("prestart-http").description("Start an mcp-proxy HTTP runtime in the background and wait until it is healthy").option("--id <id>", "Server identifier to assign to the runtime").option("--host <host>", "Host to bind to", DEFAULT_HOST$1).option("-p, --port <port>", "Preferred HTTP port for the runtime", (value) => Number.parseInt(value, 10)).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("--registry-path <path>", "Custom registry path or directory for service discovery").option("--registry-dir <path>", "Custom registry directory for service discovery").option("--timeout-ms <ms>", "How long to wait for the runtime to become healthy", String(DEFAULT_TIMEOUT_MS)).action(async (options) => {
212
- try {
213
- const { host, port, serverId, workspaceRoot } = await prestartHttpRuntime(options);
214
- process.stdout.write(`mcp-proxy HTTP runtime ready at http://${host}:${port} (${serverId})\n`);
215
- process.stdout.write(`runtimeId=${serverId}\n`);
216
- process.stdout.write(`runtimeUrl=http://${host}:${port}\n`);
217
- process.stdout.write(`workspaceRoot=${workspaceRoot}\n`);
218
- } catch (error) {
219
- throw new Error(`Failed to prestart HTTP runtime '${options.id || "generated-server-id"}': ${error instanceof Error ? error.message : String(error)}`, { cause: error });
220
- }
221
- });
211
+ function writePrestartHttpResult(result) {
212
+ process.stdout.write(`mcp-proxy HTTP runtime ready at http://${result.host}:${result.port} (${result.serverId})\n`);
213
+ process.stdout.write(`runtimeId=${result.serverId}\n`);
214
+ process.stdout.write(`runtimeUrl=http://${result.host}:${result.port}\n`);
215
+ process.stdout.write(`workspaceRoot=${result.workspaceRoot}\n`);
216
+ }
222
217
  //#endregion
223
218
  //#region src/commands/bootstrap.ts
224
219
  function toErrorMessage$9(error) {
@@ -1229,6 +1224,10 @@ async function resolveStdioHttpEndpoint(config, options, resolvedConfigPath) {
1229
1224
  ownedRuntimeServerId: runtime.reusedExistingRuntime ? void 0 : runtime.serverId
1230
1225
  };
1231
1226
  }
1227
+ async function rediscoverStdioHttpEndpoint(config, options, resolvedConfigPath) {
1228
+ const { endpoint } = await resolveStdioHttpEndpoint(config, options, resolvedConfigPath);
1229
+ return endpoint;
1230
+ }
1232
1231
  async function startStdioHttpTransport(config, options, resolvedConfigPath, proxyDefaults) {
1233
1232
  let ownedRuntimeServerId;
1234
1233
  const keepAlive = proxyDefaults?.keepAlive ?? false;
@@ -1236,7 +1235,10 @@ async function startStdioHttpTransport(config, options, resolvedConfigPath, prox
1236
1235
  const resolvedEndpoint = await resolveStdioHttpEndpoint(config, options, resolvedConfigPath);
1237
1236
  ownedRuntimeServerId = resolvedEndpoint.ownedRuntimeServerId;
1238
1237
  const { endpoint } = resolvedEndpoint;
1239
- await startServer(new require_src.StdioHttpTransportHandler({ endpoint }, createStdioSafeLogger()), async () => {
1238
+ await startServer(new require_src.StdioHttpTransportHandler({
1239
+ endpoint,
1240
+ resolveEndpoint: async () => await rediscoverStdioHttpEndpoint(config, options, resolvedConfigPath)
1241
+ }, createStdioSafeLogger()), async () => {
1240
1242
  if (keepAlive || !ownedRuntimeServerId) return;
1241
1243
  await new require_src.StopServerService().stop({
1242
1244
  serverId: ownedRuntimeServerId,
@@ -1277,11 +1279,33 @@ async function startTransport(transportType, options, resolvedConfigPath, server
1277
1279
  throw new Error(`Failed to start transport '${transportType}': ${toErrorMessage$3(error)}`);
1278
1280
  }
1279
1281
  }
1282
+ async function prestartHttpRuntimeCommand(options, resolvedConfigPath) {
1283
+ try {
1284
+ writePrestartHttpResult(await prestartHttpRuntime({
1285
+ id: options.id,
1286
+ host: options.host ?? DEFAULT_HOST,
1287
+ port: options.port,
1288
+ config: options.config || resolvedConfigPath,
1289
+ cache: options.cache,
1290
+ definitionsCache: options.definitionsCache,
1291
+ clearDefinitionsCache: options.clearDefinitionsCache,
1292
+ proxyMode: options.proxyMode,
1293
+ timeoutMs: options.timeoutMs
1294
+ }));
1295
+ } catch (error) {
1296
+ console.error(`Failed to prestart HTTP runtime '${options.id || "generated-server-id"}': ${toErrorMessage$3(error)}`);
1297
+ process.exit(1);
1298
+ }
1299
+ }
1280
1300
  /**
1281
1301
  * MCP Serve command
1282
1302
  */
1283
- 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}`).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").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) => {
1303
+ const mcpServeCommand = new commander.Command("mcp-serve").description("Start MCP server with specified transport or prestart the HTTP runtime in the background").option("-t, --type <type>", `Transport type: ${TRANSPORT_TYPE_STDIO}, ${TRANSPORT_TYPE_HTTP}, ${TRANSPORT_TYPE_SSE}, or ${TRANSPORT_TYPE_STDIO_HTTP}`).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").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)").option("--prestart-http", "Prestart the HTTP runtime in the background and exit after it becomes healthy", false).option("--timeout-ms <ms>", "How long to wait for the HTTP runtime to become healthy", String(DEFAULT_HTTP_RUNTIME_TIMEOUT_MS)).action(async (options) => {
1284
1304
  try {
1305
+ if (options.prestartHttp) {
1306
+ await prestartHttpRuntimeCommand(options, options.config || await findConfigFileAsync() || void 0);
1307
+ return;
1308
+ }
1285
1309
  const resolvedConfigPath = options.config || await findConfigFileAsync() || void 0;
1286
1310
  const proxyDefaults = resolvedConfigPath ? loadProxyDefaults(resolvedConfigPath) : {};
1287
1311
  const transportType = validateTransportType((options.type ?? proxyDefaults.type ?? TRANSPORT_TYPE_STDIO).toLowerCase());
@@ -1708,7 +1732,6 @@ async function main() {
1708
1732
  program.name("mcp-proxy").description("MCP proxy server package").version(require_src.version);
1709
1733
  program.addCommand(initCommand);
1710
1734
  program.addCommand(mcpServeCommand);
1711
- program.addCommand(prestartHttpCommand);
1712
1735
  program.addCommand(searchToolsCommand);
1713
1736
  program.addCommand(describeToolsCommand);
1714
1737
  program.addCommand(useToolCommand);
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { C as DefinitionsCacheService, D as version, T as findConfigFile, b as RuntimeStateService, d as StdioHttpTransportHandler, f as StdioTransportHandler, m as HttpTransportHandler, n as createServer, o as createProxyIoCContainer, p as SseTransportHandler, r as createSessionServer, t as TRANSPORT_MODE, u as initializeSharedServices, v as StopServerService, w as generateServerId } from "./src-C48MCBti.mjs";
2
+ import { C as DefinitionsCacheService, D as version, T as findConfigFile, b as RuntimeStateService, d as StdioHttpTransportHandler, f as StdioTransportHandler, m as HttpTransportHandler, n as createServer, o as createProxyIoCContainer, p as SseTransportHandler, r as createSessionServer, t as TRANSPORT_MODE, u as initializeSharedServices, v as StopServerService, w as generateServerId } from "./src-BWTZjdu-.mjs";
3
3
  import { constants, existsSync, readFileSync } from "node:fs";
4
4
  import { access, writeFile } from "node:fs/promises";
5
5
  import yaml from "js-yaml";
@@ -11,12 +11,12 @@ import { Liquid } from "liquidjs";
11
11
  import { Command } from "commander";
12
12
  import { fileURLToPath } from "node:url";
13
13
  import { DEFAULT_PORT_RANGE, PortRegistryService } from "@agimon-ai/foundation-port-registry";
14
- //#region src/commands/prestart-http.ts
14
+ //#region src/commands/http-runtime.ts
15
15
  /**
16
- * Prestart HTTP Command
16
+ * HTTP Runtime Helper
17
17
  *
18
18
  * Starts an mcp-proxy HTTP runtime in the background, waits until it is healthy,
19
- * and then exits so the runtime can be reused by other commands.
19
+ * and returns the runtime details for callers that need to reuse it.
20
20
  */
21
21
  const WORKSPACE_MARKERS = [
22
22
  "pnpm-workspace.yaml",
@@ -24,7 +24,7 @@ const WORKSPACE_MARKERS = [
24
24
  ".git"
25
25
  ];
26
26
  const DEFAULT_HOST$1 = "localhost";
27
- const DEFAULT_TIMEOUT_MS = 12e4;
27
+ const DEFAULT_HTTP_RUNTIME_TIMEOUT_MS = 12e4;
28
28
  const POLL_INTERVAL_MS = 250;
29
29
  function resolveWorkspaceRoot(startPath = process.env.PROJECT_PATH || process.cwd()) {
30
30
  let current = path.resolve(startPath);
@@ -80,7 +80,7 @@ function buildCliCandidates() {
80
80
  throw new Error("Unable to locate mcp-proxy CLI entrypoint");
81
81
  }
82
82
  function parseTimeoutMs(value) {
83
- if (!value) return DEFAULT_TIMEOUT_MS;
83
+ if (!value) return DEFAULT_HTTP_RUNTIME_TIMEOUT_MS;
84
84
  const parsed = Number.parseInt(value, 10);
85
85
  if (!Number.isInteger(parsed) || parsed <= 0) throw new Error(`Invalid timeout value: ${value}`);
86
86
  return parsed;
@@ -206,17 +206,12 @@ async function prestartHttpRuntime(options) {
206
206
  throw new Error(`Failed to prestart HTTP runtime '${serverId}': ${error instanceof Error ? error.message : String(error)}`, { cause: error });
207
207
  }
208
208
  }
209
- const prestartHttpCommand = new Command("prestart-http").description("Start an mcp-proxy HTTP runtime in the background and wait until it is healthy").option("--id <id>", "Server identifier to assign to the runtime").option("--host <host>", "Host to bind to", DEFAULT_HOST$1).option("-p, --port <port>", "Preferred HTTP port for the runtime", (value) => Number.parseInt(value, 10)).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("--registry-path <path>", "Custom registry path or directory for service discovery").option("--registry-dir <path>", "Custom registry directory for service discovery").option("--timeout-ms <ms>", "How long to wait for the runtime to become healthy", String(DEFAULT_TIMEOUT_MS)).action(async (options) => {
210
- try {
211
- const { host, port, serverId, workspaceRoot } = await prestartHttpRuntime(options);
212
- process.stdout.write(`mcp-proxy HTTP runtime ready at http://${host}:${port} (${serverId})\n`);
213
- process.stdout.write(`runtimeId=${serverId}\n`);
214
- process.stdout.write(`runtimeUrl=http://${host}:${port}\n`);
215
- process.stdout.write(`workspaceRoot=${workspaceRoot}\n`);
216
- } catch (error) {
217
- throw new Error(`Failed to prestart HTTP runtime '${options.id || "generated-server-id"}': ${error instanceof Error ? error.message : String(error)}`, { cause: error });
218
- }
219
- });
209
+ function writePrestartHttpResult(result) {
210
+ process.stdout.write(`mcp-proxy HTTP runtime ready at http://${result.host}:${result.port} (${result.serverId})\n`);
211
+ process.stdout.write(`runtimeId=${result.serverId}\n`);
212
+ process.stdout.write(`runtimeUrl=http://${result.host}:${result.port}\n`);
213
+ process.stdout.write(`workspaceRoot=${result.workspaceRoot}\n`);
214
+ }
220
215
  //#endregion
221
216
  //#region src/commands/bootstrap.ts
222
217
  function toErrorMessage$9(error) {
@@ -1227,6 +1222,10 @@ async function resolveStdioHttpEndpoint(config, options, resolvedConfigPath) {
1227
1222
  ownedRuntimeServerId: runtime.reusedExistingRuntime ? void 0 : runtime.serverId
1228
1223
  };
1229
1224
  }
1225
+ async function rediscoverStdioHttpEndpoint(config, options, resolvedConfigPath) {
1226
+ const { endpoint } = await resolveStdioHttpEndpoint(config, options, resolvedConfigPath);
1227
+ return endpoint;
1228
+ }
1230
1229
  async function startStdioHttpTransport(config, options, resolvedConfigPath, proxyDefaults) {
1231
1230
  let ownedRuntimeServerId;
1232
1231
  const keepAlive = proxyDefaults?.keepAlive ?? false;
@@ -1234,7 +1233,10 @@ async function startStdioHttpTransport(config, options, resolvedConfigPath, prox
1234
1233
  const resolvedEndpoint = await resolveStdioHttpEndpoint(config, options, resolvedConfigPath);
1235
1234
  ownedRuntimeServerId = resolvedEndpoint.ownedRuntimeServerId;
1236
1235
  const { endpoint } = resolvedEndpoint;
1237
- await startServer(new StdioHttpTransportHandler({ endpoint }, createStdioSafeLogger()), async () => {
1236
+ await startServer(new StdioHttpTransportHandler({
1237
+ endpoint,
1238
+ resolveEndpoint: async () => await rediscoverStdioHttpEndpoint(config, options, resolvedConfigPath)
1239
+ }, createStdioSafeLogger()), async () => {
1238
1240
  if (keepAlive || !ownedRuntimeServerId) return;
1239
1241
  await new StopServerService().stop({
1240
1242
  serverId: ownedRuntimeServerId,
@@ -1275,11 +1277,33 @@ async function startTransport(transportType, options, resolvedConfigPath, server
1275
1277
  throw new Error(`Failed to start transport '${transportType}': ${toErrorMessage$3(error)}`);
1276
1278
  }
1277
1279
  }
1280
+ async function prestartHttpRuntimeCommand(options, resolvedConfigPath) {
1281
+ try {
1282
+ writePrestartHttpResult(await prestartHttpRuntime({
1283
+ id: options.id,
1284
+ host: options.host ?? DEFAULT_HOST,
1285
+ port: options.port,
1286
+ config: options.config || resolvedConfigPath,
1287
+ cache: options.cache,
1288
+ definitionsCache: options.definitionsCache,
1289
+ clearDefinitionsCache: options.clearDefinitionsCache,
1290
+ proxyMode: options.proxyMode,
1291
+ timeoutMs: options.timeoutMs
1292
+ }));
1293
+ } catch (error) {
1294
+ console.error(`Failed to prestart HTTP runtime '${options.id || "generated-server-id"}': ${toErrorMessage$3(error)}`);
1295
+ process.exit(1);
1296
+ }
1297
+ }
1278
1298
  /**
1279
1299
  * MCP Serve command
1280
1300
  */
1281
- 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}`).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").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) => {
1301
+ const mcpServeCommand = new Command("mcp-serve").description("Start MCP server with specified transport or prestart the HTTP runtime in the background").option("-t, --type <type>", `Transport type: ${TRANSPORT_TYPE_STDIO}, ${TRANSPORT_TYPE_HTTP}, ${TRANSPORT_TYPE_SSE}, or ${TRANSPORT_TYPE_STDIO_HTTP}`).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").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)").option("--prestart-http", "Prestart the HTTP runtime in the background and exit after it becomes healthy", false).option("--timeout-ms <ms>", "How long to wait for the HTTP runtime to become healthy", String(DEFAULT_HTTP_RUNTIME_TIMEOUT_MS)).action(async (options) => {
1282
1302
  try {
1303
+ if (options.prestartHttp) {
1304
+ await prestartHttpRuntimeCommand(options, options.config || await findConfigFileAsync() || void 0);
1305
+ return;
1306
+ }
1283
1307
  const resolvedConfigPath = options.config || await findConfigFileAsync() || void 0;
1284
1308
  const proxyDefaults = resolvedConfigPath ? loadProxyDefaults(resolvedConfigPath) : {};
1285
1309
  const transportType = validateTransportType((options.type ?? proxyDefaults.type ?? TRANSPORT_TYPE_STDIO).toLowerCase());
@@ -1706,7 +1730,6 @@ async function main() {
1706
1730
  program.name("mcp-proxy").description("MCP proxy server package").version(version);
1707
1731
  program.addCommand(initCommand);
1708
1732
  program.addCommand(mcpServeCommand);
1709
- program.addCommand(prestartHttpCommand);
1710
1733
  program.addCommand(searchToolsCommand);
1711
1734
  program.addCommand(describeToolsCommand);
1712
1735
  program.addCommand(useToolCommand);
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-CRhtaDaz.cjs");
2
+ const require_src = require("./src-Dyzi_Dyb.cjs");
3
3
  exports.ConfigFetcherService = require_src.ConfigFetcherService;
4
4
  exports.DefinitionsCacheService = require_src.DefinitionsCacheService;
5
5
  exports.DescribeToolsTool = require_src.DescribeToolsTool;
package/dist/index.d.cts CHANGED
@@ -1187,6 +1187,7 @@ declare class StdioTransportHandler implements TransportHandler {
1187
1187
  //#region src/transports/stdio-http.d.ts
1188
1188
  interface StdioHttpProxyTransportConfig {
1189
1189
  endpoint: URL;
1190
+ resolveEndpoint?: () => Promise<URL>;
1190
1191
  }
1191
1192
  /**
1192
1193
  * Transport that serves MCP over stdio and forwards MCP requests to an HTTP endpoint.
@@ -1194,7 +1195,8 @@ interface StdioHttpProxyTransportConfig {
1194
1195
  * connection is lost (e.g. backend crash + restart).
1195
1196
  */
1196
1197
  declare class StdioHttpTransportHandler implements TransportHandler {
1197
- private readonly endpoint;
1198
+ private endpoint;
1199
+ private readonly resolveEndpoint?;
1198
1200
  private stdioProxyServer;
1199
1201
  private stdioTransport;
1200
1202
  private httpClient;
package/dist/index.d.mts CHANGED
@@ -1187,6 +1187,7 @@ declare class StdioTransportHandler implements TransportHandler {
1187
1187
  //#region src/transports/stdio-http.d.ts
1188
1188
  interface StdioHttpProxyTransportConfig {
1189
1189
  endpoint: URL;
1190
+ resolveEndpoint?: () => Promise<URL>;
1190
1191
  }
1191
1192
  /**
1192
1193
  * Transport that serves MCP over stdio and forwards MCP requests to an HTTP endpoint.
@@ -1194,7 +1195,8 @@ interface StdioHttpProxyTransportConfig {
1194
1195
  * connection is lost (e.g. backend crash + restart).
1195
1196
  */
1196
1197
  declare class StdioHttpTransportHandler implements TransportHandler {
1197
- private readonly endpoint;
1198
+ private endpoint;
1199
+ private readonly resolveEndpoint?;
1198
1200
  private stdioProxyServer;
1199
1201
  private stdioTransport;
1200
1202
  private httpClient;
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { C as DefinitionsCacheService, E as ConfigFetcherService, S as createProxyLogger, T as findConfigFile, _ as DescribeToolsTool, a as createProxyContainer, b as RuntimeStateService, c as createStdioHttpTransportHandler, d as StdioHttpTransportHandler, f as StdioTransportHandler, g as SearchListToolsTool, h as UseToolTool, i as createHttpTransportHandler, l as createStdioTransportHandler, m as HttpTransportHandler, n as createServer, p as SseTransportHandler, r as createSessionServer, s as createSseTransportHandler, t as TRANSPORT_MODE, u as initializeSharedServices, v as StopServerService, w as generateServerId, x as McpClientManagerService, y as SkillService } from "./src-C48MCBti.mjs";
1
+ import { C as DefinitionsCacheService, E as ConfigFetcherService, S as createProxyLogger, T as findConfigFile, _ as DescribeToolsTool, a as createProxyContainer, b as RuntimeStateService, c as createStdioHttpTransportHandler, d as StdioHttpTransportHandler, f as StdioTransportHandler, g as SearchListToolsTool, h as UseToolTool, i as createHttpTransportHandler, l as createStdioTransportHandler, m as HttpTransportHandler, n as createServer, p as SseTransportHandler, r as createSessionServer, s as createSseTransportHandler, t as TRANSPORT_MODE, u as initializeSharedServices, v as StopServerService, w as generateServerId, x as McpClientManagerService, y as SkillService } from "./src-BWTZjdu-.mjs";
2
2
  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 };
@@ -25,7 +25,7 @@ import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
25
25
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
26
26
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
27
27
  //#region package.json
28
- var version = "0.10.0";
28
+ var version = "0.10.2";
29
29
  //#endregion
30
30
  //#region src/utils/mcpConfigSchema.ts
31
31
  /**
@@ -4313,6 +4313,7 @@ function isConnectionError(error) {
4313
4313
  */
4314
4314
  var StdioHttpTransportHandler = class {
4315
4315
  endpoint;
4316
+ resolveEndpoint;
4316
4317
  stdioProxyServer = null;
4317
4318
  stdioTransport = null;
4318
4319
  httpClient = null;
@@ -4322,6 +4323,7 @@ var StdioHttpTransportHandler = class {
4322
4323
  RECONNECT_MAX_MS = 3e4;
4323
4324
  constructor(config, logger = console) {
4324
4325
  this.endpoint = config.endpoint;
4326
+ this.resolveEndpoint = config.resolveEndpoint;
4325
4327
  this.logger = logger;
4326
4328
  }
4327
4329
  async start() {
@@ -4392,6 +4394,7 @@ var StdioHttpTransportHandler = class {
4392
4394
  const delay = Math.min(this.RECONNECT_BASE_MS * 2 ** attempt, this.RECONNECT_MAX_MS);
4393
4395
  await new Promise((resolve) => setTimeout(resolve, delay));
4394
4396
  try {
4397
+ if (this.resolveEndpoint) this.endpoint = await this.resolveEndpoint();
4395
4398
  await this.httpClient?.close().catch(() => void 0);
4396
4399
  const client = await this.createAndConnectClient();
4397
4400
  this.httpClient = client;
@@ -48,7 +48,7 @@ let _modelcontextprotocol_sdk_server_sse_js = require("@modelcontextprotocol/sdk
48
48
  let _modelcontextprotocol_sdk_server_stdio_js = require("@modelcontextprotocol/sdk/server/stdio.js");
49
49
  let _modelcontextprotocol_sdk_server_index_js = require("@modelcontextprotocol/sdk/server/index.js");
50
50
  //#region package.json
51
- var version = "0.10.0";
51
+ var version = "0.10.2";
52
52
  //#endregion
53
53
  //#region src/utils/mcpConfigSchema.ts
54
54
  /**
@@ -4336,6 +4336,7 @@ function isConnectionError(error) {
4336
4336
  */
4337
4337
  var StdioHttpTransportHandler = class {
4338
4338
  endpoint;
4339
+ resolveEndpoint;
4339
4340
  stdioProxyServer = null;
4340
4341
  stdioTransport = null;
4341
4342
  httpClient = null;
@@ -4345,6 +4346,7 @@ var StdioHttpTransportHandler = class {
4345
4346
  RECONNECT_MAX_MS = 3e4;
4346
4347
  constructor(config, logger = console) {
4347
4348
  this.endpoint = config.endpoint;
4349
+ this.resolveEndpoint = config.resolveEndpoint;
4348
4350
  this.logger = logger;
4349
4351
  }
4350
4352
  async start() {
@@ -4415,6 +4417,7 @@ var StdioHttpTransportHandler = class {
4415
4417
  const delay = Math.min(this.RECONNECT_BASE_MS * 2 ** attempt, this.RECONNECT_MAX_MS);
4416
4418
  await new Promise((resolve) => setTimeout(resolve, delay));
4417
4419
  try {
4420
+ if (this.resolveEndpoint) this.endpoint = await this.resolveEndpoint();
4418
4421
  await this.httpClient?.close().catch(() => void 0);
4419
4422
  const client = await this.createAndConnectClient();
4420
4423
  this.httpClient = client;
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.10.1",
4
+ "version": "0.10.3",
5
5
  "license": "AGPL-3.0",
6
6
  "keywords": [
7
7
  "mcp",
@@ -28,10 +28,10 @@
28
28
  "js-yaml": "4.1.1",
29
29
  "liquidjs": "10.25.5",
30
30
  "zod": "4.3.6",
31
- "@agimon-ai/foundation-process-registry": "0.8.0",
32
- "@agimon-ai/log-sink-mcp": "0.8.0",
33
31
  "@agimon-ai/foundation-port-registry": "0.8.0",
34
- "@agimon-ai/foundation-validator": "0.5.0"
32
+ "@agimon-ai/foundation-process-registry": "0.8.0",
33
+ "@agimon-ai/foundation-validator": "0.5.0",
34
+ "@agimon-ai/log-sink-mcp": "0.8.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/js-yaml": "4.0.9",