Context. The gravitational lens system SDSS J1004+4112 was the first known example of a quasar lensed by a galaxy cluster. The interest in this system has been renewed following the publication of r-band light curves spanning 14.5 years and the determination of the time delays between the four brightest quasar images. Aims. We constrained the quasar accretion disk size and the fraction of the lens mass in stars using the signature of microlensing in the quasar image light curves. Methods. We built the six possible histograms of microlensing magnitude differences between the four quasar images and compared them with simulated model histograms, using a χ2 test to infer the model parameters. Results. We infer a quasar disk half-light radius of R1/2 = (0.70 ± 0.04)RE = (6.4 ± 0.4) √M/0.3M⊙ light-days at 2407 Å in the rest frame and stellar mass fractions at the quasar image positions of αA > 0.059, αB = 0.056+0.021-0.027, αC = 0.030+0.031-0.021, and αD = 0.072+0.034-0.016. Conclusions. The inferred disk size is broadly compatible with most previous estimates, and the stellar mass fractions are within the expected ranges for galaxy clusters. In the region where image C lies, the stellar mass fraction is compatible with a stellar contribution from the brightest cluster galaxy, galaxy cluster members, and intracluster light, but the values at images B, D, and especially A are slightly larger, possibly suggesting the presence of extra stellar components.