The mechanical endstop is a simple solution to a big problem. We want to be able to detect when an X/Y/Z stage has reached its minimum or maximum. Instead of messing with flags or complicated light beam interruptors, you can use a mechanical switch.
If you place the switch in the path of the stage, then the stage itself will simply close the switch when it moves against it. Other than properly positioning the switch, you do not need to modify the stage at all.
If you are worried about reliability, you can sleep well at night. These switches ?are rated for 1 million operations before failure. Since you only use the switches once per print, that means you?ll be able to do one million prints before having to replace the switch.