This can actually be done quite easily (and efficiently) using the volume absorption shader:
You're correct that this is a volumetric effect - it's dependent on how far the light travels through the coffee. There are two volume shaders (three, if you count emission) - volume absorption, and volume scattering. Volume scattering is the slow and noisy one everyone is talking about when they say "volumes are slow". Volume scattering adds an additional bounce possibility within an object, hence the noise.
Volume absorption, however, does not alter a ray path or do any other probabilistic anything. It just attenuates a ray based on how far it transmitted through the object. As a result, it's not really any noisier or slower to calculate then coloring your glass or transparent shader, and the result is much more realistic. In fact, in pretty much any case where you'd use a non-white transparent or glass shader, it's best to leave the glass/transparent shader as full white and color your object instead with the volume absorption shader. This will allow the color to vary through your object based on thickness, which is where almost all color comes from in transparent objects.
Note that finding the exact color will take some trial and error to balance saturation, brightness, and the "density" (overall strength) of the absorption. Be prepared to fiddle around in rendered view for a bit.