As an important superconducting material, MgB2 has a wide range of applications in electronics and communication fields. The optimization of its properties has been a hot research topic. In this paper, it uses first-principles calculations to delve into the impact of doping Type-I superconducting elements M (M = Al, Pb, W) on the properties of MgB2. The main focus is on exploring improvements in thermodynamic, optical and mechanical properties in conjunction with the analysis of electronic properties. For thermodynamic properties, MgPbB4 demonstrates significant variation in entropy and free energy as temperature increases, reaching 356.84 KJ/mol and −411.46 KJ/mol, respectively, at 2000 K. Regarding optical properties, the absorption band edge disappears and the range widens with the introduction of M elements. Specifically, MgWB4 exhibits the highest reflectivity R (0) and static dielectric constant ε1 (0) in the [001] direction, measured at 0.49 and 32.2, respectively. In terms of mechanical properties, the elastic modulus of MgAlB4 and MgWB4 enhances notably with B/G ratios less than 1.75, indicating their brittleness. MgWB4, in particular, stands out with the highest elastic modulus and the weakest elastic anisotropy AU (0.703), exhibiting a spatial distribution nearer to spherical. Conversely, MgPbB4 transforms the material into a ductile one, with reduced elastic modulus and the strongest anisotropy AU (4.963). This study can provide a more comprehensive perspective for the future design of MgB2-based materials.