It has been experimentally demonstrated that mixed metallic cation modification could be an effective strategy to enhance the performance and stability of perovskite-based solar cells (PSCs). However, there is limited microscopic understanding at the atomic/molecular level of the behavior of small radius alkali metal cation doping in both perovskite materials and perovskite/TiO2 junctions. Here, we perform a first-principles density functional theory study on the doping-induced variation of the geometric and electronic structures of MAPbI3 (MA = methylammonium) and the MAPbI3/TiO2 junction. The impacts of different doping methods, and different charge states and locations of the given dopants have been investigated. At first, we theoretically confirm that the structures doped by K+ are the most thermally stable compared to the structures doped by the other charge states of K, and that K+ dopants prefer to modify the perovskite lattice interstitially and stay near the MAPbI3/TiO2 interface. Meanwhile, we find that a severe geometric deformation occurs if two doped lattices come into contact directly, indicating that the lattice may rapidly collapse from the interior if the doping concentration is too high. Additionally, we observe that K+ doped interstitially near the MAPbI3/TiO2 interface causes the intensive distortion of the surface Ti-O bonds and severe bond-length fluctuations. Consequently, this results in distorted TiO2 bands of the interfacial layer and a slight decrease of the band offset of conduction bands between two phases. This work complements experiments and provides a better microscopic understanding of the doping modification of the properties of perovskite materials and PSCs.