Coupled-mode theory for on-channel nonlinear microcavities