Heterogeneous catalysts are often composite materials synthesized via several steps of chemical transformation, and thus the atomic structure in composite is a black-box. Herein with machine-learning-based atomic simulation we explore millions of structures for MFI zeolite encapsulated PtSn catalyst, demonstrating that the machine-learning enhanced large-scale potential energy surface scan offers a unique route to connect the thermodynamics and kinetics within catalysts’ preparation procedure. The functionalities of the two stages in catalyst preparation are now clarified, namely, the oxidative clustering and the reductive transformation, which form separated Sn4O4 and PtSn alloy clusters in MFI. These confined clusters have high thermal stability at the intersection voids of MFI because of the formation of “Mortise-and-tenon Joinery”. Among, the PtSn clusters with high Pt:Sn ratios (>1:1) are active for propane dehydrogenation to propene, ∼103 in turnover-of-frequency greater than conventional Pt3Sn metal. Key recipes to optimize zeolite-confined metal catalysts are predicted.