The recovery of the London penetration depth lambda from magnetic force microscopy (MFM) data is described in the case of finite-thickness superconductors. The thickness of the superconductor b can either be treated as available data or as an additional unknown. Specifically, we show that the problem of recovering the pair (lambda ,b) from experimental data is well posed and we give proof of the uniqueness. No assumption is made on the symmetry of the stray field and problems with spatially extended tips of arbitrary magnetization patterns can be treated. With the inclusion of a complex penetration depth the theory is extended to force gradient detection modes, in which the MFM tip is oscillated at a drive frequency omega (d). For such cases, the customary methods of analysis have been revised, with the inclusion of energy transfer between the sample and the tip. We show that both the penetration depth lambda and the normal fluid conductivity sigma (nf) can be recovered.