This work aims to conduct a numerical study on the magnetohydrodynamic (MHD) natural convection of nanofluid within a porous cavity corrugated hot and cold walls. The system comprises an external magnetic field. The study employs a finite element approach to solve the governing equations for momentum and energy conservation, while systematically varying influential parameters such as the Rayleigh number (Ra), Hartmann number (Ha), Darcy number (Da), and the magnetic parameter (M). The fluctuations in these parameters allow for the analysis of their effects on the Nusselt number, flow patterns and thermal performance. A notable innovation of this research lies in the incorporation of a Response Surface Methodology (RSM)-based sensitivity analysis. This approach yields valuable insights for optimizing thermal management and enhancing energy efficiency in advanced Magnetohydrodynamics (MHD) systems. According to conclusive data, employing a permeable partition instead of a solid partition leads to a notable enhancement in the mean Nusselt value. Specifically, at Ra = 100, the improvement is recorded at 26.28%. Furthermore, at Ra = 104, this enhancement reaches its peak, with a substantial increase of 56.5%.