BackgroundObservational studies have suggested associations between functional gastrointestinal disorders (FGIDs) and variations in the cerebral cortex. However, the causality of these relationships remains unclear, confounded by anxiety and depression. To clarify these causal relationships and explore the mediating roles of anxiety and depression, we applied univariate, multivariable, and mediation Mendelian randomization (MR) analyses.MethodWe utilized genome-wide association study (GWAS) summary data from the FinnGen database and the ENIGMA consortium, identifying genetic variants associated with irritable bowel syndrome (IBS), functional dyspepsia (FD), and cerebral cortex structures. Data on anxiety and depression came from FinnGen and a large meta-analysis. Utilizing a bidirectional univariate MR approach, we explored correlations between FD, IBS, and cortex variations. Then, independent effects were assessed through multivariable MR. A meta-analysis of these results, incorporating data from two cohorts, aimed to increase precision. We also explored the potential mediating roles of anxiety and depression.ResultsOur findings indicate a negative causal correlation between FD and the thickness of the rostral anterior cingulate cortex (rACC) across both global and regional adjustments (β = −0.142, 95% confidence interval (CI): −0.209 to-0.074, P.FDR = 0.004; β = −0.112, 95%CI: −0.163 to-0.006, P.FDR = 0.003) and a positive causal correlation with the globally adjusted thickness of the superior frontal gyrus (SFG) (β = 0.107, 95%CI: 0.062 to 0.153, P.FDR = 0.001). The causal correlation with the rACC persisted after multiple variable adjustments (β = −0.137, 95% CI: −0.187 to-0.087, P.FDR = 1.81 × 10−5; β = −0.109, 95%CI: −0.158 to-0.06, P.FDR = 0.002). A significant causal association was found between globally adjusted surface area of the caudal anterior cingulate cortex (cACC) and IBS (odds ratio = 1.267, 95%CI: 1.128 to 1.424, P.FDR = 0.02). The analysis showed that neither anxiety nor depression mediated the relationship between FGIDs and cerebral cortex structures.ConclusionOur research provides significant MR evidence of a bidirectional causal relationship between FGIDs and the cerebral cortex structures. This evidence not only confirms the two-way communication along the brain-gut axis but also illuminates the underlying pathophysiology, paving the way for identifying potential therapeutic approaches.