In Act 1, Scene 4, while Mercutio is trying to convince Romeo to accompany him to the Capulets' ball, he gets caught up in a rambling, allegorical monologue about "Queen Mab," a most likely folkloric fairy queen who visits dreamers in their sleep:
And in this state she gallops night by night
Through lovers’ brains, and then they dream of love;
On courtiers’ knees, that dream on cur’sies straight;
O’er lawyers’ fingers, who straight dream on fees;
O’er ladies’ lips, who straight on kisses dream,
Which oft the angry Mab with blisters plagues [...]
Sometime she driveth o’er a soldier’s neck,
And then dreams he of cutting foreign throats, [...]
Of healths five fathom deep, and then anon
Drums in his ear, at which he starts and wakes
And, being thus frighted, swears a prayer or two
And sleeps again.
In Mercutio's monologue, Queen Mab is a seemingly sweet, innocuous fairy who bestows pleasant dreams upon some of the sleeping people she visits. Those dreams fulfill unique fantasies or desires, like officious courtiers who dream of performing "straight" curtsies. But as the monologue proceeds, it becomes clear that Queen Mab can be hostile to her hosts, too, if she believes they have misbehaved. She "plagues" with blisters the lips of ladies who dream of "kisses" but who have eaten too many "sweetmeats," and she exercises vengeance by giving nightmares to soldiers who commit acts of violence in war.
As an allegory, Mercutio's Queen Mab narrative has the feel of a whimsical fairy tale, though with a much darker message. Mercutio is arguing that dreams make desires—even unconscious ones—explicit and end up revealing fundamental truths about the dreamers. Those truths may be unpleasant or unflattering, but they cannot be avoided. In this way, the Queen Mab story (though received by Romeo as a silly, nonsensical tale) is a logical extension of the remark Mercutio makes to Romeo earlier, after Romeo mentions a dream he has had: "dreamers often lie," Mercutio notes.
Here, as in other parts of Romeo and Juliet, Mercutio serves as the play's moral compass. Though not a faultless character himself—he, like Romeo and other Montague servingmen, is impulsive, proud, and sometimes misogynistic—Mercutio can see through others' words and actions and offer clear moral critiques. He seems to have a fundamental understanding of human weaknesses and how they operate. Indeed, he is the only Montague or Capulet to bluntly address and criticize the families' feud when he cries out, "A plague o' both houses!" before dying in Act 3.