  We report a method to locally measure the penetration depth $\lambda$ in a
superconductor by detecting the diamagnetic response using magnetic force
microscopy (MFM). We extract $\lambda$ by fitting the height dependence of the
levitation force in the Meissner state using an analytical model that
approximates the MFM tip as a single-domain, truncated conical shell. We
demonstrate on two YBa$_2$Cu$_3$O$_{6+x}$ single crystals with two MFM tips
that the obtained values agree well with previous results. This approach is not
affected by the tip width and can be applied to similar but not identical tips.
