Ultimately the bike has to be fit for purpose, not very good if the frame or a wheel cracks after a few rides. So the answer is “as light as it needs to be but no lighter”.
Road not MTB: my mate obsessed about bike weight, had a lot (and I mean a lot) of disposable income, so would buy the lightest bike he could. Unfortunately he wasn’t exactly svelte, probably in the 90-100kg range, and he’d crack the frames.
The other night when riding home I caught up with a rider just as we were going through the village, from there it’s 2Km uphill at about 8% gradient. I was on a Croix de Fer, he was on a carbon road bike. I matched him until about 50 metres from the top of the first long ramp when the elastic snapped, 500 metres later he’d put over 100 metres into me. He was probably 10-15kg lighter than me as well 😳