We propose a protocol to construct narrowband (NB) composite pulses using quantum optimal control in a full-parameter adjustable two-level system. The optimal NB composite pulses are highly sensitive to various types of parameter deviations. The optimal modulation parameters are obtained by minimizing the cost function composed of the weight factor and the expansion coefficients of transition probabilities. In this way, the problem of multi-parameter modulations and incomplete nullification of expansion coefficients can be effectively solved. Furthermore, the NB composite pulses with arbitrary population transfer can be flexibly achieved by only changing the constraint of the cost function, and the current protocol is easily extended to implement passband composite pulses.