@agiflowai/one-mcp 0.3.19 → 0.4.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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { _ as DefinitionsCacheService, a as SseTransportHandler, b as ConfigFetcherService, c as createServer, d as version, g as McpClientManagerService, h as SkillService, i as StdioTransportHandler, l as createSessionServer, n as RuntimeStateService, o as HttpTransportHandler, p as SearchListToolsTool, r as StdioHttpTransportHandler, s as TRANSPORT_MODE, t as StopServerService, u as initializeSharedServices, v as generateServerId, y as findConfigFile } from "./src-QphCJFbi.mjs";
2
+ import { _ as DefinitionsCacheService, a as SseTransportHandler, b as ConfigFetcherService, c as createServer, d as version, g as McpClientManagerService, h as SkillService, i as StdioTransportHandler, l as createSessionServer, n as RuntimeStateService, o as HttpTransportHandler, p as SearchListToolsTool, r as StdioHttpTransportHandler, s as TRANSPORT_MODE, t as StopServerService, u as initializeSharedServices, v as generateServerId, y as findConfigFile } from "./src-BhNZiv0s.mjs";
3
3
  import { access, writeFile } from "node:fs/promises";
4
4
  import { constants } from "node:fs";
5
5
  import { randomUUID } from "node:crypto";
@@ -8,53 +8,14 @@ import { Liquid } from "liquidjs";
8
8
  import { spawn } from "node:child_process";
9
9
  import { Command } from "commander";
10
10
  import { log, print } from "@agiflowai/aicode-utils";
11
-
12
- //#region src/services/PrefetchService/constants.ts
13
- /**
14
- * PrefetchService Constants
15
- *
16
- * Constants for package manager commands and process configuration.
17
- */
18
- /** Transport type for stdio-based MCP servers */
19
- const TRANSPORT_STDIO = "stdio";
20
- /** npx command name */
21
- const COMMAND_NPX = "npx";
22
- /** npm command name */
23
- const COMMAND_NPM = "npm";
24
11
  /** pnpx command name (pnpm's npx equivalent) */
25
12
  const COMMAND_PNPX = "pnpx";
26
13
  /** pnpm command name */
27
14
  const COMMAND_PNPM = "pnpm";
28
- /** uvx command name */
29
- const COMMAND_UVX = "uvx";
30
- /** uv command name */
31
- const COMMAND_UV = "uv";
32
- /** Path suffix for npx command */
33
- const COMMAND_NPX_SUFFIX = "/npx";
34
- /** Path suffix for pnpx command */
35
- const COMMAND_PNPX_SUFFIX = "/pnpx";
36
- /** Path suffix for uvx command */
37
- const COMMAND_UVX_SUFFIX = "/uvx";
38
- /** Path suffix for uv command */
39
- const COMMAND_UV_SUFFIX = "/uv";
40
- /** Run subcommand for uv */
41
- const ARG_RUN = "run";
42
15
  /** Tool subcommand for uv */
43
16
  const ARG_TOOL = "tool";
44
17
  /** Install subcommand for uv tool and npm/pnpm */
45
18
  const ARG_INSTALL = "install";
46
- /** Add subcommand for pnpm */
47
- const ARG_ADD = "add";
48
- /** Global flag for npm/pnpm install */
49
- const ARG_GLOBAL = "-g";
50
- /** Flag prefix for command arguments */
51
- const FLAG_PREFIX = "-";
52
- /** npx --package flag (long form) */
53
- const FLAG_PACKAGE_LONG = "--package";
54
- /** npx -p flag (short form) */
55
- const FLAG_PACKAGE_SHORT = "-p";
56
- /** Equals delimiter used in flag=value patterns */
57
- const EQUALS_DELIMITER = "=";
58
19
  /**
59
20
  * Regex pattern for valid package names (npm, pnpm, uvx, uv)
60
21
  * Allows: @scope/package-name@version, package-name, package_name
@@ -66,13 +27,10 @@ const EQUALS_DELIMITER = "=";
66
27
  const VALID_PACKAGE_NAME_PATTERN = /^(@[a-zA-Z0-9_-]+\/)?[a-zA-Z0-9._-]+(@[a-zA-Z0-9._-]+)?$/;
67
28
  /** Windows platform identifier */
68
29
  const PLATFORM_WIN32 = "win32";
69
- /** Success exit code */
70
- const EXIT_CODE_SUCCESS = 0;
71
30
  /** Stdio option to ignore stream */
72
31
  const STDIO_IGNORE = "ignore";
73
32
  /** Stdio option to pipe stream */
74
33
  const STDIO_PIPE = "pipe";
75
-
76
34
  //#endregion
