I use a large hanging basket turned upside down. It lets in blackbirds but no bigger than blackbirds.
Similar to this in the wire design www.wilko.com/.../0070679_l.jpg
I used to feed magpies very well and they quickly soon got bored of mealworms, but this was summer when insects were everywhere and they could find better than the dried stuff. Now it's winter, it's a different case. If they are for feeders, you could use a dedicated suet pellet and mealworm feeder, or a peanut one, which the magpies can't get their beak into. I only put them on a guarded ground table but for me, nobody in my garden bothers with mealworms. I am absolutely flummoxed. I may as well throw them to the magpies.