Alright so I have come up with this idea for the primary weapon of a particular class of mages in my fantasy world: the Railgun. These mages are called starborn because, when they are born, they are magically connected to a star, planet, or other gravitationally distinct astronomical object. These mages can then, at any time, use the power within the star (or planet) for their purposes. They could just emit the light of the star, at full strength, or the gravity of the star, at full strength, or the magnetic field of a star, at full strength, or literally shoot out matter from the star, but this is clearly very dangerous alot of the time. Anyways, these starborns eventually realize that the best way to destroy these massive, magical, enemy fortifications they need to destroy is to create railguns, lots of them.
My question is simply how strong of a magnetic field do these mages need to produce to make a Railgun? Or, more fit to the context of this question, is the magnetic field of basically any star, particularly red dwarfs, strong enough to use in a Railgun? If this is so, what is the least magnetically active planet I could use to make a railgun for those poor planetborns I have? Could the concentrated power of the earths magnetic field be used to make a railgun?