Primary sclerosing cholangitis (PSC) is a chronic liver disease characterized by inflammation, fibrosis, and bile stasis. Inflammatory proteins and metabolites may be involved in PSC pathogenesis. However, a comprehensive analysis is currently lacking. In this study, we employed a two-step Mendelian randomization (MR) analysis to quantify the proportion of the effect of metabolites-mediated inflammation-related proteins on PSC. The dataset includes information on PSC, levels of 91 inflammation-related proteins, and levels of 1400 metabolites in plasma. PSC data (n = 14,890) were obtained from the International PSC Study Group, while inflammation-related proteins data came from a study involving 14,824 participants. Metabolites data were sourced from a Genome-Wide Association Study with 8,299 individuals. Furthermore, we employed a two-step Mendelian randomization (MR) analysis to quantify the proportion of the effect of metabolites-mediated inflammation-related proteins on PSC. After rigorous screening, we found through MR analysis that a higher genetically predicted tumor necrosis factor ligand superfamily member 12 (TWEAK) levels (inverse-variance weighted method, odds ratio (OR) 1.53, 95% confidence interval (CI) 1.23–1.91) were associated with an increased risk of PSC. There was no compelling evidence indicating that genetically predicted PSC had an effect on TWEAK levels (OR 1.004, 95% CI 0.99–1.02). The proportion of genetically predicted TWEAK levels mediated by 3-methoxytyrosine levels was estimated to be 6.38%. Finally, we've shown a causal relationship between TWEAK levels and PSC, with some mediation by 3-methoxytyrosine. TWEAK's pivotal role in PSC as an inflammation-related protein highlights its potential as a critical therapeutic target.