What does ”melee weapon attack” mean: a melee attack with a weapon or an attack with a melee weapon?

It means a melee attack with a weapon. Similarly, ”ranged weapon attack” means a ranged attack with a weapon. Some attacks count as a melee or ranged weapon attack even if a weapon isn’t involved, as specified in the text of those attacks. For example, an unarmed strike counts as a melee weapon attack, even though the attacker’s body isn’t considered a weapon. Here’s a bit of wording minutia: we would write ”melee-weapon attack” (with a hyphen) if we meant an attack with a melee weapon.