We study the effective interactions between Dirac fermions on the surface of a three-dimensional topological insulator due to the proximity coupling to the magnetic fluctuations in a ferromagnetic or antiferromagnetic insulator. Our results show that the magnetic fluctuations can mediate attractive interactions between Dirac fermions of both Amperean and BCS type. In the ferromagnetic case, we find pairing between fermions with parallel momenta, so-called Amperean pairing, whenever the effective Lagrangian for the magnetic fluctuations does not contain a quadratic term. The pairing interaction also increases with increasing Fermi momentum, and is in agreement with previous studies in the limit of high chemical potential. If a quadratic term is present, the pairing is instead of BCS type above a certain chemical potential. In the antiferromagnetic case, BCS pairing occurs when the ferromagnetic coupling between magnons on the same sublattice exceeds the antiferromagnetic coupling between magnons on different sublattices. Outside this region in parameter space, we again find that Amperean pairing is realized.