The development plan for metadata says it should be saved in a database table, but I don't know if it was implemented. For file type sources it saves in a qmd file with the same name as the source, in the directory with it.
Yes, I made this little script that I run from Jupyter notebook. Just change as required the variables metadatain, and metawriter. It will recursively add metadata to all the files with an extension (for instance shp) inside a directory.
import xml.etree.ElementTree as ET
metadatain = ET.parse(r'ADDRESS\TO\METADATA.xml')
root = metadatain.getroot()...