This study aimed to investigate the therapeutic effects of nuciferine (Nuci) on a mouse model of slow transit constipation (STC) and to elucidate its underlying mechanisms, with a particular focus on its impact on the intestinal immune system and gut microbiota. STC was induced in mice using loperamide, and the animals were divided into normal control (NC), loperamide model (LOP), mosapride positive control (MOS), low-dose nuciferine (Nuci-L), and high-dose nuciferine (Nuci-H) groups. Comprehensive assessments were conducted through fecal analysis, intestinal transit tests, blood tests, histological examination (H&E staining), Western Blot, RT-PCR, and 16S rRNA sequencing to evaluate the therapeutic effects of nuciferine and its mechanisms in STC mice. STC mouse model was successfully established, as evidenced by decreased fecal weight and water content, and prolonged defecation time. Nuci intervention significantly increased (P<.05) fecal weight and water content, shortened defecation time, and reduced plasma motilin (MTL) levels in STC mice. Histological examination showed improvements in the distal colon of STC mice treated with Nuci. Western Blot and RT-PCR results indicated that Nuci upregulated SCF and c-Kit expression and downregulated TLR4 and NF-κB expression in the distal colon of STC mice. Gut microbiota sequencing revealed that Nuci improved gut microbiota abundance in STC mice, with changes in the abundance of specific bacterial phylum and genus. Nuciferine exhibits significant therapeutic effects on an STC mouse model by modulating the intestinal immune system and gut microbiota. These findings provide a new potential therapeutic option for STC and reveal the underlying mechanisms of nuciferine in regulating intestinal health and alleviating constipation.