Patients with cervical spondylosis are often accompanied by a series of mental disorders, but there is no direct evidence of causal relationship and the mediation factors are not clear. Our purpose is to use the aggregated data of the large-scale genome-wide association study (GWAS) to explore the causal relationship between mental disorders and cervical spondylosis by using Mendelian randomization analysis, and further explore the mediation factors, to provide theoretical basis for the prevention and treatment of cervical spondylosis. Data on cervical spondylosis, mental disorders (depression, anxiety and schizophrenia), and living habits (smoking, insomnia, drinking, exercise, and time spent watching TV) were collected from the aggregated data of GWAS. In the univariable MR, inverse variance weighted (IVW) method was adopted as the main method, MR-Egger-based regression method, weighted median (WME) method, simple mode method, and weighted mode (WM) method were adopted as the complementary methods to evaluate the causal relationship between mental disorders and cervical spondylosis. Cochran's Q test, MR-Egger intercept test, and MR pleiotropy residual sum and outlier (MR-PRESSO)test were used to verify the reliability of the analysis results as sensitivity analysis. In the multivariable MR, IVW was used to analyze the causal relationship between the three mental disorders and cervical spondylosis after adjustment. In the mediation MR analysis, according to the steps of exposure to mediation and mediation to outcome, the qualified mediation factors in living habits were screened out, and the P-value of mediation effect was calculated by coefficient product test. The confidence interval was estimated by Delta method, and the proportion mediated was calculated. The univariable analysis (OR=1.398, 95%CI:1.085-1.803, P=0.010) indicated that depression was a risk factor for cervical spondylosis. The multivariable analysis showed that depression still has positive causal relationship with cervical spondylosis after adjustment for anxiety and schizophrenia (OR=1.343, 95%CI:1.06-1.70, P=0.013). The mediation MR analysis showed that from depression to living habits, “time spent watching TV” was excluded. From living habits to cervical spondylosis, “exercise” was excluded. Drinking was also excluded by the results of coefficient product test. The mediation MR analysis showed that the causal relationship between depression and cervical spondylosis was partly mediated by smoking and insomnia, and the proportion mediated was 15.98% and 41.70%. Our study shows that there is a positive causal relationship between depression and cervical spondylosis, which is partly mediated by smoking and insomnia, and the finding may be helpful for the prevention and treatment of cervical spondylosis.