@agiflowai/one-mcp 0.3.6 → 0.3.8

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_http = require('./http-CRloqAb_.cjs');
2
+ const require_http = require('./http-pwzeCOpM.cjs');
3
3
  let node_fs_promises = require("node:fs/promises");
4
4
  let node_path = require("node:path");
5
5
  let liquidjs = require("liquidjs");
@@ -381,7 +381,7 @@ const useToolCommand = new commander.Command("use-tool").description("Execute an
381
381
  let toolArgs = {};
382
382
  try {
383
383
  toolArgs = JSON.parse(options.args);
384
- } catch (error) {
384
+ } catch (_error) {
385
385
  console.error("Error: Invalid JSON in --args");
386
386
  process.exit(1);
387
387
  }
@@ -524,7 +524,7 @@ var mcp_config_yaml_default = "# MCP Server Configuration\n# This file configure
524
524
 
525
525
  //#endregion
526
526
  //#region src/templates/mcp-config.json?raw
527
- 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\": [\n \"/path/to/mcp-server/build/index.js\"\n ],\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";
527
+ 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";
528
528
 
529
529
  //#endregion
530
530
  //#region src/commands/init.ts
@@ -1051,7 +1051,7 @@ const prefetchCommand = new commander.Command("prefetch").description("Pre-downl
1051
1051
 
1052
1052
  //#endregion
1053
1053
  //#region package.json
1054
- var version = "0.3.5";
1054
+ var version = "0.3.7";
1055
1055
 
1056
1056
  //#endregion
1057
1057
  //#region src/cli.ts
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as SkillService, c as ConfigFetcherService, i as createServer, n as SseTransportHandler, o as findConfigFile, r as StdioTransportHandler, s as McpClientManagerService, t as HttpTransportHandler } from "./http-DV3-1Emn.mjs";
2
+ import { c as findConfigFile, i as createServer, l as McpClientManagerService, n as SseTransportHandler, r as StdioTransportHandler, s as SkillService, t as HttpTransportHandler, u as ConfigFetcherService } from "./http-BDeLFFzK.mjs";
3
3
  import { writeFile } from "node:fs/promises";
4
4
  import { resolve } from "node:path";
5
5
  import { Liquid } from "liquidjs";
@@ -381,7 +381,7 @@ const useToolCommand = new Command("use-tool").description("Execute an MCP tool
381
381
  let toolArgs = {};
382
382
  try {
383
383
  toolArgs = JSON.parse(options.args);
384
- } catch (error) {
384
+ } catch (_error) {
385
385
  console.error("Error: Invalid JSON in --args");
386
386
  process.exit(1);
387
387
  }
@@ -524,7 +524,7 @@ var mcp_config_yaml_default = "# MCP Server Configuration\n# This file configure
524
524
 
525
525
  //#endregion
526
526
  //#region src/templates/mcp-config.json?raw
527
- 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\": [\n \"/path/to/mcp-server/build/index.js\"\n ],\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";
527
+ 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";
528
528
 
529
529
  //#endregion
530
530
  //#region src/commands/init.ts
@@ -1051,7 +1051,7 @@ const prefetchCommand = new Command("prefetch").description("Pre-download packag
1051
1051
 
1052
1052
  //#endregion
1053
1053
  //#region package.json
1054
- var version = "0.3.5";
1054
+ var version = "0.3.7";
1055
1055
 
1056
1056
  //#endregion
1057
1057
  //#region src/cli.ts
@@ -136,7 +136,7 @@ function validateUrlSecurity(url, security) {
136
136
  let parsedUrl;
137
137
  try {
138
138
  parsedUrl = new URL(url);
139
- } catch (error) {
139
+ } catch (_error) {
140
140
  throw new Error(`Invalid URL format: ${url}`);
141
141
  }
142
142
  const protocol = parsedUrl.protocol.replace(":", "");
@@ -538,7 +538,7 @@ var RemoteConfigCacheService = class {
538
538
  return true;
539
539
  }
540
540
  return false;
541
- } catch (error) {
541
+ } catch (_error) {
542
542
  await unlink(filePath).catch(() => {});
543
543
  return true;
544
544
  }
@@ -1468,7 +1468,7 @@ var SkillService = class {
1468
1468
  recursive: true,
1469
1469
  signal
1470
1470
  });
1471
- for await (const event of watcher) if (event.filename && event.filename.endsWith("SKILL.md")) {
1471
+ for await (const event of watcher) if (event.filename?.endsWith("SKILL.md")) {
1472
1472
  this.clearCache();
1473
1473
  this.onCacheInvalidated?.();
1474
1474
  }
@@ -1832,7 +1832,7 @@ var DescribeToolsTool = class DescribeToolsTool {
1832
1832
  serverToolsMap.set(client.serverName, filteredTools);
1833
1833
  for (const tool of filteredTools) {
1834
1834
  if (!toolToServers.has(tool.name)) toolToServers.set(tool.name, []);
1835
- toolToServers.get(tool.name).push(client.serverName);
1835
+ toolToServers.get(tool.name)?.push(client.serverName);
1836
1836
  }
1837
1837
  } catch (error) {
1838
1838
  console.error(`Failed to list tools from ${client.serverName}:`, error);
@@ -1962,7 +1962,7 @@ var DescribeToolsTool = class DescribeToolsTool {
1962
1962
  serverToolsMap.set(client.serverName, typedTools);
1963
1963
  for (const tool of typedTools) {
1964
1964
  if (!toolToServers.has(tool.name)) toolToServers.set(tool.name, []);
1965
- toolToServers.get(tool.name).push(client.serverName);
1965
+ toolToServers.get(tool.name)?.push(client.serverName);
1966
1966
  }
1967
1967
  } catch (error) {
1968
1968
  console.error(`Failed to list tools from ${client.serverName}:`, error);
@@ -2266,7 +2266,7 @@ IMPORTANT: Only use tools discovered from describe_tools with id="${this.serverI
2266
2266
  }],
2267
2267
  isError: true
2268
2268
  };
2269
- if (client$1.toolBlacklist && client$1.toolBlacklist.includes(actualToolName)) return {
2269
+ if (client$1.toolBlacklist?.includes(actualToolName)) return {
2270
2270
  content: [{
2271
2271
  type: "text",
2272
2272
  text: `Tool "${actualToolName}" is blacklisted on server "${serverName}" and cannot be executed.`
@@ -2288,7 +2288,7 @@ IMPORTANT: Only use tools discovered from describe_tools with id="${this.serverI
2288
2288
  const matchingServers = [];
2289
2289
  const results = await Promise.all(clients.map(async (client$1) => {
2290
2290
  try {
2291
- if (client$1.toolBlacklist && client$1.toolBlacklist.includes(actualToolName)) return null;
2291
+ if (client$1.toolBlacklist?.includes(actualToolName)) return null;
2292
2292
  if ((await client$1.listTools()).some((t) => t.name === actualToolName)) return client$1.serverName;
2293
2293
  } catch (error) {
2294
2294
  console.error(`Failed to list tools from ${client$1.serverName}:`, error);
@@ -2837,4 +2837,4 @@ var HttpTransportHandler = class {
2837
2837
  };
2838
2838
 
2839
2839
  //#endregion
2840
- export { SkillService as a, ConfigFetcherService as c, createServer as i, SseTransportHandler as n, findConfigFile as o, StdioTransportHandler as r, McpClientManagerService as s, HttpTransportHandler as t };
2840
+ export { UseToolTool as a, findConfigFile as c, createServer as i, McpClientManagerService as l, SseTransportHandler as n, DescribeToolsTool as o, StdioTransportHandler as r, SkillService as s, HttpTransportHandler as t, ConfigFetcherService as u };
@@ -165,7 +165,7 @@ function validateUrlSecurity(url, security) {
165
165
  let parsedUrl;
166
166
  try {
167
167
  parsedUrl = new URL(url);
168
- } catch (error) {
168
+ } catch (_error) {
169
169
  throw new Error(`Invalid URL format: ${url}`);
170
170
  }
171
171
  const protocol = parsedUrl.protocol.replace(":", "");
@@ -567,7 +567,7 @@ var RemoteConfigCacheService = class {
567
567
  return true;
568
568
  }
569
569
  return false;
570
- } catch (error) {
570
+ } catch (_error) {
571
571
  await (0, node_fs_promises.unlink)(filePath).catch(() => {});
572
572
  return true;
573
573
  }
@@ -1497,7 +1497,7 @@ var SkillService = class {
1497
1497
  recursive: true,
1498
1498
  signal
1499
1499
  });
1500
- for await (const event of watcher) if (event.filename && event.filename.endsWith("SKILL.md")) {
1500
+ for await (const event of watcher) if (event.filename?.endsWith("SKILL.md")) {
1501
1501
  this.clearCache();
1502
1502
  this.onCacheInvalidated?.();
1503
1503
  }
@@ -1861,7 +1861,7 @@ var DescribeToolsTool = class DescribeToolsTool {
1861
1861
  serverToolsMap.set(client.serverName, filteredTools);
1862
1862
  for (const tool of filteredTools) {
1863
1863
  if (!toolToServers.has(tool.name)) toolToServers.set(tool.name, []);
1864
- toolToServers.get(tool.name).push(client.serverName);
1864
+ toolToServers.get(tool.name)?.push(client.serverName);
1865
1865
  }
1866
1866
  } catch (error) {
1867
1867
  console.error(`Failed to list tools from ${client.serverName}:`, error);
@@ -1991,7 +1991,7 @@ var DescribeToolsTool = class DescribeToolsTool {
1991
1991
  serverToolsMap.set(client.serverName, typedTools);
1992
1992
  for (const tool of typedTools) {
1993
1993
  if (!toolToServers.has(tool.name)) toolToServers.set(tool.name, []);
1994
- toolToServers.get(tool.name).push(client.serverName);
1994
+ toolToServers.get(tool.name)?.push(client.serverName);
1995
1995
  }
1996
1996
  } catch (error) {
1997
1997
  console.error(`Failed to list tools from ${client.serverName}:`, error);
@@ -2295,7 +2295,7 @@ IMPORTANT: Only use tools discovered from describe_tools with id="${this.serverI
2295
2295
  }],
2296
2296
  isError: true
2297
2297
  };
2298
- if (client$1.toolBlacklist && client$1.toolBlacklist.includes(actualToolName)) return {
2298
+ if (client$1.toolBlacklist?.includes(actualToolName)) return {
2299
2299
  content: [{
2300
2300
  type: "text",
2301
2301
  text: `Tool "${actualToolName}" is blacklisted on server "${serverName}" and cannot be executed.`
@@ -2317,7 +2317,7 @@ IMPORTANT: Only use tools discovered from describe_tools with id="${this.serverI
2317
2317
  const matchingServers = [];
2318
2318
  const results = await Promise.all(clients.map(async (client$1) => {
2319
2319
  try {
2320
- if (client$1.toolBlacklist && client$1.toolBlacklist.includes(actualToolName)) return null;
2320
+ if (client$1.toolBlacklist?.includes(actualToolName)) return null;
2321
2321
  if ((await client$1.listTools()).some((t) => t.name === actualToolName)) return client$1.serverName;
2322
2322
  } catch (error) {
2323
2323
  console.error(`Failed to list tools from ${client$1.serverName}:`, error);
@@ -2872,6 +2872,12 @@ Object.defineProperty(exports, 'ConfigFetcherService', {
2872
2872
  return ConfigFetcherService;
2873
2873
  }
2874
2874
  });
2875
+ Object.defineProperty(exports, 'DescribeToolsTool', {
2876
+ enumerable: true,
2877
+ get: function () {
2878
+ return DescribeToolsTool;
2879
+ }
2880
+ });
2875
2881
  Object.defineProperty(exports, 'HttpTransportHandler', {
2876
2882
  enumerable: true,
2877
2883
  get: function () {
@@ -2902,6 +2908,12 @@ Object.defineProperty(exports, 'StdioTransportHandler', {
2902
2908
  return StdioTransportHandler;
2903
2909
  }
2904
2910
  });
2911
+ Object.defineProperty(exports, 'UseToolTool', {
2912
+ enumerable: true,
2913
+ get: function () {
2914
+ return UseToolTool;
2915
+ }
2916
+ });
2905
2917
  Object.defineProperty(exports, '__toESM', {
2906
2918
  enumerable: true,
2907
2919
  get: function () {
package/dist/index.cjs CHANGED
@@ -1,6 +1,11 @@
1
- const require_http = require('./http-CRloqAb_.cjs');
1
+ const require_http = require('./http-pwzeCOpM.cjs');
2
2
 
3
+ exports.ConfigFetcherService = require_http.ConfigFetcherService;
4
+ exports.DescribeToolsTool = require_http.DescribeToolsTool;
3
5
  exports.HttpTransportHandler = require_http.HttpTransportHandler;
6
+ exports.McpClientManagerService = require_http.McpClientManagerService;
7
+ exports.SkillService = require_http.SkillService;
4
8
  exports.SseTransportHandler = require_http.SseTransportHandler;
5
9
  exports.StdioTransportHandler = require_http.StdioTransportHandler;
10
+ exports.UseToolTool = require_http.UseToolTool;
6
11
  exports.createServer = require_http.createServer;
package/dist/index.d.cts CHANGED
@@ -341,4 +341,455 @@ declare class HttpTransportHandler implements HttpTransportHandler$1 {
341
341
  getHost(): string;
342
342
  }
343
343
  //#endregion
344
- export { HttpTransportHandler, McpClientConnection, McpHttpConfig, McpPromptInfo, McpResourceInfo, McpServerConfig, McpServerTransportConfig, McpServerTransportType, McpSseConfig, McpStdioConfig, McpToolInfo, PromptConfig, PromptSkillConfig, RemoteMcpConfiguration, type ServerOptions, Skill, SkillMetadata, SkillsConfig, SseTransportHandler, StdioTransportHandler, TRANSPORT_MODE, Tool, ToolDefinition, TransportConfig, TransportHandler, TransportMode, createServer };
344
+ //#region src/services/McpClientManagerService.d.ts
345
+ /**
346
+ * Service for managing MCP client connections to remote servers
347
+ */
348
+ declare class McpClientManagerService {
349
+ private clients;
350
+ constructor();
351
+ /**
352
+ * Cleanup all resources on exit (child processes)
353
+ */
354
+ private cleanupOnExit;
355
+ /**
356
+ * Connect to an MCP server based on its configuration with timeout
357
+ * Uses the timeout from server config, falling back to default (30s)
358
+ */
359
+ connectToServer(serverName: string, config: McpServerConfig): Promise<void>;
360
+ /**
361
+ * Perform the actual connection to MCP server
362
+ */
363
+ private performConnection;
364
+ private connectStdioClient;
365
+ private connectHttpClient;
366
+ private connectSseClient;
367
+ /**
368
+ * Get a connected client by server name
369
+ */
370
+ getClient(serverName: string): McpClientConnection | undefined;
371
+ /**
372
+ * Get all connected clients
373
+ */
374
+ getAllClients(): McpClientConnection[];
375
+ /**
376
+ * Disconnect from a specific server
377
+ */
378
+ disconnectServer(serverName: string): Promise<void>;
379
+ /**
380
+ * Disconnect from all servers
381
+ */
382
+ disconnectAll(): Promise<void>;
383
+ /**
384
+ * Check if a server is connected
385
+ */
386
+ isConnected(serverName: string): boolean;
387
+ }
388
+ //#endregion
389
+ //#region src/services/SkillService.d.ts
390
+ /**
391
+ * Service for loading and managing skills from configured skill directories.
392
+ *
393
+ * Skills are markdown files with YAML frontmatter that can be invoked via
394
+ * the skill__ prefix in describe_tools and use_tool.
395
+ *
396
+ * Skills are only enabled when explicitly configured via the `skills.paths` array
397
+ * in the MCP config.
398
+ *
399
+ * @example
400
+ * // Config with skills enabled:
401
+ * // skills:
402
+ * // paths:
403
+ * // - ".claude/skills"
404
+ * // - "/absolute/path/to/skills"
405
+ *
406
+ * const skillService = new SkillService('/project/root', ['.claude/skills']);
407
+ * const skills = await skillService.getSkills();
408
+ */
409
+ declare class SkillService {
410
+ private cwd;
411
+ private skillPaths;
412
+ private cachedSkills;
413
+ private skillsByName;
414
+ /** Active file watchers for skill directories */
415
+ private watchers;
416
+ /** Callback invoked when cache is invalidated due to file changes */
417
+ private onCacheInvalidated?;
418
+ /**
419
+ * Creates a new SkillService instance
420
+ * @param cwd - Current working directory for resolving relative paths
421
+ * @param skillPaths - Array of paths to skills directories
422
+ * @param options - Optional configuration
423
+ * @param options.onCacheInvalidated - Callback invoked when cache is invalidated due to file changes
424
+ */
425
+ constructor(cwd: string, skillPaths: string[], options?: {
426
+ onCacheInvalidated?: () => void;
427
+ });
428
+ /**
429
+ * Get all available skills from configured directories.
430
+ * Results are cached after first load.
431
+ *
432
+ * Skills from earlier entries in the config take precedence over
433
+ * skills with the same name from later entries.
434
+ *
435
+ * @returns Array of loaded skills
436
+ * @throws SkillLoadError if a critical error occurs during loading
437
+ */
438
+ getSkills(): Promise<Skill[]>;
439
+ /**
440
+ * Get a specific skill by name with O(1) lookup from cache.
441
+ * @param name - The skill name (without skill__ prefix)
442
+ * @returns The skill if found, undefined otherwise
443
+ */
444
+ getSkill(name: string): Promise<Skill | undefined>;
445
+ /**
446
+ * Clears the cached skills to force a fresh reload on the next getSkills() or getSkill() call.
447
+ * Use this when skill files have been modified on disk.
448
+ */
449
+ clearCache(): void;
450
+ /**
451
+ * Starts watching skill directories for changes to SKILL.md files.
452
+ * When changes are detected, the cache is automatically invalidated.
453
+ *
454
+ * Uses Node.js fs.watch with recursive option for efficient directory monitoring.
455
+ * Only invalidates cache when SKILL.md files are modified.
456
+ *
457
+ * @example
458
+ * const skillService = new SkillService(cwd, skillPaths, {
459
+ * onCacheInvalidated: () => console.log('Skills cache invalidated')
460
+ * });
461
+ * await skillService.startWatching();
462
+ */
463
+ startWatching(): Promise<void>;
464
+ /**
465
+ * Stops all active file watchers.
466
+ * Should be called when the service is being disposed.
467
+ */
468
+ stopWatching(): void;
469
+ /**
470
+ * Watches a directory for changes to SKILL.md files.
471
+ * @param dirPath - Directory path to watch
472
+ * @param signal - AbortSignal to stop watching
473
+ */
474
+ private watchDirectory;
475
+ /**
476
+ * Load skills from a directory.
477
+ * Supports both flat structure (SKILL.md) and nested structure (name/SKILL.md).
478
+ *
479
+ * @param dirPath - Path to the skills directory
480
+ * @param location - Whether this is a 'project' or 'user' skill directory
481
+ * @returns Array of successfully loaded skills (skips invalid skills)
482
+ * @throws SkillLoadError if there's a critical I/O error
483
+ *
484
+ * @example
485
+ * // Load skills from project directory
486
+ * const skills = await this.loadSkillsFromDirectory('/path/to/.claude/skills', 'project');
487
+ * // Returns: [{ name: 'pdf', description: '...', location: 'project', ... }]
488
+ */
489
+ private loadSkillsFromDirectory;
490
+ /**
491
+ * Load a single skill file and parse its frontmatter.
492
+ * Supports multi-line YAML values using literal (|) and folded (>) block scalars.
493
+ *
494
+ * @param filePath - Path to the SKILL.md file
495
+ * @param location - Whether this is a 'project' or 'user' skill
496
+ * @returns The loaded skill, or null if the file is invalid (missing required frontmatter)
497
+ * @throws SkillLoadError if there's an I/O error reading the file
498
+ *
499
+ * @example
500
+ * // Load a skill from a file
501
+ * const skill = await this.loadSkillFile('/path/to/pdf/SKILL.md', 'project');
502
+ * // Returns: { name: 'pdf', description: 'PDF skill', location: 'project', content: '...', basePath: '/path/to/pdf' }
503
+ * // Returns null if frontmatter is missing name or description
504
+ */
505
+ private loadSkillFile;
506
+ }
507
+ //#endregion
508
+ //#region src/tools/DescribeToolsTool.d.ts
509
+ /**
510
+ * Input schema for the DescribeToolsTool
511
+ * @property toolNames - Array of tool names to get detailed information about
512
+ */
513
+ interface DescribeToolsToolInput {
514
+ toolNames: string[];
515
+ }
516
+ /**
517
+ * DescribeToolsTool provides progressive disclosure of MCP tools and skills.
518
+ *
519
+ * This tool lists available tools from all connected MCP servers and skills
520
+ * from the configured skills directories. Users can query for specific tools
521
+ * or skills to get detailed input schemas and descriptions.
522
+ *
523
+ * Tool naming conventions:
524
+ * - Unique tools: use plain name (e.g., "browser_click")
525
+ * - Clashing tools: use serverName__toolName format (e.g., "playwright__click")
526
+ * - Skills: use skill__skillName format (e.g., "skill__pdf")
527
+ *
528
+ * @example
529
+ * const tool = new DescribeToolsTool(clientManager, skillService);
530
+ * const definition = await tool.getDefinition();
531
+ * const result = await tool.execute({ toolNames: ['browser_click', 'skill__pdf'] });
532
+ */
533
+ declare class DescribeToolsTool implements Tool<DescribeToolsToolInput> {
534
+ static readonly TOOL_NAME = "describe_tools";
535
+ private clientManager;
536
+ private skillService;
537
+ private readonly liquid;
538
+ /** Cache for auto-detected skills from prompt front-matter */
539
+ private autoDetectedSkillsCache;
540
+ /** Unique server identifier for this one-mcp instance */
541
+ private serverId;
542
+ /**
543
+ * Creates a new DescribeToolsTool instance
544
+ * @param clientManager - The MCP client manager for accessing remote servers
545
+ * @param skillService - Optional skill service for loading skills
546
+ * @param serverId - Unique server identifier for this one-mcp instance
547
+ */
548
+ constructor(clientManager: McpClientManagerService, skillService?: SkillService, serverId?: string);
549
+ /**
550
+ * Clears the cached auto-detected skills from prompt front-matter.
551
+ * Use this when prompt configurations may have changed or when
552
+ * the skill service cache is invalidated.
553
+ */
554
+ clearAutoDetectedSkillsCache(): void;
555
+ /**
556
+ * Detects and caches skills from prompt front-matter across all connected MCP servers.
557
+ * Fetches all prompts and checks their content for YAML front-matter with name/description.
558
+ * Results are cached to avoid repeated fetches.
559
+ *
560
+ * Error Handling Strategy:
561
+ * - Errors are logged to stderr but do not fail the overall detection process
562
+ * - This ensures partial results are returned even if some servers/prompts fail
563
+ * - Common failure reasons: server temporarily unavailable, prompt requires arguments,
564
+ * network timeout, or server doesn't support listPrompts
565
+ * - Errors are prefixed with [skill-detection] for easy filtering in logs
566
+ *
567
+ * @returns Array of auto-detected skills from prompt front-matter
568
+ */
569
+ private detectSkillsFromPromptFrontMatter;
570
+ /**
571
+ * Collects skills derived from prompt configurations across all connected MCP servers.
572
+ * Includes both explicitly configured prompts and auto-detected skills from front-matter.
573
+ *
574
+ * @returns Array of skill template data derived from prompts
575
+ */
576
+ private collectPromptSkills;
577
+ /**
578
+ * Finds a prompt-based skill by name from all connected MCP servers.
579
+ * Searches both explicitly configured prompts and auto-detected skills from front-matter.
580
+ *
581
+ * @param skillName - The skill name to search for
582
+ * @returns Object with serverName, promptName, and skill config, or undefined if not found
583
+ */
584
+ private findPromptSkill;
585
+ /**
586
+ * Retrieves skill content from a prompt-based skill configuration.
587
+ * Fetches the prompt from the MCP server and extracts text content.
588
+ * Handles both explicitly configured prompts and auto-detected skills from front-matter.
589
+ *
590
+ * @param skillName - The skill name being requested
591
+ * @returns SkillDescription if found and successfully fetched, undefined otherwise
592
+ */
593
+ private getPromptSkillContent;
594
+ /**
595
+ * Builds the combined toolkit description using a single Liquid template.
596
+ *
597
+ * Collects all tools from connected MCP servers and all skills, then renders
598
+ * them together using the toolkit-description.liquid template.
599
+ *
600
+ * Tool names are prefixed with serverName__ when the same tool exists
601
+ * on multiple servers. Skill names are prefixed with skill__ when they
602
+ * clash with MCP tools or other skills.
603
+ *
604
+ * @returns Object with rendered description and set of all tool names
605
+ */
606
+ private buildToolkitDescription;
607
+ /**
608
+ * Gets the tool definition including available tools and skills in a unified format.
609
+ *
610
+ * The definition includes:
611
+ * - All MCP tools from connected servers
612
+ * - All available skills (file-based and prompt-based)
613
+ * - Unified instructions for querying capability details
614
+ *
615
+ * Tool names are prefixed with serverName__ when clashing.
616
+ * Skill names are prefixed with skill__ when clashing.
617
+ *
618
+ * @returns Tool definition with description and input schema
619
+ */
620
+ getDefinition(): Promise<ToolDefinition>;
621
+ /**
622
+ * Executes tool description lookup for the requested tool and skill names.
623
+ *
624
+ * Handles three types of lookups:
625
+ * 1. skill__name - Returns skill information from SkillService
626
+ * 2. serverName__toolName - Returns tool from specific server
627
+ * 3. plainToolName - Returns tool(s) from all servers (multiple if clashing)
628
+ *
629
+ * @param input - Object containing toolNames array
630
+ * @returns CallToolResult with tool/skill descriptions or error
631
+ */
632
+ execute(input: DescribeToolsToolInput): Promise<CallToolResult>;
633
+ }
634
+ //#endregion
635
+ //#region src/tools/UseToolTool.d.ts
636
+ /**
637
+ * Input schema for UseToolTool
638
+ * @property toolName - Name of the tool or skill to execute
639
+ * @property toolArgs - Arguments to pass to the tool (from describe_tools schema)
640
+ */
641
+ interface UseToolToolInput {
642
+ toolName: string;
643
+ toolArgs?: Record<string, unknown>;
644
+ }
645
+ /**
646
+ * UseToolTool executes MCP tools and skills with proper error handling.
647
+ *
648
+ * This tool supports three invocation patterns:
649
+ * 1. skill__skillName - Invokes a skill from the configured skills directory
650
+ * 2. serverName__toolName - Invokes a tool on a specific MCP server
651
+ * 3. plainToolName - Searches all servers for a unique tool match
652
+ *
653
+ * @example
654
+ * const tool = new UseToolTool(clientManager, skillService);
655
+ * await tool.execute({ toolName: 'skill__pdf' }); // Invoke a skill
656
+ * await tool.execute({ toolName: 'playwright__browser_click', toolArgs: { ref: 'btn' } });
657
+ */
658
+ declare class UseToolTool implements Tool<UseToolToolInput> {
659
+ static readonly TOOL_NAME = "use_tool";
660
+ private clientManager;
661
+ private skillService;
662
+ /** Unique server identifier for this one-mcp instance */
663
+ private serverId;
664
+ /**
665
+ * Creates a new UseToolTool instance
666
+ * @param clientManager - The MCP client manager for accessing remote servers
667
+ * @param skillService - Optional skill service for loading and executing skills
668
+ * @param serverId - Unique server identifier for this one-mcp instance
669
+ */
670
+ constructor(clientManager: McpClientManagerService, skillService?: SkillService, serverId?: string);
671
+ /**
672
+ * Returns the MCP tool definition with name, description, and input schema.
673
+ *
674
+ * The definition describes how to use this tool to execute MCP tools or skills,
675
+ * including the skill__ prefix format for skill invocations.
676
+ *
677
+ * @returns The tool definition conforming to MCP spec
678
+ */
679
+ getDefinition(): ToolDefinition;
680
+ /**
681
+ * Returns guidance message for skill invocation.
682
+ *
683
+ * Skills are not executed via use_tool - they provide instructions that should
684
+ * be followed directly. This method returns a message directing users to use
685
+ * describe_tools to get the skill details and follow its instructions.
686
+ *
687
+ * @param skill - The skill that was requested
688
+ * @returns CallToolResult with guidance message
689
+ */
690
+ private executeSkill;
691
+ /**
692
+ * Finds a prompt-based skill by name from all connected MCP servers.
693
+ *
694
+ * @param skillName - The skill name to search for
695
+ * @returns PromptSkillMatch if found, undefined otherwise
696
+ */
697
+ private findPromptSkill;
698
+ /**
699
+ * Returns guidance message for prompt-based skill invocation.
700
+ *
701
+ * @param promptSkill - The prompt skill match that was found
702
+ * @returns CallToolResult with guidance message
703
+ */
704
+ private executePromptSkill;
705
+ /**
706
+ * Executes a tool or skill based on the provided input.
707
+ *
708
+ * Handles three invocation patterns:
709
+ * 1. skill__skillName - Routes to skill execution via SkillService
710
+ * 2. serverName__toolName - Routes to specific MCP server
711
+ * 3. plainToolName - Searches all servers for unique match
712
+ *
713
+ * Edge cases:
714
+ * - Returns error if skill not found when using skill__ prefix
715
+ * - Returns error if tool is blacklisted on target server
716
+ * - Returns disambiguation message if tool exists on multiple servers
717
+ *
718
+ * @param input - The tool/skill name and optional arguments
719
+ * @returns CallToolResult with execution output or error
720
+ */
721
+ execute(input: UseToolToolInput): Promise<CallToolResult>;
722
+ }
723
+ //#endregion
724
+ //#region src/services/ConfigFetcherService.d.ts
725
+ interface ConfigFetcherOptions {
726
+ configFilePath?: string;
727
+ cacheTtlMs?: number;
728
+ useCache?: boolean;
729
+ remoteCacheTtlMs?: number;
730
+ }
731
+ /**
732
+ * Service for fetching and caching MCP server configurations from local file and remote sources
733
+ * Supports merging multiple remote configs with local config
734
+ */
735
+ declare class ConfigFetcherService {
736
+ private configFilePath?;
737
+ private cacheTtlMs;
738
+ private cachedConfig;
739
+ private lastFetchTime;
740
+ private remoteConfigCache;
741
+ constructor(options: ConfigFetcherOptions);
742
+ /**
743
+ * Fetch MCP configuration from local file and remote sources with caching
744
+ * Merges remote configs with local config based on merge strategy
745
+ * @param forceRefresh - Force reload from source, bypassing cache
746
+ */
747
+ fetchConfiguration(forceRefresh?: boolean): Promise<RemoteMcpConfiguration>;
748
+ /**
749
+ * Load raw configuration data from a local file (supports JSON and YAML)
750
+ * Returns unparsed config data to allow access to remoteConfigs
751
+ */
752
+ private loadRawConfigFromFile;
753
+ /**
754
+ * Parse raw config data using Zod schema
755
+ * Filters out remoteConfigs to avoid including them in the final config
756
+ */
757
+ private parseConfig;
758
+ /**
759
+ * Load configuration from a remote URL with caching
760
+ *
761
+ * SECURITY NOTE: This method fetches remote configs based on URLs from the local config file.
762
+ * This is intentional and safe because:
763
+ * 1. URLs are user-controlled via their local config file (not external input)
764
+ * 2. SSRF protection validates URLs before fetching (blocks private IPs, enforces HTTPS)
765
+ * 3. Users explicitly opt-in to remote configs in their local configuration
766
+ * 4. This enables centralized config management (intended feature, not a vulnerability)
767
+ *
768
+ * CodeQL alert "file-access-to-http" is a false positive here - we're not leaking
769
+ * file contents to arbitrary URLs, we're fetching configs from user-specified sources.
770
+ */
771
+ private loadFromUrl;
772
+ /**
773
+ * Interpolate environment variables in a string
774
+ * Supports ${VAR_NAME} syntax
775
+ */
776
+ private interpolateEnvVars;
777
+ /**
778
+ * Merge two MCP configurations based on the specified merge strategy
779
+ * @param localConfig Configuration loaded from local file
780
+ * @param remoteConfig Configuration loaded from remote URL
781
+ * @param mergeStrategy Strategy for merging configs
782
+ * @returns Merged configuration
783
+ */
784
+ private mergeConfigurations;
785
+ /**
786
+ * Clear the cached configuration
787
+ */
788
+ clearCache(): void;
789
+ /**
790
+ * Check if cache is valid
791
+ */
792
+ isCacheValid(): boolean;
793
+ }
794
+ //#endregion
795
+ export { ConfigFetcherService, DescribeToolsTool, HttpTransportHandler, McpClientConnection, McpClientManagerService, McpHttpConfig, McpPromptInfo, McpResourceInfo, McpServerConfig, McpServerTransportConfig, McpServerTransportType, McpSseConfig, McpStdioConfig, McpToolInfo, PromptConfig, PromptSkillConfig, RemoteMcpConfiguration, type ServerOptions, Skill, SkillMetadata, SkillService, SkillsConfig, SseTransportHandler, StdioTransportHandler, TRANSPORT_MODE, Tool, ToolDefinition, TransportConfig, TransportHandler, TransportMode, UseToolTool, createServer };
package/dist/index.d.mts CHANGED
@@ -341,4 +341,455 @@ declare class HttpTransportHandler implements HttpTransportHandler$1 {
341
341
  getHost(): string;
342
342
  }
343
343
  //#endregion
344
- export { HttpTransportHandler, McpClientConnection, McpHttpConfig, McpPromptInfo, McpResourceInfo, McpServerConfig, McpServerTransportConfig, McpServerTransportType, McpSseConfig, McpStdioConfig, McpToolInfo, PromptConfig, PromptSkillConfig, RemoteMcpConfiguration, type ServerOptions, Skill, SkillMetadata, SkillsConfig, SseTransportHandler, StdioTransportHandler, TRANSPORT_MODE, Tool, ToolDefinition, TransportConfig, TransportHandler, TransportMode, createServer };
344
+ //#region src/services/McpClientManagerService.d.ts
345
+ /**
346
+ * Service for managing MCP client connections to remote servers
347
+ */
348
+ declare class McpClientManagerService {
349
+ private clients;
350
+ constructor();
351
+ /**
352
+ * Cleanup all resources on exit (child processes)
353
+ */
354
+ private cleanupOnExit;
355
+ /**
356
+ * Connect to an MCP server based on its configuration with timeout
357
+ * Uses the timeout from server config, falling back to default (30s)
358
+ */
359
+ connectToServer(serverName: string, config: McpServerConfig): Promise<void>;
360
+ /**
361
+ * Perform the actual connection to MCP server
362
+ */
363
+ private performConnection;
364
+ private connectStdioClient;
365
+ private connectHttpClient;
366
+ private connectSseClient;
367
+ /**
368
+ * Get a connected client by server name
369
+ */
370
+ getClient(serverName: string): McpClientConnection | undefined;
371
+ /**
372
+ * Get all connected clients
373
+ */
374
+ getAllClients(): McpClientConnection[];
375
+ /**
376
+ * Disconnect from a specific server
377
+ */
378
+ disconnectServer(serverName: string): Promise<void>;
379
+ /**
380
+ * Disconnect from all servers
381
+ */
382
+ disconnectAll(): Promise<void>;
383
+ /**
384
+ * Check if a server is connected
385
+ */
386
+ isConnected(serverName: string): boolean;
387
+ }
388
+ //#endregion
389
+ //#region src/services/SkillService.d.ts
390
+ /**
391
+ * Service for loading and managing skills from configured skill directories.
392
+ *
393
+ * Skills are markdown files with YAML frontmatter that can be invoked via
394
+ * the skill__ prefix in describe_tools and use_tool.
395
+ *
396
+ * Skills are only enabled when explicitly configured via the `skills.paths` array
397
+ * in the MCP config.
398
+ *
399
+ * @example
400
+ * // Config with skills enabled:
401
+ * // skills:
402
+ * // paths:
403
+ * // - ".claude/skills"
404
+ * // - "/absolute/path/to/skills"
405
+ *
406
+ * const skillService = new SkillService('/project/root', ['.claude/skills']);
407
+ * const skills = await skillService.getSkills();
408
+ */
409
+ declare class SkillService {
410
+ private cwd;
411
+ private skillPaths;
412
+ private cachedSkills;
413
+ private skillsByName;
414
+ /** Active file watchers for skill directories */
415
+ private watchers;
416
+ /** Callback invoked when cache is invalidated due to file changes */
417
+ private onCacheInvalidated?;
418
+ /**
419
+ * Creates a new SkillService instance
420
+ * @param cwd - Current working directory for resolving relative paths
421
+ * @param skillPaths - Array of paths to skills directories
422
+ * @param options - Optional configuration
423
+ * @param options.onCacheInvalidated - Callback invoked when cache is invalidated due to file changes
424
+ */
425
+ constructor(cwd: string, skillPaths: string[], options?: {
426
+ onCacheInvalidated?: () => void;
427
+ });
428
+ /**
429
+ * Get all available skills from configured directories.
430
+ * Results are cached after first load.
431
+ *
432
+ * Skills from earlier entries in the config take precedence over
433
+ * skills with the same name from later entries.
434
+ *
435
+ * @returns Array of loaded skills
436
+ * @throws SkillLoadError if a critical error occurs during loading
437
+ */
438
+ getSkills(): Promise<Skill[]>;
439
+ /**
440
+ * Get a specific skill by name with O(1) lookup from cache.
441
+ * @param name - The skill name (without skill__ prefix)
442
+ * @returns The skill if found, undefined otherwise
443
+ */
444
+ getSkill(name: string): Promise<Skill | undefined>;
445
+ /**
446
+ * Clears the cached skills to force a fresh reload on the next getSkills() or getSkill() call.
447
+ * Use this when skill files have been modified on disk.
448
+ */
449
+ clearCache(): void;
450
+ /**
451
+ * Starts watching skill directories for changes to SKILL.md files.
452
+ * When changes are detected, the cache is automatically invalidated.
453
+ *
454
+ * Uses Node.js fs.watch with recursive option for efficient directory monitoring.
455
+ * Only invalidates cache when SKILL.md files are modified.
456
+ *
457
+ * @example
458
+ * const skillService = new SkillService(cwd, skillPaths, {
459
+ * onCacheInvalidated: () => console.log('Skills cache invalidated')
460
+ * });
461
+ * await skillService.startWatching();
462
+ */
463
+ startWatching(): Promise<void>;
464
+ /**
465
+ * Stops all active file watchers.
466
+ * Should be called when the service is being disposed.
467
+ */
468
+ stopWatching(): void;
469
+ /**
470
+ * Watches a directory for changes to SKILL.md files.
471
+ * @param dirPath - Directory path to watch
472
+ * @param signal - AbortSignal to stop watching
473
+ */
474
+ private watchDirectory;
475
+ /**
476
+ * Load skills from a directory.
477
+ * Supports both flat structure (SKILL.md) and nested structure (name/SKILL.md).
478
+ *
479
+ * @param dirPath - Path to the skills directory
480
+ * @param location - Whether this is a 'project' or 'user' skill directory
481
+ * @returns Array of successfully loaded skills (skips invalid skills)
482
+ * @throws SkillLoadError if there's a critical I/O error
483
+ *
484
+ * @example
485
+ * // Load skills from project directory
486
+ * const skills = await this.loadSkillsFromDirectory('/path/to/.claude/skills', 'project');
487
+ * // Returns: [{ name: 'pdf', description: '...', location: 'project', ... }]
488
+ */
489
+ private loadSkillsFromDirectory;
490
+ /**
491
+ * Load a single skill file and parse its frontmatter.
492
+ * Supports multi-line YAML values using literal (|) and folded (>) block scalars.
493
+ *
494
+ * @param filePath - Path to the SKILL.md file
495
+ * @param location - Whether this is a 'project' or 'user' skill
496
+ * @returns The loaded skill, or null if the file is invalid (missing required frontmatter)
497
+ * @throws SkillLoadError if there's an I/O error reading the file
498
+ *
499
+ * @example
500
+ * // Load a skill from a file
501
+ * const skill = await this.loadSkillFile('/path/to/pdf/SKILL.md', 'project');
502
+ * // Returns: { name: 'pdf', description: 'PDF skill', location: 'project', content: '...', basePath: '/path/to/pdf' }
503
+ * // Returns null if frontmatter is missing name or description
504
+ */
505
+ private loadSkillFile;
506
+ }
507
+ //#endregion
508
+ //#region src/tools/DescribeToolsTool.d.ts
509
+ /**
510
+ * Input schema for the DescribeToolsTool
511
+ * @property toolNames - Array of tool names to get detailed information about
512
+ */
513
+ interface DescribeToolsToolInput {
514
+ toolNames: string[];
515
+ }
516
+ /**
517
+ * DescribeToolsTool provides progressive disclosure of MCP tools and skills.
518
+ *
519
+ * This tool lists available tools from all connected MCP servers and skills
520
+ * from the configured skills directories. Users can query for specific tools
521
+ * or skills to get detailed input schemas and descriptions.
522
+ *
523
+ * Tool naming conventions:
524
+ * - Unique tools: use plain name (e.g., "browser_click")
525
+ * - Clashing tools: use serverName__toolName format (e.g., "playwright__click")
526
+ * - Skills: use skill__skillName format (e.g., "skill__pdf")
527
+ *
528
+ * @example
529
+ * const tool = new DescribeToolsTool(clientManager, skillService);
530
+ * const definition = await tool.getDefinition();
531
+ * const result = await tool.execute({ toolNames: ['browser_click', 'skill__pdf'] });
532
+ */
533
+ declare class DescribeToolsTool implements Tool<DescribeToolsToolInput> {
534
+ static readonly TOOL_NAME = "describe_tools";
535
+ private clientManager;
536
+ private skillService;
537
+ private readonly liquid;
538
+ /** Cache for auto-detected skills from prompt front-matter */
539
+ private autoDetectedSkillsCache;
540
+ /** Unique server identifier for this one-mcp instance */
541
+ private serverId;
542
+ /**
543
+ * Creates a new DescribeToolsTool instance
544
+ * @param clientManager - The MCP client manager for accessing remote servers
545
+ * @param skillService - Optional skill service for loading skills
546
+ * @param serverId - Unique server identifier for this one-mcp instance
547
+ */
548
+ constructor(clientManager: McpClientManagerService, skillService?: SkillService, serverId?: string);
549
+ /**
550
+ * Clears the cached auto-detected skills from prompt front-matter.
551
+ * Use this when prompt configurations may have changed or when
552
+ * the skill service cache is invalidated.
553
+ */
554
+ clearAutoDetectedSkillsCache(): void;
555
+ /**
556
+ * Detects and caches skills from prompt front-matter across all connected MCP servers.
557
+ * Fetches all prompts and checks their content for YAML front-matter with name/description.
558
+ * Results are cached to avoid repeated fetches.
559
+ *
560
+ * Error Handling Strategy:
561
+ * - Errors are logged to stderr but do not fail the overall detection process
562
+ * - This ensures partial results are returned even if some servers/prompts fail
563
+ * - Common failure reasons: server temporarily unavailable, prompt requires arguments,
564
+ * network timeout, or server doesn't support listPrompts
565
+ * - Errors are prefixed with [skill-detection] for easy filtering in logs
566
+ *
567
+ * @returns Array of auto-detected skills from prompt front-matter
568
+ */
569
+ private detectSkillsFromPromptFrontMatter;
570
+ /**
571
+ * Collects skills derived from prompt configurations across all connected MCP servers.
572
+ * Includes both explicitly configured prompts and auto-detected skills from front-matter.
573
+ *
574
+ * @returns Array of skill template data derived from prompts
575
+ */
576
+ private collectPromptSkills;
577
+ /**
578
+ * Finds a prompt-based skill by name from all connected MCP servers.
579
+ * Searches both explicitly configured prompts and auto-detected skills from front-matter.
580
+ *
581
+ * @param skillName - The skill name to search for
582
+ * @returns Object with serverName, promptName, and skill config, or undefined if not found
583
+ */
584
+ private findPromptSkill;
585
+ /**
586
+ * Retrieves skill content from a prompt-based skill configuration.
587
+ * Fetches the prompt from the MCP server and extracts text content.
588
+ * Handles both explicitly configured prompts and auto-detected skills from front-matter.
589
+ *
590
+ * @param skillName - The skill name being requested
591
+ * @returns SkillDescription if found and successfully fetched, undefined otherwise
592
+ */
593
+ private getPromptSkillContent;
594
+ /**
595
+ * Builds the combined toolkit description using a single Liquid template.
596
+ *
597
+ * Collects all tools from connected MCP servers and all skills, then renders
598
+ * them together using the toolkit-description.liquid template.
599
+ *
600
+ * Tool names are prefixed with serverName__ when the same tool exists
601
+ * on multiple servers. Skill names are prefixed with skill__ when they
602
+ * clash with MCP tools or other skills.
603
+ *
604
+ * @returns Object with rendered description and set of all tool names
605
+ */
606
+ private buildToolkitDescription;
607
+ /**
608
+ * Gets the tool definition including available tools and skills in a unified format.
609
+ *
610
+ * The definition includes:
611
+ * - All MCP tools from connected servers
612
+ * - All available skills (file-based and prompt-based)
613
+ * - Unified instructions for querying capability details
614
+ *
615
+ * Tool names are prefixed with serverName__ when clashing.
616
+ * Skill names are prefixed with skill__ when clashing.
617
+ *
618
+ * @returns Tool definition with description and input schema
619
+ */
620
+ getDefinition(): Promise<ToolDefinition>;
621
+ /**
622
+ * Executes tool description lookup for the requested tool and skill names.
623
+ *
624
+ * Handles three types of lookups:
625
+ * 1. skill__name - Returns skill information from SkillService
626
+ * 2. serverName__toolName - Returns tool from specific server
627
+ * 3. plainToolName - Returns tool(s) from all servers (multiple if clashing)
628
+ *
629
+ * @param input - Object containing toolNames array
630
+ * @returns CallToolResult with tool/skill descriptions or error
631
+ */
632
+ execute(input: DescribeToolsToolInput): Promise<CallToolResult>;
633
+ }
634
+ //#endregion
635
+ //#region src/tools/UseToolTool.d.ts
636
+ /**
637
+ * Input schema for UseToolTool
638
+ * @property toolName - Name of the tool or skill to execute
639
+ * @property toolArgs - Arguments to pass to the tool (from describe_tools schema)
640
+ */
641
+ interface UseToolToolInput {
642
+ toolName: string;
643
+ toolArgs?: Record<string, unknown>;
644
+ }
645
+ /**
646
+ * UseToolTool executes MCP tools and skills with proper error handling.
647
+ *
648
+ * This tool supports three invocation patterns:
649
+ * 1. skill__skillName - Invokes a skill from the configured skills directory
650
+ * 2. serverName__toolName - Invokes a tool on a specific MCP server
651
+ * 3. plainToolName - Searches all servers for a unique tool match
652
+ *
653
+ * @example
654
+ * const tool = new UseToolTool(clientManager, skillService);
655
+ * await tool.execute({ toolName: 'skill__pdf' }); // Invoke a skill
656
+ * await tool.execute({ toolName: 'playwright__browser_click', toolArgs: { ref: 'btn' } });
657
+ */
658
+ declare class UseToolTool implements Tool<UseToolToolInput> {
659
+ static readonly TOOL_NAME = "use_tool";
660
+ private clientManager;
661
+ private skillService;
662
+ /** Unique server identifier for this one-mcp instance */
663
+ private serverId;
664
+ /**
665
+ * Creates a new UseToolTool instance
666
+ * @param clientManager - The MCP client manager for accessing remote servers
667
+ * @param skillService - Optional skill service for loading and executing skills
668
+ * @param serverId - Unique server identifier for this one-mcp instance
669
+ */
670
+ constructor(clientManager: McpClientManagerService, skillService?: SkillService, serverId?: string);
671
+ /**
672
+ * Returns the MCP tool definition with name, description, and input schema.
673
+ *
674
+ * The definition describes how to use this tool to execute MCP tools or skills,
675
+ * including the skill__ prefix format for skill invocations.
676
+ *
677
+ * @returns The tool definition conforming to MCP spec
678
+ */
679
+ getDefinition(): ToolDefinition;
680
+ /**
681
+ * Returns guidance message for skill invocation.
682
+ *
683
+ * Skills are not executed via use_tool - they provide instructions that should
684
+ * be followed directly. This method returns a message directing users to use
685
+ * describe_tools to get the skill details and follow its instructions.
686
+ *
687
+ * @param skill - The skill that was requested
688
+ * @returns CallToolResult with guidance message
689
+ */
690
+ private executeSkill;
691
+ /**
692
+ * Finds a prompt-based skill by name from all connected MCP servers.
693
+ *
694
+ * @param skillName - The skill name to search for
695
+ * @returns PromptSkillMatch if found, undefined otherwise
696
+ */
697
+ private findPromptSkill;
698
+ /**
699
+ * Returns guidance message for prompt-based skill invocation.
700
+ *
701
+ * @param promptSkill - The prompt skill match that was found
702
+ * @returns CallToolResult with guidance message
703
+ */
704
+ private executePromptSkill;
705
+ /**
706
+ * Executes a tool or skill based on the provided input.
707
+ *
708
+ * Handles three invocation patterns:
709
+ * 1. skill__skillName - Routes to skill execution via SkillService
710
+ * 2. serverName__toolName - Routes to specific MCP server
711
+ * 3. plainToolName - Searches all servers for unique match
712
+ *
713
+ * Edge cases:
714
+ * - Returns error if skill not found when using skill__ prefix
715
+ * - Returns error if tool is blacklisted on target server
716
+ * - Returns disambiguation message if tool exists on multiple servers
717
+ *
718
+ * @param input - The tool/skill name and optional arguments
719
+ * @returns CallToolResult with execution output or error
720
+ */
721
+ execute(input: UseToolToolInput): Promise<CallToolResult>;
722
+ }
723
+ //#endregion
724
+ //#region src/services/ConfigFetcherService.d.ts
725
+ interface ConfigFetcherOptions {
726
+ configFilePath?: string;
727
+ cacheTtlMs?: number;
728
+ useCache?: boolean;
729
+ remoteCacheTtlMs?: number;
730
+ }
731
+ /**
732
+ * Service for fetching and caching MCP server configurations from local file and remote sources
733
+ * Supports merging multiple remote configs with local config
734
+ */
735
+ declare class ConfigFetcherService {
736
+ private configFilePath?;
737
+ private cacheTtlMs;
738
+ private cachedConfig;
739
+ private lastFetchTime;
740
+ private remoteConfigCache;
741
+ constructor(options: ConfigFetcherOptions);
742
+ /**
743
+ * Fetch MCP configuration from local file and remote sources with caching
744
+ * Merges remote configs with local config based on merge strategy
745
+ * @param forceRefresh - Force reload from source, bypassing cache
746
+ */
747
+ fetchConfiguration(forceRefresh?: boolean): Promise<RemoteMcpConfiguration>;
748
+ /**
749
+ * Load raw configuration data from a local file (supports JSON and YAML)
750
+ * Returns unparsed config data to allow access to remoteConfigs
751
+ */
752
+ private loadRawConfigFromFile;
753
+ /**
754
+ * Parse raw config data using Zod schema
755
+ * Filters out remoteConfigs to avoid including them in the final config
756
+ */
757
+ private parseConfig;
758
+ /**
759
+ * Load configuration from a remote URL with caching
760
+ *
761
+ * SECURITY NOTE: This method fetches remote configs based on URLs from the local config file.
762
+ * This is intentional and safe because:
763
+ * 1. URLs are user-controlled via their local config file (not external input)
764
+ * 2. SSRF protection validates URLs before fetching (blocks private IPs, enforces HTTPS)
765
+ * 3. Users explicitly opt-in to remote configs in their local configuration
766
+ * 4. This enables centralized config management (intended feature, not a vulnerability)
767
+ *
768
+ * CodeQL alert "file-access-to-http" is a false positive here - we're not leaking
769
+ * file contents to arbitrary URLs, we're fetching configs from user-specified sources.
770
+ */
771
+ private loadFromUrl;
772
+ /**
773
+ * Interpolate environment variables in a string
774
+ * Supports ${VAR_NAME} syntax
775
+ */
776
+ private interpolateEnvVars;
777
+ /**
778
+ * Merge two MCP configurations based on the specified merge strategy
779
+ * @param localConfig Configuration loaded from local file
780
+ * @param remoteConfig Configuration loaded from remote URL
781
+ * @param mergeStrategy Strategy for merging configs
782
+ * @returns Merged configuration
783
+ */
784
+ private mergeConfigurations;
785
+ /**
786
+ * Clear the cached configuration
787
+ */
788
+ clearCache(): void;
789
+ /**
790
+ * Check if cache is valid
791
+ */
792
+ isCacheValid(): boolean;
793
+ }
794
+ //#endregion
795
+ export { ConfigFetcherService, DescribeToolsTool, HttpTransportHandler, McpClientConnection, McpClientManagerService, McpHttpConfig, McpPromptInfo, McpResourceInfo, McpServerConfig, McpServerTransportConfig, McpServerTransportType, McpSseConfig, McpStdioConfig, McpToolInfo, PromptConfig, PromptSkillConfig, RemoteMcpConfiguration, type ServerOptions, Skill, SkillMetadata, SkillService, SkillsConfig, SseTransportHandler, StdioTransportHandler, TRANSPORT_MODE, Tool, ToolDefinition, TransportConfig, TransportHandler, TransportMode, UseToolTool, createServer };
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { i as createServer, n as SseTransportHandler, r as StdioTransportHandler, t as HttpTransportHandler } from "./http-DV3-1Emn.mjs";
1
+ import { a as UseToolTool, i as createServer, l as McpClientManagerService, n as SseTransportHandler, o as DescribeToolsTool, r as StdioTransportHandler, s as SkillService, t as HttpTransportHandler, u as ConfigFetcherService } from "./http-BDeLFFzK.mjs";
2
2
 
3
- export { HttpTransportHandler, SseTransportHandler, StdioTransportHandler, createServer };
3
+ export { ConfigFetcherService, DescribeToolsTool, HttpTransportHandler, McpClientManagerService, SkillService, SseTransportHandler, StdioTransportHandler, UseToolTool, createServer };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agiflowai/one-mcp",
3
3
  "description": "One MCP server package",
4
- "version": "0.3.6",
4
+ "version": "0.3.8",
5
5
  "license": "AGPL-3.0",
6
6
  "keywords": [
7
7
  "mcp",
@@ -19,7 +19,7 @@
19
19
  "README.md"
20
20
  ],
21
21
  "dependencies": {
22
- "@modelcontextprotocol/sdk": "1.25.2",
22
+ "@modelcontextprotocol/sdk": "1.26.0",
23
23
  "chalk": "5.6.2",
24
24
  "commander": "14.0.1",
25
25
  "express": "^4.21.2",
@@ -27,7 +27,7 @@
27
27
  "js-yaml": "^4.1.0",
28
28
  "liquidjs": "^10.21.0",
29
29
  "zod": "^3.24.1",
30
- "@agiflowai/aicode-utils": "1.0.12"
30
+ "@agiflowai/aicode-utils": "1.0.14"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/express": "^5.0.0",