@agimon-ai/mcp-proxy 0.8.0 → 0.9.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-dZuRf3Wt.cjs");
2
+ const require_src = require("./src-DJJH7z8i.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");
@@ -136,36 +136,35 @@ function resolveWorkspaceRoot(startPath = process.env.PROJECT_PATH || process.cw
136
136
  }
137
137
  }
138
138
  const PROCESS_REGISTRY_SERVICE_HTTP$1 = "mcp-proxy-http";
139
- async function findExistingHealthyRuntime(workspaceRoot) {
139
+ async function findExistingRuntime(workspaceRoot) {
140
140
  const match = (await new _agimon_ai_foundation_process_registry.ProcessRegistryService(process.env.PROCESS_REGISTRY_PATH).listProcesses({
141
141
  repositoryPath: workspaceRoot,
142
142
  serviceName: PROCESS_REGISTRY_SERVICE_HTTP$1
143
143
  }))[0];
144
144
  if (!match?.host || !match?.port) return null;
145
+ const metadata = match.metadata;
146
+ return {
147
+ host: match.host,
148
+ port: match.port,
149
+ serverId: metadata?.serverId ?? "unknown"
150
+ };
151
+ }
152
+ async function isRuntimeHealthy(host, port) {
145
153
  try {
146
- const healthUrl = `http://${match.host}:${match.port}/health`;
147
- if ((await fetch(healthUrl)).ok) {
148
- const metadata = match.metadata;
149
- return {
150
- host: match.host,
151
- port: match.port,
152
- serverId: metadata?.serverId ?? "unknown",
153
- workspaceRoot,
154
- reusedExistingRuntime: true
155
- };
156
- }
157
- } catch {}
158
- return null;
154
+ return (await fetch(`http://${host}:${port}/health`)).ok;
155
+ } catch {
156
+ return false;
157
+ }
159
158
  }
