Here's the trap I used. It's balanced so that once the mouse goes inside after bait, it tips backwards and the door snaps shut:
And here's the trap with the door sensor's magnet attached to the back end, weights on the front of the door to balance this out, and a couple of screws to act as pivot points:
The screws seem to work well about 10mm up from the pivot point on the bottom of the trap:
I figured out a good height for the magnet by setting the end of the trap on a flat surface next to the sensor and marking spots for mounting holes with a pocket knife (the end comes off to put bait in, so it's easy to work with):
I discovered that I needed to add counterweights to the door so that the trap would stay (just barely) open. I used a couple of extra small screws and those little nuts that come with Presta valves on bike inner tubes for this, but just about any random small hardware should work:
It's a good idea to test the balance of the trap with bait already in the cap, because you may have to adjust weight:
In the past, I've had good luck with dry noodles and seeds, but I went with peanut butter this time around in part because it sticks to the trap and thus can be less finicky for balance.
Once I had the trap add-ons figured out, I needed some sort of platform to mount the door sensor and trap, so it'd predictably trigger the sensor when trapped. I went with a spare sheet of acrylic and a couple of these self-adhesive cable clips I had lying around. In a pinch, a square of cardboard or plywood and some u-staples would probably work just as well. One benefit of the cable clips is that they snap open and closed, so it's easy to separate the trap once you catch a mouse.
(If you go with acrylic, make sure to drill pilot holes for any screws.)
Once that's taken care of, the whole thing comes together:
The magnet should always land within a few mm of the door sensor, but there's a fair amount of tolerance here - they don't have to touch for the contact to register.
You might want a mount for the PIR sensor - I put together a quick one out of Lego blocks:
For a polished build, you'd probably want to mount the Raspberry Pi and the PIR sensor to the baseplate as well, enclosing wires to avoid getting them chewed on by your test subjects, but at this point you should be able to do a test deployment of the whole system.