Module: AIA::McpParser
- Defined in:
- lib/aia/config/mcp_parser.rb
Class Method Summary collapse
-
.parse_files(file_paths) ⇒ Array<Hash>
Parse MCP server configuration files and return array of server configs in robot_lab's nested transport format.
Class Method Details
.parse_files(file_paths) ⇒ Array<Hash>
Parse MCP server configuration files and return array of server configs in robot_lab's nested transport format.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/aia/config/mcp_parser.rb', line 48 def parse_files(file_paths) return [] if file_paths.nil? || file_paths.empty? servers = [] file_paths.each do |file_path| = File.(file_path) unless File.exist?() $stderr.puts "Warning: MCP config file not found: #{file_path}" next end begin json_content = File.read() parsed = JSON.parse(json_content) servers.concat(convert_to_config_format(parsed, file_path)) rescue JSON::ParserError => e $stderr.puts "Warning: Invalid JSON in MCP config file '#{file_path}': #{e.}" rescue StandardError => e $stderr.puts "Warning: Error reading MCP config file '#{file_path}': #{e.}" end end servers end |