@agiflowai/one-mcp 0.2.0 → 0.2.2

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,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- const require_http = require('./http-B5WVqLzz.cjs');
2
+ const require_http = require('./http-3v8zyDO3.cjs');
3
3
  let node_fs_promises = require("node:fs/promises");
4
- let commander = require("commander");
5
4
  let node_path = require("node:path");
5
+ let commander = require("commander");
6
6
  let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
7
7
 
8
8
  //#region src/types/index.ts
@@ -63,7 +63,7 @@ const mcpServeCommand = new commander.Command("mcp-serve").description("Start MC
63
63
  try {
64
64
  const transportType = options.type.toLowerCase();
65
65
  const serverOptions = {
66
- configFilePath: options.config,
66
+ configFilePath: options.config || require_http.findConfigFile(),
67
67
  noCache: options.cache === false
68
68
  };
69
69
  if (transportType === "stdio") await startServer(new require_http.StdioTransportHandler(await require_http.createServer(serverOptions)));
@@ -115,11 +115,12 @@ const mcpServeCommand = new commander.Command("mcp-serve").description("Start MC
115
115
  */
116
116
  const listToolsCommand = new commander.Command("list-tools").description("List all available tools from connected MCP servers").option("-c, --config <path>", "Path to MCP server configuration file").option("-s, --server <name>", "Filter by server name").option("-j, --json", "Output as JSON", false).action(async (options) => {
117
117
  try {
118
- if (!options.config) {
119
- console.error("Error: --config is required");
118
+ const configFilePath = options.config || require_http.findConfigFile();
119
+ if (!configFilePath) {
120
+ console.error("Error: No config file found. Use --config or create mcp-config.yaml");
120
121
  process.exit(1);
121
122
  }
122
- const config = await new require_http.ConfigFetcherService({ configFilePath: options.config }).fetchConfiguration();
123
+ const config = await new require_http.ConfigFetcherService({ configFilePath }).fetchConfiguration();
123
124
  const clientManager = new require_http.McpClientManagerService();
124
125
  const connectionPromises = Object.entries(config.mcpServers).map(async ([serverName, serverConfig]) => {
125
126
  try {
@@ -190,11 +191,12 @@ const listToolsCommand = new commander.Command("list-tools").description("List a
190
191
  */
191
192
  const describeToolsCommand = new commander.Command("describe-tools").description("Describe specific MCP tools").argument("<toolNames...>", "Tool names to describe").option("-c, --config <path>", "Path to MCP server configuration file").option("-s, --server <name>", "Filter by server name").option("-j, --json", "Output as JSON", false).action(async (toolNames, options) => {
192
193
  try {
193
- if (!options.config) {
194
- console.error("Error: --config is required");
194
+ const configFilePath = options.config || require_http.findConfigFile();
195
+ if (!configFilePath) {
196
+ console.error("Error: No config file found. Use --config or create mcp-config.yaml");
195
197
  process.exit(1);
196
198
  }
197
- const config = await new require_http.ConfigFetcherService({ configFilePath: options.config }).fetchConfiguration();
199
+ const config = await new require_http.ConfigFetcherService({ configFilePath }).fetchConfiguration();
198
200
  const clientManager = new require_http.McpClientManagerService();
199
201
  const connectionPromises = Object.entries(config.mcpServers).map(async ([serverName, serverConfig]) => {
200
202
  try {
@@ -290,8 +292,9 @@ const describeToolsCommand = new commander.Command("describe-tools").description
290
292
  */
291
293
  const useToolCommand = new commander.Command("use-tool").description("Execute an MCP tool with arguments").argument("<toolName>", "Tool name to execute").option("-c, --config <path>", "Path to MCP server configuration file").option("-s, --server <name>", "Server name (required if tool exists on multiple servers)").option("-a, --args <json>", "Tool arguments as JSON string", "{}").option("-j, --json", "Output as JSON", false).action(async (toolName, options) => {
292
294
  try {
293
- if (!options.config) {
294
- console.error("Error: --config is required");
295
+ const configFilePath = options.config || require_http.findConfigFile();
296
+ if (!configFilePath) {
297
+ console.error("Error: No config file found. Use --config or create mcp-config.yaml");
295
298
  process.exit(1);
296
299
  }
297
300
  let toolArgs = {};
@@ -301,7 +304,7 @@ const useToolCommand = new commander.Command("use-tool").description("Execute an
301
304
  console.error("Error: Invalid JSON in --args");
302
305
  process.exit(1);
303
306
  }
304
- const config = await new require_http.ConfigFetcherService({ configFilePath: options.config }).fetchConfiguration();
307
+ const config = await new require_http.ConfigFetcherService({ configFilePath }).fetchConfiguration();
305
308
  const clientManager = new require_http.McpClientManagerService();
306
309
  const connectionPromises = Object.entries(config.mcpServers).map(async ([serverName, serverConfig]) => {
307
310
  try {
@@ -396,7 +399,7 @@ const useToolCommand = new commander.Command("use-tool").description("Execute an
396
399
 
397
400
  //#endregion
398
401
  //#region src/templates/mcp-config.yaml?raw
399
- var mcp_config_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\nmcpServers:\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";
402
+ var mcp_config_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 # 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";
400
403
 
401
404
  //#endregion
402
405
  //#region src/templates/mcp-config.json?raw
@@ -457,7 +460,7 @@ const initCommand = new commander.Command("init").description("Initialize MCP co
457
460
 
458
461
  //#endregion
459
462
  //#region package.json
460
- var version = "0.1.0";
463
+ var version = "0.2.2";
461
464
 
462
465
  //#endregion
463
466
  //#region src/cli.ts
package/dist/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { a as McpClientManagerService, i as createServer, n as SseTransportHandler, o as ConfigFetcherService, r as StdioTransportHandler, t as HttpTransportHandler } from "./http-B1EDyxR_.mjs";
2
+ import { a as findConfigFile, i as createServer, n as SseTransportHandler, o as McpClientManagerService, r as StdioTransportHandler, s as ConfigFetcherService, t as HttpTransportHandler } from "./http-CzQfsUEI.mjs";
3
3
  import { writeFile } from "node:fs/promises";
4
- import { Command } from "commander";
5
4
  import { resolve } from "node:path";
5
+ import { Command } from "commander";
6
6
  import { log } from "@agiflowai/aicode-utils";
7
7
 
8
8
  //#region src/types/index.ts
@@ -63,7 +63,7 @@ const mcpServeCommand = new Command("mcp-serve").description("Start MCP server w
63
63
  try {
64
64
  const transportType = options.type.toLowerCase();
65
65
  const serverOptions = {
66
- configFilePath: options.config,
66
+ configFilePath: options.config || findConfigFile(),
67
67
  noCache: options.cache === false
68
68
  };
69
69
  if (transportType === "stdio") await startServer(new StdioTransportHandler(await createServer(serverOptions)));
@@ -115,11 +115,12 @@ const mcpServeCommand = new Command("mcp-serve").description("Start MCP server w
115
115
  */
116
116
  const listToolsCommand = new Command("list-tools").description("List all available tools from connected MCP servers").option("-c, --config <path>", "Path to MCP server configuration file").option("-s, --server <name>", "Filter by server name").option("-j, --json", "Output as JSON", false).action(async (options) => {
117
117
  try {
118
- if (!options.config) {
119
- console.error("Error: --config is required");
118
+ const configFilePath = options.config || findConfigFile();
119
+ if (!configFilePath) {
120
+ console.error("Error: No config file found. Use --config or create mcp-config.yaml");
120
121
  process.exit(1);
121
122
  }
122
- const config = await new ConfigFetcherService({ configFilePath: options.config }).fetchConfiguration();
123
+ const config = await new ConfigFetcherService({ configFilePath }).fetchConfiguration();
123
124
  const clientManager = new McpClientManagerService();
124
125
  const connectionPromises = Object.entries(config.mcpServers).map(async ([serverName, serverConfig]) => {
125
126
  try {
@@ -190,11 +191,12 @@ const listToolsCommand = new Command("list-tools").description("List all availab
190
191
  */
191
192
  const describeToolsCommand = new Command("describe-tools").description("Describe specific MCP tools").argument("<toolNames...>", "Tool names to describe").option("-c, --config <path>", "Path to MCP server configuration file").option("-s, --server <name>", "Filter by server name").option("-j, --json", "Output as JSON", false).action(async (toolNames, options) => {
192
193
  try {
193
- if (!options.config) {
194
- console.error("Error: --config is required");
194
+ const configFilePath = options.config || findConfigFile();
195
+ if (!configFilePath) {
196
+ console.error("Error: No config file found. Use --config or create mcp-config.yaml");
195
197
  process.exit(1);
196
198
  }
197
- const config = await new ConfigFetcherService({ configFilePath: options.config }).fetchConfiguration();
199
+ const config = await new ConfigFetcherService({ configFilePath }).fetchConfiguration();
198
200
  const clientManager = new McpClientManagerService();
199
201
  const connectionPromises = Object.entries(config.mcpServers).map(async ([serverName, serverConfig]) => {
200
202
  try {
@@ -290,8 +292,9 @@ const describeToolsCommand = new Command("describe-tools").description("Describe
290
292
  */
291
293
  const useToolCommand = new Command("use-tool").description("Execute an MCP tool with arguments").argument("<toolName>", "Tool name to execute").option("-c, --config <path>", "Path to MCP server configuration file").option("-s, --server <name>", "Server name (required if tool exists on multiple servers)").option("-a, --args <json>", "Tool arguments as JSON string", "{}").option("-j, --json", "Output as JSON", false).action(async (toolName, options) => {
292
294
  try {
293
- if (!options.config) {
294
- console.error("Error: --config is required");
295
+ const configFilePath = options.config || findConfigFile();
296
+ if (!configFilePath) {
297
+ console.error("Error: No config file found. Use --config or create mcp-config.yaml");
295
298
  process.exit(1);
296
299
  }
297
300
  let toolArgs = {};
@@ -301,7 +304,7 @@ const useToolCommand = new Command("use-tool").description("Execute an MCP tool
301
304
  console.error("Error: Invalid JSON in --args");
302
305
  process.exit(1);
303
306
  }
304
- const config = await new ConfigFetcherService({ configFilePath: options.config }).fetchConfiguration();
307
+ const config = await new ConfigFetcherService({ configFilePath }).fetchConfiguration();
305
308
  const clientManager = new McpClientManagerService();
306
309
  const connectionPromises = Object.entries(config.mcpServers).map(async ([serverName, serverConfig]) => {
307
310
  try {
@@ -396,7 +399,7 @@ const useToolCommand = new Command("use-tool").description("Execute an MCP tool
396
399
 
397
400
  //#endregion
398
401
  //#region src/templates/mcp-config.yaml?raw
399
- var mcp_config_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\nmcpServers:\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";
402
+ var mcp_config_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 # 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";
400
403
 
401
404
  //#endregion
402
405
  //#region src/templates/mcp-config.json?raw
@@ -457,7 +460,7 @@ const initCommand = new Command("init").description("Initialize MCP configuratio
457
460
 
458
461
  //#endregion
459
462
  //#region package.json
460
- var version = "0.1.0";
463
+ var version = "0.2.2";
461
464
 
462
465
  //#endregion
463
466
  //#region src/cli.ts