The UCI does have rules for the maximum number of riders. The base max is 28, but you can get extra spots for having new pros on your roster, up to 2 extra spots. The rule comes from section "2.15.110 Riders" of the UCI regulations. This cycling blog has a good explanation of it written up: <