This paper describes the electrochemical behaviors of Cd2+ and Pb2+ on the proposed mesoporous carbon microspheres/mefenamic acid/nafion modified glassy carbon electrode (MC/MA/Nafion/GC) studied by square wave anodic stripping voltammetry (SWASV). The prepared material is characterized by XRD, SEM, FTIR, RAMAN and BET analysis. Experimental parameters, such as the deposition potential and time, the pH value of buffer solution were optimized. Under the optimized conditions, the electrode responded linearly to Cd2+ and Pb2+ in the concentration range from 50 to 300 nM, and the detection limits were 24.2 and 11.26 nM respectively. The sensitivity determined was 0.0623 μA/nM (Cd2+) and 0.192 μA/nM (Pb2+). Multiple metal ion detection with clear demarcation of peaks was produced by the electrode. Moreover, the modified electrode has possessed good selectivity and reproducibility of Cd2+ and Pb2+ detection. We also investigated the interference of various anions and surfactants for the detection of Cd2+ and Pb2+ ions. Finally the modified electrode was used to detect the presence of metal ions in practical samples and the results obtained are comparatively good with respect to AAS.