Aims. In this study we determine absolute integrated magnitudes in the J, H, K S passbands for Galactic star clusters from the Milky Way Star Clusters survey. In the wide solar neighbourhood, we derive the open cluster luminosity function (CLF) for different cluster ages. Methods. The integrated magnitudes are based on uniform cluster membership derived from the 2MAst catalogue (a merger of the PPMXL and 2MASS) and are computed by summing up the individual luminosities of the most reliable cluster members. We discuss two different techniques of constructing the CLF, a magnitude-limited and a distance-limited approach. Results. Absolute J, H, K S integrated magnitudes are obtained for 3061 open clusters, and 147 globular clusters. The integrated magnitudes and colours are accurate to about 0.8 and 0.2 mag, respectively. Based on the sample of open clusters we construct the general cluster luminosity function in the solar neighbourhood in the three passbands. In each passband the CLF shows a linear part covering a range of 6 to 7 mag at the bright end. The CLFs reach their maxima at an absolute magnitude of −2 mag, then drop by one order of magnitude. During cluster evolution, the CLF changes its slope within tight, but well-defined limits. The CLF of the youngest clusters has a steep slope of about 0.4 at bright magnitudes and a quasi-flat portion for faint clusters. For the oldest population, we find a flatter function with a slope of about 0.2. The CLFs at Galactocentric radii smaller than that of the solar circle differ from those in the direction of the Galactic anti-centre. The CLF in the inner area is flatter and the cluster surface density higher than the local one. In contrast, the CLF is somewhat steeper than the local one in the outer disk, and the surface density is lower.