BackgroundEpilepsy is associated with the immune system and metabolism; however, its etiology remains insufficiently understood. Here, we aim to elucidate whether circulating immune cell profiles and metabolites impact the susceptibility to epilepsy.MethodsWe used publicly available genetic data and two-sample Mendelian randomization (MR) analyses to establish causal relationships and mediating effects between 731 immune cells and 1,400 metabolites associated with epilepsy. Sensitivity analyses were conducted to detect heterogeneity and horizontal pleiotropy in the study results.ResultsMR analysis examining the relationship between immune cells, metabolites, and epilepsy revealed significant causal associations with 28 different subtypes of immune cells and 14 metabolites. Besides, the mediation effects analysis revealed that eight metabolites mediated the effects of six types of immune cells on epilepsy and that 3-hydroxyoctanoylcarnitine (2) levels exhibited the highest mediating effect, mediating 15.3% (95%CI, −0.008, −30.6%, p = 0.049) of the effect of DN (CD4−CD8−) AC on epilepsy. 1-(1-enyl-stearoyl)-2-linoleoyl-GPE (p-18:0/18:2) levels (95%CI, 0.668, 10.6%, p = 0.026) and X-12544 levels (95%CI, −15.1, −0.856%, p = 0.028) contributed 5.63 and 8%, respectively, to the causal effect of FSC-A on myeloid DC on epilepsy.ConclusionThis study revealed a significant causal link between immune cells, metabolites, and epilepsy. It remarkably enhances our understanding of the interplay between immune responses, metabolites, and epilepsy risk, providing insights into the development of therapeutic strategies from both immune and metabolic perspectives.