about:config in your address bar.
Right-click → New → Boolean → Name:
Next time you use the magnet protocol, it will give you the "associate application" box.
Point it to the
magnet2torrent script below if you want to associate it with