TNF-α levels showed a statistically significant effect modification to quinolinic acid/tryptophan and serotonin levels in patients with MDD and T2DM and those with only MDD (β = 1.029, adjusted p < 0.001; β =  − 1.444, adjusted p = 0.047, respectively). Here, TNF is linked to type 2 diabetes mellitus.