77
35
  //#region src/services/PrefetchService/PrefetchService.ts
78
36
  /**
@@ -132,7 +90,7 @@ var PrefetchService = class {
132
90
  const { mcpConfig, filter } = this.config;
133
91
  for (const [serverName, serverConfig] of Object.entries(mcpConfig.mcpServers)) {
134
92
  if (serverConfig.disabled) continue;
135
- if (serverConfig.transport !== TRANSPORT_STDIO) continue;
93
+ if (serverConfig.transport !== "stdio") continue;
136
94
  if (!isMcpStdioConfig(serverConfig.config)) continue;
137
95
  const packageInfo = this.extractPackageInfo(serverName, serverConfig.config);
138
96
  if (packageInfo) {
@@ -221,21 +179,21 @@ var PrefetchService = class {
221
179
  extractPackageInfo(serverName, config) {
222
180
  const command = config.command.toLowerCase();
223
181
  const args = config.args || [];
224
- if (command === COMMAND_NPX || command.endsWith(COMMAND_NPX_SUFFIX)) {
182
+ if (command === "npx" || command.endsWith("/npx")) {
225
183
  const packageName = this.extractNpxPackage(args);
226
184
  if (packageName && this.isValidPackageName(packageName)) return {
227
185
  serverName,
228
- packageManager: COMMAND_NPX,
186
+ packageManager: "npx",
229
187
  packageName,
230
188
  fullCommand: [
231
- COMMAND_NPM,
189
+ "npm",
232
190
  ARG_INSTALL,
233
- ARG_GLOBAL,
191
+ "-g",
234
192
  packageName
235
193
  ]
236
194
  };
237
195
  }
238
- if (command === COMMAND_PNPX || command.endsWith(COMMAND_PNPX_SUFFIX)) {
196
+ if (command === "pnpx" || command.endsWith("/pnpx")) {
239
197
  const packageName = this.extractNpxPackage(args);
240
198
  if (packageName && this.isValidPackageName(packageName)) return {
241
199
  serverName,
@@ -243,29 +201,29 @@ var PrefetchService = class {
243
201
  packageName,
244
202
  fullCommand: [
245
203
  COMMAND_PNPM,
246
- ARG_ADD,
247
- ARG_GLOBAL,
204
+ "add",
205
+ "-g",
248
206
  packageName
249
207
  ]
250
208
  };
251
209
  }
252
- if (command === COMMAND_UVX || command.endsWith(COMMAND_UVX_SUFFIX)) {
210
+ if (command === "uvx" || command.endsWith("/uvx")) {
253
211
  const packageName = this.extractUvxPackage(args);
254
212
  if (packageName && this.isValidPackageName(packageName)) return {
255
213
  serverName,
256
- packageManager: COMMAND_UVX,
214
+ packageManager: "uvx",
257
215
  packageName,
258
- fullCommand: [COMMAND_UVX, packageName]
216
+ fullCommand: ["uvx", packageName]
259
217
  };
260
218
  }
261
- if ((command === COMMAND_UV || command.endsWith(COMMAND_UV_SUFFIX)) && args.includes(ARG_RUN)) {
219
+ if ((command === "uv" || command.endsWith("/uv")) && args.includes("run")) {
262
220
  const packageName = this.extractUvRunPackage(args);
263
221
  if (packageName && this.isValidPackageName(packageName)) return {
264
222
  serverName,
265
- packageManager: COMMAND_UV,
223
+ packageManager: "uv",
266
224
  packageName,
267
225
  fullCommand: [
268
- COMMAND_UV,
226
+ "uv",
269
227
  ARG_TOOL,
270
228
  ARG_INSTALL,
271
229
  packageName
@@ -292,18 +250,18 @@ var PrefetchService = class {
292
250
  extractNpxPackage(args) {
293
251
  for (let i = 0; i < args.length; i++) {
294
252
  const arg = args[i];
295
- if (arg.startsWith(FLAG_PACKAGE_LONG + EQUALS_DELIMITER)) return arg.slice(FLAG_PACKAGE_LONG.length + EQUALS_DELIMITER.length) || null;
296
- if (arg === FLAG_PACKAGE_LONG && i + 1 < args.length) {
253
+ if (arg.startsWith("--package=")) return arg.slice(10) || null;
254
+ if (arg === "--package" && i + 1 < args.length) {
297
255
  const nextArg = args[i + 1];
298
- if (!nextArg.startsWith(FLAG_PREFIX)) return nextArg;
256
+ if (!nextArg.startsWith("-")) return nextArg;
299
257
  }
300
- if (arg === FLAG_PACKAGE_SHORT && i + 1 < args.length) {
258
+ if (arg === "-p" && i + 1 < args.length) {
301
259
  const nextArg = args[i + 1];
302
- if (!nextArg.startsWith(FLAG_PREFIX)) return nextArg;
260
+ if (!nextArg.startsWith("-")) return nextArg;
303
261
  }
304
262
  }
305
263
  for (const arg of args) {
306
- if (arg.startsWith(FLAG_PREFIX)) continue;
264
+ if (arg.startsWith("-")) continue;
307
265
  return arg;
308
266
  }
309
267
  return null;
@@ -320,7 +278,7 @@ var PrefetchService = class {
320
278
  */
