class RubyLLM::MCP::Configuration::ConfigFile

def initialize(file_path)

def initialize(file_path)
  @file_path = file_path
end

def load_mcps_config(config)

def load_mcps_config(config)
  return [] unless config.key?(:mcp_servers)
  config[:mcp_servers].map do |name, configuration|
    {
      name: name,
      transport_type: configuration.delete(:transport_type),
      start: false,
      config: configuration
    }
  end
end

def parse

def parse
  @parse ||= if @file_path && File.exist?(@file_path)
               config = parse_config_file
               load_mcps_config(config)
             else
               []
             end
end

def parse_config_file

def parse_config_file
  output = ERB.new(File.read(@file_path)).result
  if [".yaml", ".yml"].include?(File.extname(@file_path))
    YAML.safe_load(output, symbolize_names: true)
  else
    JSON.parse(output, symbolize_names: true)
  end
end