1. Preheat oven to 325 degrees. Whisk together flour, cocoa powder, baking soda, and salt; set aside. Melt chocolate with butter in a small heatproof bowl set over a pan of simmering water; let cool slightly.
2.Put chocolate mixture, sugar, eggs, and vanilla in the bowl of an electric mixer fitted with the paddle attachment. Mix on medium speed until combined. Reduce speed to low; gradually mix in flour mixture. Fold in M&Ms.
3.Using a 1 1/2-inch ice cream scoop, drop dough onto baking sheets lined with parchment paper or nonstick baking mats, spacing 2 inches apart. Bake until cookies are flat and surfaces crack, about 15 minutes (cookies should be soft). Let cool on parchment on wire racks. Cookies can be stored between layers of parchment in airtight containers at room temperature up to 3 days.