Mitragyna speciosa ("kratom") is used as a natural remedy for pain and management of opioid dependence. The pharmacological properties of kratom have been linked to a complex mixture of monoterpene indole alkaloids, most notably mitragynine. Here, we report the central biosynthetic steps responsible for the scaffold formation of mitragynine and related corynanthe-type alkaloids. We illuminate the mechanistic basis by which the key stereogenic center of this scaffold is formed. These discoveries were leveraged for the enzymatic production of mitragynine, the C-20 epimer speciogynine, and fluorinated analogues.