Different endophytes isolated from the seeds of Sophora flavescens were tested for their ability to produce matrine production. Response surface methodology (RSM) was applied to optimize the medium components for the endophytic fungus. Results indicated that endophyte Aspergillus terreus had the