I wrote this up a few years ago for another thread. Note a main breaker is never required to be part of the panelboard assembly, it could be in a separate enclosure next to it, but a main breaker is usually the simplest and cheapest way to go.
Main breaker needed if:
1. a disconnecting means is required and there are more than 6 branch breakers, or the panel requires a main breaker even if there are 2-6 branch breakers (heard of those on this forum, never seen one). This would apply for a service, separate structure, or SDS.
2. To comply with 408.36 when taps, transformers, or a larger feeder/OCPD than panel rating is used.
3. To meet conductor overload protection requirements for taps or transformer secondary conductors
4. To meet transformer protection requirements (450.3)
5. Possibly installed or modified to meet one of the provisions in 705.12(D)(2) (PV applications)
6. To achieve a series rating so lower rated branch breakers can be used
Fairly often I see main breakers installed where they are not required. I assume some of these are lack of knowledge and the specifier was just "playing it safe", but others the designer perhaps just thought it was "good design" to have a main breaker installed for perceived convenience.