Path integral formulation of mean-field perturbation theory