The relationship between gut microbial metabolism and mental health is one of the most intriguing and controversial topics in microbiome research. Bidirectional microbiota-gut-brain communication has mostly been explored in animal models, with human research lagging behind. Large-scale metagenomics studies could facilitate the translational process, but their interpretation is hampered by a lack of dedicated reference databases and tools to study the microbial neuroactive potential. Surveying a large microbiome population cohort (Flemish Gut Flora Project, n = 1,054) with validation in independent data sets (ntotal = 1,070), we studied how microbiome features correlate with host quality of life and depression. Butyrate-producing Faecalibacterium and Coprococcus bacteria were consistently associated with higher quality of life indicators. Together with Dialister, Coprococcus spp. were also depleted in depression, even after correcting for the confounding effects of antidepressants. Using a module-based analytical framework, we assembled a catalogue of neuroactive potential of sequenced gut prokaryotes. Gut-brain module analysis of faecal metagenomes identified the microbial synthesis potential of the dopamine metabolite 3,4-dihydroxyphenylacetic acid as correlating positively with mental quality of life and indicated a potential role of microbial γ-aminobutyric acid production in depression. Our results provide population-scale evidence for microbiome links to mental health, while emphasizing confounder importance.