Quantum engineering of spin and anisotropy in magnetic molecular junctions