160
159
  function buildCliCandidates() {
161
- const __filename = (0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href);
162
- const __dirname = node_path.default.dirname(__filename);
160
+ const currentFile = (0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href);
161
+ const currentDir = node_path.default.dirname(currentFile);
163
162
  const distCandidates = [
164
- node_path.default.resolve(__dirname, "cli.mjs"),
165
- node_path.default.resolve(__dirname, "..", "dist", "cli.mjs"),
166
- node_path.default.resolve(__dirname, "..", "..", "dist", "cli.mjs")
163
+ node_path.default.resolve(currentDir, "cli.mjs"),
164
+ node_path.default.resolve(currentDir, "..", "dist", "cli.mjs"),
165
+ node_path.default.resolve(currentDir, "..", "..", "dist", "cli.mjs")
167
166
  ];
168
- const srcCandidates = [node_path.default.resolve(__dirname, "..", "cli.ts"), node_path.default.resolve(__dirname, "..", "..", "src", "cli.ts")];
167
+ const srcCandidates = [node_path.default.resolve(currentDir, "..", "cli.ts"), node_path.default.resolve(currentDir, "..", "..", "src", "cli.ts")];
169
168
  for (const candidate of distCandidates) if ((0, node_fs.existsSync)(candidate)) return {
170
169
  command: process.execPath,
171
170
  args: [candidate]
@@ -254,9 +253,16 @@ async function prestartHttpRuntime(options) {
254
253
  const timeoutMs = parseTimeoutMs(options.timeoutMs);
255
254
  const registryPath = options.registryPath || options.registryDir;
256
255
  const workspaceRoot = resolveWorkspaceRoot();
257
- const existing = await findExistingHealthyRuntime(workspaceRoot);
258
- if (existing) return existing;
259
- await stopExistingRuntime(new require_src.RuntimeStateService(), options.id, options.host, options.port);
256
+ const existing = await findExistingRuntime(workspaceRoot);
257
+ if (existing && await isRuntimeHealthy(existing.host, existing.port)) return {
258
+ host: existing.host,
259
+ port: existing.port,
260
+ serverId: existing.serverId,
261
+ workspaceRoot,
262
+ reusedExistingRuntime: true
263
+ };
264
+ const targetPort = options.port ?? existing?.port;
265
+ await stopExistingRuntime(new require_src.RuntimeStateService(), options.id, options.host, targetPort);
260
266
  const childEnv = {
261
267
  ...process.env,
262
268
  ...registryPath ? {
@@ -272,7 +278,7 @@ async function prestartHttpRuntime(options) {
272
278
  serverId,
273
279
  "--host",
274
280
  options.host || DEFAULT_HOST$1,
275
- ...options.port !== void 0 ? ["--port", String(options.port)] : [],
281
+ ...targetPort !== void 0 ? ["--port", String(targetPort)] : [],
276
282
  ...options.config ? ["--config", options.config] : [],
277
283
  ...options.cache === false ? ["--no-cache"] : [],
278
284
  ...options.definitionsCache ? ["--definitions-cache", options.definitionsCache] : [],
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, w as generateServerId, y as StopServerService } from "./src-Dorvm5bM.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, w as generateServerId, y as StopServerService } from "./src-DA5H3rpr.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";
@@ -134,36 +134,35 @@ function resolveWorkspaceRoot(startPath = process.env.PROJECT_PATH || process.cw
134
134
  }
135
135
  }
136
136
  const PROCESS_REGISTRY_SERVICE_HTTP$1 = "mcp-proxy-http";
137
- async function findExistingHealthyRuntime(workspaceRoot) {
137
+ async function findExistingRuntime(workspaceRoot) {
138
138
  const match = (await new ProcessRegistryService(process.env.PROCESS_REGISTRY_PATH).listProcesses({
139
139
  repositoryPath: workspaceRoot,
140
140
  serviceName: PROCESS_REGISTRY_SERVICE_HTTP$1
141
141
  }))[0];
142
142
  if (!match?.host || !match?.port) return null;
143
+ const metadata = match.metadata;
144
+ return {
145
+ host: match.host,
146
+ port: match.port,
147
+ serverId: metadata?.serverId ?? "unknown"
148
+ };
149
+ }
150
+ async function isRuntimeHealthy(host, port) {
143
151
  try {
144
- const healthUrl = `http://${match.host}:${match.port}/health`;
145
- if ((await fetch(healthUrl)).ok) {
146
- const metadata = match.metadata;
147
- return {
148
- host: match.host,
149
- port: match.port,
150
- serverId: metadata?.serverId ?? "unknown",
151
- workspaceRoot,
152
- reusedExistingRuntime: true
153
- };
154
- }
155
- } catch {}
156
- return null;
152
+ return (await fetch(`http://${host}:${port}/health`)).ok;
153
+ } catch {
154
+ return false;
155
+ }
157
156
  }
158
157
  function buildCliCandidates() {
159
- const __filename = fileURLToPath(import.meta.url);
160
- const __dirname = path.dirname(__filename);
158
+ const currentFile = fileURLToPath(import.meta.url);
159
+ const currentDir = path.dirname(currentFile);
161
160
  const distCandidates = [
162
- path.resolve(__dirname, "cli.mjs"),
163
- path.resolve(__dirname, "..", "dist", "cli.mjs"),
164
- path.resolve(__dirname, "..", "..", "dist", "cli.mjs")
161
+ path.resolve(currentDir, "cli.mjs"),
162
+ path.resolve(currentDir, "..", "dist", "cli.mjs"),
163
+ path.resolve(currentDir, "..", "..", "dist", "cli.mjs")
165
164
  ];
166
- const srcCandidates = [path.resolve(__dirname, "..", "cli.ts"), path.resolve(__dirname, "..", "..", "src", "cli.ts")];
165
+ const srcCandidates = [path.resolve(currentDir, "..", "cli.ts"), path.resolve(currentDir, "..", "..", "src", "cli.ts")];
167
166
  for (const candidate of distCandidates) if (existsSync(candidate)) return {
168
167
  command: process.execPath,
169
168
  args: [candidate]
@@ -252,9 +251,16 @@ async function prestartHttpRuntime(options) {
252
251
  const timeoutMs = parseTimeoutMs(options.timeoutMs);
253
252
  const registryPath = options.registryPath || options.registryDir;
254
253
  const workspaceRoot = resolveWorkspaceRoot();
255
- const existing = await findExistingHealthyRuntime(workspaceRoot);
256
- if (existing) return existing;
257
- await stopExistingRuntime(new RuntimeStateService(), options.id, options.host, options.port);
254
+ const existing = await findExistingRuntime(workspaceRoot);
255
+ if (existing && await isRuntimeHealthy(existing.host, existing.port)) return {
256
+ host: existing.host,
257
+ port: existing.port,
258
+ serverId: existing.serverId,
259
+ workspaceRoot,
260
+ reusedExistingRuntime: true
261
+ };
262
+ const targetPort = options.port ?? existing?.port;
263
+ await stopExistingRuntime(new RuntimeStateService(), options.id, options.host, targetPort);
258
264
  const childEnv = {
259
265
  ...process.env,
260
266
  ...registryPath ? {
@@ -270,7 +276,7 @@ async function prestartHttpRuntime(options) {
270
276
  serverId,
271
277
  "--host",
272
278
  options.host || DEFAULT_HOST$1,
273
- ...options.port !== void 0 ? ["--port", String(options.port)] : [],
279
+ ...targetPort !== void 0 ? ["--port", String(targetPort)] : [],
274
280
  ...options.config ? ["--config", options.config] : [],
275
281
  ...options.cache === false ? ["--no-cache"] : [],
276
282
  ...options.definitionsCache ? ["--definitions-cache", options.definitionsCache] : [],
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-dZuRf3Wt.cjs");
2
+ const require_src = require("./src-DJJH7z8i.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.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 SkillService, w as generateServerId, x as McpClientManagerService, y as StopServerService } from "./src-Dorvm5bM.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 SkillService, w as generateServerId, x as McpClientManagerService, y as StopServerService } from "./src-DA5H3rpr.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 };
@@ -24,7 +24,7 @@ import { Hono } from "hono";
24
24
  import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
25
25
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
26
26
  //#region package.json
27
- var version = "0.7.3";
27
+ var version = "0.8.0";
28
28
  //#endregion
29
29
  //#region src/utils/mcpConfigSchema.ts
30
30
  /**
@@ -47,7 +47,7 @@ let hono = require("hono");
47
47
  let _modelcontextprotocol_sdk_server_sse_js = require("@modelcontextprotocol/sdk/server/sse.js");
48
48
  let _modelcontextprotocol_sdk_server_stdio_js = require("@modelcontextprotocol/sdk/server/stdio.js");
49
49
  //#region package.json
50
- var version = "0.7.3";
50
+ var version = "0.8.0";
51
51
  //#endregion
52
52
  //#region src/utils/mcpConfigSchema.ts
53
53
  /**
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.8.0",
4
+ "version": "0.9.0",
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.6.0",
32
- "@agimon-ai/foundation-validator": "0.3.0",
33
- "@agimon-ai/log-sink-mcp": "0.6.0",
34
- "@agimon-ai/foundation-port-registry": "0.6.0"
31
+ "@agimon-ai/foundation-process-registry": "0.7.0",
32
+ "@agimon-ai/foundation-port-registry": "0.7.0",
33
+ "@agimon-ai/log-sink-mcp": "0.7.0",
34
+ "@agimon-ai/foundation-validator": "0.4.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/js-yaml": "4.0.9",