Add protocol handler xdg-open using mime
Create Desktop File
Create file ~/.local/share/applications/deluge-magnet.desktop with next content.
[Desktop Entry]
Name=Deluge-Magnet
Exec=deluge-add-magnet.sh %u
Icon=insert-link
Type=Application
Terminal=false
MimeType=x-scheme-handler/magnet;
Activate Desktop File
KDE Plasma
For KDE plasma run kbuildsycoca5 to create the cached resource file.
Gnome
For a gnome desktop use 'xdg-mime' command. Do not use the path only the name of the desktop file.
Checking
Using xdg-mime can tell which application is bound to the passed mime.