Due to the excessive use of nonlinear loads and inverter interfaced distributed generators, harmonic issues have been regarded as a major concern in power distribution systems. Therefore, harmonic compensation in microgrids is a subject of current interest. Consequently, a novel direct harmonic voltage-controlled mode (VCM) active power filter (APF) is proposed to mitigate the harmonics in a cooperative manner and provide a better harmonic compensation performance of less than 5%. Due to the dispersive characteristics of renewable energy resources, voltage feedback based on a harmonic compensation control loop is implemented for the first time. This system can be smoothly combined with the current control loop. Our method proposes a better performance while mitigating the harmonics in comparison with conventional resistive active power filters (R-APF). Based on direct voltage detection at the point of common coupling (PCC), the proposed VCM-APF can therefore be seamlessly incorporated with multiple grid-connected generators (DGs) to enhance their harmonic compensation capabilities. The advantage of this scheme is that it avoids the need for designing and tuning the resistance, which was required in earlier conventional control schemes of R-APF for voltage unbalance compensation. Additionally, our scheme does not require the grid and load current measurements since these can be carried out at the PCC voltage, which further reduces the implementation cost of the system. Furthermore, the simulation results show the significance of proposed method.