321
279
  extractUvxPackage(args) {
322
280
  for (const arg of args) {
323
- if (arg.startsWith(FLAG_PREFIX)) continue;
281
+ if (arg.startsWith("-")) continue;
324
282
  return arg;
325
283
  }
326
284
  return null;
@@ -337,11 +295,11 @@ var PrefetchService = class {
337
295
  * extractUvRunPackage(['install', 'pkg']) // returns null (no 'run')
338
296
  */
339
297
  extractUvRunPackage(args) {
340
- const runIndex = args.indexOf(ARG_RUN);
298
+ const runIndex = args.indexOf("run");
341
299
  if (runIndex === -1) return null;
342
300
  for (let i = runIndex + 1; i < args.length; i++) {
343
301
  const arg = args[i];
344
- if (arg.startsWith(FLAG_PREFIX)) continue;
302
+ if (arg.startsWith("-")) continue;
345
303
  return arg;
346
304
  }
347
305
  return null;
@@ -353,7 +311,7 @@ var PrefetchService = class {
353
311
  * @returns Promise with success status and output
354
312
  */
355
313
  runCommand(command, args) {
356
- return new Promise((resolve$1) => {
314
+ return new Promise((resolve) => {
357
315
  const proc = spawn(command, args, {
358
316
  stdio: [
359
317
  STDIO_IGNORE,
@@ -371,13 +329,13 @@ var PrefetchService = class {
371
329
  stderr += data.toString();
372
330
  });
373
331
  proc.on("close", (code) => {
374
- resolve$1({
375
- success: code === EXIT_CODE_SUCCESS,
332
+ resolve({
333
+ success: code === 0,
376
334
  output: stdout || stderr
377
335
  });
378
336
  });
379
337
  proc.on("error", (error) => {
380
- resolve$1({
338
+ resolve({
381
339
  success: false,
382
340
  output: error.message
383
341
  });
@@ -385,15 +343,12 @@ var PrefetchService = class {
385
343
  });
386
344
  }
387
345
  };
388
-
389
346
  //#endregion
390
347
  //#region src/templates/mcp-config.yaml.liquid?raw
391
348
  var mcp_config_yaml_default = "# MCP Server Configuration\n# This file configures the MCP servers that one-mcp will connect to\n#\n# Environment Variable Interpolation:\n# Use ${VAR_NAME} syntax to reference environment variables\n# Example: ${HOME}, ${API_KEY}, ${DATABASE_URL}\n#\n# Instructions:\n# - config.instruction: Server's default instruction (from server documentation)\n# - instruction: User override (optional, takes precedence over config.instruction)\n# - config.toolBlacklist: Array of tool names to hide/block from this server\n# - config.omitToolDescription: Boolean to show only tool names without descriptions (saves tokens)\n\n# Remote Configuration Sources (OPTIONAL)\n# Fetch and merge configurations from remote URLs\n# Remote configs are merged with local configs based on merge strategy\n#\n# SECURITY: SSRF Protection is ENABLED by default\n# - Only HTTPS URLs are allowed (set security.enforceHttps: false to allow HTTP)\n# - Private IPs and localhost are blocked (set security.allowPrivateIPs: true for internal networks)\n# - Blocked ranges: 127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16\nremoteConfigs:\n # Example 1: Basic remote config with default security\n # - url: ${AGIFLOW_URL}/api/v1/mcp-configs\n # headers:\n # Authorization: Bearer ${AGIFLOW_API_KEY}\n # mergeStrategy: local-priority # Options: local-priority (default), remote-priority, merge-deep\n #\n # Example 2: Remote config with custom security settings (for internal networks)\n # - url: ${INTERNAL_URL}/mcp-configs\n # headers:\n # Authorization: Bearer ${INTERNAL_TOKEN}\n # security:\n # allowPrivateIPs: true # Allow internal IPs (default: false)\n # enforceHttps: false # Allow HTTP (default: true, HTTPS only)\n # mergeStrategy: local-priority\n #\n # Example 3: Remote config with additional validation (OPTIONAL)\n # - url: ${AGIFLOW_URL}/api/v1/mcp-configs\n # headers:\n # Authorization: Bearer ${AGIFLOW_API_KEY}\n # X-API-Key: ${AGIFLOW_API_KEY}\n # security:\n # enforceHttps: true # Require HTTPS (default: true)\n # allowPrivateIPs: false # Block private IPs (default: false)\n # validation: # OPTIONAL: Additional regex validation on top of security checks\n # url: ^https://.*\\.agiflow\\.io/.* # OPTIONAL: Regex pattern to validate URL format\n # headers: # OPTIONAL: Regex patterns to validate header values\n # Authorization: ^Bearer [A-Za-z0-9_-]+$\n # X-API-Key: ^[A-Za-z0-9_-]{32,}$\n # mergeStrategy: local-priority\n\nmcpServers:\n{%- if mcpServers %}{% for server in mcpServers %}\n {{ server.name }}:\n command: {{ server.command }}\n args:{% for arg in server.args %}\n - '{{ arg }}'{% endfor %}\n # env:\n # LOG_LEVEL: info\n # # API_KEY: ${MY_API_KEY}\n # config:\n # instruction: Use this server for...\n # # toolBlacklist:\n # # - tool_to_block\n # # omitToolDescription: true\n{% endfor %}\n # Example MCP server using SSE transport\n # remote-server:\n # url: https://example.com/mcp\n # type: sse\n # headers:\n # Authorization: Bearer ${API_KEY}\n # config:\n # instruction: This server provides tools for...\n{% else %}\n # Example MCP server using stdio transport\n example-server:\n command: node\n args:\n - /path/to/mcp-server/build/index.js\n env:\n # Environment variables for the MCP server\n LOG_LEVEL: info\n # You can use environment variable interpolation:\n # DATABASE_URL: ${DATABASE_URL}\n # API_KEY: ${MY_API_KEY}\n config:\n # Server's default instruction (from server documentation)\n instruction: Use this server for...\n # Optional: Block specific tools from being listed or executed\n # toolBlacklist:\n # - dangerous_tool_name\n # - another_blocked_tool\n # Optional: Omit tool descriptions to save tokens (default: false)\n # omitToolDescription: true\n # instruction: Optional user override - takes precedence over config.instruction\n\n # Example MCP server using SSE transport with environment variables\n # remote-server:\n # url: https://example.com/mcp\n # type: sse\n # headers:\n # # Use ${VAR_NAME} to interpolate environment variables\n # Authorization: Bearer ${API_KEY}\n # config:\n # instruction: This server provides tools for...\n # # Optional: Block specific tools from being listed or executed\n # # toolBlacklist:\n # # - tool_to_block\n # # Optional: Omit tool descriptions to save tokens (default: false)\n # # omitToolDescription: true\n # # instruction: Optional user override\n{% endif %}\n";
392
-
393
349
  //#endregion
394
350
  //#region src/templates/mcp-config.json?raw
395
351
  var mcp_config_default = "{\n \"_comment\": \"MCP Server Configuration - Use ${VAR_NAME} syntax for environment variable interpolation\",\n \"_instructions\": \"config.instruction: Server's default instruction | instruction: User override (takes precedence)\",\n \"mcpServers\": {\n \"example-server\": {\n \"command\": \"node\",\n \"args\": [\"/path/to/mcp-server/build/index.js\"],\n \"env\": {\n \"LOG_LEVEL\": \"info\",\n \"_comment\": \"You can use environment variable interpolation:\",\n \"_example_DATABASE_URL\": \"${DATABASE_URL}\",\n \"_example_API_KEY\": \"${MY_API_KEY}\"\n },\n \"config\": {\n \"instruction\": \"Use this server for...\"\n },\n \"_instruction_override\": \"Optional user override - takes precedence over config.instruction\"\n }\n }\n}\n";
396
-
397
352
  //#endregion
398
353
  //#region src/commands/init.ts
399
354
  /**
@@ -463,7 +418,6 @@ const initCommand = new Command("init").description("Initialize MCP configuratio
463
418
  process.exit(1);
464
419
  }
465
420
  });
466
-
467
421
  //#endregion
468
422
  //#region src/commands/mcp-serve.ts
469
423
  /**
@@ -864,7 +818,6 @@ const mcpServeCommand = new Command("mcp-serve").description("Start MCP server w
864
818
  process.exit(1);
865
819
  }
866
820
  });
867
-
868
821
  //#endregion
869
822
  //#region src/commands/list-tools.ts
870
823
  /**
@@ -947,7 +900,6 @@ const searchToolsCommand = new Command("search-tools").description("Search proxi
947
900
  process.exit(1);
948
901
  }
949
902
  });
950
-
951
903
  //#endregion
952
904
  //#region src/commands/describe-tools.ts
953
905
  /**
@@ -1105,7 +1057,6 @@ const describeToolsCommand = new Command("describe-tools").description("Describe
1105
1057
  process.exit(1);
1106
1058
  }
1107
1059
  });
1108
-
1109
1060
  //#endregion
1110
1061
  //#region src/commands/use-tool.ts
1111
1062
  /**
@@ -1163,15 +1114,15 @@ const useToolCommand = new Command("use-tool").description("Execute an MCP tool
1163
1114
  process.exit(1);
1164
1115
  }
1165
1116
  if (options.server) {
1166
- const client$1 = clientManager.getClient(options.server);
1167
- if (!client$1) {
1117
+ const client = clientManager.getClient(options.server);
1118
+ if (!client) {
1168
1119
  console.error(`Server "${options.server}" not found`);
1169
1120
  process.exit(1);
1170
1121
  }
1171
1122
  try {
1172
1123
  if (!options.json) console.error(`Executing ${toolName} on ${options.server}...`);
1173
1124
  const requestOptions = options.timeout ? { timeout: options.timeout } : void 0;
1174
- const result = await client$1.callTool(toolName, toolArgs, requestOptions);
1125
+ const result = await client.callTool(toolName, toolArgs, requestOptions);
1175
1126
  if (options.json) console.log(JSON.stringify(result, null, 2));
1176
1127
  else {
1177
1128
  console.log("\nResult:");
@@ -1190,17 +1141,17 @@ const useToolCommand = new Command("use-tool").description("Execute an MCP tool
1190
1141
  process.exit(1);
1191
1142
  }
1192
1143
  }
1193
- const searchResults = await Promise.all(clients.map(async (client$1) => {
1144
+ const searchResults = await Promise.all(clients.map(async (client) => {
1194
1145
  try {
1195
- const hasTool = (await client$1.listTools()).some((t) => t.name === toolName);
1146
+ const hasTool = (await client.listTools()).some((t) => t.name === toolName);
1196
1147
  return {
1197
- serverName: client$1.serverName,
1148
+ serverName: client.serverName,
1198
1149
  hasTool,
1199
1150
  error: null
1200
1151
  };
1201
1152
  } catch (error) {
1202
1153
  return {
1203
- serverName: client$1.serverName,
1154
+ serverName: client.serverName,
1204
1155
  hasTool: false,
1205
1156
  error
1206
1157
  };
@@ -1280,7 +1231,6 @@ const useToolCommand = new Command("use-tool").description("Execute an MCP tool
1280
1231
  process.exit(1);
1281
1232
  }
1282
1233
  });
1283
-
1284
1234
  //#endregion
1285
1235
  //#region src/commands/list-resources.ts
1286
1236
  /**
@@ -1362,7 +1312,6 @@ const listResourcesCommand = new Command("list-resources").description("List all
1362
1312
  process.exit(1);
1363
1313
  }
1364
1314
  });
1365
-
1366
1315
  //#endregion
1367
1316
  //#region src/commands/read-resource.ts
1368
1317
  /**
@@ -1409,27 +1358,27 @@ const readResourceCommand = new Command("read-resource").description("Read a res
1409
1358
  const clients = clientManager.getAllClients();
1410
1359
  if (clients.length === 0) throw new Error("No MCP servers connected");
1411
1360
  if (options.server) {
1412
- const client$1 = clientManager.getClient(options.server);
1413
- if (!client$1) throw new Error(`Server "${options.server}" not found`);
1361
+ const client = clientManager.getClient(options.server);
1362
+ if (!client) throw new Error(`Server "${options.server}" not found`);
1414
1363
  if (!options.json) console.error(`Reading ${uri} from ${options.server}...`);
1415
- const result$1 = await client$1.readResource(uri);
1416
- if (options.json) console.log(JSON.stringify(result$1, null, 2));
1417
- else for (const content of result$1.contents) if ("text" in content) console.log(content.text);
1364
+ const result = await client.readResource(uri);
1365
+ if (options.json) console.log(JSON.stringify(result, null, 2));
1366
+ else for (const content of result.contents) if ("text" in content) console.log(content.text);
1418
1367
  else console.log(JSON.stringify(content, null, 2));
1419
1368
  await clientManager.disconnectAll();
1420
1369
  return;
1421
1370
  }
1422
- const searchResults = await Promise.all(clients.map(async (client$1) => {
1371
+ const searchResults = await Promise.all(clients.map(async (client) => {
1423
1372
  try {
1424
- const hasResource = (await client$1.listResources()).some((r) => r.uri === uri);
1373
+ const hasResource = (await client.listResources()).some((r) => r.uri === uri);
1425
1374
  return {
1426
- serverName: client$1.serverName,
1375
+ serverName: client.serverName,
1427
1376
  hasResource,
1428
1377
  error: null
1429
1378
  };
1430
1379
  } catch (error) {
1431
1380
  return {
1432
- serverName: client$1.serverName,
1381
+ serverName: client.serverName,
1433
1382
  hasResource: false,
1434
1383
  error
1435
1384
  };
@@ -1459,7 +1408,6 @@ const readResourceCommand = new Command("read-resource").description("Read a res
1459
1408
  process.exit(1);
1460
1409
  }
1461
1410
  });
1462
-
1463
1411
  //#endregion
1464
1412
  //#region src/commands/list-prompts.ts
1465
1413
  function toErrorMessage$2(error) {
@@ -1511,7 +1459,6 @@ const listPromptsCommand = new Command("list-prompts").description("List all ava
1511
1459
  process.exit(1);
1512
1460
  }
1513
1461
  });
1514
-
1515
1462
  //#endregion
1516
1463
  //#region src/commands/get-prompt.ts
1517
1464
  function toErrorMessage$1(error) {
@@ -1540,11 +1487,11 @@ const getPromptCommand = new Command("get-prompt").description("Get a prompt by
1540
1487
  const clients = clientManager.getAllClients();
1541
1488
  if (clients.length === 0) throw new Error("No MCP servers connected");
1542
1489
  if (options.server) {
1543
- const client$1 = clientManager.getClient(options.server);
1544
- if (!client$1) throw new Error(`Server "${options.server}" not found`);
1545
- const prompt$1 = await client$1.getPrompt(promptName, promptArgs);
1546
- if (options.json) console.log(JSON.stringify(prompt$1, null, 2));
1547
- else for (const message of prompt$1.messages) {
1490
+ const client = clientManager.getClient(options.server);
1491
+ if (!client) throw new Error(`Server "${options.server}" not found`);
1492
+ const prompt = await client.getPrompt(promptName, promptArgs);
1493
+ if (options.json) console.log(JSON.stringify(prompt, null, 2));
1494
+ else for (const message of prompt.messages) {
1548
1495
  const content = message.content;
1549
1496
  if (typeof content === "object" && content && "text" in content) console.log(content.text);
1550
1497
  else console.log(JSON.stringify(message, null, 2));
@@ -1553,11 +1500,11 @@ const getPromptCommand = new Command("get-prompt").description("Get a prompt by
1553
1500
  return;
1554
1501
  }
1555
1502
  const matchingServers = [];
1556
- await Promise.all(clients.map(async (client$1) => {
1503
+ await Promise.all(clients.map(async (client) => {
1557
1504
  try {
1558
- if ((await client$1.listPrompts()).some((prompt$1) => prompt$1.name === promptName)) matchingServers.push(client$1.serverName);
1505
+ if ((await client.listPrompts()).some((prompt) => prompt.name === promptName)) matchingServers.push(client.serverName);
1559
1506
  } catch (error) {
1560
- if (!options.json) console.error(`Failed to list prompts from ${client$1.serverName}: ${toErrorMessage$1(error)}`);
1507
+ if (!options.json) console.error(`Failed to list prompts from ${client.serverName}: ${toErrorMessage$1(error)}`);
1561
1508
  }
1562
1509
  }));
1563
1510
  if (matchingServers.length === 0) throw new Error(`Prompt "${promptName}" not found on any connected server`);
@@ -1577,7 +1524,6 @@ const getPromptCommand = new Command("get-prompt").description("Get a prompt by
1577
1524
  process.exit(1);
1578
1525
  }
1579
1526
  });
1580
-
1581
1527
  //#endregion
1582
1528
  //#region src/commands/prefetch.ts
1583
1529
  /**
@@ -1702,14 +1648,13 @@ const prefetchCommand = new Command("prefetch").description("Pre-download packag
1702
1648
  process.exit(1);
1703
1649
  }
1704
1650
  });
1705
-
1706
1651
  //#endregion
1707
1652
  //#region src/commands/stop.ts
1708
1653
  /**
1709
1654
  * Stop Command
1710
1655
  *
1711
- * Stops a running HTTP one-mcp server using the authenticated admin endpoint
1712
- * and the persisted runtime registry.
1656
+ * Stops a running HTTP one-mcp server using the persisted runtime registry
1657
+ * and a local process signal.
1713
1658
  */
1714
1659
  function toErrorMessage(error) {
1715
1660
  return error instanceof Error ? error.message : String(error);
@@ -1722,14 +1667,13 @@ function printStopResult(result) {
1722
1667
  /**
1723
1668
  * Stop a running HTTP one-mcp server.
1724
1669
  */
1725
- const stopCommand = new Command("stop").description("Stop a running HTTP one-mcp server").option("--id <id>", "Target server ID from the runtime registry").option("--host <host>", "Target runtime host").option("--port <port>", "Target runtime port", (value) => Number.parseInt(value, 10)).option("-c, --config <path>", "Reserved for future config-based targeting support").option("--token <token>", "Override the persisted shutdown token").option("--force", "Skip server ID verification against the /health response", false).option("-j, --json", "Output as JSON", false).option("--timeout <ms>", "Maximum time to wait for shutdown completion", (value) => Number.parseInt(value, 10), 5e3).action(async (options) => {
1670
+ const stopCommand = new Command("stop").description("Stop a running HTTP one-mcp server").option("--id <id>", "Target server ID from the runtime registry").option("--host <host>", "Target runtime host").option("--port <port>", "Target runtime port", (value) => Number.parseInt(value, 10)).option("-c, --config <path>", "Reserved for future config-based targeting support").option("--force", "Skip server ID verification against the /health response", false).option("-j, --json", "Output as JSON", false).option("--timeout <ms>", "Maximum time to wait for shutdown completion", (value) => Number.parseInt(value, 10), 5e3).action(async (options) => {
1726
1671
  try {
1727
1672
  if (options.config) console.error("Warning: --config is not used yet; runtime resolution uses the persisted registry.");
1728
1673
  const result = await new StopServerService().stop({
1729
1674
  serverId: options.id,
1730
1675
  host: options.host,
1731
1676
  port: options.port,
1732
- token: options.token,
1733
1677
  force: options.force,
1734
1678
  timeoutMs: options.timeout
1735
1679
  });
@@ -1748,7 +1692,6 @@ const stopCommand = new Command("stop").description("Stop a running HTTP one-mcp
1748
1692
  process.exit(1);
1749
1693
  }
1750
1694
  });
1751
-
1752
1695
  //#endregion
1753
1696
  //#region src/cli.ts
1754
1697
  /**
@@ -1797,6 +1740,5 @@ main().catch((error) => {
1797
1740
  console.error(`Fatal error: ${error instanceof Error ? error.message : error}`);
1798
1741
  process.exit(1);
1799
1742
  });
1800
-
1801
1743
  //#endregion
1802
- export { };
1744
+ export {};
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
- const require_src = require('./src-BXzji7SM.cjs');
2
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_src = require("./src-Cc3lEKJ5.cjs");
3
3
  exports.ConfigFetcherService = require_src.ConfigFetcherService;
4
4
  exports.DefinitionsCacheService = require_src.DefinitionsCacheService;
5
5
  exports.DescribeToolsTool = require_src.DescribeToolsTool;
@@ -18,4 +18,4 @@ exports.createServer = require_src.createServer;
18
18
  exports.createSessionServer = require_src.createSessionServer;
19
19
  exports.findConfigFile = require_src.findConfigFile;
20
20
  exports.generateServerId = require_src.generateServerId;
21
- exports.initializeSharedServices = require_src.initializeSharedServices;
21
+ exports.initializeSharedServices = require_src.initializeSharedServices;
package/dist/index.d.cts CHANGED
@@ -1,8 +1,6 @@
1
1
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
2
  import { CallToolResult, GetPromptResult, ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
3
-
4
3
  //#region src/types/index.d.ts
5
-
6
4
  /**
7
5
  * Tool definition for MCP
8
6
  * @property name - The unique name of the tool
@@ -1132,7 +1130,6 @@ declare class RuntimeStateService implements RuntimeStateManager {
1132
1130
  * @property serverId - Explicit one-mcp server identifier to stop
1133
1131
  * @property host - Host fallback for runtime lookup
1134
1132
  * @property port - Port fallback for runtime lookup
1135
- * @property token - Optional shutdown token override
1136
1133
  * @property force - Skip server ID verification against /health when true
1137
1134
  * @property timeoutMs - Maximum time to wait for shutdown completion
1138
1135
  */
@@ -1140,7 +1137,6 @@ interface StopServerRequest {
1140
1137
  serverId?: string;
1141
1138
  host?: string;
1142
1139
  port?: number;
1143
- token?: string;
1144
1140
  force?: boolean;
1145
1141
  timeoutMs?: number;
1146
1142
  }
@@ -1186,14 +1182,7 @@ declare class StopServerService {
1186
1182
  * @returns Reachability status and optional payload
1187
1183
  */
1188
1184
  private fetchHealth;
1189
- /**
1190
- * Send authenticated shutdown request to the admin endpoint.
1191
- * @param runtime - Runtime to stop
1192
- * @param shutdownToken - Bearer token for the admin endpoint
1193
- * @param timeoutMs - Request timeout in milliseconds
1194
- * @returns Parsed shutdown response payload
1195
- */
1196
- private requestShutdown;
1185
+ private requestLocalShutdown;
1197
1186
  /**
1198
1187
  * Poll until the target runtime is no longer reachable.
1199
1188
  * @param runtime - Runtime expected to stop
package/dist/index.d.mts CHANGED
@@ -3,7 +3,6 @@ import { CallToolResult, GetPromptResult, ReadResourceResult } from "@modelconte
3
3
  import { z } from "zod";
4
4
 
5
5
  //#region src/types/index.d.ts
6
-
7
6
  /**
8
7
  * Tool definition for MCP
9
8
  * @property name - The unique name of the tool
@@ -1133,7 +1132,6 @@ declare class RuntimeStateService implements RuntimeStateManager {
1133
1132
  * @property serverId - Explicit one-mcp server identifier to stop
1134
1133
  * @property host - Host fallback for runtime lookup
1135
1134
  * @property port - Port fallback for runtime lookup
1136
- * @property token - Optional shutdown token override
1137
1135
  * @property force - Skip server ID verification against /health when true
1138
1136
  * @property timeoutMs - Maximum time to wait for shutdown completion
1139
1137
  */
@@ -1141,7 +1139,6 @@ interface StopServerRequest {
1141
1139
  serverId?: string;
1142
1140
  host?: string;
1143
1141
  port?: number;
1144
- token?: string;
1145
1142
  force?: boolean;
1146
1143
  timeoutMs?: number;
1147
1144
  }
@@ -1187,14 +1184,7 @@ declare class StopServerService {
1187
1184
  * @returns Reachability status and optional payload
1188
1185
  */
1189
1186
  private fetchHealth;
1190
- /**
1191
- * Send authenticated shutdown request to the admin endpoint.
1192
- * @param runtime - Runtime to stop
1193
- * @param shutdownToken - Bearer token for the admin endpoint
1194
- * @param timeoutMs - Request timeout in milliseconds
1195
- * @returns Parsed shutdown response payload
1196
- */
1197
- private requestShutdown;
1187
+ private requestLocalShutdown;
1198
1188
  /**
1199
1189
  * Poll until the target runtime is no longer reachable.
1200
1190
  * @param runtime - Runtime expected to stop
package/dist/index.mjs CHANGED
@@ -1,3 +1,2 @@
1
- import { _ as DefinitionsCacheService, a as SseTransportHandler, b as ConfigFetcherService, c as createServer, f as UseToolTool, g as McpClientManagerService, h as SkillService, i as StdioTransportHandler, l as createSessionServer, m as DescribeToolsTool, n as RuntimeStateService, o as HttpTransportHandler, p as SearchListToolsTool, r as StdioHttpTransportHandler, s as TRANSPORT_MODE, t as StopServerService, u as initializeSharedServices, v as generateServerId, y as findConfigFile } from "./src-QphCJFbi.mjs";
2
-
3
- export { ConfigFetcherService, DefinitionsCacheService, DescribeToolsTool, HttpTransportHandler, McpClientManagerService, RuntimeStateService, SearchListToolsTool, SkillService, SseTransportHandler, StdioHttpTransportHandler, StdioTransportHandler, StopServerService, TRANSPORT_MODE, UseToolTool, createServer, createSessionServer, findConfigFile, generateServerId, initializeSharedServices };
1
+ import { _ as DefinitionsCacheService, a as SseTransportHandler, b as ConfigFetcherService, c as createServer, f as UseToolTool, g as McpClientManagerService, h as SkillService, i as StdioTransportHandler, l as createSessionServer, m as DescribeToolsTool, n as RuntimeStateService, o as HttpTransportHandler, p as SearchListToolsTool, r as StdioHttpTransportHandler, s as TRANSPORT_MODE, t as StopServerService, u as initializeSharedServices, v as generateServerId, y as findConfigFile } from "./src-BhNZiv0s.mjs";
2
+ export { ConfigFetcherService, DefinitionsCacheService, DescribeToolsTool, HttpTransportHandler, McpClientManagerService, RuntimeStateService, SearchListToolsTool, SkillService, SseTransportHandler, StdioHttpTransportHandler, StdioTransportHandler, StopServerService, TRANSPORT_MODE, UseToolTool, createServer, createSessionServer, findConfigFile, generateServerId, initializeSharedServices };