BackgroundIt has been suggested in several observational studies that migraines are associated with the gut microbiota. It remains unclear, however, how the gut microbiota and migraines are causally related.MethodsWe performed a bidirectional two-sample mendelian randomization study. Genome-wide association study (GWAS) summary statistics for the gut microbiota were obtained from the MiBioGen consortium (n = 18,340) and the Dutch Microbiota Project (n = 7,738). Pooled GWAS data for plasma metabolites were obtained from four different human metabolomics studies. GWAS summary data for migraine (cases = 48,975; controls = 450,381) were sourced from the International Headache Genetics Consortium. We used inverse-variance weighting as the primary analysis. Multiple sensitivity analyses were performed to ensure the robustness of the estimated results. We also conducted reverse mendelian randomization when a causal relationship between exposure and migraine was found.ResultsLachnospiraceaeUCG001 (OR = 1.12, 95% CI: 1.05–1.20) was a risk factor for migraine. Blautia (OR = 0.93, 95% CI: 0.88–0.99), Eubacterium (nodatum group; OR = 0.94, 95% CI: 0.90–0.98), and Bacteroides fragilis (OR = 0.97, 95% CI: 0.94–1.00) may have a suggestive association with a lower migraine risk. Functional pathways of methionine synthesis (OR = 0.89, 95% CI: 0.83–0.95) associated with microbiota abundance and plasma hydrocinnamate (OR = 0.85, 95% CI: 0.73–1.00), which are downstream metabolites of Blautia and Bacteroides fragilis, respectively, may also be associated with lower migraine risk. No causal association between migraine and the gut microbiota or metabolites was found in reverse mendelian randomization analysis. Both significant horizontal pleiotropy and significant heterogeneity were not clearly identified.ConclusionThis Mendelian randomization analysis showed that LachnospiraceaeUCG001 was associated with an increased risk of migraine, while some bacteria in the gut microbiota may reduce migraine risk. These findings provide a reference for a deeper comprehension of the role of the gut–brain axis in migraine as well as possible targets for treatment interventions.